umview-0.8.2/0000755000175000017500000000000011753517420012116 5ustar renzorenzoumview-0.8.2/Makefile.in0000644000175000017500000006064611753517331014200 0ustar renzorenzo# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_UMDEVTAP_TRUE@am__append_1 = umdevtap @ENABLE_UMFUSE_TRUE@am__append_2 = umfuse @ENABLE_UM_LWIP_TRUE@am__append_3 = umnetlwipv6 subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure COPYING INSTALL config.guess \ config.sub depcomp install-sh ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = doc include um_lib um_cmd um_testmodule umdev \ umdev_testmodules umdevmbr umbinfmt xmview ummisc \ ummisc_modules um_viewfs umnet umnet_modules umfuse_modules \ umdevtap umfuse umnetlwipv6 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB20_CFLAGS = @GLIB20_CFLAGS@ GLIB20_LIBS = @GLIB20_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 DEBUGLEVEL = 3 SUBDIRS = doc include um_lib um_cmd um_testmodule umdev \ umdev_testmodules umdevmbr umbinfmt xmview ummisc \ ummisc_modules um_viewfs umnet umnet_modules umfuse_modules \ $(am__append_1) $(am__append_2) $(am__append_3) CLEANFILES = ctags cscope.out all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-generic distclean-hdr \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-recursive uninstall uninstall-am tags: ctags -R . cscope: cscope -R -b vim: tags cscope extraclean: maintainer-clean rm -rf aclocal.m4 autom4te.cache autoscan.log configure.scan \ config.h.in* configure depcomp install-sh Makefile.in config.guess config.sub \ ltmain.sh missing `find . -name Makefile.in` umview-*.tar.gz \ umview-*.tar.bz2 @ENABLE_DEBUG_TRUE@release: @ENABLE_DEBUG_TRUE@ for subdir in $(SUBDIRS); \ @ENABLE_DEBUG_TRUE@ do \ @ENABLE_DEBUG_TRUE@ $(MAKE) -C $$subdir $@ || break; @ENABLE_DEBUG_TRUE@ done @ENABLE_DEBUG_TRUE@debug: all @ENABLE_DEBUG_FALSE@release: all @ENABLE_DEBUG_FALSE@debug: @ENABLE_DEBUG_FALSE@ for subdir in $(SUBDIRS); \ @ENABLE_DEBUG_FALSE@ do \ @ENABLE_DEBUG_FALSE@ $(MAKE) -C $$subdir $@ || break; \ @ENABLE_DEBUG_FALSE@ done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: umview-0.8.2/depcomp0000755000175000017500000004755611753517330013514 0ustar renzorenzo#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2011-12-04.11; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test "$stat" = 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/ \1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/ / G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: umview-0.8.2/missing0000755000175000017500000002415211753517327013527 0ustar renzorenzo#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: umview-0.8.2/install-sh0000755000175000017500000003325611753517327014141 0ustar renzorenzo#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: umview-0.8.2/config.sub0000755000175000017500000010517611753517327014121 0ustar renzorenzo#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: umview-0.8.2/config.guess0000755000175000017500000012743211753517327014455 0ustar renzorenzo#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program 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 # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: umview-0.8.2/config.h.in0000644000175000017500000002323511753517327014154 0ustar renzorenzo/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the `atexit' function. */ #undef HAVE_ATEXIT /* Define to 1 if your system has a working `chown' function. */ #undef HAVE_CHOWN /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the `ftruncate' function. */ #undef HAVE_FTRUNCATE /* Define to 1 if you have the header file. */ #undef HAVE_FUSE_FUSE_H /* Define to 1 if you have the header file. */ #undef HAVE_FUSE_H /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `lchown' function. */ #undef HAVE_LCHOWN /* Define to 1 if you have the `dl' library (-ldl). */ #undef HAVE_LIBDL /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `mempcpy' function. */ #undef HAVE_MEMPCPY /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the `mkdir' function. */ #undef HAVE_MKDIR /* Define to 1 if you have the `mkfifo' function. */ #undef HAVE_MKFIFO /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if your system has a GNU libc compatible `realloc' function, and to 0 otherwise. */ #undef HAVE_REALLOC /* Define to 1 if you have the `rmdir' function. */ #undef HAVE_RMDIR /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_STAT_EMPTY_STRING_BUG /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strcoll' function and it is properly defined. */ #undef HAVE_STRCOLL /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE /* Define to 1 if `st_blocks' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLOCKS /* Define to 1 if `st_rdev' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_RDEV /* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ #undef HAVE_ST_BLOCKS /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CAPABILITY_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MOUNT_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STATFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STATVFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `utime' function. */ #undef HAVE_UTIME /* Define to 1 if you have the header file. */ #undef HAVE_UTIME_H /* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */ #undef HAVE_UTIME_NULL /* Define to 1 if you have the header file. */ #undef HAVE_VALUES_H /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to 1 if `major', `minor', and `makedev' are declared in . */ #undef MAJOR_IN_MKDEV /* Define to 1 if `major', `minor', and `makedev' are declared in . */ #undef MAJOR_IN_SYSMACROS /* Extension of shared objects */ #undef MODULES_EXT /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define for Solaris 2.5.1 so the uint64_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT64_T /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `int' if does not define. */ #undef mode_t /* Define to `long int' if does not define. */ #undef off_t /* Define to `int' if does not define. */ #undef pid_t /* Define to rpl_realloc if the replacement function should be used. */ #undef realloc /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if does not define. */ #undef ssize_t /* Define to `int' if doesn't define. */ #undef uid_t /* Define to the type of an unsigned integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ #undef uint64_t /* Define as `fork' if `vfork' does not work. */ #undef vfork umview-0.8.2/configure0000755000175000017500000173067311753517326014053 0ustar renzorenzo#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for View-OS 0.8.2. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: info@v2.cs.unibo.it about your system, including any $0: error possibly output before this message. Then install $0: a modern shell, or manually run the script under such a $0: shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='View-OS' PACKAGE_TARNAME='umview' PACKAGE_VERSION='0.8.2' PACKAGE_STRING='View-OS 0.8.2' PACKAGE_BUGREPORT='info@v2.cs.unibo.it' PACKAGE_URL='' ac_unique_file="xmview/umview.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS ENABLE_DEBUG_FALSE ENABLE_DEBUG_TRUE ENABLE_UM_LWIP_FALSE ENABLE_UM_LWIP_TRUE ENABLE_UMFUSE_FALSE ENABLE_UMFUSE_TRUE ENABLE_UMDEVTAP_FALSE ENABLE_UMDEVTAP_TRUE GLIB20_LIBS GLIB20_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG LIBOBJS ALLOCA OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL EGREP GREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock enable_debug enable_fuse enable_vde enable_lwip ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR GLIB20_CFLAGS GLIB20_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # 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 View-OS 0.8.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/umview] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of View-OS 0.8.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-debug Enable debug functionalities --disable-fuse Disable support for FUSE --disable-vde Disable support for VDE with libvdeplug --disable-lwip Disable support for LWIPv6 networking Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path GLIB20_CFLAGS C compiler flags for GLIB20, overriding pkg-config GLIB20_LIBS linker flags for GLIB20, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF View-OS configure 0.8.2 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ---------------------------------- ## ## Report this to info@v2.cs.unibo.it ## ## ---------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t 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 View-OS $as_me 0.8.2, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " stdlib.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_header_list " sys/param.h" as_fn_append ac_header_list " utime.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='umview' VERSION='0.8.2' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' ac_config_headers="$ac_config_headers config.h" DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h # Checks for programs. for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: cat >>confdefs.h <<_ACEOF #define MODULES_EXT "$shrext_cmds" _ACEOF # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF LIBS="-ldl $LIBS" else as_fn_error $? "libdl missing" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_key_create in -lpthread" >&5 $as_echo_n "checking for pthread_key_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_key_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_key_create (); int main () { return pthread_key_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_key_create=yes else ac_cv_lib_pthread_pthread_key_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_key_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_key_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_key_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" else as_fn_error $? "libpthread missing" "$LINENO" 5 fi # Is part of this package { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vde_recv in -lvdeplug" >&5 $as_echo_n "checking for vde_recv in -lvdeplug... " >&6; } if ${ac_cv_lib_vdeplug_vde_recv+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lvdeplug $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char vde_recv (); int main () { return vde_recv (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_vdeplug_vde_recv=yes else ac_cv_lib_vdeplug_vde_recv=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vdeplug_vde_recv" >&5 $as_echo "$ac_cv_lib_vdeplug_vde_recv" >&6; } if test "x$ac_cv_lib_vdeplug_vde_recv" = xyes; then : enable_umdevtap=yes else enable_umdevtap=warn fi #umpyew temporary disabled (not yet upgraded to 0.8) #AM_PATH_PYTHON([2.4], [enable_umpyew=yes], [enable_umpyew=warn]) ## define PYTHOPN_CFLAGS & PYTHON_LIBS #PYTHON_CONFIG=`type -p python$PYTHON_VERSION-config` #if test "$PYTHON_CONFIG" != ""; then # PYTHON_CFLAGS=`$PYTHON_CONFIG --includes` # PYTHON_LIBS=`$PYTHON_CONFIG --libs` #else # PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes` # PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs` #fi # #AC_SUBST(PYTHON_CFLAGS) #AC_SUBST(PYTHON_LIBS) # Checks for header files. ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "#define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } if eval \${$as_ac_Header+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_ac_Header=yes" else eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$as_ac_Header { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi for ac_header in fcntl.h limits.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/mount.h sys/param.h sys/socket.h sys/statfs.h sys/statvfs.h sys/time.h sys/capability.h unistd.h utime.h values.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else as_fn_error $? "required header file missing" "$LINENO" 5 fi done for ac_header in fuse.h fuse/fuse.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#define _FILE_OFFSET_BITS 64 " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF enable_umfuse=yes else enable_umfuse=warn fi done ac_fn_c_check_header_mongrel "$LINENO" "libvdeplug.h" "ac_cv_header_libvdeplug_h" "$ac_includes_default" if test "x$ac_cv_header_libvdeplug_h" = xyes; then : else enable_umdevtap=warn fi ac_fn_c_check_header_mongrel "$LINENO" "lwipv6.h" "ac_cv_header_lwipv6_h" "$ac_includes_default" if test "x$ac_cv_header_lwipv6_h" = xyes; then : enable_um_lwip=yes else enable_um_lwip=warn fi #CPPFLAGS_save="${CPPFLAGS}" #CPPFLAGS="${PYTHON_CFLAGS}" #AC_CHECK_HEADER([Python.h],, [enable_umpyew=warn]) #CPPFLAGS="${CPPFLAGS_save}" # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then $as_echo "#define uid_t int" >>confdefs.h $as_echo "#define gid_t int" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 _ACEOF fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLOCKS 1 _ACEOF $as_echo "#define HAVE_ST_BLOCKS 1" >>confdefs.h else case " $LIBOBJS " in *" fileblocks.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext" ;; esac fi ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_RDEV 1 _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) $as_echo "#define _UINT64_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint64_t $ac_cv_c_uint64_t _ACEOF ;; esac # Checks for library functions. for ac_header in unistd.h do : ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UNISTD_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5 $as_echo_n "checking for working chown... " >&6; } if ${ac_cv_func_chown_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_chown_works=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #include int main () { char *f = "conftest.chown"; struct stat before, after; if (creat (f, 0600) < 0) return 1; if (stat (f, &before) < 0) return 1; if (chown (f, (uid_t) -1, (gid_t) -1) == -1) return 1; if (stat (f, &after) < 0) return 1; return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_chown_works=yes else ac_cv_func_chown_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f conftest.chown fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5 $as_echo "$ac_cv_func_chown_works" >&6; } if test $ac_cv_func_chown_works = yes; then $as_echo "#define HAVE_CHOWN 1" >>confdefs.h fi for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi if test $ac_cv_c_compiler_gnu = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 $as_echo_n "checking whether $CC needs -traditional... " >&6; } if ${ac_cv_prog_gcc_traditional+:} false; then : $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 $as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 $as_echo_n "checking whether sys/types.h defines makedev... " >&6; } if ${ac_cv_header_sys_types_h_makedev+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { return makedev(0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_header_sys_types_h_makedev=yes else ac_cv_header_sys_types_h_makedev=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_types_h_makedev" >&5 $as_echo "$ac_cv_header_sys_types_h_makedev" >&6; } if test $ac_cv_header_sys_types_h_makedev = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : $as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h fi if test $ac_cv_header_sys_mkdev_h = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : $as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h fi fi fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if ${ac_cv_func_memcmp_working+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_memcmp_working=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_memcmp_working=yes else ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 $as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpagesize do : ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" if test "x$ac_cv_func_getpagesize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPAGESIZE 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 $as_echo_n "checking for working mmap... " >&6; } if ${ac_cv_func_mmap_fixed_mapped+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_mmap_fixed_mapped=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; const char *cdata2; int i, pagesize; int fd, fd2; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 2; if (write (fd, data, pagesize) != pagesize) return 3; close (fd); /* Next, check that the tail of a page is zero-filled. File must have non-zero length, otherwise we risk SIGBUS for entire page. */ fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; cdata2 = ""; if (write (fd2, cdata2, 1) != 1) return 5; data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) if (*(data2 + i)) return 7; close (fd2); if (munmap (data2, pagesize)) return 8; /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 9; if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 10; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 11; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 12; if (read (fd, data3, pagesize) != pagesize) return 13; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 14; close (fd); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_mmap_fixed_mapped=yes else ac_cv_func_mmap_fixed_mapped=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 $as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then $as_echo "#define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if ${ac_cv_func_realloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "#define HAVE_REALLOC 1" >>confdefs.h else $as_echo "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac $as_echo "#define realloc rpl_realloc" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then : ac_cv_func_lstat_dereferences_slashed_symlink=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_dereferences_slashed_symlink=yes else ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 $as_echo_n "checking whether stat accepts an empty string... " >&6; } if ${ac_cv_func_stat_empty_string_bug+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_stat_empty_string_bug=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_stat_empty_string_bug=no else ac_cv_func_stat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 $as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strcoll" >&5 $as_echo_n "checking for working strcoll... " >&6; } if ${ac_cv_func_strcoll_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_strcoll_works=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { return (strcoll ("abc", "def") >= 0 || strcoll ("ABC", "DEF") >= 0 || strcoll ("123", "456") >= 0) ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strcoll_works=yes else ac_cv_func_strcoll_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strcoll_works" >&5 $as_echo "$ac_cv_func_strcoll_works" >&6; } if test $ac_cv_func_strcoll_works = yes; then $as_echo "#define HAVE_STRCOLL 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strnlen" >&5 $as_echo_n "checking for working strnlen... " >&6; } if ${ac_cv_func_strnlen_working+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : # Guess no on AIX systems, yes otherwise. case "$host_os" in aix*) ac_cv_func_strnlen_working=no;; *) ac_cv_func_strnlen_working=yes;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { #define S "foobar" #define S_LEN (sizeof S - 1) /* At least one implementation is buggy: that of AIX 4.3 would give strnlen (S, 1) == 3. */ int i; for (i = 0; i < S_LEN + 1; ++i) { int expected = i <= S_LEN ? i : S_LEN; if (strnlen (S, i) != expected) return 1; } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strnlen_working=yes else ac_cv_func_strnlen_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strnlen_working" >&5 $as_echo "$ac_cv_func_strnlen_working" >&6; } test $ac_cv_func_strnlen_working = no && case " $LIBOBJS " in *" strnlen.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strnlen.$ac_objext" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether utime accepts a null argument" >&5 $as_echo_n "checking whether utime accepts a null argument... " >&6; } if ${ac_cv_func_utime_null+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.data; >conftest.data # Sequent interprets utime(file, 0) to mean use start of epoch. Wrong. if test "$cross_compiling" = yes; then : ac_cv_func_utime_null='guessing yes' else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_UTIME_H # include #endif int main () { struct stat s, t; return ! (stat ("conftest.data", &s) == 0 && utime ("conftest.data", 0) == 0 && stat ("conftest.data", &t) == 0 && t.st_mtime >= s.st_mtime && t.st_mtime - s.st_mtime < 120); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_utime_null=yes else ac_cv_func_utime_null=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_utime_null" >&5 $as_echo "$ac_cv_func_utime_null" >&6; } if test "x$ac_cv_func_utime_null" != xno; then ac_cv_func_utime_null=yes $as_echo "#define HAVE_UTIME_NULL 1" >>confdefs.h fi rm -f conftest.data for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = xyes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done for ac_func in atexit ftruncate lchown memmove mempcpy memset mkdir mkfifo rmdir setenv strchr strdup strerror strrchr utime do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else as_fn_error $? "required functions missing" "$LINENO" 5 fi done if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB20" >&5 $as_echo_n "checking for GLIB20... " >&6; } if test -n "$GLIB20_CFLAGS"; then pkg_cv_GLIB20_CFLAGS="$GLIB20_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GLIB20_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$GLIB20_LIBS"; then pkg_cv_GLIB20_LIBS="$GLIB20_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GLIB20_LIBS=`$PKG_CONFIG --libs "glib-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then GLIB20_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0" 2>&1` else GLIB20_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GLIB20_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (glib-2.0) were not met: $GLIB20_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables GLIB20_CFLAGS and GLIB20_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables GLIB20_CFLAGS and GLIB20_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else GLIB20_CFLAGS=$pkg_cv_GLIB20_CFLAGS GLIB20_LIBS=$pkg_cv_GLIB20_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; if test x$enableval != "xno"; then enable_debug=yes ; else enable_debug=no; fi else enable_debug=no fi # Check whether --enable-fuse was given. if test "${enable_fuse+set}" = set; then : enableval=$enable_fuse; if test x$enableval = "xno"; then enable_umfuse=no; fi fi # Check whether --enable-vde was given. if test "${enable_vde+set}" = set; then : enableval=$enable_vde; if test x$enableval = "xno"; then enable_umdevtap=no; fi fi # Check whether --enable-lwip was given. if test "${enable_lwip+set}" = set; then : enableval=$enable_lwip; if test x$enableval = "xno"; then enable_um_lwip=no; fi fi # umpyew disabled #AC_ARG_ENABLE([python], # AS_HELP_STRING([--disable-python], # [Disable support for Python modules]), # [if test x$enableval = "xno"; then enable_umpyew=no; fi],) if test x$enable_umdevtap = "xyes"; then ENABLE_UMDEVTAP_TRUE= ENABLE_UMDEVTAP_FALSE='#' else ENABLE_UMDEVTAP_TRUE='#' ENABLE_UMDEVTAP_FALSE= fi if test x$enable_umfuse = "xyes"; then ENABLE_UMFUSE_TRUE= ENABLE_UMFUSE_FALSE='#' else ENABLE_UMFUSE_TRUE='#' ENABLE_UMFUSE_FALSE= fi if test x$enable_um_lwip = "xyes"; then ENABLE_UM_LWIP_TRUE= ENABLE_UM_LWIP_FALSE='#' else ENABLE_UM_LWIP_TRUE='#' ENABLE_UM_LWIP_FALSE= fi # umpyew disabled #AM_CONDITIONAL([ENABLE_UMPYEW], [test x$enable_umpyew = "xyes"]) if test x$enable_debug = "xyes"; then ENABLE_DEBUG_TRUE= ENABLE_DEBUG_FALSE='#' else ENABLE_DEBUG_TRUE='#' ENABLE_DEBUG_FALSE= fi ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile um_lib/Makefile um_cmd/Makefile um_testmodule/Makefile umdev/Makefile umdev_testmodules/Makefile umdevmbr/Makefile umdevtap/Makefile umfuse/Makefile umbinfmt/Makefile um_viewfs/Makefile ummisc/Makefile ummisc_modules/Makefile umnet/Makefile umnet_modules/Makefile umnetlwipv6/Makefile umfuse_modules/Makefile xmview/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_UMDEVTAP_TRUE}" && test -z "${ENABLE_UMDEVTAP_FALSE}"; then as_fn_error $? "conditional \"ENABLE_UMDEVTAP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_UMFUSE_TRUE}" && test -z "${ENABLE_UMFUSE_FALSE}"; then as_fn_error $? "conditional \"ENABLE_UMFUSE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_UM_LWIP_TRUE}" && test -z "${ENABLE_UM_LWIP_FALSE}"; then as_fn_error $? "conditional \"ENABLE_UM_LWIP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_DEBUG_TRUE}" && test -z "${ENABLE_DEBUG_FALSE}"; then as_fn_error $? "conditional \"ENABLE_DEBUG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by View-OS $as_me 0.8.2, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ View-OS config.status 0.8.2 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "um_lib/Makefile") CONFIG_FILES="$CONFIG_FILES um_lib/Makefile" ;; "um_cmd/Makefile") CONFIG_FILES="$CONFIG_FILES um_cmd/Makefile" ;; "um_testmodule/Makefile") CONFIG_FILES="$CONFIG_FILES um_testmodule/Makefile" ;; "umdev/Makefile") CONFIG_FILES="$CONFIG_FILES umdev/Makefile" ;; "umdev_testmodules/Makefile") CONFIG_FILES="$CONFIG_FILES umdev_testmodules/Makefile" ;; "umdevmbr/Makefile") CONFIG_FILES="$CONFIG_FILES umdevmbr/Makefile" ;; "umdevtap/Makefile") CONFIG_FILES="$CONFIG_FILES umdevtap/Makefile" ;; "umfuse/Makefile") CONFIG_FILES="$CONFIG_FILES umfuse/Makefile" ;; "umbinfmt/Makefile") CONFIG_FILES="$CONFIG_FILES umbinfmt/Makefile" ;; "um_viewfs/Makefile") CONFIG_FILES="$CONFIG_FILES um_viewfs/Makefile" ;; "ummisc/Makefile") CONFIG_FILES="$CONFIG_FILES ummisc/Makefile" ;; "ummisc_modules/Makefile") CONFIG_FILES="$CONFIG_FILES ummisc_modules/Makefile" ;; "umnet/Makefile") CONFIG_FILES="$CONFIG_FILES umnet/Makefile" ;; "umnet_modules/Makefile") CONFIG_FILES="$CONFIG_FILES umnet_modules/Makefile" ;; "umnetlwipv6/Makefile") CONFIG_FILES="$CONFIG_FILES umnetlwipv6/Makefile" ;; "umfuse_modules/Makefile") CONFIG_FILES="$CONFIG_FILES umfuse_modules/Makefile" ;; "xmview/Makefile") CONFIG_FILES="$CONFIG_FILES xmview/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi if test x$enable_umdevtap = "xwarn" then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: TAP module for UMDev (umdevtap) will NOT be compiled. You need libvdeplug development files installed." >&5 $as_echo "$as_me: WARNING: TAP module for UMDev (umdevtap) will NOT be compiled. You need libvdeplug development files installed." >&2;} fi if test x$enable_umfuse = "xwarn" then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: UMView support for FUSE modules (umfuse) will NOT be compiled. You need FUSE development files installed." >&5 $as_echo "$as_me: WARNING: UMView support for FUSE modules (umfuse) will NOT be compiled. You need FUSE development files installed." >&2;} fi if test x$enable_um_lwip = "xwarn" then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: UMView support for LWIPv6 networking (um_lwip) will NOT be compiled. You need LWIPv6 development files installed." >&5 $as_echo "$as_me: WARNING: UMView support for LWIPv6 networking (um_lwip) will NOT be compiled. You need LWIPv6 development files installed." >&2;} fi # umpyew disabled #if test x$enable_umpyew = "xwarn" #then # AC_MSG_WARN([UMView support for Python modules (umpyew) will NOT be #compiled. You nedd Python >= 2.4 and Python >= 2.4 development files installed.]) #fi umview-0.8.2/aclocal.m40000644000175000017500000011744311753517324013773 0ustar renzorenzo# generated automatically by aclocal 1.11.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, [m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program 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 # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) umview-0.8.2/ltmain.sh0000644000175000017500000105202211753517317013745 0ustar renzorenzo # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.2 Debian-2.4.2-1" TIMESTAMP="" package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 umview-0.8.2/xmview/0000755000175000017500000000000011753517351013440 5ustar renzorenzoumview-0.8.2/xmview/Makefile.in0000644000175000017500000040255211753517331015513 0ustar renzorenzo# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = kmview$(EXEEXT) umview$(EXEEXT) libexec_PROGRAMS = umbinwrap$(EXEEXT) subdir = xmview DIST_COMMON = $(dist_man1_MANS) $(dist_man2_MANS) $(dist_man5_MANS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" \ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man2dir)" \ "$(DESTDIR)$(man5dir)" PROGRAMS = $(bin_PROGRAMS) $(libexec_PROGRAMS) am__objects_1 = kmview-canonicalize.$(OBJEXT) \ kmview-capture_nested.$(OBJEXT) kmview-gdebug.$(OBJEXT) \ kmview-mainpoll.$(OBJEXT) kmview-modutils.$(OBJEXT) \ kmview-pcb.$(OBJEXT) kmview-scmap.$(OBJEXT) \ kmview-sctab.$(OBJEXT) kmview-services.$(OBJEXT) \ kmview-treepoch.$(OBJEXT) kmview-um_basicio.$(OBJEXT) \ kmview-um_exec.$(OBJEXT) kmview-um_ioctl.$(OBJEXT) \ kmview-um_misc.$(OBJEXT) kmview-um_mmap.$(OBJEXT) \ kmview-um_plusio.$(OBJEXT) kmview-um_select.$(OBJEXT) \ kmview-um_services.$(OBJEXT) kmview-um_signal.$(OBJEXT) \ kmview-um_socket.$(OBJEXT) kmview-um_time.$(OBJEXT) \ kmview-um_uname.$(OBJEXT) kmview-um_wdm.$(OBJEXT) \ kmview-umproc.$(OBJEXT) kmview-loginshell.$(OBJEXT) \ kmview-hashtab.$(OBJEXT) am_kmview_OBJECTS = $(am__objects_1) kmview-capture_km.$(OBJEXT) \ kmview-kmview.$(OBJEXT) nodist_kmview_OBJECTS = kmview_OBJECTS = $(am_kmview_OBJECTS) $(nodist_kmview_OBJECTS) kmview_DEPENDENCIES = am_umbinwrap_OBJECTS = umbinwrap.$(OBJEXT) umbinwrap_OBJECTS = $(am_umbinwrap_OBJECTS) umbinwrap_LDADD = $(LDADD) am__objects_2 = umview-canonicalize.$(OBJEXT) \ umview-capture_nested.$(OBJEXT) umview-gdebug.$(OBJEXT) \ umview-mainpoll.$(OBJEXT) umview-modutils.$(OBJEXT) \ umview-pcb.$(OBJEXT) umview-scmap.$(OBJEXT) \ umview-sctab.$(OBJEXT) umview-services.$(OBJEXT) \ umview-treepoch.$(OBJEXT) umview-um_basicio.$(OBJEXT) \ umview-um_exec.$(OBJEXT) umview-um_ioctl.$(OBJEXT) \ umview-um_misc.$(OBJEXT) umview-um_mmap.$(OBJEXT) \ umview-um_plusio.$(OBJEXT) umview-um_select.$(OBJEXT) \ umview-um_services.$(OBJEXT) umview-um_signal.$(OBJEXT) \ umview-um_socket.$(OBJEXT) umview-um_time.$(OBJEXT) \ umview-um_uname.$(OBJEXT) umview-um_wdm.$(OBJEXT) \ umview-umproc.$(OBJEXT) umview-loginshell.$(OBJEXT) \ umview-hashtab.$(OBJEXT) am_umview_OBJECTS = $(am__objects_2) umview-capture_um.$(OBJEXT) \ umview-ptrace_multi_test.$(OBJEXT) umview-umview.$(OBJEXT) \ umview-utils_um.$(OBJEXT) nodist_umview_OBJECTS = umview_OBJECTS = $(am_umview_OBJECTS) $(nodist_umview_OBJECTS) umview_DEPENDENCIES = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(kmview_SOURCES) $(nodist_kmview_SOURCES) \ $(umbinwrap_SOURCES) $(umview_SOURCES) \ $(nodist_umview_SOURCES) DIST_SOURCES = $(kmview_SOURCES) $(umbinwrap_SOURCES) \ $(umview_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 man2dir = $(mandir)/man2 man5dir = $(mandir)/man5 NROFF = nroff MANS = $(dist_man1_MANS) $(dist_man2_MANS) $(dist_man5_MANS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB20_CFLAGS = @GLIB20_CFLAGS@ GLIB20_LIBS = @GLIB20_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DEBUGLEVEL = 10 PCB_MODULES = \ pcb.00.capture.h \ pcb.00.mainpoll.h \ pcb.01.sctab.h \ pcb.02.umproc.h \ pcb.03.mmap.h \ pcb.04.select.h COMMON_SOURCES = \ canonicalize.c canonicalize.h \ capture.h \ capture_nested.c capture_nested.h \ defs.h \ gdebug.c \ mainpoll.c mainpoll.h \ modutils.c modutils.h \ pcb.c pcb.h \ scmap.c scmap.h \ sctab.c sctab.h \ siglist.h \ services.c services.h \ treepoch.c treepoch.h \ uid16to32.h \ um_basicio.c \ um_exec.c \ um_ioctl.c \ um_misc.c \ um_mmap.c \ um_plusio.c \ um_select.c um_select.h \ um_services.c um_services.h \ um_signal.c \ um_socket.c \ um_time.c \ um_uname.c \ um_wdm.c \ umproc.c umproc.h \ utils.h \ loginshell.c loginshell.h \ hashtab.c hashtab.h \ kmview.h kmview_SOURCES = \ $(COMMON_SOURCES) \ capture_km.c capture_km.h \ defs_i386_km.h defs_ppc_km.h defs_x86_64_km.h \ kmview.c kmview-main.h nodist_kmview_SOURCES = \ pcb-all.h umview_SOURCES = \ $(COMMON_SOURCES) \ capture_um.c capture_um.h \ defs_i386_um.h defs_ppc_um.h defs_x86_64_um.h \ ptrace2.h \ ptrace_multi_test.c ptrace_multi_test.h \ umview.c umview.h \ utils_um.c nodist_umview_SOURCES = \ pcb-all.h EXTRA_DIST = $(PCB_MODULES) kmview_LDADD = -ldl -lpthread umview_LDADD = -ldl -lpthread BUILT_SOURCES = pcb-all.h CLEANFILES = pcb-all.h umbinwrap_SOURCES = \ umbinwrap.c dist_man1_MANS = kmview.1 umview.1 dist_man2_MANS = msocket.2viewos dist_man5_MANS = viewospasswd.5 CBASEFLAGS = -DNDEBUG CDEBUGFLAGS = -g3 -ggdb3 CPPBASEFLAGS = -Wall -I../include -D_GNU_SOURCE -DLIBEXECDIR=\"$(libexecdir)\" -DMODULES_DIR=\"$(pkglibdir)/modules\" -D_UM_MMAP -D_UM_EPOLL CPPDEBUGFLAGS = -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) @ENABLE_DEBUG_FALSE@CFULLFLAGS = $(CBASEFLAGS) @ENABLE_DEBUG_TRUE@CFULLFLAGS = $(CBASEFLAGS) $(CDEBUGFLAGS) @ENABLE_DEBUG_FALSE@CPPFULLFLAGS = $(CPPBASEFLAGS) @ENABLE_DEBUG_TRUE@CPPFULLFLAGS = $(CPPBASEFLAGS) $(CPPDEBUGFLAGS) AM_LDFLAGS = -rdynamic AM_CFLAGS = $(CFULLFLAGS) kmview_CPPFLAGS = $(CPPFULLFLAGS) -D_VIEWOS_KM umview_CPPFLAGS = $(CPPFULLFLAGS) -D_VIEWOS_UM all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign xmview/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign xmview/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list install-libexecPROGRAMS: $(libexec_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(libexecdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecdir)" @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ } \ ; done uninstall-libexecPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(libexecdir)" && rm -f $$files clean-libexecPROGRAMS: @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list kmview$(EXEEXT): $(kmview_OBJECTS) $(kmview_DEPENDENCIES) $(EXTRA_kmview_DEPENDENCIES) @rm -f kmview$(EXEEXT) $(LINK) $(kmview_OBJECTS) $(kmview_LDADD) $(LIBS) umbinwrap$(EXEEXT): $(umbinwrap_OBJECTS) $(umbinwrap_DEPENDENCIES) $(EXTRA_umbinwrap_DEPENDENCIES) @rm -f umbinwrap$(EXEEXT) $(LINK) $(umbinwrap_OBJECTS) $(umbinwrap_LDADD) $(LIBS) umview$(EXEEXT): $(umview_OBJECTS) $(umview_DEPENDENCIES) $(EXTRA_umview_DEPENDENCIES) @rm -f umview$(EXEEXT) $(LINK) $(umview_OBJECTS) $(umview_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-canonicalize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-capture_km.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-capture_nested.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-gdebug.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-hashtab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-kmview.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-loginshell.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-mainpoll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-modutils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-pcb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-scmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-sctab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-services.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-treepoch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_basicio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_exec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_ioctl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_misc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_mmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_plusio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_select.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_services.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_signal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_socket.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_time.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_uname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-um_wdm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmview-umproc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umbinwrap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-canonicalize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-capture_nested.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-capture_um.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-gdebug.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-hashtab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-loginshell.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-mainpoll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-modutils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-pcb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-ptrace_multi_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-scmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-sctab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-services.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-treepoch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_basicio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_exec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_ioctl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_misc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_mmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_plusio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_select.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_services.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_signal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_socket.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_time.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_uname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-um_wdm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-umproc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-umview.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umview-utils_um.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< kmview-canonicalize.o: canonicalize.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-canonicalize.o -MD -MP -MF $(DEPDIR)/kmview-canonicalize.Tpo -c -o kmview-canonicalize.o `test -f 'canonicalize.c' || echo '$(srcdir)/'`canonicalize.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-canonicalize.Tpo $(DEPDIR)/kmview-canonicalize.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='canonicalize.c' object='kmview-canonicalize.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-canonicalize.o `test -f 'canonicalize.c' || echo '$(srcdir)/'`canonicalize.c kmview-canonicalize.obj: canonicalize.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-canonicalize.obj -MD -MP -MF $(DEPDIR)/kmview-canonicalize.Tpo -c -o kmview-canonicalize.obj `if test -f 'canonicalize.c'; then $(CYGPATH_W) 'canonicalize.c'; else $(CYGPATH_W) '$(srcdir)/canonicalize.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-canonicalize.Tpo $(DEPDIR)/kmview-canonicalize.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='canonicalize.c' object='kmview-canonicalize.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-canonicalize.obj `if test -f 'canonicalize.c'; then $(CYGPATH_W) 'canonicalize.c'; else $(CYGPATH_W) '$(srcdir)/canonicalize.c'; fi` kmview-capture_nested.o: capture_nested.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-capture_nested.o -MD -MP -MF $(DEPDIR)/kmview-capture_nested.Tpo -c -o kmview-capture_nested.o `test -f 'capture_nested.c' || echo '$(srcdir)/'`capture_nested.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-capture_nested.Tpo $(DEPDIR)/kmview-capture_nested.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='capture_nested.c' object='kmview-capture_nested.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-capture_nested.o `test -f 'capture_nested.c' || echo '$(srcdir)/'`capture_nested.c kmview-capture_nested.obj: capture_nested.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-capture_nested.obj -MD -MP -MF $(DEPDIR)/kmview-capture_nested.Tpo -c -o kmview-capture_nested.obj `if test -f 'capture_nested.c'; then $(CYGPATH_W) 'capture_nested.c'; else $(CYGPATH_W) '$(srcdir)/capture_nested.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-capture_nested.Tpo $(DEPDIR)/kmview-capture_nested.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='capture_nested.c' object='kmview-capture_nested.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-capture_nested.obj `if test -f 'capture_nested.c'; then $(CYGPATH_W) 'capture_nested.c'; else $(CYGPATH_W) '$(srcdir)/capture_nested.c'; fi` kmview-gdebug.o: gdebug.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-gdebug.o -MD -MP -MF $(DEPDIR)/kmview-gdebug.Tpo -c -o kmview-gdebug.o `test -f 'gdebug.c' || echo '$(srcdir)/'`gdebug.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-gdebug.Tpo $(DEPDIR)/kmview-gdebug.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdebug.c' object='kmview-gdebug.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-gdebug.o `test -f 'gdebug.c' || echo '$(srcdir)/'`gdebug.c kmview-gdebug.obj: gdebug.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-gdebug.obj -MD -MP -MF $(DEPDIR)/kmview-gdebug.Tpo -c -o kmview-gdebug.obj `if test -f 'gdebug.c'; then $(CYGPATH_W) 'gdebug.c'; else $(CYGPATH_W) '$(srcdir)/gdebug.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-gdebug.Tpo $(DEPDIR)/kmview-gdebug.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdebug.c' object='kmview-gdebug.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-gdebug.obj `if test -f 'gdebug.c'; then $(CYGPATH_W) 'gdebug.c'; else $(CYGPATH_W) '$(srcdir)/gdebug.c'; fi` kmview-mainpoll.o: mainpoll.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-mainpoll.o -MD -MP -MF $(DEPDIR)/kmview-mainpoll.Tpo -c -o kmview-mainpoll.o `test -f 'mainpoll.c' || echo '$(srcdir)/'`mainpoll.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-mainpoll.Tpo $(DEPDIR)/kmview-mainpoll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mainpoll.c' object='kmview-mainpoll.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-mainpoll.o `test -f 'mainpoll.c' || echo '$(srcdir)/'`mainpoll.c kmview-mainpoll.obj: mainpoll.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-mainpoll.obj -MD -MP -MF $(DEPDIR)/kmview-mainpoll.Tpo -c -o kmview-mainpoll.obj `if test -f 'mainpoll.c'; then $(CYGPATH_W) 'mainpoll.c'; else $(CYGPATH_W) '$(srcdir)/mainpoll.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-mainpoll.Tpo $(DEPDIR)/kmview-mainpoll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mainpoll.c' object='kmview-mainpoll.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-mainpoll.obj `if test -f 'mainpoll.c'; then $(CYGPATH_W) 'mainpoll.c'; else $(CYGPATH_W) '$(srcdir)/mainpoll.c'; fi` kmview-modutils.o: modutils.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-modutils.o -MD -MP -MF $(DEPDIR)/kmview-modutils.Tpo -c -o kmview-modutils.o `test -f 'modutils.c' || echo '$(srcdir)/'`modutils.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-modutils.Tpo $(DEPDIR)/kmview-modutils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modutils.c' object='kmview-modutils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-modutils.o `test -f 'modutils.c' || echo '$(srcdir)/'`modutils.c kmview-modutils.obj: modutils.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-modutils.obj -MD -MP -MF $(DEPDIR)/kmview-modutils.Tpo -c -o kmview-modutils.obj `if test -f 'modutils.c'; then $(CYGPATH_W) 'modutils.c'; else $(CYGPATH_W) '$(srcdir)/modutils.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-modutils.Tpo $(DEPDIR)/kmview-modutils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modutils.c' object='kmview-modutils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-modutils.obj `if test -f 'modutils.c'; then $(CYGPATH_W) 'modutils.c'; else $(CYGPATH_W) '$(srcdir)/modutils.c'; fi` kmview-pcb.o: pcb.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-pcb.o -MD -MP -MF $(DEPDIR)/kmview-pcb.Tpo -c -o kmview-pcb.o `test -f 'pcb.c' || echo '$(srcdir)/'`pcb.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-pcb.Tpo $(DEPDIR)/kmview-pcb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pcb.c' object='kmview-pcb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-pcb.o `test -f 'pcb.c' || echo '$(srcdir)/'`pcb.c kmview-pcb.obj: pcb.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-pcb.obj -MD -MP -MF $(DEPDIR)/kmview-pcb.Tpo -c -o kmview-pcb.obj `if test -f 'pcb.c'; then $(CYGPATH_W) 'pcb.c'; else $(CYGPATH_W) '$(srcdir)/pcb.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-pcb.Tpo $(DEPDIR)/kmview-pcb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pcb.c' object='kmview-pcb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-pcb.obj `if test -f 'pcb.c'; then $(CYGPATH_W) 'pcb.c'; else $(CYGPATH_W) '$(srcdir)/pcb.c'; fi` kmview-scmap.o: scmap.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-scmap.o -MD -MP -MF $(DEPDIR)/kmview-scmap.Tpo -c -o kmview-scmap.o `test -f 'scmap.c' || echo '$(srcdir)/'`scmap.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-scmap.Tpo $(DEPDIR)/kmview-scmap.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scmap.c' object='kmview-scmap.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-scmap.o `test -f 'scmap.c' || echo '$(srcdir)/'`scmap.c kmview-scmap.obj: scmap.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-scmap.obj -MD -MP -MF $(DEPDIR)/kmview-scmap.Tpo -c -o kmview-scmap.obj `if test -f 'scmap.c'; then $(CYGPATH_W) 'scmap.c'; else $(CYGPATH_W) '$(srcdir)/scmap.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-scmap.Tpo $(DEPDIR)/kmview-scmap.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scmap.c' object='kmview-scmap.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-scmap.obj `if test -f 'scmap.c'; then $(CYGPATH_W) 'scmap.c'; else $(CYGPATH_W) '$(srcdir)/scmap.c'; fi` kmview-sctab.o: sctab.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-sctab.o -MD -MP -MF $(DEPDIR)/kmview-sctab.Tpo -c -o kmview-sctab.o `test -f 'sctab.c' || echo '$(srcdir)/'`sctab.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-sctab.Tpo $(DEPDIR)/kmview-sctab.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sctab.c' object='kmview-sctab.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-sctab.o `test -f 'sctab.c' || echo '$(srcdir)/'`sctab.c kmview-sctab.obj: sctab.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-sctab.obj -MD -MP -MF $(DEPDIR)/kmview-sctab.Tpo -c -o kmview-sctab.obj `if test -f 'sctab.c'; then $(CYGPATH_W) 'sctab.c'; else $(CYGPATH_W) '$(srcdir)/sctab.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-sctab.Tpo $(DEPDIR)/kmview-sctab.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sctab.c' object='kmview-sctab.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-sctab.obj `if test -f 'sctab.c'; then $(CYGPATH_W) 'sctab.c'; else $(CYGPATH_W) '$(srcdir)/sctab.c'; fi` kmview-services.o: services.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-services.o -MD -MP -MF $(DEPDIR)/kmview-services.Tpo -c -o kmview-services.o `test -f 'services.c' || echo '$(srcdir)/'`services.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-services.Tpo $(DEPDIR)/kmview-services.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='services.c' object='kmview-services.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-services.o `test -f 'services.c' || echo '$(srcdir)/'`services.c kmview-services.obj: services.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-services.obj -MD -MP -MF $(DEPDIR)/kmview-services.Tpo -c -o kmview-services.obj `if test -f 'services.c'; then $(CYGPATH_W) 'services.c'; else $(CYGPATH_W) '$(srcdir)/services.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-services.Tpo $(DEPDIR)/kmview-services.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='services.c' object='kmview-services.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-services.obj `if test -f 'services.c'; then $(CYGPATH_W) 'services.c'; else $(CYGPATH_W) '$(srcdir)/services.c'; fi` kmview-treepoch.o: treepoch.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-treepoch.o -MD -MP -MF $(DEPDIR)/kmview-treepoch.Tpo -c -o kmview-treepoch.o `test -f 'treepoch.c' || echo '$(srcdir)/'`treepoch.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-treepoch.Tpo $(DEPDIR)/kmview-treepoch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='treepoch.c' object='kmview-treepoch.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-treepoch.o `test -f 'treepoch.c' || echo '$(srcdir)/'`treepoch.c kmview-treepoch.obj: treepoch.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-treepoch.obj -MD -MP -MF $(DEPDIR)/kmview-treepoch.Tpo -c -o kmview-treepoch.obj `if test -f 'treepoch.c'; then $(CYGPATH_W) 'treepoch.c'; else $(CYGPATH_W) '$(srcdir)/treepoch.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-treepoch.Tpo $(DEPDIR)/kmview-treepoch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='treepoch.c' object='kmview-treepoch.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-treepoch.obj `if test -f 'treepoch.c'; then $(CYGPATH_W) 'treepoch.c'; else $(CYGPATH_W) '$(srcdir)/treepoch.c'; fi` kmview-um_basicio.o: um_basicio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_basicio.o -MD -MP -MF $(DEPDIR)/kmview-um_basicio.Tpo -c -o kmview-um_basicio.o `test -f 'um_basicio.c' || echo '$(srcdir)/'`um_basicio.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_basicio.Tpo $(DEPDIR)/kmview-um_basicio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_basicio.c' object='kmview-um_basicio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_basicio.o `test -f 'um_basicio.c' || echo '$(srcdir)/'`um_basicio.c kmview-um_basicio.obj: um_basicio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_basicio.obj -MD -MP -MF $(DEPDIR)/kmview-um_basicio.Tpo -c -o kmview-um_basicio.obj `if test -f 'um_basicio.c'; then $(CYGPATH_W) 'um_basicio.c'; else $(CYGPATH_W) '$(srcdir)/um_basicio.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_basicio.Tpo $(DEPDIR)/kmview-um_basicio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_basicio.c' object='kmview-um_basicio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_basicio.obj `if test -f 'um_basicio.c'; then $(CYGPATH_W) 'um_basicio.c'; else $(CYGPATH_W) '$(srcdir)/um_basicio.c'; fi` kmview-um_exec.o: um_exec.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_exec.o -MD -MP -MF $(DEPDIR)/kmview-um_exec.Tpo -c -o kmview-um_exec.o `test -f 'um_exec.c' || echo '$(srcdir)/'`um_exec.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_exec.Tpo $(DEPDIR)/kmview-um_exec.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_exec.c' object='kmview-um_exec.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_exec.o `test -f 'um_exec.c' || echo '$(srcdir)/'`um_exec.c kmview-um_exec.obj: um_exec.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_exec.obj -MD -MP -MF $(DEPDIR)/kmview-um_exec.Tpo -c -o kmview-um_exec.obj `if test -f 'um_exec.c'; then $(CYGPATH_W) 'um_exec.c'; else $(CYGPATH_W) '$(srcdir)/um_exec.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_exec.Tpo $(DEPDIR)/kmview-um_exec.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_exec.c' object='kmview-um_exec.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_exec.obj `if test -f 'um_exec.c'; then $(CYGPATH_W) 'um_exec.c'; else $(CYGPATH_W) '$(srcdir)/um_exec.c'; fi` kmview-um_ioctl.o: um_ioctl.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_ioctl.o -MD -MP -MF $(DEPDIR)/kmview-um_ioctl.Tpo -c -o kmview-um_ioctl.o `test -f 'um_ioctl.c' || echo '$(srcdir)/'`um_ioctl.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_ioctl.Tpo $(DEPDIR)/kmview-um_ioctl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_ioctl.c' object='kmview-um_ioctl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_ioctl.o `test -f 'um_ioctl.c' || echo '$(srcdir)/'`um_ioctl.c kmview-um_ioctl.obj: um_ioctl.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_ioctl.obj -MD -MP -MF $(DEPDIR)/kmview-um_ioctl.Tpo -c -o kmview-um_ioctl.obj `if test -f 'um_ioctl.c'; then $(CYGPATH_W) 'um_ioctl.c'; else $(CYGPATH_W) '$(srcdir)/um_ioctl.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_ioctl.Tpo $(DEPDIR)/kmview-um_ioctl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_ioctl.c' object='kmview-um_ioctl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_ioctl.obj `if test -f 'um_ioctl.c'; then $(CYGPATH_W) 'um_ioctl.c'; else $(CYGPATH_W) '$(srcdir)/um_ioctl.c'; fi` kmview-um_misc.o: um_misc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_misc.o -MD -MP -MF $(DEPDIR)/kmview-um_misc.Tpo -c -o kmview-um_misc.o `test -f 'um_misc.c' || echo '$(srcdir)/'`um_misc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_misc.Tpo $(DEPDIR)/kmview-um_misc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_misc.c' object='kmview-um_misc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_misc.o `test -f 'um_misc.c' || echo '$(srcdir)/'`um_misc.c kmview-um_misc.obj: um_misc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_misc.obj -MD -MP -MF $(DEPDIR)/kmview-um_misc.Tpo -c -o kmview-um_misc.obj `if test -f 'um_misc.c'; then $(CYGPATH_W) 'um_misc.c'; else $(CYGPATH_W) '$(srcdir)/um_misc.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_misc.Tpo $(DEPDIR)/kmview-um_misc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_misc.c' object='kmview-um_misc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_misc.obj `if test -f 'um_misc.c'; then $(CYGPATH_W) 'um_misc.c'; else $(CYGPATH_W) '$(srcdir)/um_misc.c'; fi` kmview-um_mmap.o: um_mmap.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_mmap.o -MD -MP -MF $(DEPDIR)/kmview-um_mmap.Tpo -c -o kmview-um_mmap.o `test -f 'um_mmap.c' || echo '$(srcdir)/'`um_mmap.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_mmap.Tpo $(DEPDIR)/kmview-um_mmap.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_mmap.c' object='kmview-um_mmap.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_mmap.o `test -f 'um_mmap.c' || echo '$(srcdir)/'`um_mmap.c kmview-um_mmap.obj: um_mmap.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_mmap.obj -MD -MP -MF $(DEPDIR)/kmview-um_mmap.Tpo -c -o kmview-um_mmap.obj `if test -f 'um_mmap.c'; then $(CYGPATH_W) 'um_mmap.c'; else $(CYGPATH_W) '$(srcdir)/um_mmap.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_mmap.Tpo $(DEPDIR)/kmview-um_mmap.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_mmap.c' object='kmview-um_mmap.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_mmap.obj `if test -f 'um_mmap.c'; then $(CYGPATH_W) 'um_mmap.c'; else $(CYGPATH_W) '$(srcdir)/um_mmap.c'; fi` kmview-um_plusio.o: um_plusio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_plusio.o -MD -MP -MF $(DEPDIR)/kmview-um_plusio.Tpo -c -o kmview-um_plusio.o `test -f 'um_plusio.c' || echo '$(srcdir)/'`um_plusio.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_plusio.Tpo $(DEPDIR)/kmview-um_plusio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_plusio.c' object='kmview-um_plusio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_plusio.o `test -f 'um_plusio.c' || echo '$(srcdir)/'`um_plusio.c kmview-um_plusio.obj: um_plusio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_plusio.obj -MD -MP -MF $(DEPDIR)/kmview-um_plusio.Tpo -c -o kmview-um_plusio.obj `if test -f 'um_plusio.c'; then $(CYGPATH_W) 'um_plusio.c'; else $(CYGPATH_W) '$(srcdir)/um_plusio.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_plusio.Tpo $(DEPDIR)/kmview-um_plusio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_plusio.c' object='kmview-um_plusio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_plusio.obj `if test -f 'um_plusio.c'; then $(CYGPATH_W) 'um_plusio.c'; else $(CYGPATH_W) '$(srcdir)/um_plusio.c'; fi` kmview-um_select.o: um_select.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_select.o -MD -MP -MF $(DEPDIR)/kmview-um_select.Tpo -c -o kmview-um_select.o `test -f 'um_select.c' || echo '$(srcdir)/'`um_select.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_select.Tpo $(DEPDIR)/kmview-um_select.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_select.c' object='kmview-um_select.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_select.o `test -f 'um_select.c' || echo '$(srcdir)/'`um_select.c kmview-um_select.obj: um_select.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_select.obj -MD -MP -MF $(DEPDIR)/kmview-um_select.Tpo -c -o kmview-um_select.obj `if test -f 'um_select.c'; then $(CYGPATH_W) 'um_select.c'; else $(CYGPATH_W) '$(srcdir)/um_select.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_select.Tpo $(DEPDIR)/kmview-um_select.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_select.c' object='kmview-um_select.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_select.obj `if test -f 'um_select.c'; then $(CYGPATH_W) 'um_select.c'; else $(CYGPATH_W) '$(srcdir)/um_select.c'; fi` kmview-um_services.o: um_services.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_services.o -MD -MP -MF $(DEPDIR)/kmview-um_services.Tpo -c -o kmview-um_services.o `test -f 'um_services.c' || echo '$(srcdir)/'`um_services.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_services.Tpo $(DEPDIR)/kmview-um_services.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_services.c' object='kmview-um_services.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_services.o `test -f 'um_services.c' || echo '$(srcdir)/'`um_services.c kmview-um_services.obj: um_services.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_services.obj -MD -MP -MF $(DEPDIR)/kmview-um_services.Tpo -c -o kmview-um_services.obj `if test -f 'um_services.c'; then $(CYGPATH_W) 'um_services.c'; else $(CYGPATH_W) '$(srcdir)/um_services.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_services.Tpo $(DEPDIR)/kmview-um_services.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_services.c' object='kmview-um_services.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_services.obj `if test -f 'um_services.c'; then $(CYGPATH_W) 'um_services.c'; else $(CYGPATH_W) '$(srcdir)/um_services.c'; fi` kmview-um_signal.o: um_signal.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_signal.o -MD -MP -MF $(DEPDIR)/kmview-um_signal.Tpo -c -o kmview-um_signal.o `test -f 'um_signal.c' || echo '$(srcdir)/'`um_signal.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_signal.Tpo $(DEPDIR)/kmview-um_signal.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_signal.c' object='kmview-um_signal.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_signal.o `test -f 'um_signal.c' || echo '$(srcdir)/'`um_signal.c kmview-um_signal.obj: um_signal.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_signal.obj -MD -MP -MF $(DEPDIR)/kmview-um_signal.Tpo -c -o kmview-um_signal.obj `if test -f 'um_signal.c'; then $(CYGPATH_W) 'um_signal.c'; else $(CYGPATH_W) '$(srcdir)/um_signal.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_signal.Tpo $(DEPDIR)/kmview-um_signal.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_signal.c' object='kmview-um_signal.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_signal.obj `if test -f 'um_signal.c'; then $(CYGPATH_W) 'um_signal.c'; else $(CYGPATH_W) '$(srcdir)/um_signal.c'; fi` kmview-um_socket.o: um_socket.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_socket.o -MD -MP -MF $(DEPDIR)/kmview-um_socket.Tpo -c -o kmview-um_socket.o `test -f 'um_socket.c' || echo '$(srcdir)/'`um_socket.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_socket.Tpo $(DEPDIR)/kmview-um_socket.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_socket.c' object='kmview-um_socket.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_socket.o `test -f 'um_socket.c' || echo '$(srcdir)/'`um_socket.c kmview-um_socket.obj: um_socket.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_socket.obj -MD -MP -MF $(DEPDIR)/kmview-um_socket.Tpo -c -o kmview-um_socket.obj `if test -f 'um_socket.c'; then $(CYGPATH_W) 'um_socket.c'; else $(CYGPATH_W) '$(srcdir)/um_socket.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_socket.Tpo $(DEPDIR)/kmview-um_socket.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_socket.c' object='kmview-um_socket.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_socket.obj `if test -f 'um_socket.c'; then $(CYGPATH_W) 'um_socket.c'; else $(CYGPATH_W) '$(srcdir)/um_socket.c'; fi` kmview-um_time.o: um_time.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_time.o -MD -MP -MF $(DEPDIR)/kmview-um_time.Tpo -c -o kmview-um_time.o `test -f 'um_time.c' || echo '$(srcdir)/'`um_time.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_time.Tpo $(DEPDIR)/kmview-um_time.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_time.c' object='kmview-um_time.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_time.o `test -f 'um_time.c' || echo '$(srcdir)/'`um_time.c kmview-um_time.obj: um_time.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_time.obj -MD -MP -MF $(DEPDIR)/kmview-um_time.Tpo -c -o kmview-um_time.obj `if test -f 'um_time.c'; then $(CYGPATH_W) 'um_time.c'; else $(CYGPATH_W) '$(srcdir)/um_time.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_time.Tpo $(DEPDIR)/kmview-um_time.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_time.c' object='kmview-um_time.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_time.obj `if test -f 'um_time.c'; then $(CYGPATH_W) 'um_time.c'; else $(CYGPATH_W) '$(srcdir)/um_time.c'; fi` kmview-um_uname.o: um_uname.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_uname.o -MD -MP -MF $(DEPDIR)/kmview-um_uname.Tpo -c -o kmview-um_uname.o `test -f 'um_uname.c' || echo '$(srcdir)/'`um_uname.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_uname.Tpo $(DEPDIR)/kmview-um_uname.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_uname.c' object='kmview-um_uname.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_uname.o `test -f 'um_uname.c' || echo '$(srcdir)/'`um_uname.c kmview-um_uname.obj: um_uname.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_uname.obj -MD -MP -MF $(DEPDIR)/kmview-um_uname.Tpo -c -o kmview-um_uname.obj `if test -f 'um_uname.c'; then $(CYGPATH_W) 'um_uname.c'; else $(CYGPATH_W) '$(srcdir)/um_uname.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_uname.Tpo $(DEPDIR)/kmview-um_uname.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_uname.c' object='kmview-um_uname.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_uname.obj `if test -f 'um_uname.c'; then $(CYGPATH_W) 'um_uname.c'; else $(CYGPATH_W) '$(srcdir)/um_uname.c'; fi` kmview-um_wdm.o: um_wdm.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_wdm.o -MD -MP -MF $(DEPDIR)/kmview-um_wdm.Tpo -c -o kmview-um_wdm.o `test -f 'um_wdm.c' || echo '$(srcdir)/'`um_wdm.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_wdm.Tpo $(DEPDIR)/kmview-um_wdm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_wdm.c' object='kmview-um_wdm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_wdm.o `test -f 'um_wdm.c' || echo '$(srcdir)/'`um_wdm.c kmview-um_wdm.obj: um_wdm.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-um_wdm.obj -MD -MP -MF $(DEPDIR)/kmview-um_wdm.Tpo -c -o kmview-um_wdm.obj `if test -f 'um_wdm.c'; then $(CYGPATH_W) 'um_wdm.c'; else $(CYGPATH_W) '$(srcdir)/um_wdm.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-um_wdm.Tpo $(DEPDIR)/kmview-um_wdm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_wdm.c' object='kmview-um_wdm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-um_wdm.obj `if test -f 'um_wdm.c'; then $(CYGPATH_W) 'um_wdm.c'; else $(CYGPATH_W) '$(srcdir)/um_wdm.c'; fi` kmview-umproc.o: umproc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-umproc.o -MD -MP -MF $(DEPDIR)/kmview-umproc.Tpo -c -o kmview-umproc.o `test -f 'umproc.c' || echo '$(srcdir)/'`umproc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-umproc.Tpo $(DEPDIR)/kmview-umproc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='umproc.c' object='kmview-umproc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-umproc.o `test -f 'umproc.c' || echo '$(srcdir)/'`umproc.c kmview-umproc.obj: umproc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-umproc.obj -MD -MP -MF $(DEPDIR)/kmview-umproc.Tpo -c -o kmview-umproc.obj `if test -f 'umproc.c'; then $(CYGPATH_W) 'umproc.c'; else $(CYGPATH_W) '$(srcdir)/umproc.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-umproc.Tpo $(DEPDIR)/kmview-umproc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='umproc.c' object='kmview-umproc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-umproc.obj `if test -f 'umproc.c'; then $(CYGPATH_W) 'umproc.c'; else $(CYGPATH_W) '$(srcdir)/umproc.c'; fi` kmview-loginshell.o: loginshell.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-loginshell.o -MD -MP -MF $(DEPDIR)/kmview-loginshell.Tpo -c -o kmview-loginshell.o `test -f 'loginshell.c' || echo '$(srcdir)/'`loginshell.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-loginshell.Tpo $(DEPDIR)/kmview-loginshell.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loginshell.c' object='kmview-loginshell.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-loginshell.o `test -f 'loginshell.c' || echo '$(srcdir)/'`loginshell.c kmview-loginshell.obj: loginshell.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-loginshell.obj -MD -MP -MF $(DEPDIR)/kmview-loginshell.Tpo -c -o kmview-loginshell.obj `if test -f 'loginshell.c'; then $(CYGPATH_W) 'loginshell.c'; else $(CYGPATH_W) '$(srcdir)/loginshell.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-loginshell.Tpo $(DEPDIR)/kmview-loginshell.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loginshell.c' object='kmview-loginshell.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-loginshell.obj `if test -f 'loginshell.c'; then $(CYGPATH_W) 'loginshell.c'; else $(CYGPATH_W) '$(srcdir)/loginshell.c'; fi` kmview-hashtab.o: hashtab.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-hashtab.o -MD -MP -MF $(DEPDIR)/kmview-hashtab.Tpo -c -o kmview-hashtab.o `test -f 'hashtab.c' || echo '$(srcdir)/'`hashtab.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-hashtab.Tpo $(DEPDIR)/kmview-hashtab.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hashtab.c' object='kmview-hashtab.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-hashtab.o `test -f 'hashtab.c' || echo '$(srcdir)/'`hashtab.c kmview-hashtab.obj: hashtab.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-hashtab.obj -MD -MP -MF $(DEPDIR)/kmview-hashtab.Tpo -c -o kmview-hashtab.obj `if test -f 'hashtab.c'; then $(CYGPATH_W) 'hashtab.c'; else $(CYGPATH_W) '$(srcdir)/hashtab.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-hashtab.Tpo $(DEPDIR)/kmview-hashtab.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hashtab.c' object='kmview-hashtab.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-hashtab.obj `if test -f 'hashtab.c'; then $(CYGPATH_W) 'hashtab.c'; else $(CYGPATH_W) '$(srcdir)/hashtab.c'; fi` kmview-capture_km.o: capture_km.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-capture_km.o -MD -MP -MF $(DEPDIR)/kmview-capture_km.Tpo -c -o kmview-capture_km.o `test -f 'capture_km.c' || echo '$(srcdir)/'`capture_km.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-capture_km.Tpo $(DEPDIR)/kmview-capture_km.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='capture_km.c' object='kmview-capture_km.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-capture_km.o `test -f 'capture_km.c' || echo '$(srcdir)/'`capture_km.c kmview-capture_km.obj: capture_km.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-capture_km.obj -MD -MP -MF $(DEPDIR)/kmview-capture_km.Tpo -c -o kmview-capture_km.obj `if test -f 'capture_km.c'; then $(CYGPATH_W) 'capture_km.c'; else $(CYGPATH_W) '$(srcdir)/capture_km.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-capture_km.Tpo $(DEPDIR)/kmview-capture_km.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='capture_km.c' object='kmview-capture_km.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-capture_km.obj `if test -f 'capture_km.c'; then $(CYGPATH_W) 'capture_km.c'; else $(CYGPATH_W) '$(srcdir)/capture_km.c'; fi` kmview-kmview.o: kmview.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-kmview.o -MD -MP -MF $(DEPDIR)/kmview-kmview.Tpo -c -o kmview-kmview.o `test -f 'kmview.c' || echo '$(srcdir)/'`kmview.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-kmview.Tpo $(DEPDIR)/kmview-kmview.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kmview.c' object='kmview-kmview.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-kmview.o `test -f 'kmview.c' || echo '$(srcdir)/'`kmview.c kmview-kmview.obj: kmview.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmview-kmview.obj -MD -MP -MF $(DEPDIR)/kmview-kmview.Tpo -c -o kmview-kmview.obj `if test -f 'kmview.c'; then $(CYGPATH_W) 'kmview.c'; else $(CYGPATH_W) '$(srcdir)/kmview.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmview-kmview.Tpo $(DEPDIR)/kmview-kmview.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kmview.c' object='kmview-kmview.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmview-kmview.obj `if test -f 'kmview.c'; then $(CYGPATH_W) 'kmview.c'; else $(CYGPATH_W) '$(srcdir)/kmview.c'; fi` umview-canonicalize.o: canonicalize.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-canonicalize.o -MD -MP -MF $(DEPDIR)/umview-canonicalize.Tpo -c -o umview-canonicalize.o `test -f 'canonicalize.c' || echo '$(srcdir)/'`canonicalize.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-canonicalize.Tpo $(DEPDIR)/umview-canonicalize.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='canonicalize.c' object='umview-canonicalize.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-canonicalize.o `test -f 'canonicalize.c' || echo '$(srcdir)/'`canonicalize.c umview-canonicalize.obj: canonicalize.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-canonicalize.obj -MD -MP -MF $(DEPDIR)/umview-canonicalize.Tpo -c -o umview-canonicalize.obj `if test -f 'canonicalize.c'; then $(CYGPATH_W) 'canonicalize.c'; else $(CYGPATH_W) '$(srcdir)/canonicalize.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-canonicalize.Tpo $(DEPDIR)/umview-canonicalize.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='canonicalize.c' object='umview-canonicalize.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-canonicalize.obj `if test -f 'canonicalize.c'; then $(CYGPATH_W) 'canonicalize.c'; else $(CYGPATH_W) '$(srcdir)/canonicalize.c'; fi` umview-capture_nested.o: capture_nested.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-capture_nested.o -MD -MP -MF $(DEPDIR)/umview-capture_nested.Tpo -c -o umview-capture_nested.o `test -f 'capture_nested.c' || echo '$(srcdir)/'`capture_nested.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-capture_nested.Tpo $(DEPDIR)/umview-capture_nested.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='capture_nested.c' object='umview-capture_nested.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-capture_nested.o `test -f 'capture_nested.c' || echo '$(srcdir)/'`capture_nested.c umview-capture_nested.obj: capture_nested.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-capture_nested.obj -MD -MP -MF $(DEPDIR)/umview-capture_nested.Tpo -c -o umview-capture_nested.obj `if test -f 'capture_nested.c'; then $(CYGPATH_W) 'capture_nested.c'; else $(CYGPATH_W) '$(srcdir)/capture_nested.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-capture_nested.Tpo $(DEPDIR)/umview-capture_nested.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='capture_nested.c' object='umview-capture_nested.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-capture_nested.obj `if test -f 'capture_nested.c'; then $(CYGPATH_W) 'capture_nested.c'; else $(CYGPATH_W) '$(srcdir)/capture_nested.c'; fi` umview-gdebug.o: gdebug.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-gdebug.o -MD -MP -MF $(DEPDIR)/umview-gdebug.Tpo -c -o umview-gdebug.o `test -f 'gdebug.c' || echo '$(srcdir)/'`gdebug.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-gdebug.Tpo $(DEPDIR)/umview-gdebug.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdebug.c' object='umview-gdebug.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-gdebug.o `test -f 'gdebug.c' || echo '$(srcdir)/'`gdebug.c umview-gdebug.obj: gdebug.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-gdebug.obj -MD -MP -MF $(DEPDIR)/umview-gdebug.Tpo -c -o umview-gdebug.obj `if test -f 'gdebug.c'; then $(CYGPATH_W) 'gdebug.c'; else $(CYGPATH_W) '$(srcdir)/gdebug.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-gdebug.Tpo $(DEPDIR)/umview-gdebug.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdebug.c' object='umview-gdebug.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-gdebug.obj `if test -f 'gdebug.c'; then $(CYGPATH_W) 'gdebug.c'; else $(CYGPATH_W) '$(srcdir)/gdebug.c'; fi` umview-mainpoll.o: mainpoll.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-mainpoll.o -MD -MP -MF $(DEPDIR)/umview-mainpoll.Tpo -c -o umview-mainpoll.o `test -f 'mainpoll.c' || echo '$(srcdir)/'`mainpoll.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-mainpoll.Tpo $(DEPDIR)/umview-mainpoll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mainpoll.c' object='umview-mainpoll.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-mainpoll.o `test -f 'mainpoll.c' || echo '$(srcdir)/'`mainpoll.c umview-mainpoll.obj: mainpoll.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-mainpoll.obj -MD -MP -MF $(DEPDIR)/umview-mainpoll.Tpo -c -o umview-mainpoll.obj `if test -f 'mainpoll.c'; then $(CYGPATH_W) 'mainpoll.c'; else $(CYGPATH_W) '$(srcdir)/mainpoll.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-mainpoll.Tpo $(DEPDIR)/umview-mainpoll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mainpoll.c' object='umview-mainpoll.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-mainpoll.obj `if test -f 'mainpoll.c'; then $(CYGPATH_W) 'mainpoll.c'; else $(CYGPATH_W) '$(srcdir)/mainpoll.c'; fi` umview-modutils.o: modutils.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-modutils.o -MD -MP -MF $(DEPDIR)/umview-modutils.Tpo -c -o umview-modutils.o `test -f 'modutils.c' || echo '$(srcdir)/'`modutils.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-modutils.Tpo $(DEPDIR)/umview-modutils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modutils.c' object='umview-modutils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-modutils.o `test -f 'modutils.c' || echo '$(srcdir)/'`modutils.c umview-modutils.obj: modutils.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-modutils.obj -MD -MP -MF $(DEPDIR)/umview-modutils.Tpo -c -o umview-modutils.obj `if test -f 'modutils.c'; then $(CYGPATH_W) 'modutils.c'; else $(CYGPATH_W) '$(srcdir)/modutils.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-modutils.Tpo $(DEPDIR)/umview-modutils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modutils.c' object='umview-modutils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-modutils.obj `if test -f 'modutils.c'; then $(CYGPATH_W) 'modutils.c'; else $(CYGPATH_W) '$(srcdir)/modutils.c'; fi` umview-pcb.o: pcb.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-pcb.o -MD -MP -MF $(DEPDIR)/umview-pcb.Tpo -c -o umview-pcb.o `test -f 'pcb.c' || echo '$(srcdir)/'`pcb.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-pcb.Tpo $(DEPDIR)/umview-pcb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pcb.c' object='umview-pcb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-pcb.o `test -f 'pcb.c' || echo '$(srcdir)/'`pcb.c umview-pcb.obj: pcb.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-pcb.obj -MD -MP -MF $(DEPDIR)/umview-pcb.Tpo -c -o umview-pcb.obj `if test -f 'pcb.c'; then $(CYGPATH_W) 'pcb.c'; else $(CYGPATH_W) '$(srcdir)/pcb.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-pcb.Tpo $(DEPDIR)/umview-pcb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pcb.c' object='umview-pcb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-pcb.obj `if test -f 'pcb.c'; then $(CYGPATH_W) 'pcb.c'; else $(CYGPATH_W) '$(srcdir)/pcb.c'; fi` umview-scmap.o: scmap.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-scmap.o -MD -MP -MF $(DEPDIR)/umview-scmap.Tpo -c -o umview-scmap.o `test -f 'scmap.c' || echo '$(srcdir)/'`scmap.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-scmap.Tpo $(DEPDIR)/umview-scmap.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scmap.c' object='umview-scmap.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-scmap.o `test -f 'scmap.c' || echo '$(srcdir)/'`scmap.c umview-scmap.obj: scmap.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-scmap.obj -MD -MP -MF $(DEPDIR)/umview-scmap.Tpo -c -o umview-scmap.obj `if test -f 'scmap.c'; then $(CYGPATH_W) 'scmap.c'; else $(CYGPATH_W) '$(srcdir)/scmap.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-scmap.Tpo $(DEPDIR)/umview-scmap.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scmap.c' object='umview-scmap.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-scmap.obj `if test -f 'scmap.c'; then $(CYGPATH_W) 'scmap.c'; else $(CYGPATH_W) '$(srcdir)/scmap.c'; fi` umview-sctab.o: sctab.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-sctab.o -MD -MP -MF $(DEPDIR)/umview-sctab.Tpo -c -o umview-sctab.o `test -f 'sctab.c' || echo '$(srcdir)/'`sctab.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-sctab.Tpo $(DEPDIR)/umview-sctab.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sctab.c' object='umview-sctab.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-sctab.o `test -f 'sctab.c' || echo '$(srcdir)/'`sctab.c umview-sctab.obj: sctab.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-sctab.obj -MD -MP -MF $(DEPDIR)/umview-sctab.Tpo -c -o umview-sctab.obj `if test -f 'sctab.c'; then $(CYGPATH_W) 'sctab.c'; else $(CYGPATH_W) '$(srcdir)/sctab.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-sctab.Tpo $(DEPDIR)/umview-sctab.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sctab.c' object='umview-sctab.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-sctab.obj `if test -f 'sctab.c'; then $(CYGPATH_W) 'sctab.c'; else $(CYGPATH_W) '$(srcdir)/sctab.c'; fi` umview-services.o: services.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-services.o -MD -MP -MF $(DEPDIR)/umview-services.Tpo -c -o umview-services.o `test -f 'services.c' || echo '$(srcdir)/'`services.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-services.Tpo $(DEPDIR)/umview-services.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='services.c' object='umview-services.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-services.o `test -f 'services.c' || echo '$(srcdir)/'`services.c umview-services.obj: services.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-services.obj -MD -MP -MF $(DEPDIR)/umview-services.Tpo -c -o umview-services.obj `if test -f 'services.c'; then $(CYGPATH_W) 'services.c'; else $(CYGPATH_W) '$(srcdir)/services.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-services.Tpo $(DEPDIR)/umview-services.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='services.c' object='umview-services.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-services.obj `if test -f 'services.c'; then $(CYGPATH_W) 'services.c'; else $(CYGPATH_W) '$(srcdir)/services.c'; fi` umview-treepoch.o: treepoch.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-treepoch.o -MD -MP -MF $(DEPDIR)/umview-treepoch.Tpo -c -o umview-treepoch.o `test -f 'treepoch.c' || echo '$(srcdir)/'`treepoch.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-treepoch.Tpo $(DEPDIR)/umview-treepoch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='treepoch.c' object='umview-treepoch.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-treepoch.o `test -f 'treepoch.c' || echo '$(srcdir)/'`treepoch.c umview-treepoch.obj: treepoch.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-treepoch.obj -MD -MP -MF $(DEPDIR)/umview-treepoch.Tpo -c -o umview-treepoch.obj `if test -f 'treepoch.c'; then $(CYGPATH_W) 'treepoch.c'; else $(CYGPATH_W) '$(srcdir)/treepoch.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-treepoch.Tpo $(DEPDIR)/umview-treepoch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='treepoch.c' object='umview-treepoch.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-treepoch.obj `if test -f 'treepoch.c'; then $(CYGPATH_W) 'treepoch.c'; else $(CYGPATH_W) '$(srcdir)/treepoch.c'; fi` umview-um_basicio.o: um_basicio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_basicio.o -MD -MP -MF $(DEPDIR)/umview-um_basicio.Tpo -c -o umview-um_basicio.o `test -f 'um_basicio.c' || echo '$(srcdir)/'`um_basicio.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_basicio.Tpo $(DEPDIR)/umview-um_basicio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_basicio.c' object='umview-um_basicio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_basicio.o `test -f 'um_basicio.c' || echo '$(srcdir)/'`um_basicio.c umview-um_basicio.obj: um_basicio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_basicio.obj -MD -MP -MF $(DEPDIR)/umview-um_basicio.Tpo -c -o umview-um_basicio.obj `if test -f 'um_basicio.c'; then $(CYGPATH_W) 'um_basicio.c'; else $(CYGPATH_W) '$(srcdir)/um_basicio.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_basicio.Tpo $(DEPDIR)/umview-um_basicio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_basicio.c' object='umview-um_basicio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_basicio.obj `if test -f 'um_basicio.c'; then $(CYGPATH_W) 'um_basicio.c'; else $(CYGPATH_W) '$(srcdir)/um_basicio.c'; fi` umview-um_exec.o: um_exec.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_exec.o -MD -MP -MF $(DEPDIR)/umview-um_exec.Tpo -c -o umview-um_exec.o `test -f 'um_exec.c' || echo '$(srcdir)/'`um_exec.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_exec.Tpo $(DEPDIR)/umview-um_exec.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_exec.c' object='umview-um_exec.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_exec.o `test -f 'um_exec.c' || echo '$(srcdir)/'`um_exec.c umview-um_exec.obj: um_exec.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_exec.obj -MD -MP -MF $(DEPDIR)/umview-um_exec.Tpo -c -o umview-um_exec.obj `if test -f 'um_exec.c'; then $(CYGPATH_W) 'um_exec.c'; else $(CYGPATH_W) '$(srcdir)/um_exec.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_exec.Tpo $(DEPDIR)/umview-um_exec.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_exec.c' object='umview-um_exec.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_exec.obj `if test -f 'um_exec.c'; then $(CYGPATH_W) 'um_exec.c'; else $(CYGPATH_W) '$(srcdir)/um_exec.c'; fi` umview-um_ioctl.o: um_ioctl.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_ioctl.o -MD -MP -MF $(DEPDIR)/umview-um_ioctl.Tpo -c -o umview-um_ioctl.o `test -f 'um_ioctl.c' || echo '$(srcdir)/'`um_ioctl.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_ioctl.Tpo $(DEPDIR)/umview-um_ioctl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_ioctl.c' object='umview-um_ioctl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_ioctl.o `test -f 'um_ioctl.c' || echo '$(srcdir)/'`um_ioctl.c umview-um_ioctl.obj: um_ioctl.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_ioctl.obj -MD -MP -MF $(DEPDIR)/umview-um_ioctl.Tpo -c -o umview-um_ioctl.obj `if test -f 'um_ioctl.c'; then $(CYGPATH_W) 'um_ioctl.c'; else $(CYGPATH_W) '$(srcdir)/um_ioctl.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_ioctl.Tpo $(DEPDIR)/umview-um_ioctl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_ioctl.c' object='umview-um_ioctl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_ioctl.obj `if test -f 'um_ioctl.c'; then $(CYGPATH_W) 'um_ioctl.c'; else $(CYGPATH_W) '$(srcdir)/um_ioctl.c'; fi` umview-um_misc.o: um_misc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_misc.o -MD -MP -MF $(DEPDIR)/umview-um_misc.Tpo -c -o umview-um_misc.o `test -f 'um_misc.c' || echo '$(srcdir)/'`um_misc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_misc.Tpo $(DEPDIR)/umview-um_misc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_misc.c' object='umview-um_misc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_misc.o `test -f 'um_misc.c' || echo '$(srcdir)/'`um_misc.c umview-um_misc.obj: um_misc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_misc.obj -MD -MP -MF $(DEPDIR)/umview-um_misc.Tpo -c -o umview-um_misc.obj `if test -f 'um_misc.c'; then $(CYGPATH_W) 'um_misc.c'; else $(CYGPATH_W) '$(srcdir)/um_misc.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_misc.Tpo $(DEPDIR)/umview-um_misc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_misc.c' object='umview-um_misc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_misc.obj `if test -f 'um_misc.c'; then $(CYGPATH_W) 'um_misc.c'; else $(CYGPATH_W) '$(srcdir)/um_misc.c'; fi` umview-um_mmap.o: um_mmap.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_mmap.o -MD -MP -MF $(DEPDIR)/umview-um_mmap.Tpo -c -o umview-um_mmap.o `test -f 'um_mmap.c' || echo '$(srcdir)/'`um_mmap.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_mmap.Tpo $(DEPDIR)/umview-um_mmap.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_mmap.c' object='umview-um_mmap.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_mmap.o `test -f 'um_mmap.c' || echo '$(srcdir)/'`um_mmap.c umview-um_mmap.obj: um_mmap.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_mmap.obj -MD -MP -MF $(DEPDIR)/umview-um_mmap.Tpo -c -o umview-um_mmap.obj `if test -f 'um_mmap.c'; then $(CYGPATH_W) 'um_mmap.c'; else $(CYGPATH_W) '$(srcdir)/um_mmap.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_mmap.Tpo $(DEPDIR)/umview-um_mmap.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_mmap.c' object='umview-um_mmap.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_mmap.obj `if test -f 'um_mmap.c'; then $(CYGPATH_W) 'um_mmap.c'; else $(CYGPATH_W) '$(srcdir)/um_mmap.c'; fi` umview-um_plusio.o: um_plusio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_plusio.o -MD -MP -MF $(DEPDIR)/umview-um_plusio.Tpo -c -o umview-um_plusio.o `test -f 'um_plusio.c' || echo '$(srcdir)/'`um_plusio.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_plusio.Tpo $(DEPDIR)/umview-um_plusio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_plusio.c' object='umview-um_plusio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_plusio.o `test -f 'um_plusio.c' || echo '$(srcdir)/'`um_plusio.c umview-um_plusio.obj: um_plusio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_plusio.obj -MD -MP -MF $(DEPDIR)/umview-um_plusio.Tpo -c -o umview-um_plusio.obj `if test -f 'um_plusio.c'; then $(CYGPATH_W) 'um_plusio.c'; else $(CYGPATH_W) '$(srcdir)/um_plusio.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_plusio.Tpo $(DEPDIR)/umview-um_plusio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_plusio.c' object='umview-um_plusio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_plusio.obj `if test -f 'um_plusio.c'; then $(CYGPATH_W) 'um_plusio.c'; else $(CYGPATH_W) '$(srcdir)/um_plusio.c'; fi` umview-um_select.o: um_select.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_select.o -MD -MP -MF $(DEPDIR)/umview-um_select.Tpo -c -o umview-um_select.o `test -f 'um_select.c' || echo '$(srcdir)/'`um_select.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_select.Tpo $(DEPDIR)/umview-um_select.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_select.c' object='umview-um_select.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_select.o `test -f 'um_select.c' || echo '$(srcdir)/'`um_select.c umview-um_select.obj: um_select.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_select.obj -MD -MP -MF $(DEPDIR)/umview-um_select.Tpo -c -o umview-um_select.obj `if test -f 'um_select.c'; then $(CYGPATH_W) 'um_select.c'; else $(CYGPATH_W) '$(srcdir)/um_select.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_select.Tpo $(DEPDIR)/umview-um_select.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_select.c' object='umview-um_select.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_select.obj `if test -f 'um_select.c'; then $(CYGPATH_W) 'um_select.c'; else $(CYGPATH_W) '$(srcdir)/um_select.c'; fi` umview-um_services.o: um_services.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_services.o -MD -MP -MF $(DEPDIR)/umview-um_services.Tpo -c -o umview-um_services.o `test -f 'um_services.c' || echo '$(srcdir)/'`um_services.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_services.Tpo $(DEPDIR)/umview-um_services.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_services.c' object='umview-um_services.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_services.o `test -f 'um_services.c' || echo '$(srcdir)/'`um_services.c umview-um_services.obj: um_services.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_services.obj -MD -MP -MF $(DEPDIR)/umview-um_services.Tpo -c -o umview-um_services.obj `if test -f 'um_services.c'; then $(CYGPATH_W) 'um_services.c'; else $(CYGPATH_W) '$(srcdir)/um_services.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_services.Tpo $(DEPDIR)/umview-um_services.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_services.c' object='umview-um_services.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_services.obj `if test -f 'um_services.c'; then $(CYGPATH_W) 'um_services.c'; else $(CYGPATH_W) '$(srcdir)/um_services.c'; fi` umview-um_signal.o: um_signal.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_signal.o -MD -MP -MF $(DEPDIR)/umview-um_signal.Tpo -c -o umview-um_signal.o `test -f 'um_signal.c' || echo '$(srcdir)/'`um_signal.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_signal.Tpo $(DEPDIR)/umview-um_signal.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_signal.c' object='umview-um_signal.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_signal.o `test -f 'um_signal.c' || echo '$(srcdir)/'`um_signal.c umview-um_signal.obj: um_signal.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_signal.obj -MD -MP -MF $(DEPDIR)/umview-um_signal.Tpo -c -o umview-um_signal.obj `if test -f 'um_signal.c'; then $(CYGPATH_W) 'um_signal.c'; else $(CYGPATH_W) '$(srcdir)/um_signal.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_signal.Tpo $(DEPDIR)/umview-um_signal.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_signal.c' object='umview-um_signal.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_signal.obj `if test -f 'um_signal.c'; then $(CYGPATH_W) 'um_signal.c'; else $(CYGPATH_W) '$(srcdir)/um_signal.c'; fi` umview-um_socket.o: um_socket.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_socket.o -MD -MP -MF $(DEPDIR)/umview-um_socket.Tpo -c -o umview-um_socket.o `test -f 'um_socket.c' || echo '$(srcdir)/'`um_socket.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_socket.Tpo $(DEPDIR)/umview-um_socket.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_socket.c' object='umview-um_socket.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_socket.o `test -f 'um_socket.c' || echo '$(srcdir)/'`um_socket.c umview-um_socket.obj: um_socket.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_socket.obj -MD -MP -MF $(DEPDIR)/umview-um_socket.Tpo -c -o umview-um_socket.obj `if test -f 'um_socket.c'; then $(CYGPATH_W) 'um_socket.c'; else $(CYGPATH_W) '$(srcdir)/um_socket.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_socket.Tpo $(DEPDIR)/umview-um_socket.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_socket.c' object='umview-um_socket.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_socket.obj `if test -f 'um_socket.c'; then $(CYGPATH_W) 'um_socket.c'; else $(CYGPATH_W) '$(srcdir)/um_socket.c'; fi` umview-um_time.o: um_time.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_time.o -MD -MP -MF $(DEPDIR)/umview-um_time.Tpo -c -o umview-um_time.o `test -f 'um_time.c' || echo '$(srcdir)/'`um_time.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_time.Tpo $(DEPDIR)/umview-um_time.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_time.c' object='umview-um_time.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_time.o `test -f 'um_time.c' || echo '$(srcdir)/'`um_time.c umview-um_time.obj: um_time.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_time.obj -MD -MP -MF $(DEPDIR)/umview-um_time.Tpo -c -o umview-um_time.obj `if test -f 'um_time.c'; then $(CYGPATH_W) 'um_time.c'; else $(CYGPATH_W) '$(srcdir)/um_time.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_time.Tpo $(DEPDIR)/umview-um_time.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_time.c' object='umview-um_time.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_time.obj `if test -f 'um_time.c'; then $(CYGPATH_W) 'um_time.c'; else $(CYGPATH_W) '$(srcdir)/um_time.c'; fi` umview-um_uname.o: um_uname.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_uname.o -MD -MP -MF $(DEPDIR)/umview-um_uname.Tpo -c -o umview-um_uname.o `test -f 'um_uname.c' || echo '$(srcdir)/'`um_uname.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_uname.Tpo $(DEPDIR)/umview-um_uname.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_uname.c' object='umview-um_uname.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_uname.o `test -f 'um_uname.c' || echo '$(srcdir)/'`um_uname.c umview-um_uname.obj: um_uname.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_uname.obj -MD -MP -MF $(DEPDIR)/umview-um_uname.Tpo -c -o umview-um_uname.obj `if test -f 'um_uname.c'; then $(CYGPATH_W) 'um_uname.c'; else $(CYGPATH_W) '$(srcdir)/um_uname.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_uname.Tpo $(DEPDIR)/umview-um_uname.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_uname.c' object='umview-um_uname.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_uname.obj `if test -f 'um_uname.c'; then $(CYGPATH_W) 'um_uname.c'; else $(CYGPATH_W) '$(srcdir)/um_uname.c'; fi` umview-um_wdm.o: um_wdm.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_wdm.o -MD -MP -MF $(DEPDIR)/umview-um_wdm.Tpo -c -o umview-um_wdm.o `test -f 'um_wdm.c' || echo '$(srcdir)/'`um_wdm.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_wdm.Tpo $(DEPDIR)/umview-um_wdm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_wdm.c' object='umview-um_wdm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_wdm.o `test -f 'um_wdm.c' || echo '$(srcdir)/'`um_wdm.c umview-um_wdm.obj: um_wdm.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-um_wdm.obj -MD -MP -MF $(DEPDIR)/umview-um_wdm.Tpo -c -o umview-um_wdm.obj `if test -f 'um_wdm.c'; then $(CYGPATH_W) 'um_wdm.c'; else $(CYGPATH_W) '$(srcdir)/um_wdm.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-um_wdm.Tpo $(DEPDIR)/umview-um_wdm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um_wdm.c' object='umview-um_wdm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-um_wdm.obj `if test -f 'um_wdm.c'; then $(CYGPATH_W) 'um_wdm.c'; else $(CYGPATH_W) '$(srcdir)/um_wdm.c'; fi` umview-umproc.o: umproc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-umproc.o -MD -MP -MF $(DEPDIR)/umview-umproc.Tpo -c -o umview-umproc.o `test -f 'umproc.c' || echo '$(srcdir)/'`umproc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-umproc.Tpo $(DEPDIR)/umview-umproc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='umproc.c' object='umview-umproc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-umproc.o `test -f 'umproc.c' || echo '$(srcdir)/'`umproc.c umview-umproc.obj: umproc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-umproc.obj -MD -MP -MF $(DEPDIR)/umview-umproc.Tpo -c -o umview-umproc.obj `if test -f 'umproc.c'; then $(CYGPATH_W) 'umproc.c'; else $(CYGPATH_W) '$(srcdir)/umproc.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-umproc.Tpo $(DEPDIR)/umview-umproc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='umproc.c' object='umview-umproc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-umproc.obj `if test -f 'umproc.c'; then $(CYGPATH_W) 'umproc.c'; else $(CYGPATH_W) '$(srcdir)/umproc.c'; fi` umview-loginshell.o: loginshell.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-loginshell.o -MD -MP -MF $(DEPDIR)/umview-loginshell.Tpo -c -o umview-loginshell.o `test -f 'loginshell.c' || echo '$(srcdir)/'`loginshell.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-loginshell.Tpo $(DEPDIR)/umview-loginshell.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loginshell.c' object='umview-loginshell.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-loginshell.o `test -f 'loginshell.c' || echo '$(srcdir)/'`loginshell.c umview-loginshell.obj: loginshell.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-loginshell.obj -MD -MP -MF $(DEPDIR)/umview-loginshell.Tpo -c -o umview-loginshell.obj `if test -f 'loginshell.c'; then $(CYGPATH_W) 'loginshell.c'; else $(CYGPATH_W) '$(srcdir)/loginshell.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-loginshell.Tpo $(DEPDIR)/umview-loginshell.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loginshell.c' object='umview-loginshell.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-loginshell.obj `if test -f 'loginshell.c'; then $(CYGPATH_W) 'loginshell.c'; else $(CYGPATH_W) '$(srcdir)/loginshell.c'; fi` umview-hashtab.o: hashtab.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-hashtab.o -MD -MP -MF $(DEPDIR)/umview-hashtab.Tpo -c -o umview-hashtab.o `test -f 'hashtab.c' || echo '$(srcdir)/'`hashtab.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-hashtab.Tpo $(DEPDIR)/umview-hashtab.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hashtab.c' object='umview-hashtab.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-hashtab.o `test -f 'hashtab.c' || echo '$(srcdir)/'`hashtab.c umview-hashtab.obj: hashtab.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-hashtab.obj -MD -MP -MF $(DEPDIR)/umview-hashtab.Tpo -c -o umview-hashtab.obj `if test -f 'hashtab.c'; then $(CYGPATH_W) 'hashtab.c'; else $(CYGPATH_W) '$(srcdir)/hashtab.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-hashtab.Tpo $(DEPDIR)/umview-hashtab.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hashtab.c' object='umview-hashtab.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-hashtab.obj `if test -f 'hashtab.c'; then $(CYGPATH_W) 'hashtab.c'; else $(CYGPATH_W) '$(srcdir)/hashtab.c'; fi` umview-capture_um.o: capture_um.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-capture_um.o -MD -MP -MF $(DEPDIR)/umview-capture_um.Tpo -c -o umview-capture_um.o `test -f 'capture_um.c' || echo '$(srcdir)/'`capture_um.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-capture_um.Tpo $(DEPDIR)/umview-capture_um.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='capture_um.c' object='umview-capture_um.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-capture_um.o `test -f 'capture_um.c' || echo '$(srcdir)/'`capture_um.c umview-capture_um.obj: capture_um.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-capture_um.obj -MD -MP -MF $(DEPDIR)/umview-capture_um.Tpo -c -o umview-capture_um.obj `if test -f 'capture_um.c'; then $(CYGPATH_W) 'capture_um.c'; else $(CYGPATH_W) '$(srcdir)/capture_um.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-capture_um.Tpo $(DEPDIR)/umview-capture_um.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='capture_um.c' object='umview-capture_um.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-capture_um.obj `if test -f 'capture_um.c'; then $(CYGPATH_W) 'capture_um.c'; else $(CYGPATH_W) '$(srcdir)/capture_um.c'; fi` umview-ptrace_multi_test.o: ptrace_multi_test.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-ptrace_multi_test.o -MD -MP -MF $(DEPDIR)/umview-ptrace_multi_test.Tpo -c -o umview-ptrace_multi_test.o `test -f 'ptrace_multi_test.c' || echo '$(srcdir)/'`ptrace_multi_test.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-ptrace_multi_test.Tpo $(DEPDIR)/umview-ptrace_multi_test.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ptrace_multi_test.c' object='umview-ptrace_multi_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-ptrace_multi_test.o `test -f 'ptrace_multi_test.c' || echo '$(srcdir)/'`ptrace_multi_test.c umview-ptrace_multi_test.obj: ptrace_multi_test.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-ptrace_multi_test.obj -MD -MP -MF $(DEPDIR)/umview-ptrace_multi_test.Tpo -c -o umview-ptrace_multi_test.obj `if test -f 'ptrace_multi_test.c'; then $(CYGPATH_W) 'ptrace_multi_test.c'; else $(CYGPATH_W) '$(srcdir)/ptrace_multi_test.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-ptrace_multi_test.Tpo $(DEPDIR)/umview-ptrace_multi_test.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ptrace_multi_test.c' object='umview-ptrace_multi_test.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-ptrace_multi_test.obj `if test -f 'ptrace_multi_test.c'; then $(CYGPATH_W) 'ptrace_multi_test.c'; else $(CYGPATH_W) '$(srcdir)/ptrace_multi_test.c'; fi` umview-umview.o: umview.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-umview.o -MD -MP -MF $(DEPDIR)/umview-umview.Tpo -c -o umview-umview.o `test -f 'umview.c' || echo '$(srcdir)/'`umview.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-umview.Tpo $(DEPDIR)/umview-umview.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='umview.c' object='umview-umview.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-umview.o `test -f 'umview.c' || echo '$(srcdir)/'`umview.c umview-umview.obj: umview.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-umview.obj -MD -MP -MF $(DEPDIR)/umview-umview.Tpo -c -o umview-umview.obj `if test -f 'umview.c'; then $(CYGPATH_W) 'umview.c'; else $(CYGPATH_W) '$(srcdir)/umview.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-umview.Tpo $(DEPDIR)/umview-umview.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='umview.c' object='umview-umview.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-umview.obj `if test -f 'umview.c'; then $(CYGPATH_W) 'umview.c'; else $(CYGPATH_W) '$(srcdir)/umview.c'; fi` umview-utils_um.o: utils_um.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-utils_um.o -MD -MP -MF $(DEPDIR)/umview-utils_um.Tpo -c -o umview-utils_um.o `test -f 'utils_um.c' || echo '$(srcdir)/'`utils_um.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-utils_um.Tpo $(DEPDIR)/umview-utils_um.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils_um.c' object='umview-utils_um.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-utils_um.o `test -f 'utils_um.c' || echo '$(srcdir)/'`utils_um.c umview-utils_um.obj: utils_um.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umview-utils_um.obj -MD -MP -MF $(DEPDIR)/umview-utils_um.Tpo -c -o umview-utils_um.obj `if test -f 'utils_um.c'; then $(CYGPATH_W) 'utils_um.c'; else $(CYGPATH_W) '$(srcdir)/utils_um.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umview-utils_um.Tpo $(DEPDIR)/umview-utils_um.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils_um.c' object='umview-utils_um.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umview_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umview-utils_um.obj `if test -f 'utils_um.c'; then $(CYGPATH_W) 'utils_um.c'; else $(CYGPATH_W) '$(srcdir)/utils_um.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(dist_man1_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-man2: $(dist_man2_MANS) @$(NORMAL_INSTALL) test -z "$(man2dir)" || $(MKDIR_P) "$(DESTDIR)$(man2dir)" @list='$(dist_man2_MANS)'; test -n "$(man2dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^2][0-9a-z]*$$,2,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man2dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man2dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man2dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man2dir)" || exit $$?; }; \ done; } uninstall-man2: @$(NORMAL_UNINSTALL) @list='$(dist_man2_MANS)'; test -n "$(man2dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^2][0-9a-z]*$$,2,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man2dir)'; $(am__uninstall_files_from_dir) install-man5: $(dist_man5_MANS) @$(NORMAL_INSTALL) test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)" @list='$(dist_man5_MANS)'; test -n "$(man5dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ done; } uninstall-man5: @$(NORMAL_UNINSTALL) @list='$(dist_man5_MANS)'; test -n "$(man5dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(PROGRAMS) $(MANS) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man2dir)" "$(DESTDIR)$(man5dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libexecPROGRAMS \ clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-libexecPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-man2 install-man5 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-libexecPROGRAMS \ uninstall-man uninstall-man: uninstall-man1 uninstall-man2 uninstall-man5 .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libexecPROGRAMS clean-libtool ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-libexecPROGRAMS \ install-man install-man1 install-man2 install-man5 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-libexecPROGRAMS uninstall-man uninstall-man1 \ uninstall-man2 uninstall-man5 @ENABLE_DEBUG_TRUE@release: clean @ENABLE_DEBUG_TRUE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS)' @ENABLE_DEBUG_TRUE@debug: all @ENABLE_DEBUG_FALSE@release: all @ENABLE_DEBUG_FALSE@debug: clean @ENABLE_DEBUG_FALSE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS) $(CDEBUGFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS) $(CPPDEBUGFLAGS)' pcb-all.h: $(PCB_MODULES) echo "/* DO NOT EDIT. File Automagically generated */" > pcb-all.h cat $(PCB_MODULES) >> pcb-all.h #ifeq ($(PIVOTING),true) # #syscall_code.c syscall_code.h: compile_code.sh # ./compile_code.sh syscall_code.h syscall_code.c # #endif # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: umview-0.8.2/xmview/um_time.c0000644000175000017500000001141011753517211015233 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_time.c: time wrapper * * Copyright 2006 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_time.c 968 2011-08-03 10:16:26Z rd235 $ * */ #include #include #include #include #include #include "defs.h" #include "hashtab.h" #include "utils.h" #include "sctab.h" /* mapped onto gettimeofday */ int wrap_in_time(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long addr=pc->sysargs[0]; if (addr != umNULL) { struct timeval tv; pc->retval = um_syscall(&tv,NULL); if (pc->retval >= 0) { pc->retval = tv.tv_sec; ustoren(pc,addr,4,&(pc->retval)); } else pc->erno = errno; } else { pc->retval = -1; pc->erno = EINVAL; } return SC_FAKE; } int wrap_in_gettimeofday(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { struct timeval tv; struct timezone tz; long tvp=pc->sysargs[0]; long tzp=pc->sysargs[1]; if ((pc->retval = um_syscall(&tv,&tz)) < 0) pc->erno=errno; else { if (tvp != umNULL) ustoren(pc,tvp,sizeof(struct timeval),&tv); if (tzp != umNULL) ustoren(pc,tzp,sizeof(struct timezone),&tz); } return SC_FAKE; } int wrap_in_settimeofday(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { struct timeval tv,*tvx; struct timezone tz,*tzx; long tvp=pc->sysargs[0]; long tzp=pc->sysargs[1]; /* The calling process has insufficient privilege to call settimeofday(); under Linux the CAP_SYS_TIME capability is required. */ if (secure && capcheck(CAP_SYS_TIME,pc)) { pc->retval = -1; pc->erno = EPERM; return SC_FAKE; } if (tvp != umNULL) { umoven(pc,tvp,sizeof(struct timeval),&tv); tvx=&tv; } else tvx=NULL; if (tzp != umNULL) { umoven(pc,tzp,sizeof(struct timezone),&tz); tzx=&tz; } else tzx=NULL; if ((pc->retval = um_syscall(tvx,tzx)) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_adjtimex(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { struct timex tmx; long tmxp=pc->sysargs[0]; if (tmxp != umNULL) { umoven(pc,tmxp,sizeof(struct timeval),&tmx); /* tmx.mode is non-zero and the caller does not have sufficient privilege. Under Linux the CAP_SYS_TIME capability is required. */ if (secure && tmx.modes != 0 && capcheck(CAP_SYS_TIME,pc)) { pc->retval = -1; pc->erno = EPERM; return SC_FAKE; } pc->retval=um_syscall(&tmx); if (pc->retval>= 0) ustoren(pc,tmxp,sizeof(struct timeval),&tmx); else pc->erno=errno; } else { pc->retval = -1; pc->erno = EFAULT; } return SC_FAKE; } int wrap_in_clock_gettime(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { clockid_t clk_id=pc->sysargs[0]; if (clk_id == CLOCK_REALTIME || clk_id == CLOCK_MONOTONIC) { long tss=pc->sysargs[1]; struct timespec ts; pc->retval=um_syscall(clk_id,&ts); if (pc->retval>= 0) ustoren(pc,tss,sizeof(struct timespec),&ts); else pc->erno=errno; return SC_FAKE; } else return STD_BEHAVIOR; } int wrap_in_clock_settime(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { clockid_t clk_id=pc->sysargs[0]; if (clk_id == CLOCK_REALTIME || clk_id == CLOCK_MONOTONIC) { long tss=pc->sysargs[1]; struct timespec ts; if (tss != umNULL) umoven(pc,tss,sizeof(struct timespec),&ts); if (secure && clk_id == CLOCK_REALTIME && capcheck(CAP_SYS_TIME,pc)) { pc->retval = -1; pc->erno = EPERM; return SC_FAKE; } if ((pc->retval=um_syscall(clk_id,&ts)) < 0) pc->erno=errno; return SC_FAKE; } else return STD_BEHAVIOR; } int wrap_in_clock_getres(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { clockid_t clk_id=pc->sysargs[0]; if (clk_id == CLOCK_REALTIME || clk_id == CLOCK_MONOTONIC) { long tss=pc->sysargs[1]; struct timespec ts; pc->retval=um_syscall(clk_id,&ts); if (pc->retval>= 0) ustoren(pc,tss,sizeof(struct timespec),&ts); else pc->erno=errno; return SC_FAKE; } else return STD_BEHAVIOR; } umview-0.8.2/xmview/defs_i386_um.h0000644000175000017500000000631411753517211016003 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * defs.h: interfaces to system call arguments (architecture dependant) * needed for capture_um * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Mattia Belletti, Ludovico Gardenghi, Andrea Gasparini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: defs_i386_um.h 974 2011-08-08 08:52:20Z rd235 $ * */ #ifndef _DEFS_I386 #define _DEFS_I386 /* libc keeps some critical values inside registers */ #define LIBC_VFORK_DIRTY_TRICKS #define _KERNEL_NSIG 64 #define _KERNEL_SIGSET_SIZE _KERNEL_NSIG/8 static inline long getregs(struct pcb *pc) { return r_ptrace(PTRACE_GETREGS,pc->pid,NULL,(void*) pc->saved_regs); } static inline long setregs(struct pcb *pc, enum __ptrace_request call, long op, long sig) { if (has_ptrace_multi) { struct ptrace_multi req[] = { {PTRACE_SETREGS, 0, (void *) pc->saved_regs, 0}, {call,op,(void *)sig,0}}; return r_ptrace(PTRACE_MULTI,pc->pid,req,2); } else { int rv; rv=r_ptrace(PTRACE_SETREGS,pc->pid,NULL,(void*) pc->saved_regs); if(rv== 0) rv=r_ptrace(call,pc->pid,op,sig); return rv; } } //printregs: current state of the working copy of registers static inline void printregs(struct pcb *pc) { GDEBUG(3, "saved_regs:eax:%x\torig_eax:%x\n\tebx:%x\tecx:%x\n\tedx:%x\tesi:%x", pc->saved_regs[EAX],pc->saved_regs[ORIG_EAX], pc->saved_regs[EBX],pc->saved_regs[ECX], pc->saved_regs[EDX],pc->saved_regs[ESI]); } #define getscno(PC) ( (PC)->saved_regs[ORIG_EAX] ) #define putscno(X,PC) ( (PC)->saved_regs[ORIG_EAX]=(X) ) #define getargn(N,PC) ( (PC)->saved_regs[(N)] ) #define getargp(PC) ((long*)(PC)->saved_regs) #define putargn(N,X,PC) ( (PC)->saved_regs[N]=(X) ) #define getrv(PC) ({ int eax; \ eax = (PC)->saved_regs[EAX];\ (eax<0 && -eax < MAXERR)? -1 : eax; }) #define putrv(RV,PC) ( (PC)->saved_regs[EAX]=(RV) ) #define puterrno(ERR,PC) ( ((ERR)!=0 && (PC)->retval==-1)?(PC)->saved_regs[EAX]=-(ERR) : 0 ) #define puterrno0(PC) /* #define putexit(RV,ERR,PC) \ do { \ r_ptrace(PTRACE_POKEUSER, ((PC)->pid), 4 * PT_R3, (RV)); \ r_ptrace(PTRACE_POKEUSER, ((PC)->pid), 4 * ORIG_EAX, (ERR)); \ } while (0) */ #define getsp(PC) (PC)->saved_regs[UESP] #define getpc(PC) (PC)->saved_regs[EIP] #define putsp(RV,PC) ( (PC)->saved_regs[UESP]=(RV) ) #define putpc(RV,PC) ( (PC)->saved_regs[EIP]=(RV) ) #define LITTLEENDIAN #define LONG_LONG(_l,_h) \ ((long long)((unsigned long long)(unsigned)(_l) | ((unsigned long long)(_h)<<32))) #define MAXERR 4096 #define __NR_setpgrp __NR_doesnotexist #endif umview-0.8.2/xmview/pcb.00.mainpoll.h0000644000175000017500000000104111753517211016374 0ustar renzorenzo#ifdef _PCB_DEFINITIONS /* STATUS DEFINITIONS */ void mainpoll_addproc(),mainpoll_delproc(),mainpoll_init(); #define READY 0 #define BLOCKED 1 #define WAKE_ME_UP 2 #define TERMINATED 3 #define bq_block(pc) ((pc)->pollstatus=BLOCKED) #define bq_unblock(pc) ((pc)->pollstatus=READY) #endif #ifdef _PCB_COMMON_FIELDS int pollstatus; #endif #ifdef _PCB_ONLY_FIELDS #endif #ifdef _NPCB_ONLY_FIELDS #endif #ifdef _PCB_CONSTRUCTOR mainpoll_addproc, #endif #ifdef _PCB_DESTRUCTOR mainpoll_delproc, #endif #ifdef _PCB_INITS mainpoll_init, #endif umview-0.8.2/xmview/capture_um.c0000644000175000017500000006374511753517211015762 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * capture_um.c : capture and divert system calls * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Mattia Belletti, Ludovico Gardenghi, Andrea Gasparini * Modified 2006 Renzo Davoli * * Some code has been inherited from strace * Copyright (c) 1991, 1992 Paul Kranenburg * Copyright (c) 1993 Branko Lankester * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey * Copyright (c) 1996-1999 Wichert Akkerman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: capture_um.c 1011 2011-10-24 20:10:26Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "capture_nested.h" #include "defs.h" #include "utils.h" #include "gdebug.h" #ifdef GDEBUG_ENABLED #include "syscallnames.h" #endif #define PCBSIZE 10 pthread_key_t pcb_key=0; /* key to grab the current thread pcb */ sfun native_syscall=syscall; /* debugging output, (bypass pure_libc when loaded) */ int vprintk(const char *fmt, va_list ap) { char *s; int rv=0; int level=PRINTK_STANDARD_LEVEL; if (fmt[0] == '<' && fmt[1] != 0 && fmt[2] == '>') { /*level*/ switch (fmt[1]) { case '0' ... '7': level=fmt[1] - '0'; fmt+=3; break; } } if (level <= printk_current_level) { rv=vasprintf(&s, fmt, ap); if (rv>0) rv=r_write(2,s,strlen(s)); free(s); } return rv; } int printk(const char *fmt, ...) { int rv; va_list ap; va_start(ap,fmt); rv=vprintk(fmt,ap); va_end(ap); return rv; } static struct pcb **pcbtab; /* capture_um pcb table */ int nprocs = 0; /* number of active processes */ static int pcbtabsize; /* actual size of the pcb table */ divfun scdtab[_UM_NR_syscalls]; /* upcalls */ char scdnarg[_UM_NR_syscalls]; /*nargs*/ /* linux has a single call for all the socket calls * in several architecture (i386, ppc), socket calls are standard * system calls in others (x86_64) */ #if __NR_socketcall != __NR_doesnotexist divfun sockcdtab[19]; /* upcalls */ static char socketcallnargs[] = { 0, 3, /* sys_socket(2) */ 3, /* sys_bind(2) */ 3, /* sys_connect(2) */ 2, /* sys_listen(2) */ 3, /* sys_accept(2) */ 3, /* sys_getsockname(2) */ 3, /* sys_getpeername(2) */ 4, /* sys_socketpair(2) */ 4, /* sys_send(2) */ 4, /* sys_recv(2) */ 6, /* sys_sendto(2) */ 6, /* sys_recvfrom(2) */ 2, /* sys_shutdown(2) */ 5, /* sys_setsockopt(2) */ 5, /* sys_getsockopt(2) */ 3, /* sys_sendmsg(2) */ 3, /* sys_recvmsg(2) */ 4 /* sys_msocket new call for multiple stack access */ }; #endif /* umview have to exit with the exit code of the first child: here we remember * what the first child was, and save its exit value */ pid_t first_child_pid; int first_child_exit_status = -1; /* just an interface to a hidden value */ int pcbtablesize(void) { return pcbtabsize; } /* the "current process" info gets stored as key specific data of the thread */ struct pcb *get_pcb() { return pthread_getspecific(pcb_key); } void set_pcb(void *new) { pthread_setspecific(pcb_key,new); } /* pcb allocator, it resizes the data structure when needed */ static struct pcb *newpcb (int pid) { register int i,j; struct pcb *pcb; for (i=0; 1; i++) { if (i==pcbtabsize) { /* expand the pcb table */ /* we double the size, from pcbtabsize to pcbtabsize*2; to do this, we * reallocate the newtab to double the size it was before; then we need * pcbtabsize more pointers; so we allocate a table of pointers of size * pcbtabsize, and the new pointers to pointers now points to that. It's * a bit difficult to understand - graphically: * * newtab: * +---------------------------------------------------------------+ * |0123|45678...| | | * +---------------------------------------------------------------+ * | | | | * V V V V * first second third fourth * calloc calloc calloc calloc * of of of of * newpcbs newpcbs newpcbs newpcbs * * Messy it can be, this way pointers to pcbs still remain valid after * a reallocation. */ struct pcb **newtab = (struct pcb **) realloc(pcbtab, 2 * pcbtabsize * sizeof pcbtab[0]); struct pcb *newpcbs = (struct pcb *) calloc(pcbtabsize, sizeof *newpcbs); if (newtab == NULL || newpcbs == NULL) { if (newtab != NULL) free(newtab); return NULL; } for (j = pcbtabsize; j < 2 * pcbtabsize; ++j) newtab[j] = &newpcbs[j - pcbtabsize]; pcbtabsize *= 2; pcbtab = newtab; } pcb=pcbtab[i]; if (! (pcb->flags & PCB_INUSE)) { pcb->pid=pid; pcb->umpid=i+1; // umpid==0 is reserved for umview itself pcb->flags = PCB_INUSE | PCB_STARTING; pcb->sysscno = NOSC; pcb->pp = NULL; nprocs++; return pcb; } } /* never reach here! */ assert(0); return NULL; } /* this is an iterator on the pcb table */ void forallpcbdo(voidfun f,void *arg) { register int i; for (i = 0; i < pcbtabsize; i++) { struct pcb *pc = pcbtab[i]; if (pc->flags & PCB_INUSE) { GDEBUG(8, "calling @%p with arg %p on pid %d", f, arg, pc->pid); f(pc,arg); GDEBUG(8, "returning from call"); } } } /* pid 2 pcb conversion (by linear search) */ struct pcb *pid2pcb(int pid) { register int i; for (i = 0; i < pcbtabsize; i++) { struct pcb *pc = pcbtab[i]; if (pc->pid == pid && pc->flags & PCB_INUSE) return pc; } return NULL; } /* orphan processes must NULL-ify their parent process pointer */ static void _cut_pp(struct pcb *pc, struct pcb *delpc) { if (pc->pp == delpc) pc->pp = NULL; } /* pcb deallocator */ static void droppcb(struct pcb *pc) { /* the last process descriptor should stay "alive" for * the termination of all modules */ /* otherwise the "nesting" mechanism misunderstands * the pcb by a npcb */ /* XXX rd235 20090805: it seems not a problem any more in the new version. deleted for dup delproc notication for proc #1 */ #ifdef _PROC_MEM_TEST if (pc->memfd >= 0) close(pc->memfd); #endif nprocs--; forallpcbdo(_cut_pp,pc); pcb_destructor(pc,0/*flags*/,0); #if 0 if (nprocs > 0) #endif pc->flags = 0; /*NOT PCB_INUSE */; } /* initial PCB table allocation */ static void allocatepcbtab() { struct pcb *pc; /* Allocate the initial pcbtab. */ /* look at newpcb for some explanations about the structure */ pcbtabsize = PCBSIZE; /* allocation of pointers */ pcbtab = (struct pcb **) malloc (pcbtabsize * sizeof pcbtab[0]); /* allocation of PCBs */ pcbtab[0] = (struct pcb *) calloc (pcbtabsize, sizeof *pcbtab[0]); /* each pointer points to the corresponding PCB */ for (pc = pcbtab[0]; pc < &pcbtab[0][pcbtabsize]; ++pc) pcbtab[pc - pcbtab[0]] = &pcbtab[0][pc - pcbtab[0]]; } static int handle_new_proc(int pid, struct pcb *pp) { struct pcb *oldpc,*pc; #ifdef LIBC_VFORK_DIRTY_TRICKS long saved_regs[VIEWOS_FRAME_SIZE]; #endif /*LIBC_VFORK_DIRTY_TRICKS*/ //printk("handle_new_proc %d %p\n",pid,pp); if ((oldpc=pc=pid2pcb(pid)) == NULL && (pc = newpcb(pid))== NULL) { printk("[pcb table full]\n"); if(r_ptrace(PTRACE_KILL, pid, 0, 0) < 0){ GPERROR(0, "KILL"); exit(1); } } if (pp != NULL) { // GDEBUG(2, "handle_new_proc(pid=%d,pp=%d) -- pc->pid: %d oldpc=%d pc=%d",pid,pp,pc->pid,oldpc,pc); pc->pp = pp; if (oldpc != NULL) { pc->flags &= ~PCB_STARTING; #ifdef LIBC_VFORK_DIRTY_TRICKS pc->saved_regs=saved_regs; getregs(pc); putargn(0,pp->sysargs[0],pc); putargn(1,pp->sysargs[1],pc); ////printk("starting1 pc->pid %d %x %x was %x %x\n",pc->pid, pp->sysargs[0],pp->sysargs[1],getargn(0,pc),getargn(1,pc)); if(setregs(pc,PTRACE_SYSCALL,0,0) < 0){ GPERROR(0, "continuing"); exit(1); } #else if(r_ptrace(PTRACE_SYSCALL, pid, 0, 0) < 0){ GPERROR(0, "continuing"); exit(1); } pc->saved_regs=NULL; #endif /*LIBC_VFORK_DIRTY_TRICKS*/ } else { pc->sysargs[0]=pp->sysargs[0]; pc->sysargs[1]=pp->sysargs[1]; } #ifdef _PROC_MEM_TEST if (!has_ptrace_multi) { char *memfile; asprintf(&memfile,"/proc/%d/mem",pc->pid); pc->memfd=r_open(memfile,O_RDWR,0); free(memfile); } else pc->memfd= -1; #endif pc->signum=0; pcb_constructor(pc,pp->sysargs[2],0); } return 0; } #ifdef FAKESIGSTOP int fakesigstopcont(struct pcb *pc) { long kpid=getargn(0,pc); long ksig=getargn(1,pc); struct pcb *kpc; if ((kpc=pid2pcb(kpid)) != NULL && ksig == SIGCONT && (kpc->flags & PCB_FAKESTOP)) { GDEBUG(1, "FAKECONT %d",kpid); kpc->flags &= ~PCB_FAKESTOP; if(r_ptrace(PTRACE_SYSCALL, kpid, 0, 0) < 0){ GPERROR(0, "continuing"); exit(1); } return SC_FAKE; } return STD_BEHAVIOR; } #endif /* FORK/VFORK/CLONE management */ void offspring_enter(struct pcb *pc) { //printf("offspring_enter:%d\n",pc->pid); pc->sysargs[0]=getargn(0,pc); pc->sysargs[1]=getargn(1,pc); //printk("offspring_enter %x %x\n",pc->sysargs[0],pc->sysargs[1]); if (pc->sysscno == __NR_fork || pc->sysscno == __NR_vfork) { putscno(__NR_clone,pc); putargn(0,CLONE_PTRACE|SIGCHLD, pc); putargn(1,0, pc); pc->sysargs[2]=SIGCHLD; } else if (pc->sysscno == __NR_clone) { putargn(0,pc->sysargs[0] | CLONE_PTRACE, pc); pc->sysargs[2]=pc->sysargs[0]; } } void offspring_exit(struct pcb *pc) { putargn(0,pc->sysargs[0],pc); putargn(1,pc->sysargs[1],pc); } /* Tracer core, executed any time an event occurs*/ void tracehand() { int pid, status, scno=0; struct pcb *pc; while(nprocs>0){ /* get the id of the signalling process */ if((pid = r_waitpid(-1, &status, WUNTRACED | __WALL | WNOHANG)) < 0) { GPERROR(0, "wait"); exit(1); } /* This is a safe exit if there are spurious chars in the pipe */ if (pid==0) return; if ((pc=pid2pcb(pid))==NULL) { /* race condition, new procs can be faster than parents*/ if(WIFSTOPPED(status) && (WSTOPSIG(status) == SIGSTOP)) { /* create the descriptor, block the process * until the parent complete the pcb */ ////printk("RACE CONDITION %d\n",pid); handle_new_proc(pid,NULL); continue; } /* error case */ printk("signal from unknown pid %d: killed\n",pid); GDEBUG(0, "signal from unknown pid %d: killed",pid); if(r_ptrace(PTRACE_KILL, pid, 0, 0) < 0){ GPERROR(0, "KILL"); exit(1); } } /* set the pcb of the signalling (current) process as a * thread private data */ pthread_setspecific(pcb_key,pc); if(WIFSTOPPED(status) && (WSTOPSIG(status) == SIGTRAP)){ int isreproducing=0; long saved_regs[VIEWOS_FRAME_SIZE]; pc->saved_regs=saved_regs; if ( getregs(pc) < 0 ){ GPERROR(0, "saving register"); exit(1); } //printregs(pc); scno=getscno(pc); /* execve does not return */ if ( #if __NR_socketcall != __NR_doesnotexist pc->sockaddr == 0 && #endif pc->sysscno == __NR_execve && scno != __NR_execve && (pc->behavior != SC_FAKE || scno != __NR_getpid)){ pc->sysscno = NOSC; } isreproducing=(scno == __NR_fork || scno == __NR_vfork || scno == __NR_clone); /* sigreturn and rt_sigreturn give random "OUT" values, maybe 0. * this is a workaroud */ #if defined(__x86_64__) //sigreturn and signal aren't defineed in amd64 /* x86_64 has not the single socketcall */ if (pc->sysscno == __NR_rt_sigreturn ) pc->sysscno = NOSC; #else if ( #if __NR_socketcall != __NR_doesnotexist pc->sockaddr == 0 && #endif (pc->sysscno == __NR_rt_sigreturn || pc->sysscno == __NR_sigreturn)) pc->sysscno = NOSC; /*0 is READ for x86_84*/ else if (scno == 0) { if (pc->sysscno == __NR_execve) pc->sysscno = NOSC; } #endif else if (pc->sysscno == NOSC) /* PRE syscall tracing event (IN)*/ { divfun fun; pc->signum=0; GDEBUG(3, "--> pid %d syscall %d (%s) @ %p", pid, scno, SYSCALLNAME(scno), getpc(pc)); //printf("IN\n"); pc->sysscno = scno; switch (scdnarg[scno]) { case 6: pc->sysargs[5]=getargn(5,pc); case 5: pc->sysargs[4]=getargn(4,pc); case 4: pc->sysargs[3]=getargn(3,pc); case 3: pc->sysargs[2]=getargn(2,pc); case 2: pc->sysargs[1]=getargn(1,pc); case 1: pc->sysargs[0]=getargn(0,pc); } #if __NR_socketcall != __NR_doesnotexist if (scno==__NR_socketcall) { //printk("socketcall %d %x\n",pc->sysargs[0],pc->sysargs[1]); pc->sysscno=pc->sysargs[0]; pc->sockaddr=pc->sysargs[1]; umoven(pc,pc->sockaddr, socketcallnargs[pc->sysscno] * sizeof(long), pc->sysargs); fun=sockcdtab[pc->sysscno]; } else { pc->sockaddr=0; fun=scdtab[pc->sysscno]; } #else fun=scdtab[pc->sysscno]; #endif if (fun != NULL) pc->behavior=fun(pc->sysscno,IN,pc); else pc->behavior=STD_BEHAVIOR; #ifdef FAKESIGSTOP if (scno == __NR_kill && pc->behavior == STD_BEHAVIOR) pc->behavior=fakesigstopcont(pc); #endif if (pc->behavior & SC_SKIP_CALL) { if (PT_VM_OK) { /* kernel supports System call skip PTRACE_SYSVM */ if ((fun(scno,OUT,pc) & SC_SUSPENDED)==0) pc->sysscno=NOSC; } else /* fake syscall with getpid if the kernel does not support * syscall shortcuts */ putscno(__NR_getpid,pc); } else { /* fork is translated into clone * offspring management */ if (isreproducing) { offspring_enter(pc); } if (pc->behavior & SC_SAVEREGS) { /* in case the call has been changed, count the * args for the new call */ switch (scdnarg[getscno(pc)]) { case 6: putargn(5,pc->sysargs[5],pc); case 5: putargn(4,pc->sysargs[4],pc); case 4: putargn(3,pc->sysargs[3],pc); case 3: putargn(2,pc->sysargs[2],pc); case 2: putargn(1,pc->sysargs[1],pc); case 1: putargn(0,pc->sysargs[0],pc); } } } } else { /* POST syscall management (OUT phase) */ divfun fun; GDEBUG(3, "<-- pid %d syscall %d (%s) @ %p", pid, scno, SYSCALLNAME(scno), getpc(pc)); //printk("OUT\n"); if (isreproducing) { long newpid; newpid=getrv(pc); if (newpid >= 0) { handle_new_proc(newpid,pc); offspring_exit(pc); putrv(newpid,pc); } else { ////printf("ERESTARTNOINTR scno %d %ld %ld\n",scno, newpid,pc->saved_regs[MY_RAX]); offspring_exit(pc); } GDEBUG(3, "FORK! %d->%d",pid,newpid); /* restore original arguments */ } /* It is just for the sake of correctness, this test could be * safely eliminated to increase the performance*/ if ((pc->behavior == SC_FAKE && scno != __NR_getpid) && #if __NR_socketcall != __NR_doesnotexist (scno != __NR_socketcall && pc->sockaddr == 0) && #endif scno != pc->sysscno) GDEBUG(0, "error FAKE != %s",SYSCALLNAME(scno)); #if __NR_socketcall != __NR_doesnotexist if (pc->sockaddr == 0) fun=scdtab[pc->sysscno]; else fun=sockcdtab[pc->sysscno]; #else fun=scdtab[pc->sysscno]; #endif if (fun != NULL && (pc->behavior == SC_FAKE || pc->behavior == SC_CALLONXIT || pc->behavior == SC_TRACEONLY)) { pc->behavior = fun(pc->sysscno,OUT,pc); if ((pc->behavior & SC_SUSPENDED) == 0) pc->sysscno=NOSC; else pc->behavior=SC_SUSPOUT; } else { pc->behavior = STD_BEHAVIOR; pc->sysscno=NOSC; } } // end if scno==NOSC (OUT) /* resume the caller ONLY IF the syscall is not blocking */ /* setregs is a macro that resume the execution, too */ if ((pc->behavior & SC_SUSPENDED) == 0) { if ((pc->behavior & SC_SAVEREGS) || isreproducing) { if (PT_VM_OK) { /*printk("SC %s %d\n",SYSCALLNAME(scno),pc->behavior);*/ if(setregs(pc,PTRACE_SYSVM, (isreproducing ? 0 : (pc->behavior & SC_VM_MASK)),pc->signum) == -1) GPERROR(0, "setregs"); if(!isreproducing && (pc->behavior & PTRACE_VM_SKIPEXIT)) pc->sysscno=NOSC; } else if( setregs(pc,PTRACE_SYSCALL, 0, pc->signum) < 0) GPERROR(0, "setregs"); } else /* register not modified */ { //printk ("RESTART\n"); if (PT_VM_OK) { if (r_ptrace(PTRACE_SYSVM,pc->pid,pc->behavior & SC_VM_MASK,pc->signum) < 0) GPERROR(0, "restart"); if(pc->behavior & PTRACE_VM_SKIPEXIT) pc->sysscno=NOSC; }else { if (r_ptrace(PTRACE_SYSCALL,pc->pid,0,pc->signum) < 0) GPERROR(0, "restart"); } } pc->saved_regs=NULL; } else { pc->saved_regs=malloc(sizeof(saved_regs)); memcpy(pc->saved_regs,saved_regs,sizeof(saved_regs)); } } // end if SIGTRAP else if(WIFSIGNALED(status)) { GDEBUG(3, "%d: signaled %d",pid,WTERMSIG(status)); /* process killed by a signal */ droppcb(pc); } /* Abend and signal management */ else if(WIFSTOPPED(status)) { long saved_regs[VIEWOS_FRAME_SIZE]; pc->saved_regs=saved_regs; GDEBUG(3, "%d: stopped sig=%d",pid,(WSTOPSIG(status))); if(WSTOPSIG(status) == SIGSEGV) { if(getregs(pc) == -1) GDEBUG(3, "[err]"); GDEBUG(3, "%d: stopped sig=SIGSEGV @ %p", pc->pid, getpc(pc)); } /*if (!sigishandled(pc, WSTOPSIG(status))) { // also progenie, but for now //r_ptrace(PTRACE_KILL,pid,0,0); //printf("KILLED %d %d\n", pid,pc->pid); }*/ #ifdef FAKESIGSTOP if (WSTOPSIG(status) == SIGTSTP && pc->pp != NULL) { pc->flags |= PCB_FAKESTOP; GDEBUG(1, "KILL 28 %d",pc->pp->pid); //SIGSTOP -> FAKE SIGWINCH kill(pc->pp->pid,28); } else #endif if (WSTOPSIG(status) == SIGSTOP && (pc->flags & PCB_STARTING)) { pc->flags &= ~PCB_STARTING; #ifdef LIBC_VFORK_DIRTY_TRICKS getregs(pc); ////printk("starting2 %x %x was %x %x\n",pc->sysargs[0],pc->sysargs[1],getargn(0,pc),getargn(1,pc)); putargn(0,pc->sysargs[0],pc); putargn(1,pc->sysargs[1],pc); setregs(pc,PTRACE_SYSCALL,0,0); #else r_ptrace(PTRACE_SYSCALL, pid, 0, 0); #endif } else /* forward signals to the process */ if(r_ptrace(PTRACE_SYSCALL, pid, 0, WSTOPSIG(status)) < 0){ GPERROR(0, "continuing"); exit(1); } pc->saved_regs=NULL; } /* process termination management */ else if(WIFEXITED(status)) { //printf("%d: exited\n",pid); /* the process has terminated */ droppcb(pc); /* if it was the "init" process (first child), save its exit status, * since it is also _our_ exit status! */ if(first_child_pid == pc->pid) first_child_exit_status = WEXITSTATUS(status); } else GDEBUG(1, "wait failed - pid = %d, status = %d", pid, status); } } /* pc can be resumed: there is data to unblock (maybe) its system call */ void sc_resume(struct pcb *pc) { /* int pid=pc->pid; */ //printk("RESUME %d\n",pc->pid); int scno=pc->sysscno; int inout=pc->behavior-SC_SUSPENDED; int isreproducing=(scno == __NR_fork || scno == __NR_vfork || scno == __NR_clone); int signum=0; divfun fun; /* set the current process */ pthread_setspecific(pcb_key,pc); #if __NR_socketcall != __NR_doesnotexist if (pc->sockaddr == 0) fun=scdtab[pc->sysscno]; else fun=sockcdtab[pc->sysscno]; #else fun=scdtab[scno]; #endif /* try again to execute the mgmt function */ if (fun != NULL) pc->behavior=fun(scno,inout,pc); else pc->behavior=STD_BEHAVIOR; if (inout==IN) { /* resumed in IN phase */ if (pc->behavior == SC_FAKE) { if (PT_VM_OK) { /* in case PTRACE_SYSVM supports syscall skipping */ if (inout==IN && (fun(scno,OUT,pc) & SC_SUSPENDED)==0) pc->sysscno=NOSC; } else putscno(__NR_getpid,pc); } else { if (isreproducing) offspring_enter(pc); if (pc->behavior & SC_SAVEREGS) { /* in case the call has been changed, count the * args for the new call */ switch (scdnarg[getscno(pc)]) { case 6: putargn(5,pc->sysargs[5],pc); case 5: putargn(4,pc->sysargs[4],pc); case 4: putargn(3,pc->sysargs[3],pc); case 3: putargn(2,pc->sysargs[2],pc); case 2: putargn(1,pc->sysargs[1],pc); case 1: putargn(0,pc->sysargs[0],pc); } } } } else { /* inout == OUT */ if ((pc->behavior & SC_SUSPENDED) == 0) pc->sysscno=NOSC; else pc->behavior = SC_SUSPOUT; signum=pc->signum; } //printk("RESTARTED %d %d\n",pc->pid,pc->behavior); /* restore registers and restart ONLY IF the call is not already blocking */ if ((pc->behavior & SC_SUSPENDED) == 0) { if (PT_VM_OK) { if(setregs(pc,PTRACE_SYSVM,isreproducing ? 0 : pc->behavior,signum) == -1) GPERROR(0, "setregs"); if(!isreproducing && (pc->behavior & PTRACE_VM_SKIPEXIT)) pc->sysscno=NOSC; } else if( setregs(pc,PTRACE_SYSCALL,0,signum) == -1) GPERROR(0, "setregs"); free(pc->saved_regs); pc->saved_regs=0; } } void wake_null(int s) { } static void setsigaction(void) { struct sigaction sa; sigset_t blockchild; sa.sa_handler = SIG_IGN; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; r_sigaction(SIGTTOU, &sa, NULL); r_sigaction(SIGTTIN, &sa, NULL); r_sigaction(SIGHUP, &sa, NULL); r_sigaction(SIGINT, &sa, NULL); r_sigaction(SIGQUIT, &sa, NULL); r_sigaction(SIGPIPE, &sa, NULL); r_sigaction(SIGTERM, &sa, NULL); ////sa.sa_handler = SIG_DFL; // SIGCHLD: syscall hadling is interruptable //sigaddset(&sa.sa_mask,SIGCHLD); // fillset: syscall handling is not interruptable sigfillset(&sa.sa_mask); /* * The signal handler is no longer the whole tracehand() * but a smaller function whose only duty is to * wake up the select() in main(). * With ppoll there is no need for pipe: in this latter * case SIGCHLD gets blocked. SIGCHLD will unblock ppoll */ sigemptyset(&blockchild); sigaddset(&blockchild,SIGCHLD); r_sigprocmask(SIG_BLOCK,&blockchild,NULL); sa.sa_handler = wake_null; r_sigaction(SIGCHLD, &sa, NULL); } /* destructor: the pcb element is flagged as free */ static void vir_pcb_free(void *arg) { struct pcb *pc=arg; if (pc->flags & PCB_ALLOCATED) { pcb_destructor(pc,0,1); free(arg); } } #if 0 /* execvp implementation (to avoid pure_libc management) */ static int r_execvp(const char *file, char *const argv[]){ if(strchr(file,'/') != NULL) return execve(file,argv,environ); else { char *path; char *envpath; char *pathelem; char buf[PATH_MAX]; if ((envpath=getenv("PATH")) == NULL) envpath="/bin:/usr/bin"; path=strdup(envpath); while((pathelem=strsep(&path,":")) != NULL){ if (*pathelem != 0) { register int i,j; for (i=0; i # include # include # define WORDLEN sizeof(int *) # define WORDALIGN(X) (((X) + WORDLEN) & ~(WORDLEN-1)) /* Moves len bytes from address 'addr' in the address space of the process * whose pid is 'pid' to local address '_laddr'. */ static inline int umoven(struct pcb *pc, long addr, int len, void *_laddr) { struct kmview_ioctl_data data={pc->kmpid,addr,len,_laddr}; return (ioctl(kmviewfd,KMVIEW_READDATA,&data) < 0); } /* Moves bytes from address 'addr' in the address space of the process whose * pid is 'pid' to local address '_laddr', until it doesn't find a '\0' */ static inline int umovestr(struct pcb *pc, long addr, int len, void *_laddr) { struct kmview_ioctl_data data={pc->kmpid,addr,len,_laddr}; return (ioctl(kmviewfd,KMVIEW_READSTRINGDATA,&data) < 0); } /* Moves len bytes from local address '_laddr' in our address space to address * 'addr' in the address space of the process whose pid is 'pid'. */ static inline int ustoren(struct pcb *pc, long addr, int len, void *_laddr) { struct kmview_ioctl_data data={pc->kmpid,addr,len,_laddr}; return (ioctl(kmviewfd,KMVIEW_WRITEDATA,&data) < 0); } /* Moves bytes from local address '_laddr' in our address space to address * 'addr' in the address space of the process whose pid is 'pid', until it * doesn't find a '\0' */ static inline int ustorestr(struct pcb *pc, long addr, int len, void *_laddr) { struct kmview_ioctl_data data={pc->kmpid,addr, strnlen((char *)_laddr,len)+1, /* +1: final '\0' must be included */ _laddr}; return (ioctl(kmviewfd,KMVIEW_WRITEDATA,&data) < 0); } static inline int addfd(struct pcb *pc, int fd) { struct kmview_fd kmfd={pc->kmpid,fd}; //printk("FD ADD pid %d fd %d\n",pc->pid,fd); return (ioctl(kmviewfd,KMVIEW_ADDFD,&kmfd)); } static inline int delfd(struct pcb *pc, int fd) { struct kmview_fd kmfd={pc->kmpid,fd}; //printk("FD DEL pid %d fd %d\n",pc->pid,fd); return (ioctl(kmviewfd,KMVIEW_DELFD,&kmfd)); } #endif #ifdef _VIEWOS_UM /* Moves len bytes from address 'addr' in the address space of the process * whose pid is 'pid' to local address '_laddr'. */ int umoven(struct pcb *pc, long addr, int len, void *_laddr); /* Moves bytes from address 'addr' in the address space of the process whose * pid is 'pid' to local address '_laddr', until it doesn't find a '\0' */ int umovestr(struct pcb *pc, long addr, int len, void *_laddr); /* Moves len bytes from local address '_laddr' in our address space to address * 'addr' in the address space of the process whose pid is 'pid'. */ int ustoren(struct pcb *pc, long addr, int len, void *_laddr); /* Moves bytes from local address '_laddr' in our address space to address * 'addr' in the address space of the process whose pid is 'pid', until it * doesn't find a '\0' */ int ustorestr(struct pcb *pc, long addr, int len, void *_laddr); static inline int addfd(struct pcb *pc, int fd) { return 0; } static inline int delfd(struct pcb *pc, int fd) { return 0; } #endif #endif umview-0.8.2/xmview/ptrace2.h0000644000175000017500000000273711753517211015155 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: ptrace2.h 545 2008-06-09 09:49:10Z rd235 $ * */ #ifndef _PTRACE2_H #define _PTRACE2_H #include #ifndef PTRACE_MULTI #define PTRACE_MULTI 0x4300 #define PTRACE_PEEKCHARDATA 0x4301 #define PTRACE_POKECHARDATA 0x4302 #define PTRACE_PEEKSTRINGDATA 0x4303 struct ptrace_multi { long request; long addr; void *localaddr; long length; }; #endif #ifndef PTRACE_SYSVM #define PTRACE_OLDSYSVM 33 /* options for PTRACE_SYSVM */ #define PTRACE_VM_TEST 0x80000000 #define PTRACE_VM_SKIPCALL 5 #define PTRACE_VM_SKIPEXIT 2 #endif #define PTRACE_VM_SKIPOK (PTRACE_VM_SKIPCALL | PTRACE_VM_SKIPEXIT) #endif umview-0.8.2/xmview/um_uname.c0000644000175000017500000000653711753517211015420 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_uname.c: system id syscall * * Copyright 2006 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_uname.c 866 2010-08-11 07:17:33Z rd235 $ * */ #include #include #include #include #include #include #include #include #include "defs.h" #include "hashtab.h" #include "sctab.h" #include "utils.h" int wrap_in_uname(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long addr=pc->sysargs[0]; if (addr != umNULL) { struct new_utsname buf; pc->retval = um_syscall(&buf); if (pc->retval >= 0) { if(sc_number == __NR_uname) ustoren(pc,addr,sizeof(struct new_utsname),&buf); else if (sc_number == __NR_olduname) ustoren(pc,addr,sizeof(struct old_utsname),&buf); else { /*oldolduname*/ struct oldold_utsname oldbuf; memcpy(&oldbuf.sysname,&buf.sysname,8); memcpy(&oldbuf.nodename,&buf.nodename,8); memcpy(&oldbuf.release,&buf.release,8); memcpy(&oldbuf.version,&buf.version,8); memcpy(&oldbuf.machine,&buf.machine,8); oldbuf.sysname[8]= oldbuf.nodename[8]= oldbuf.release[8]= oldbuf.version[8]= oldbuf.machine[8]=0; ustoren(pc,addr,sizeof(struct oldold_utsname),&oldbuf); } } } else { pc->retval = -1; pc->erno = EINVAL; } return SC_FAKE; } int wrap_in_gethostname(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long addr=pc->sysargs[0]; if (addr != umNULL) { long size=pc->sysargs[1]; if (size > 0 || size <= HOST_NAME_MAX) { char *name; struct new_utsname buf; if ((pc->retval = um_syscall(&buf)) >= 0) { if (sc_number == __NR_gethostname) name=buf.nodename; else /* getdomainname */ name=buf.domainname; if (strlen(name)+1 > size) { pc->retval = -1; pc->erno=EINVAL; } else ustorestr(pc,addr,size,name); } } else { pc->retval = -1; pc->erno = EINVAL; } } else { pc->retval = -1; pc->erno = EFAULT; } return SC_FAKE; } int wrap_in_sethostname(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long addr=pc->sysargs[0]; if (addr != umNULL) { long size=pc->sysargs[1]; if (secure && capcheck(CAP_SYS_ADMIN,pc)) { pc->retval = -1; pc->erno = EPERM; return SC_FAKE; } if (size > 0 || size <= HOST_NAME_MAX) { char *name=alloca(size); umovestr(pc,addr,size,name); if ((pc->retval = um_syscall(name,size)) < 0) pc->erno = errno; } else { pc->retval = -1; pc->erno = EINVAL; } } else { pc->retval = -1; pc->erno = EFAULT; } return SC_FAKE; } umview-0.8.2/xmview/capture_um.h0000644000175000017500000000341211753517211015750 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Ludovico Gardenghi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: capture_um.h 968 2011-08-03 10:16:26Z rd235 $ * */ #ifndef CAPTURE_UM_H_ #define CAPTURE_UM_H_ #include "defs.h" extern divfun scdtab[]; extern char scdnarg[]; #if __NR_socketcall != __NR_doesnotexist extern divfun sockcdtab[]; #endif extern int first_child_exit_status; /* start a rc file */ void capture_execrc(const char *path,const char *argv1); /* let the game start! */ int capture_main(char **argv, char *rc); /* resume a process previously suspended */ void sc_resume(void *pc); /* get the pcb of the current thread (thread safe) */ struct pcb *get_pcb(); /* set the pcb of the current thread */ void set_pcb(void *new); /* just ask for the current size of the pcbtable */ int pcbtablesize(void); /* This is the handler of sigchld from user processes */ void tracehand(); /* pcb search (linear scan) */ struct pcb *pid2pcb(int pid); int capture_attach(struct pcb *pc,pid_t pid); #endif umview-0.8.2/xmview/um_ioctl.c0000644000175000017500000000536211753517211015420 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_ioctl: ioctl mgmt * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_ioctl.c 775 2009-09-01 21:15:23Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "defs.h" #include "umproc.h" #include "services.h" #include "hashtab.h" #include "um_services.h" #include "sctab.h" #include "scmap.h" #include "utils.h" #include #include static void ioctl_getarg(struct pcb* pc, int ioctlparms, unsigned long arg, void **larg) { int len=ioctlparms & IOCTLLENMASK; if (len > 0) { *larg=malloc(len); if (ioctlparms & IOCTL_R) umoven(pc,arg,len,*larg); } else *larg = (void *) arg; } static void ioctl_putarg(struct pcb* pc, int ioctlparms, unsigned long arg, void *larg) { int len=ioctlparms & IOCTLLENMASK; if (len > 0) { if (ioctlparms & IOCTL_W) ustoren(pc,arg,len,larg); free(larg); } } int wrap_in_ioctl(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { unsigned long req=pc->sysargs[1]; unsigned long arg=pc->sysargs[2]; void *larg; sysfun checkarg; int ioctlparms=0; if ((checkarg=ht_ioctlparms(hte)) != NULL) ioctlparms=checkarg(sfd,req); ioctl_getarg(pc,ioctlparms,arg,&larg); if ((pc->retval = um_syscall(sfd,req,larg)) >= 0) ioctl_putarg(pc,ioctlparms,arg,larg); else { pc->erno=errno; ioctl_putarg(pc,ioctlparms & ~IOCTL_W,arg,larg); } /*printk("wrap_in_ioctl %d req %x arg %x parms %x -> %d\n",sfd,req,larg,ioctlparms,pc->retval);*/ /*printk("wrap_in_ioctl %d %d\n",pc->retval,pc->erno);*/ } return SC_FAKE; } umview-0.8.2/xmview/um_signal.c0000644000175000017500000000465211753517211015564 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_signal: basic signal handling (to be completed). * added to manage signals to blocked processes. * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include "defs.h" #include "hashtab.h" #include "mainpoll.h" #include "capture.h" #include "sctab.h" int wrap_in_kill(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pid=pc->sysargs[0]; long signo=pc->sysargs[1]; if (secure) { if (capcheck(CAP_KILL,pc)) { /* For a process to have permission to send a signal it must either be privileged (under Linux: have the CAP_KILL capability), or the real or effective user ID of the sending process must equal the real or saved set-user-ID of the target process. */ struct pcb *target=pid2pcb(pid); if (target != NULL) { if (pc->ruid != target->ruid && pc->ruid != target->suid && pc->euid != target->ruid && pc->euid != target->suid) { /* XXX todo: In the case of SIGCONT it suffices when the sending and receiving processes belong to the same session. */ if (signo != SIGCONT) { pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } } } else { /* XXX signals to external process: allow or deny? option? */ /* NOW: CAP_KILL->allow !CAP_KILL->deny */ pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } } } if (bq_pidwake(pid,signo)) { putscno(__NR_getpid,pc); return SC_MODICALL; } else return STD_BEHAVIOR; } int wrap_out_kill(int sc_number,struct pcb *pc) { if (pc->retval < 0) puterrno(pc->erno,pc); return SC_MODICALL; } umview-0.8.2/xmview/msocket.2viewos0000644000175000017500000003166511753517211016433 0ustar renzorenzo.\" Copyright (c) 2008 Renzo Davoli .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License, .\" version 2, as published by the Free Software Foundation. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual 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 General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, write to the Free .\" Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, .\" MA 02110-1301 USA. .\" .\" .\" Modified from socket(2) manual page: its license follows. .\" Copyright (c) 1983, 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $Id: socket.2,v 1.4 1999/05/13 11:33:42 freitag Exp $ .\" .\" Modified 1993-07-24 by Rik Faith .\" Modified 1996-10-22 by Eric S. Raymond .\" Modified 1998, 1999 by Andi Kleen .\" Modified 2002-07-17 by Michael Kerrisk .\" Modified 2004-06-17 by Michael Kerrisk .\" Modified 2008-04-23 by Renzo Davoli .\" .TH MSOCKET 2VIEWOS 2008-04-23 "View-OS" "Linux/View-OS Programmer's Manual" .SH NAME msocket \- create an endpoint for communication in a multi-stack environment .SH SYNOPSIS .BR "#include " " /* See NOTES */" .br .B #include .sp .BI "int msocket(char * " path ", int " domain ", int " type ", int " protocol ); .SH DESCRIPTION .BR msocket () creates an endpoint for communication and returns a descriptor in a multi-stack environment or defines the default stack. .PP The .I path parameter selects the stack used for the call. The path must refer to a stack special file (S_IFSTACK). When path is NULL, the default stack gets used. It is possible to specify a default network stack for each domain (see SOCK_DEFAULT below). .PP The .I domain parameter specifies a communication domain; this selects the protocol family which will be used for communication. These families are defined in .IR . The currently understood formats include: .TS tab(:); l l l. Name:Purpose:Man page T{ .BR PF_UNIX ", " PF_LOCAL T}:T{ Local communication T}:T{ .BR unix (7) T} T{ .B PF_INET T}:IPv4 Internet protocols:T{ .BR ip (7) T} T{ .B PF_INET6 T}:IPv6 Internet protocols:T{ .BR ipv6 (7) T} T{ .B PF_IPX T}:IPX \- Novell protocols: T{ .B PF_NETLINK T}:T{ Kernel user interface device T}:T{ .BR netlink (7) T} T{ .B PF_X25 T}:ITU-T X.25 / ISO-8208 protocol:T{ .BR x25 (7) T} T{ .B PF_AX25 T}:T{ Amateur radio AX.25 protocol T}: T{ .B PF_ATMPVC T}:Access to raw ATM PVCs: T{ .B PF_APPLETALK T}:Appletalk:T{ .BR ddp (7) T} T{ .B PF_PACKET T}:T{ Low level packet interface T}:T{ .BR packet (7) T} .TE .PP The socket has the indicated .IR type , which specifies the communication semantics or .B SOCK_DEFAULT to define the standard stack for the specified domain(s). Currently defined types are: .TP .B SOCK_STREAM Provides sequenced, reliable, two-way, connection-based byte streams. An out-of-band data transmission mechanism may be supported. .TP .B SOCK_DGRAM Supports datagrams (connectionless, unreliable messages of a fixed maximum length). .TP .B SOCK_SEQPACKET Provides a sequenced, reliable, two-way connection-based data transmission path for datagrams of fixed maximum length; a consumer is required to read an entire packet with each input system call. .TP .B SOCK_RAW Provides raw network protocol access. .TP .B SOCK_RDM Provides a reliable datagram layer that does not guarantee ordering. .TP .B SOCK_PACKET Obsolete and should not be used in new programs; see .BR packet (7). .PP Some socket types may not be implemented by all protocol families; for example, .B SOCK_SEQPACKET is not implemented for .BR AF_INET . .PP When .IR type is .B SOCK_DEFAULT msocket does not define any communication endpoint, instead it defines the stack that will be used for the following msocket calls with NULL path, or for the following obsolete .BR socket (2) calls. Default stacks get inherited through process creation .BR fork (2) and execution .BR execve (2). When .IR type is .B SOCK_DEFAULT and .IR domain is .B PF_UNSPEC the named stack becames the default stack for all the protocols it supports. .PP The .I protocol specifies a particular protocol to be used with the socket. Normally only a single protocol exists to support a particular socket type within a given protocol family, in which case .I protocol can be specified as 0. However, it is possible that many protocols may exist, in which case a particular protocol must be specified in this manner. The protocol number to use is specific to the \*(lqcommunication domain\*(rq in which communication is to take place; see .BR protocols (5). See .BR getprotoent (3) on how to map protocol name strings to protocol numbers. .PP Sockets of type .B SOCK_STREAM are full-duplex byte streams, similar to pipes. They do not preserve record boundaries. A stream socket must be in a .I connected state before any data may be sent or received on it. A connection to another socket is created with a .BR connect (2) call. Once connected, data may be transferred using .BR read (2) and .BR write (2) calls or some variant of the .BR send (2) and .BR recv (2) calls. When a session has been completed a .BR close (2) may be performed. Out-of-band data may also be transmitted as described in .BR send (2) and received as described in .BR recv (2). .PP The communications protocols which implement a .B SOCK_STREAM ensure that data is not lost or duplicated. If a piece of data for which the peer protocol has buffer space cannot be successfully transmitted within a reasonable length of time, then the connection is considered to be dead. When .B SO_KEEPALIVE is enabled on the socket the protocol checks in a protocol-specific manner if the other end is still alive. A .B SIGPIPE signal is raised if a process sends or receives on a broken stream; this causes naive processes, which do not handle the signal, to exit. .B SOCK_SEQPACKET sockets employ the same system calls as .B SOCK_STREAM sockets. The only difference is that .BR read (2) calls will return only the amount of data requested, and any data remaining in the arriving packet will be discarded. Also all message boundaries in incoming datagrams are preserved. .PP .B SOCK_DGRAM and .B SOCK_RAW sockets allow sending of datagrams to correspondents named in .BR sendto (2) calls. Datagrams are generally received with .BR recvfrom (2), which returns the next datagram along with the address of its sender. .PP .B SOCK_PACKET is an obsolete socket type to receive raw packets directly from the device driver. Use .BR packet (7) instead. .PP An .BR fcntl (2) .B F_SETOWN operation can be used to specify a process or process group to receive a .B SIGURG signal when the out-of-band data arrives or .B SIGPIPE signal when a .B SOCK_STREAM connection breaks unexpectedly. This operation may also be used to set the process or process group that receives the I/O and asynchronous notification of I/O events via .BR SIGIO . Using .B F_SETOWN is equivalent to an .BR ioctl (2) call with the .B FIOSETOWN or .B SIOCSPGRP argument. .PP When the network signals an error condition to the protocol module (e.g., using a ICMP message for IP) the pending error flag is set for the socket. The next operation on this socket will return the error code of the pending error. For some protocols it is possible to enable a per-socket error queue to retrieve detailed information about the error; see .B IP_RECVERR in .BR ip (7). .PP The operation of sockets is controlled by socket level .IR options . These options are defined in .IR . The functions .BR setsockopt (2) and .BR getsockopt (2) are used to set and get options, respectively. .SH "RETURN VALUE" On success, a file descriptor for the new socket is returned except when .IR type is .BR SOCK_DEFAULT. In this latter case 0 is returned on success. On error, \-1 is returned, and .I errno is set appropriately. .SH ERRORS .TP .B EACCES Permission to create a socket of the specified type and/or protocol is denied. .TP .B EAFNOSUPPORT The implementation does not support the specified address family. .TP .B EINVAL Unknown protocol, or protocol family not available. .TP .B EMFILE Process file table overflow. .TP .B ENFILE The system limit on the total number of open files has been reached. .TP .BR ENOBUFS " or " ENOMEM Insufficient memory is available. The socket cannot be created until sufficient resources are freed. .TP .B EPROTONOSUPPORT The protocol type or the specified protocol is not supported within this domain. .PP Other errors may be generated by the underlying protocol modules. .SH "CONFORMING TO" This is a system call defined for View-OS. It extends .BR socket (), appeared in 4.2BSD and conforming to 4.4BSD, POSIX.1-2001. System providing .BR msocket () do provide also a .BR socket () call for backward compatibility. In fact: .BR "socket(domain,type,protocol)" is equivalent to .BR "msocket(NULL,domain,type,protocol)" In this way it is generally portable to/from non-BSD systems supporting clones of the BSD socket layer (including System V variants). .SH NOTES POSIX.1-2001 does not require the inclusion of .IR , and this header file is not required on Linux. However, some historical (BSD) implementations required this header file, and portable applications are probably wise to include it. The manifest constants used under 4.x BSD for protocol families are .BR PF_UNIX , .BR PF_INET , etc., while .B AF_UNIX etc. are used for address families. However, already the BSD man page promises: "The protocol family generally is the same as the address family", and subsequent standards use AF_* everywhere. The header file .I is only required for libc4 or earlier. Some packages, like util-linux, claim portability to all Linux versions and libraries. They certainly need this header file. .SH BUGS .B SOCK_UUCP is not implemented yet. .\"SH EXAMPLE .\"An example of the use of .\"BR socket () .\"s shown in .\"BR getaddrinfo (3). .SH "SEE ALSO" .BR socket (2), .BR accept (2), .BR bind (2), .BR connect (2), .BR fcntl (2), .BR getpeername (2), .BR getsockname (2), .BR getsockopt (2), .BR ioctl (2), .BR listen (2), .BR read (2), .BR recv (2), .BR select (2), .BR send (2), .BR shutdown (2), .BR socketpair (2), .BR write (2), .BR getprotoent (3), .BR ip (7), .BR socket (7), .BR tcp (7), .BR udp (7), .BR unix (7) .PP .SH COLOPHON This page has been modified from .BR socket (2) page of release 2.79 of the Linux. In fact .BR msocket (2) is an extension of this call. .I man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. .PP View-OS is a project of the Computer Science Department, University of Bologna. Project Leader: Renzo Davoli. .br Howto's and further information can be found on the project wiki .br . umview-0.8.2/xmview/services.c0000644000175000017500000003577111753517211015437 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * services.c: management of virtualization services * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: services.c 968 2011-08-03 10:16:26Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include "services.h" #include "defs.h" #include "sctab.h" #include "syscallnames.h" #include "gdebug.h" #include "scmap.h" #include "hashtab.h" #include "modutils.h" #include "bits/wordsize.h" static sysfun reg_service[sizeof(c_set)], dereg_service[sizeof(c_set)]; struct syscall_unifier { long proc_sc; // System call nr. as called by the process long mod_sc; // System call nr. as seen by the module }; static struct syscall_unifier scunify[] = { {__NR_creat, __NR_open}, {__NR_readv, __NR_read}, {__NR_writev, __NR_write}, #ifdef __NR_preadv #ifdef __NR_pread64 {__NR_preadv, __NR_pread64}, #else {__NR_preadv, __NR_pread}, #endif #endif #ifdef __NR_pwritev #ifdef __NR_pwrite64 {__NR_pwritev,__NR_pwrite64}, #else {__NR_pwritev,__NR_pwrite}, #endif #endif {__NR_time, __NR_gettimeofday}, {__NR_fchmod, __NR_chmod}, #if (__NR_olduname != __NR_doesnotexist) {__NR_olduname, __NR_uname}, #endif #if (__NR_oldolduname != __NR_doesnotexist) {__NR_oldolduname, __NR_uname}, #endif #if (__NR_setpgrp != __NR_doesnotexist) {__NR_setpgrp,__NR_setpgid}, #endif {__NR_getpgrp,__NR_getpgid}, {__NR_getdents, __NR_getdents64}, #if ! defined(__x86_64__) {__NR_umount, __NR_umount2}, {__NR_stat, __NR_lstat64}, {__NR_lstat, __NR_lstat64}, {__NR_fstat, __NR_lstat64}, {__NR_stat64, __NR_lstat64}, {__NR_fstat64,__NR_lstat64}, {__NR_truncate, __NR_truncate64}, {__NR_ftruncate,__NR_ftruncate64}, {__NR_statfs, __NR_statfs64}, {__NR_fstatfs, __NR_statfs64}, {__NR_fstatfs64, __NR_statfs64}, #else {__NR_fstatfs, __NR_statfs}, {__NR_stat, __NR_lstat}, {__NR_fstat, __NR_lstat}, #endif #if (__NR_fcntl64 != __NR_doesnotexist) {__NR_fcntl64, __NR_fcntl}, #endif {__NR_openat, __NR_open}, {__NR_mkdirat, __NR_mkdir}, {__NR_mknodat, __NR_mknod}, {__NR_futimesat, __NR_utimes}, #ifdef __NR_utimensat {__NR_utimensat, __NR_utimes}, #endif {__NR_utime, __NR_utimes}, #ifdef __NR_newfstatat #if ! defined(__x86_64__) {__NR_newfstatat, __NR_lstat64}, #else {__NR_newfstatat, __NR_lstat}, #endif #endif #ifdef __NR_fstatat64 {__NR_fstatat64, __NR_lstat64}, #endif {__NR_unlinkat, __NR_unlink}, {__NR_renameat, __NR_rename}, {__NR_linkat, __NR_link}, {__NR_symlinkat, __NR_symlink}, {__NR_readlinkat, __NR_readlink}, {__NR_fchmodat, __NR_chmod}, {__NR_faccessat, __NR_access}, #if defined(__NR_getuid32) && __NR_getuid32 != __NR_doesnotexist {__NR_getuid, __NR_getresuid32}, {__NR_getgid, __NR_getresgid32}, {__NR_geteuid, __NR_getresuid32}, {__NR_getegid, __NR_getresgid32}, {__NR_setreuid, __NR_setresuid32}, {__NR_setregid, __NR_setresgid32}, {__NR_getgroups, __NR_getgroups32}, {__NR_setgroups, __NR_setgroups32}, {__NR_setresuid, __NR_setresuid32}, {__NR_getresuid, __NR_getresuid32}, {__NR_setresgid, __NR_setresgid32}, {__NR_getresgid, __NR_getresgid32}, {__NR_setuid, __NR_setresuid32}, {__NR_setgid, __NR_setresgid32}, {__NR_setfsuid, __NR_setfsuid32}, {__NR_setfsgid, __NR_setfsgid32}, #else {__NR_getuid, __NR_getresuid}, {__NR_getgid, __NR_getresgid}, {__NR_geteuid, __NR_getresuid}, {__NR_getegid, __NR_getresgid}, {__NR_setreuid, __NR_setresuid}, {__NR_setregid, __NR_setresgid}, {__NR_setuid, __NR_setresuid}, {__NR_setgid, __NR_setresgid}, #endif #if defined(__NR_chown32) && __NR_chown32 != __NR_doesnotexist {__NR_chown, __NR_lchown32}, {__NR_fchown, __NR_lchown32}, {__NR_lchown, __NR_lchown32}, {__NR_chown32, __NR_lchown32}, {__NR_fchown32, __NR_lchown32}, {__NR_fchownat, __NR_lchown32}, #else {__NR_chown, __NR_lchown}, {__NR_fchown, __NR_lchown}, {__NR_fchownat, __NR_lchown}, #endif #ifdef __NR_getxattr {__NR_getxattr, __NR_lgetxattr}, {__NR_fgetxattr, __NR_lgetxattr}, {__NR_setxattr, __NR_lsetxattr}, {__NR_fsetxattr, __NR_lsetxattr}, {__NR_listxattr, __NR_llistxattr}, {__NR_flistxattr, __NR_llistxattr}, {__NR_removexattr, __NR_lremovexattr}, {__NR_fremovexattr, __NR_lremovexattr}, #endif #ifdef SNDRCVMSGUNIFY #if (__NR_socketcall == __NR_doesnotexist) {__NR_send, __NR_sendmsg}, {__NR_sendto, __NR_sendmsg}, {__NR_recv, __NR_recvmsg}, {__NR_recvfrom, __NR_recvmsg}, #endif #endif }; #define SIZESCUNIFY (sizeof(scunify)/sizeof(struct syscall_unifier)) #if (__NR_socketcall != __NR_doesnotexist) /*WIP this "unification" is not active yet */ static struct syscall_unifier sockunify[] = { #ifdef SNDRCVMSGUNIFY /* unify to *msg */ {SYS_SEND, SYS_SENDMSG}, {SYS_SENDTO, SYS_SENDMSG}, {SYS_RECV, SYS_RECVMSG}, {SYS_RECVFROM, SYS_RECVMSG}, #endif }; #define SIZESOCKUNIFY (sizeof(sockunify)/sizeof(struct syscall_unifier)) #endif struct syscall_default_maganer { long proc_sc; sysfun defmgr; }; static long erropnotsupp() { errno=EOPNOTSUPP; return -1; } static struct syscall_default_maganer scdefmgr[]={ {__NR_lgetxattr, erropnotsupp}, }; #define SIZESCDEFMGR (sizeof(scdefmgr)/sizeof(struct syscall_default_maganer)) static inline int s_error(int err) { errno=err; return -1; } /* System call remapping (i.e. stat->stat64, creat->open) etc. * This functions takes a struct service and, for each system call defined in * scunify[] (field proc_sc), sets the corresponding entry in the um_syscall array to be * the manager for syscall mod_sc. */ void modify_um_syscall(struct service *s) { int i; for (i = 0; i < SIZESCUNIFY; i++) { GDEBUG(9, "i = %d < %d", i, SIZESCUNIFY); /* The entry in um_syscall is not NULL, so someone has defined a * manager for this syscall. It won't be used, so print a warning. * XXX This can cause false positives if the um_syscall is allocated * with malloc (instead of calloc) and not memset'd to all NULLs. */ if (s->um_syscall[uscno(scunify[i].proc_sc)]) { GERROR("WARNING: a module has defined syscall %s that will not be used:", SYSCALLNAME(scunify[i].proc_sc)); GERROR(" %s will be managed by the module function for %s.", SYSCALLNAME(scunify[i].proc_sc), SYSCALLNAME(scunify[i].mod_sc)); } s->um_syscall[uscno(scunify[i].proc_sc)] = s->um_syscall[uscno(scunify[i].mod_sc)]; } #if (__NR_socketcall != __NR_doesnotexist) for (i = 0; i < SIZESOCKUNIFY; i++) { GDEBUG(9, "i = %d < %d", i, SIZESOCKUNIFY); /* The entry in um_syscall is not NULL, so someone has defined a * manager for this syscall. It won't be used, so print a warning. * XXX This can cause false positives if the um_syscall is allocated * with malloc (instead of calloc) and not memset'd to all NULLs. */ if (s->um_socket[sockunify[i].proc_sc]) { GERROR("WARNING: a module has defined syscall %s that will not be used:", SOCKCALLNAME(sockunify[i].proc_sc)); GERROR(" %s will be managed by the module function for %s.", SOCKCALLNAME(sockunify[i].proc_sc), SOCKCALLNAME(sockunify[i].mod_sc)); } s->um_socket[sockunify[i].proc_sc] = s->um_socket[sockunify[i].mod_sc]; } #endif if (s->um_virsc && s->um_virsc[VIRSYS_MSOCKET]) { if #if (__NR_socketcall != __NR_doesnotexist) (s->um_socket[SYS_SOCKET]) #else (s->um_syscall[uscno(__NR_socket)]) #endif { GERROR("WARNING: a module has defined syscall socket that will not be used"); GERROR(" socket will be managed by the module function for msocket."); } #if (__NR_socketcall != __NR_doesnotexist) s->um_socket[SYS_SOCKET]=s->um_virsc[VIRSYS_MSOCKET]; #else s->um_syscall[uscno(__NR_socket)]=s->um_virsc[VIRSYS_MSOCKET]; #endif } for (i = 0; i < SIZESCDEFMGR; i++) s->um_syscall[uscno(scdefmgr[i].proc_sc)] = scdefmgr[i].defmgr; } static inline int s_error_dlclose(int err,void *handle) { dlclose(handle); errno=err; return -1; } static void *nullinit(char *args) { return NULL; } /* add a new service */ int add_service(char *file,int permanent) { char *args; void *handle; for (args=file;*args != 0 && *args != ',';args++) ; if (*args == ',') { *args = 0; args++; } handle=openmodule(file,RTLD_LAZY|RTLD_GLOBAL); if (handle != NULL) { struct service *s=dlsym(handle,"viewos_service"); if (!s) return s_error_dlclose(EINVAL,handle); else if (ht_check(CHECKMODULE,s->name,NULL,0)) return s_error_dlclose(EEXIST,handle); else { int i; struct timestamp *tst=um_x_gettst(); struct ht_elem *hte; void *(*pinit)() = dlsym(handle,"viewos_init"); if (s->dlhandle==NULL) modify_um_syscall(s); /* dl handle is the dynamic library handle*/ s->dlhandle=handle; if (pinit == NULL) pinit=nullinit; hte=ht_tab_add(CHECKMODULE,s->name,strlen(s->name),s,NULL,pinit(args)); if (permanent) { ht_count_plus1(hte); } /* update the process time */ tst->epoch=get_epoch(); for (i = 0; i < sizeof(c_set); i++) if (MCH_ISSET(i, &(s->ctlhs))) if (reg_service[i]) { GDEBUG(3, "calling reg_service[%d](%s)", i, s->name); reg_service[i](s->name); } /* NEW: hash table registration */ service_ctl(MC_MODULE | MC_ADD, s->name, NULL); return 0; } } else { printk("module error: %s\n",dlerror()); return s_error(EFAULT); } } /* delete a service */ static void del_service_internal(struct ht_elem *hte,void *arg) { int i; struct service *s=ht_get_service(hte); /* notify other modules of service removal */ service_ctl(MC_MODULE | MC_REM, s->name, NULL); /* call deregistration upcall (if any) */ for (i = 0; i < sizeof(c_set); i++) if (MCH_ISSET(i, &(s->ctlhs))) if (dereg_service[i]) { GDEBUG(3, "calling dereg_service[%d](%s)", i, s->name); dereg_service[i](s->name); } ht_tab_invalidate(hte); } int del_service(char *name) { struct ht_elem *hte=ht_check(CHECKMODULE,name,NULL,0); if (!hte) return s_error(ENOENT); struct service *s=ht_get_service(hte); if (ht_get_count(hte) != 0) return s_error(EBUSY); else { void *handle=s->dlhandle; void (*pfini)() = dlsym(handle,"viewos_fini"); if (pfini != NULL) pfini(ht_get_private_data(hte)); del_service_internal(hte,NULL); ht_tab_del(hte); dlclose(handle); } return 0; } /* list services: returns a list of codes */ void list_item(struct ht_elem *hte, void *arg) { FILE *f=arg; struct service *s=ht_get_service(hte); fprintf(f,"%s:",s->name); } int list_services(char *buf,int len) { FILE *f=fmemopen(buf,len,"w"); forall_ht_tab_do(CHECKMODULE,list_item,f); fclose(f); return(strlen(buf)); } /* name services: maps a service code to its description */ int name_service(char *name,char *buf,int len) { struct ht_elem *hte=ht_check(CHECKMODULE,name,NULL,0); if (!hte) return s_error(ENOENT); else { struct service *s=ht_get_service(hte); snprintf(buf,len,"%s",s->description); return 0; } } /* * Call the ctl function of a specific service or of every service except * at most one. * * - type is the ctl function to be called (e.g. MC_PROC | MC_ADD is the same as * the old "addproc" * - code is the service code. If UM_NONE, every service will be called. * - skip is the code of a service to be skipped if code is UM_NONE. If no * services have to be skipped, use -1. * - the remaining arguments are containe in the va_list ap and depend on the type. */ struct vservice { unsigned long type; char *sender; va_list ap; }; static void vservice_ctl_item(struct ht_elem *hte, void *arg) { struct service *s=ht_get_service(hte); struct vservice *varg=arg; if (s->ctl && varg->sender != s->name) { va_list aq; va_copy(aq, varg->ap); GDEBUG(2, "calling service %s!", s->name); s->ctl(varg->type, varg->sender, aq); va_end(aq); } } static void vservice_ctl(unsigned long type, char *sender, char *destination, va_list ap) { struct vservice varg={.type=type,.sender=sender}; va_copy(varg.ap,ap); GDEBUG(2, "type %d sender %s destination %s...", type, sender, destination); if (destination == NULL) { forall_ht_tab_do(CHECKMODULE,vservice_ctl_item,&varg); } else { struct ht_elem *hte=ht_check(CHECKMODULE,destination,NULL,0); if (hte) vservice_ctl_item(hte,&varg); } } /* vararg wrapper for vservice_ctl */ void service_ctl(unsigned long type, char *sender, char *destination, ...) { va_list ap; va_start(ap, destination); vservice_ctl(type, sender, destination, ap); va_end(ap); } /* Call the ctl function of a specific service (or every one except the * caller). This is similar to service_ctl but to be used by umview modules * for inter-module communication. * * - type is the ctl function to be called. It is contained in k bits, where k * is the number of bits in a long, minus the number of bits of service_t, * minus one. Currently, on 32 bits architecture, it is 32 - 8 - 1 = 23. * - sender is the service struct of the caller module. * - destination is the service name of the module whose ctl function is to be * called. It can be NULL (i.e. every registerend service except * the caller) * - the remaining arguments depend on the type. sender and receipients must * agree on the args. */ void service_userctl(unsigned long type, struct service *sender, char *destination, ...) { if (sender && sender->name) { va_list ap; va_start(ap, destination); vservice_ctl(MC_USERCTL(type), sender->name, destination, ap); va_end(ap); } } static void reg_mod_item(struct ht_elem *ht, void *arg) { struct service *s=ht_get_service(ht); service_ctl(MC_MODULE | MC_ADD, s->name, arg, NULL); } static void reg_modules(char *destination) { forall_ht_tab_do(CHECKMODULE,reg_mod_item,destination); } static void dereg_mod_item(struct ht_elem *ht, void *arg) { struct service *s=ht_get_service(ht); service_ctl(MC_MODULE | MC_REM, s->name, arg, NULL); } static void dereg_modules(char *destination) { forall_ht_tab_do(CHECKMODULE,dereg_mod_item,destination); } /* service initialization: upcalls for new services/deleted services * may be supplied */ void service_addregfun(int class, sysfun regfun, sysfun deregfun) { GDEBUG(3, "adding register/deregister function for class %d", class); reg_service[class] = regfun; dereg_service[class] = deregfun; } static void _service_fini() { forall_ht_tab_do(CHECKMODULE,del_service_internal,NULL); } /* set exit function */ void _service_init() { atexit(_service_fini); service_addregfun(MC_MODULE, (sysfun)reg_modules, (sysfun)dereg_modules); } umview-0.8.2/xmview/siglist.h0000644000175000017500000000626411753517211015272 0ustar renzorenzo/* Canonical list of all signal names. Copyright (C) 1996,97,98,99 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* This file should be usable for any platform, since it just associates the SIG* macros with text names and descriptions. The actual values come from (via ). For any signal macros do not exist on every platform, we can use #ifdef tests here and still use this single common file for all platforms. */ /* This file is included multiple times. */ /* Standard signals */ init_sig (SIGHUP, "HUP", N_("Hangup")) init_sig (SIGINT, "INT", N_("Interrupt")) init_sig (SIGQUIT, "QUIT", N_("Quit")) init_sig (SIGILL, "ILL", N_("Illegal instruction")) init_sig (SIGTRAP, "TRAP", N_("Trace/breakpoint trap")) init_sig (SIGABRT, "ABRT", N_("Aborted")) init_sig (SIGFPE, "FPE", N_("Floating point exception")) init_sig (SIGKILL, "KILL", N_("Killed")) init_sig (SIGBUS, "BUS", N_("Bus error")) init_sig (SIGSEGV, "SEGV", N_("Segmentation fault")) init_sig (SIGPIPE, "PIPE", N_("Broken pipe")) init_sig (SIGALRM, "ALRM", N_("Alarm clock")) init_sig (SIGTERM, "TERM", N_("Terminated")) init_sig (SIGURG, "URG", N_("Urgent I/O condition")) init_sig (SIGSTOP, "STOP", N_("Stopped (signal)")) init_sig (SIGTSTP, "TSTP", N_("Stopped")) init_sig (SIGCONT, "CONT", N_("Continued")) init_sig (SIGCHLD, "CHLD", N_("Child exited")) init_sig (SIGTTIN, "TTIN", N_("Stopped (tty input)")) init_sig (SIGTTOU, "TTOU", N_("Stopped (tty output)")) init_sig (SIGIO, "IO", N_("I/O possible")) init_sig (SIGXCPU, "XCPU", N_("CPU time limit exceeded")) init_sig (SIGXFSZ, "XFSZ", N_("File size limit exceeded")) init_sig (SIGVTALRM, "VTALRM", N_("Virtual timer expired")) init_sig (SIGPROF, "PROF", N_("Profiling timer expired")) init_sig (SIGWINCH, "WINCH", N_("Window changed")) init_sig (SIGUSR1, "USR1", N_("User defined signal 1")) init_sig (SIGUSR2, "USR2", N_("User defined signal 2")) /* Variations */ #ifdef SIGEMT init_sig (SIGEMT, "EMT", N_("EMT trap")) #endif #ifdef SIGSYS init_sig (SIGSYS, "SYS", N_("Bad system call")) #endif #ifdef SIGSTKFLT init_sig (SIGSTKFLT, "STKFLT", N_("Stack fault")) #endif #ifdef SIGINFO init_sig (SIGINFO, "INFO", N_("Information request")) #elif defined(SIGPWR) && (!defined(SIGLOST) || (SIGPWR != SIGLOST)) init_sig (SIGPWR, "PWR", N_("Power failure")) #endif #ifdef SIGLOST init_sig (SIGLOST, "LOST", N_("Resource lost")) #endif umview-0.8.2/xmview/um_exec.c0000644000175000017500000002356311753517211015235 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_exec: support for virtual executables and binfmt services * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Ludovico Gardenghi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_exec.c 968 2011-08-03 10:16:26Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "defs.h" #include "gdebug.h" #include "umproc.h" #include "hashtab.h" #include "um_services.h" #include "sctab.h" #include "scmap.h" #include "utils.h" #include "canonicalize.h" #define BINFMTBUFLEN 128 #define HT_SCRIPT ((struct ht_elem *) 1) #define STDINTERP "/bin/bash" /* filecopy creates a copy of the executable inside the tmp file dir */ static int filecopy(struct ht_elem *hte,const char *from, const char *to) { char buf[BUFSIZ]; int fdf,fdt; int n; /* NO need for hte search. from is the path so hte and private data is already set for modules */ if ((fdf=ht_syscall(hte,uscno(__NR_open))(from,O_RDONLY,0)) < 0) return -errno; if ((fdt=open(to,O_CREAT|O_TRUNC|O_WRONLY,0600)) < 0) return -errno; while ((n=ht_syscall(hte,uscno(__NR_read))(fdf,buf,BUFSIZ)) > 0) r_write (fdt,buf,n); ht_syscall(hte,uscno(__NR_close))(fdf); fchmod (fdt,0700); /* permissions? */ close (fdt); return 0; } /* is the executable a script? */ static struct ht_elem *checkscript(struct ht_elem *hte,struct binfmt_req *req) { char *scriptbuf=req->buf; /* this should include ELF, COFF and a.out */ if (scriptbuf[0] < '\n' || scriptbuf[0] == '\177') return NULL; else if (scriptbuf[0]=='#' && scriptbuf[1]=='!') { /* parse the first line */ char *s=scriptbuf+2; /* skip leading spaces */ while(*s == ' ' || *s == '\t') s++; /* the first non blank is the interpreter */ req->interp=s; while(*s != ' ' && *s != '\t' && *s != '\n' && *s!=0) s++; if (*s == 0 || *s=='\n') *s=0; else { *s++ = 0; while(*s == ' ' || *s == '\t') *s++ = 0; req->extraarg=s; while(*s != '\n' && *s!=0) s++; while(*(s-1)==' ' || *(s-1)=='\t') s--; *s=0; if (*(req->extraarg)==0) req->extraarg=NULL; } if (*(req->interp)==0) req->interp=STDINTERP; return HT_SCRIPT; } else { /* heuristics here */ return NULL; } } /* getparms (argv) from the user space */ #define CHUNKSIZE 16 static char **getparms(struct pcb *pc,long laddr) { long *paddr=NULL; char **parms; int size=0; int n=0; int i; do { if (n >= size) { size+=CHUNKSIZE; paddr=realloc(paddr,size*sizeof(long)); assert(paddr); } #ifdef NDEBUG umoven(pc,laddr,sizeof(char *),&(paddr[n])); #else { int rv; rv=umoven(pc,laddr,sizeof(char *),&(paddr[n])); assert(rv>=0); } #endif laddr+= sizeof(char *); n++; } while (paddr[n-1] != 0); parms=malloc(n*sizeof(char *)); assert(parms); parms[n-1]=NULL; for (i=0;i %s\n",*parms); parms++; } } */ #define UMBINWRAP LIBEXECDIR "/umbinwrap" /* wrap_in: execve handling */ int wrap_in_execve(int sc_number,struct pcb *pc, struct ht_elem *hte,sysfun um_syscall) { char buf[BINFMTBUFLEN+1]; struct binfmt_req req={(char *)pc->path,NULL,NULL,buf,0}; epoch_t nestepoch=um_setnestepoch(0); struct ht_elem *binfmtht; if (um_xx_access(req.path,X_OK,pc)!=0) { pc->erno=errno; pc->retval=-1; return SC_FAKE; } /* management of set[ug]id executables */ if (!secure || !(ht_get_mountflags(pc->hte) & MS_NOSUID)) { if (pc->pathstat.st_mode & S_ISUID) { pc->suid=pc->euid; pc->euid=pc->fsuid=pc->pathstat.st_uid; } else if (pc->ruid == pc->euid) pc->suid=pc->ruid; if (pc->pathstat.st_mode & S_ISGID) { pc->sgid=pc->egid; pc->egid=pc->fsgid=pc->pathstat.st_gid; } else if (pc->rgid == pc->egid) pc->sgid=pc->rgid; } if (!secure && (strcmp(pc->path,"/bin/mount") == 0 || strcmp(pc->path,"/bin/umount") == 0)) { pc->suid=pc->euid; pc->ruid=pc->suid=0; } /* The epoch should be just after the mount * which generated the executable */ um_setnestepoch(nestepoch+1); memset(buf,0,BINFMTBUFLEN+1); int fd=open(req.path,O_RDONLY); if (fd >= 0) { read(fd, buf, BINFMTBUFLEN); close(fd); } binfmtht=checkscript(hte,&req); if (binfmtht == NULL) binfmtht=ht_check(CHECKBINFMT,&req,NULL,0); //printk("wrap_in_execve %s |%s| |%s|\n",ht_get_servicename(binfmtht),req.interp,req.extraarg); um_setnestepoch(nestepoch); /* is there a binfmt service for this executable? */ if (binfmtht != NULL) { char *umbinfmtarg0; int sep; long largv=pc->sysargs[1]; long larg0; char oldarg0[PATH_MAX+1]; int rv; int filenamelen; int arg0len; long sp=getsp(pc); char *chrootpath=pc->path; if (*(req.interp) != '/') { /* full pathname required */ pc->erno=ENOENT; pc->retval=-1; return SC_FAKE; } /* strip the root path when running in a chroot environment */ if (pc->fdfs->root[1] != 0) { int len=strlen(pc->fdfs->root); if (strncmp(chrootpath,pc->fdfs->root,len)==0) chrootpath+=len; } /* create the argv for the wrapper! */ rv=umoven(pc,largv,sizeof(char *),&(larg0)); //printk("%s %d %ld %ld rv=%d\n",chrootpath,getpc(pc),largv,larg0,rv); /* XXX this is a workaround. strace has the same error! * exec seems to cause an extra prace in a strange address space * to be solved (maybe using PTRACE OPTIONS!) */ //assert(rv); if (rv<0) return STD_BEHAVIOR; if (req.flags & BINFMT_KEEP_ARG0) { oldarg0[PATH_MAX]=0; umovestr(pc,larg0,PATH_MAX,oldarg0); } else oldarg0[0]=0; /* search for an unused char to act as arg separator */ for (sep=1;sep<255 && (strchr((char *)chrootpath,sep)!=NULL || strchr(req.interp,sep)!=NULL || strchr(oldarg0,sep)!=NULL); sep++) ; if (req.extraarg==NULL) req.extraarg=""; #ifndef NOUMBINWRAP /* collapse all the args in only one arg */ if (req.flags & BINFMT_KEEP_ARG0) asprintf(&umbinfmtarg0,"%c%s%c%s%c%s%c%s", sep,req.interp, sep,req.extraarg, sep,(char *)chrootpath, sep,oldarg0); else asprintf(&umbinfmtarg0,"%c%s%c%s%c%s", sep,req.interp, sep,req.extraarg, sep,(char *)chrootpath); filenamelen=WORDALIGN(strlen(UMBINWRAP)); arg0len=WORDALIGN(strlen(umbinfmtarg0)); pc->retval=0; ustorestr(pc,sp-filenamelen,filenamelen,UMBINWRAP); pc->sysargs[0]=sp-filenamelen; larg0=sp-filenamelen-arg0len; ustoren(pc,larg0,arg0len,umbinfmtarg0); ustoren(pc,largv,sizeof(char *),&larg0); //printk("%s %s\n",UMBINWRAP,umbinfmtarg0); /* exec the wrapper instead of the executable! */ free(umbinfmtarg0); #endif if (req.flags & BINFMT_MODULE_ALLOC) free(req.interp); return SC_CALLONXIT; } else if (hte != NULL) { pc->retval=ERESTARTSYS; if (secure && (ht_get_mountflags(hte) & MS_NOEXEC)) { pc->retval=-1; pc->erno=EACCES; } /* does the module define a semantics for execve? */ else if (!isnosys(um_syscall)) { long largv=pc->sysargs[1]; long lenv=pc->sysargs[2]; char **argv=getparms(pc,largv); char **env=getparms(pc,lenv); /*printparms("ARGV",argv); printparms("ENV",env);*/ /* call the module's execve implementation */ if ((pc->retval=um_syscall(pc->path,argv,env)) < 0) pc->erno=errno; freeparms(argv); freeparms(env); } /* Either no execve implementation in the module, or the module decided * to require the real execve */ if (pc->retval==ERESTARTSYS){ char *filename=strdup(um_proc_tmpname()); //printk("wrap_in_execve! %s %p %d\n",(char *)pc->path,um_syscall,isnosys(um_syscall)); /* copy the file and change the first arg of execve to * address the copy */ if ((pc->retval=filecopy(hte,pc->path,filename))>=0) { um_x_rewritepath(pc,filename,0,0); /* remember to clean up the copy as soon as possible */ pc->tmpfile2unlink_n_free=filename; return SC_CALLONXIT; } else { /* something went wrong during the copy */ free(filename); pc->erno= -(pc->retval); pc->retval= -1; return SC_FAKE; } } else return SC_FAKE; } else if (__builtin_expect(pc->needs_path_rewrite,0)) { um_x_rewritepath(pc,pc->path,0,0); return SC_CALLONXIT; } else return STD_BEHAVIOR; } int wrap_out_execve(int sc_number,struct pcb *pc) { /* If this function is executed it means that something went wrong! */ //printk("wrap_out_execve %d\n",pc->retval); /* The tmp file gets automagically deleted (see sctab.c) */ if (pc->retval < 0) { pc->euid=pc->fsuid=pc->suid; pc->egid=pc->fsgid=pc->sgid; putrv(pc->retval,pc); puterrno(pc->erno,pc); return SC_MODICALL; } else return STD_BEHAVIOR; } umview-0.8.2/xmview/ptrace_multi_test.c0000644000175000017500000000763711753517211017343 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * ptrace_multi_test.c : Test if this kernel has the ptrace_multi patch * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: ptrace_multi_test.c 974 2011-08-08 08:52:20Z rd235 $ * */ #include #include #include #include #include #include #include #include "ptrace2.h" #include #include #include #include /* these constant should eventually enter in sys/ptrace.h */ #ifndef PTRACE_SYSCALL_SKIPCALL #define PTRACE_SYSCALL_SKIPCALL 0x6 #endif #ifndef PTRACE_SYSCALL_SKIPEXIT #define PTRACE_SYSCALL_SKIPEXIT 0x2 #endif /* test thread code. This thread is started only to test * which features are provided by the linux kernel */ static int child(void *arg) { int *featurep=arg; int p[2]={-1,-1}; if(r_ptrace(PTRACE_TRACEME, 0, 0, 0) < 0){ perror("ptrace test_ptracemulti"); } kill(getpid(), SIGSTOP); getpid(); /* if it reaches this point in 1 stop it means that * * PTRACE_SYSCALL_SKIPEXIT works */ *featurep=PTRACE_SYSCALL_SKIPEXIT; pipe(p); /* if after a PTRACE_SYSCALL_SKIPCALL p[0] is already <0 * * pipe has been really skipped */ if (p[0] < 0) *featurep=PTRACE_SYSCALL_SKIPCALL; /* pipe's fds do not need clean up, they'll die with this thread */ /* final stop the thread will be killed here*/ getpid(); return 0; } /* kernel feature test: * exit value =1 means that there is ptrace multi support * vm_mask is the mask of PTRACE_SYSVM supported features * and sysvm_tag is the SYSVM ptrace option tag*/ unsigned int test_ptracemulti(unsigned int *vm_mask, unsigned int *sysvm_tag) { int pid, status, rv; static char stack[1024]; *vm_mask=0; if((pid = clone(child, &stack[1020], SIGCHLD | CLONE_VM, vm_mask)) < 0){ perror("clone"); return 0; } if((pid = r_waitpid(pid, &status, WUNTRACED)) < 0){ perror("Waiting for stop"); return 0; } /* restart and wait for the next syscall (getpid)*/ rv=r_ptrace(PTRACE_SYSCALL, pid, 0, 0); if(waitpid(pid, &status, WUNTRACED) < 0) goto out; /* try to skip the exit call */ rv=r_ptrace(PTRACE_SYSCALL, pid, PTRACE_SYSCALL_SKIPEXIT, 0); if (rv < 0) goto out; /* wait for the next stop */ if(waitpid(pid, &status, WUNTRACED) < 0) goto out; /* if feature is already 0 it means that this is the exit call, * and it has not been skipped, otherwise this is the * entry call for the system call "pipe" */ if (*vm_mask #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "defs.h" #include "umproc.h" #include "hashtab.h" #include "um_services.h" #include "sctab.h" #include "scmap.h" #include "utils.h" #include "gdebug.h" #ifdef _VIEWOS_KM #include "capture_km.h" #endif int wrap_in_getcwd(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long arg1=pc->sysargs[1]; if (pc->sysargs[0]==(long) NULL) { pc->retval=(long) NULL; pc->erno=EFAULT; } else { //printk("dsys_getcwd %s\n",pc->fdfs->cwd); int len; char *root=um_getroot(pc); char *cwd=pc->fdfs->cwd; int rootlen=strlen(root); if (rootlen>1 && strncmp(cwd,root,rootlen)==0) cwd += rootlen; if (*cwd == 0) cwd="/"; len=strlen(cwd)+1; if (len > arg1) { pc->retval= -1; pc->erno=ERANGE; } else { /*if (arg1 > PATH_MAX) arg1=PATH_MAX;*/ if (ustorestr(pc,pc->sysargs[0],arg1,cwd) < 0) { pc->retval= -1; pc->erno=ERANGE; } else { pc->retval=len; pc->erno=0; } } } return SC_FAKE; } /* kmview: set/unset privatedir for ghost mount */ static inline void set_wdm_kmview_chroot(struct pcb *pc) { #ifdef _VIEWOS_KM /* when chroot-ed, PCB_KM_PRIVATEDIR is always set */ if (strcmp(pc->fdfs->root,"/")==0) { /* if this is a ghost mount (returns 0 when pc->hte is NULL) */ if (ht_get_mountflags(pc->hte) & MS_GHOST) { if ((pc->flags & PCB_KM_PRIVATEDIR) == 0) { capture_km_kmpid_chroot(pc->kmpid,1); pc->flags |= PCB_KM_PRIVATEDIR; } } else { if ((pc->flags & PCB_KM_PRIVATEDIR) != 0) { capture_km_kmpid_chroot(pc->kmpid,0); pc->flags &= ~PCB_KM_PRIVATEDIR; } } } #endif } /* TODO: While fchdir tries to make a chdir to the real directory instead of * /tmp (if it exists), chdir does not try this yet. I was not sure about * the correct check and where to put it, so I haven't done it at the moment. * But it should be changed. */ int wrap_in_chdir(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { if (!S_ISDIR(pc->pathstat.st_mode)) { if (pc->pathstat.st_mode == 0) pc->erno=ENOENT; else pc->erno=ENOTDIR; } if ( (pc->erno==0) && (um_x_access(pc->path,X_OK,pc,&pc->pathstat)!=0) ) { pc->erno=EACCES; } if (pc->erno == 0 && S_ISDIR(pc->pathstat.st_mode)) { if (hte != NULL) um_x_rewritepath(pc,um_proc_fakecwd(),0,0); else um_x_rewritepath(pc,pc->path,0,0); return SC_CALLONXIT; } else { pc->retval = -1; return SC_FAKE; } } int wrap_out_chdir(int sc_number,struct pcb *pc) { if (pc->behavior == SC_FAKE) { //printk("chdir err %d\n",pc->erno); putrv(pc->retval,pc); puterrno(pc->erno,pc); /* we use pc->path. it has been dup-ped already */ /* if retval < 0 should be deallocated? isn't it? XXX */ pc->path=NULL; /* this prevents pc->path to be free-ed */ return SC_MODICALL; } else { pc->retval=getrv(pc); if (pc->retval >= 0) { set_wdm_kmview_chroot(pc); free(pc->fdfs->cwd); pc->fdfs->cwd = pc->path; pc->path=NULL; //printk("new dir %d - %s\n",pc->pid, pc->fdfs->cwd); } return STD_BEHAVIOR; } } int wrap_in_fchdir(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { char *path; path=fd_getpath(pc->fds,pc->sysargs[0]); if (path == NULL) { int rv; path=alloca(PATH_MAX); snprintf(path,PATH_MAX,"/proc/%d/fd/%ld",pc->pid,pc->sysargs[0]); if ((rv=readlink(path,path,PATH_MAX)) < 0) path=NULL; else path[rv]=0; } if (path != NULL) { //printk("fchdir to %s\n",path); pc->path=strdup(path); um_x_lstat64(pc->path, &(pc->pathstat), pc, 0); /* If there is a real directory with this name, and it is chdir-able, * we can chdir there instead of /tmp/ so the core and the process * will see the same cwd. */ /* (rd) maybe there is a virtual dir with the same name of * a real file with X permission... * commented out 20080626*/ if (S_ISDIR(pc->pathstat.st_mode) && (r_access(pc->path,X_OK) == 0)) { um_x_rewritepath(pc,pc->path,0,0); putscno(__NR_chdir, pc); GDEBUG(4, "FCHDIR making fake chdir to real %s", pc->path); return SC_CALLONXIT; } else { if (S_ISDIR(pc->pathstat.st_mode)) { if (um_x_access(pc->path,X_OK,pc,&pc->pathstat)!=0) { GDEBUG(4, "FCHDIR EACCES for %s", pc->path); pc->erno=EACCES; pc->retval = -1; return SC_FAKE; } else { if (hte != NULL) um_x_rewritepath(pc,um_proc_fakecwd(),0,0); else um_x_rewritepath(pc,pc->path,0,0); putscno(__NR_chdir,pc); return SC_CALLONXIT; } } else { GDEBUG(4, "FCHDIR ENOTDIR for %s", pc->path); pc->retval = -1; pc->erno=ENOTDIR; return SC_FAKE; } } } else { GDEBUG(4, "FCHDIR EBADF for %s", pc->path); pc->retval = -1; pc->erno = EBADF; return SC_FAKE; } } int wrap_in_umask(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { mode_t mode=pc->sysargs[0]; pc->fdfs->mask = mode; return STD_BEHAVIOR; } int wrap_in_chroot(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { //printk("CHROOT %s\n",pc->path); if (pc->erno != 0) { pc->retval = -1; pc->erno = ENOENT; return SC_FAKE; } else { /* view-OS chroot can only restrict the visible subtree, no risk for users */ #if 0 if (secure && capcheck(CAP_SYS_CHROOT,pc)) { pc->retval = -1; pc->erno = EPERM; return SC_FAKE; } else #endif { if (strcmp(pc->fdfs->root,pc->path) != 0) { #ifdef _VIEWOS_KM if (strcmp(pc->fdfs->root,"/")==0) capture_km_kmpid_chroot(pc->kmpid,1); #endif free(pc->fdfs->root); pc->fdfs->root=strdup(pc->path); } pc->retval = 0; pc->erno = 0; return SC_FAKE; } } } int wrap_out_chroot(int sc_number,struct pcb *pc) { /* if it is on a virtualize part of the file system * chroot gets virtualized */ if (pc->behavior == SC_FAKE) { putrv(pc->retval,pc); puterrno(pc->erno,pc); if (pc->retval >= 0) { free(pc->fdfs->root); pc->fdfs->root=pc->path; pc->path=NULL; } return SC_MODICALL; } else { /* otherwise if the kernel's chroot succeeded * keep track of the new root */ pc->retval=getrv(pc); if (pc->retval >= 0) { free(pc->fdfs->root); pc->fdfs->root=pc->path; pc->path=NULL; } return STD_BEHAVIOR; } } umview-0.8.2/xmview/um_socket.c0000644000175000017500000004501111753517211015571 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_socket: socketcall wrappers * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_socket.c 994 2011-08-17 14:50:25Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "defs.h" #include "umproc.h" #include "services.h" #include "hashtab.h" #include "um_services.h" #include "sctab.h" #include "scmap.h" #include "utils.h" #define SOCK_DEFAULT 0 /* SOCKET & MSOCKET call management (IN) */ int wrap_in_msocket(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { /* path = pc->sysarg[0] = pc->path */ int domain =pc->sysargs[1]; int type =pc->sysargs[2]; int protocol=pc->sysargs[3]; /* msocket is ALWAYS called: msocket(NULL...) calls must be converted * into socket(...) syscalls */ if (hte != NULL) { if (type == SOCK_DEFAULT) { if (pc->path == NULL) { pc->retval = -1; pc->erno = EINVAL; } else { if ((pc->retval = um_syscall(pc->path,domain,type,protocol)) < 0) { pc->erno = errno; } //printk("SOCK_DEFAULT %s %d\n",pc->path,domain); } return SC_FAKE; } else { if ((pc->retval = um_syscall(pc->path,domain,type,protocol)) < 0) { if (errno == ENOSYS && pc->path==NULL) { /* backward compatibility: * modules implementing only "socket". * the code reaches this case only from wrap_in_socket */ #if (__NR_socketcall != __NR_doesnotexist) um_syscall=ht_socketcall(hte,SYS_SOCKET); #else um_syscall=ht_syscall(hte,uscno(__NR_socket)); #endif if ((pc->retval = um_syscall(domain,type,protocol)) < 0) { pc->erno = errno; } } else pc->erno = errno; } /* create the comm fifo with the user process */ if (pc->retval >= 0 && (pc->retval=lfd_open(hte,pc->retval,NULL,O_RDWR,0)) >= 0) { um_x_rewritepath(pc,lfd_getfilename(pc->retval),0,0); putscno(__NR_open,pc); pc->sysargs[1]=O_RDONLY; return SC_CALLONXIT; } else return SC_FAKE; } } else { /* msocket -> socket translation for native system calls * just for the case path=NULL */ if (pc->sysargs[0]==umNULL) { #if (__NR_socketcall != __NR_doesnotexist) struct { long domain; long type; long protocol; } socketcallparms = {domain,type,protocol}; long sp=getsp(pc); ustoren(pc,sp-sizeof(socketcallparms), sizeof(socketcallparms),&socketcallparms); pc->sysargs[0]=SYS_SOCKET; pc->sysargs[1]=sp-sizeof(socketcallparms); putscno(__NR_socketcall,pc); return SC_MODICALL; #else pc->sysargs[0]=domain; pc->sysargs[1]=type; pc->sysargs[2]=protocol; putscno(__NR_socket,pc); return SC_MODICALL; #endif } else { pc->retval = -1; pc->erno = ENOTSUP; return SC_FAKE; } } } int wrap_in_socket(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { pc->sysargs[3]=pc->sysargs[2]; pc->sysargs[2]=pc->sysargs[1]; pc->sysargs[1]=pc->sysargs[0]; pc->sysargs[0]=umNULL; pc->path=NULL; return wrap_in_msocket(__NR_msocket,pc,hte, ht_virsyscall(hte,VIRSYS_MSOCKET)); } #define MAX_SOCKLEN 1024 /* accept creates a new fd! */ int wrap_in_accept(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); /* the virtual file does not exist */ if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { /* get the system call args */ long sock_plen=pc->sysargs[2]; int sock_len; if (sock_plen != umNULL) { umoven(pc,sock_plen,4,&sock_len); /* safety check for sock */ if (sock_len == 0 || sock_len > MAX_SOCKLEN) { pc->retval= -1; pc->erno= EINVAL; } else { long sock_addr=pc->sysargs[1]; char *sock; if (__builtin_expect((sock_len > MAX_SOCKET_NAME),0)) sock_len=MAX_SOCKET_NAME; sock=(char *)alloca(sock_len); /* get the sock_addr */ umoven(pc,sock_addr,sock_len,sock); /* virtual syscall */ if ((pc->retval = um_syscall(sfd,sock,&sock_len)) < 0) pc->erno=errno; else { /* store the results (if the call was successful) */ if (sock_addr != umNULL) ustoren(pc,sock_addr,sock_len,sock); if (sock_plen != umNULL) umoven(pc,sock_plen,4,&sock_len); } } } else { if ((pc->retval = um_syscall(sfd,NULL,NULL)) < 0) pc->erno=errno; } /* open the new fifo, (accept creates a new fd) */ if (pc->retval >= 0 && (pc->retval=lfd_open(hte,pc->retval,NULL,O_RDWR,0)) >= 0) { um_x_rewritepath(pc,lfd_getfilename(pc->retval),0,0); putscno(__NR_open,pc); pc->sysargs[1]=O_RDONLY; return SC_CALLONXIT; } else return SC_FAKE; } return SC_FAKE; } /* SOCKET & MSOCKET & ACCEPT wrap out */ int wrap_out_socket(int sc_number,struct pcb *pc) { /*int lerno=errno;*/ //printk("wrap_out_socket %d %d\n",pc->behavior,SC_FAKE); /* if everything was okay for the virtual call */ if (pc->behavior==SC_CALLONXIT && pc->retval >= 0) { int fd=getrv(pc); /* if the syscall issued by the process was also okay */ if (fd >= 0 && addfd(pc,fd) == 0) { /* update open file table*/ lfd_register(pc->fds,fd,pc->retval); #ifdef __NR_accept4 if (sc_number == __NR_accept4) { int flags = pc->sysargs[3]; if (flags & SOCK_CLOEXEC) fd_setfdfl(pc->fds,fd,FD_CLOEXEC); } #endif } else { putrv(pc->retval,pc); puterrno(pc->erno,pc); //printk("wrap_out_socket!!\n"); lfd_close(pc->retval); } } else { putrv(pc->retval,pc); puterrno(pc->erno,pc); } return SC_MODICALL; } int wrap_in_bind_connect(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { long sock_addr=pc->sysargs[1]; long sock_len=pc->sysargs[2]; char *sock; if (__builtin_expect((sock_len > MAX_SOCKET_NAME),0)) sock_len=MAX_SOCKET_NAME; sock=(char *)alloca(sock_len); umoven(pc,sock_addr,sock_len,sock); if ((pc->retval = um_syscall(sfd,sock,sock_len)) < 0) pc->erno=errno; } return SC_FAKE; } int wrap_in_listen(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { int backlog=pc->sysargs[1]; if ((pc->retval=um_syscall(sfd,backlog)) < 0) pc->erno=errno; } return SC_FAKE; } int wrap_in_getsock(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { long sock_addr=pc->sysargs[1]; long sock_plen=pc->sysargs[2]; int sock_len; if (sock_plen != umNULL) umoven(pc,sock_plen,4,&sock_len); char *sock; if (__builtin_expect((sock_len > MAX_SOCKET_NAME),0)) sock_len=MAX_SOCKET_NAME; sock=(char *)alloca(sock_len); umoven(pc,sock_addr,sock_len,sock); if ((pc->retval = um_syscall(sfd,sock,&sock_len)) < 0) pc->erno=errno; else { if (sock_addr != umNULL) ustoren(pc,sock_addr,sock_len,sock); if (sock_plen != umNULL) umoven(pc,sock_plen,4,&sock_len); } } return SC_FAKE; } int wrap_in_send(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { long buf=pc->sysargs[1]; int len=pc->sysargs[2]; int flags=pc->sysargs[3]; char *lbuf=(char *)lalloca(len); #ifdef SNDRCVMSGUNIFY struct iovec iov = {lbuf,len}; struct msghdr msg = { .msg_name=NULL, .msg_namelen=0, .msg_iov=&iov, .msg_iovlen=1, .msg_control=NULL, .msg_controllen=0, .msg_flags=flags}; #endif umoven(pc,buf,len,lbuf); #ifdef SNDRCVMSGUNIFY if ((pc->retval=um_syscall(sfd,&msg,flags)) < 0) pc->erno=errno; #else if ((pc->retval=um_syscall(sfd,lbuf,len,flags)) < 0) pc->erno=errno; #endif lfree(lbuf,len); } return SC_FAKE; } int wrap_in_recv(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { long buf=pc->sysargs[1]; int len=pc->sysargs[2]; int flags=pc->sysargs[3]; char *lbuf=(char *)lalloca(len); #ifdef SNDRCVMSGUNIFY struct iovec iov = {lbuf,len}; struct msghdr msg = { .msg_name=NULL, .msg_namelen=0, .msg_iov=&iov, .msg_iovlen=1, .msg_control=NULL, .msg_controllen=0, .msg_flags=flags}; if ((pc->retval=um_syscall(sfd,&msg,flags)) < 0) pc->erno=errno; #else if ((pc->retval=um_syscall(sfd,lbuf,len,flags)) < 0) pc->erno=errno; #endif if (pc->retval > 0) ustoren(pc,buf,pc->retval,lbuf); lfree(lbuf,len); } return SC_FAKE; } int wrap_in_sendto(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { long buf=pc->sysargs[1]; int len=pc->sysargs[2]; int flags=pc->sysargs[3]; long pto=pc->sysargs[4]; int tolen=pc->sysargs[5]; char *lbuf=(char *)lalloca(len); char *tosock=NULL; #ifdef SNDRCVMSGUNIFY struct iovec iov = {lbuf,len}; struct msghdr msg = { .msg_name=NULL, .msg_namelen=0, .msg_iov=&iov, .msg_iovlen=1, .msg_control=NULL, .msg_controllen=0, .msg_flags=flags}; #endif umoven(pc,buf,len,lbuf); if (pto != umNULL) { if (__builtin_expect((tolen > MAX_SOCKET_NAME),0)) tolen=MAX_SOCKET_NAME; tosock=alloca(tolen); umoven(pc,pto,tolen,tosock); #ifdef SNDRCVMSGUNIFY msg.msg_name=tosock; msg.msg_namelen=tolen; #endif } #ifdef SNDRCVMSGUNIFY if ((pc->retval=um_syscall(sfd,&msg,flags)) < 0) pc->erno=errno; #else if ((pc->retval=um_syscall(sfd,lbuf,len,flags,tosock,tolen)) < 0) pc->erno=errno; #endif lfree(lbuf,len); } return SC_FAKE; } int wrap_in_recvfrom(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { long buf=pc->sysargs[1]; int len=pc->sysargs[2]; int flags=pc->sysargs[3]; long pfrom=pc->sysargs[4]; long pfromlen=pc->sysargs[5]; int fromlen=0; char *lbuf=(char *)lalloca(len); char *fromsock=NULL; #ifdef SNDRCVMSGUNIFY struct iovec iov = {lbuf,len}; struct msghdr msg = { .msg_name=NULL, .msg_namelen=0, .msg_iov=&iov, .msg_iovlen=1, .msg_control=NULL, .msg_controllen=0, .msg_flags=flags}; #endif if (pfromlen != umNULL) { umoven(pc,pfromlen,4,(char *)&fromlen); if (pfrom != umNULL && fromlen != 0) { if (__builtin_expect((fromlen > MAX_SOCKET_NAME),0)) fromlen=MAX_SOCKET_NAME; fromsock=alloca(fromlen); umoven(pc,pfrom,fromlen,fromsock); } #ifdef SNDRCVMSGUNIFY msg.msg_name=fromsock; msg.msg_namelen=pfromlen; #endif } #ifdef SNDRCVMSGUNIFY if ((pc->retval=um_syscall(sfd,&msg,flags)) < 0) pc->erno=errno; #else if ((pc->retval=um_syscall(sfd,lbuf,len,flags,fromsock,&fromlen)) < 0) pc->erno=errno; #endif if (pc->retval > 0) { ustoren(pc,buf,pc->retval,lbuf); if (pfrom != umNULL) ustoren(pc,pfrom,fromlen,fromsock); if (pfromlen != umNULL) ustoren(pc,pfromlen,4,&fromlen); } lfree(lbuf,len); } return SC_FAKE; } int wrap_in_shutdown(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { int how=pc->sysargs[1]; if ((pc->retval=um_syscall(sfd,how)) < 0) pc->erno=errno; } return SC_FAKE; } int wrap_in_getsockopt(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { int level=pc->sysargs[1]; int optname=pc->sysargs[2]; long poptval=pc->sysargs[3]; long poptlen=pc->sysargs[4]; int optlen; void *optval; if (poptlen != umNULL) { umoven(pc,poptlen,4,(char *)&optlen); if (__builtin_expect((optlen > MAX_SOCKOPT_LEN),0)) optlen=MAX_SOCKOPT_LEN; optval=(optlen > 0)?alloca(optlen):NULL; } else { optlen=0; optval=NULL; } if ((pc->retval=um_syscall(sfd,level,optname,optval,&optlen)) < 0) pc->erno=errno; if (poptlen != umNULL) ustoren(pc,poptlen,4,&optlen); if (poptval != umNULL) ustoren(pc,poptval,optlen,optval); } return SC_FAKE; } int wrap_in_setsockopt(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { int level=pc->sysargs[1]; int optname=pc->sysargs[2]; long poptval=pc->sysargs[3]; int optlen=pc->sysargs[4]; void *optval; //printk("setsockopt fd %d level %d optname %d poptval %x optlen %d\n",pc->sysargs[0],level,optname,poptval,optlen); if (optlen > 0 && poptval != umNULL) { if (__builtin_expect((optlen > MAX_SOCKOPT_LEN),0)) optlen=MAX_SOCKOPT_LEN; optval=alloca(optlen); umoven(pc,poptval,optlen,optval); } else optval=NULL; if ((pc->retval=um_syscall(sfd,level,optname,optval,optlen)) < 0) pc->erno=errno; /*if (optval != NULL) ustoren(pc,poptval,optlen,optval);*/ } return SC_FAKE; } /* sendmsg and recvmsg have more complex arguments */ int wrap_in_recvmsg(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { long pmsg=pc->sysargs[1]; int flags=pc->sysargs[2]; struct msghdr msg; struct msghdr lmsg; struct iovec liovec; struct iovec *iovec; umoven(pc,pmsg,sizeof(struct msghdr),&msg); lmsg=msg; if (msg.msg_namelen > 0 && msg.msg_name != NULL) { if (__builtin_expect((msg.msg_namelen > MAX_SOCKET_NAME),0)) msg.msg_namelen=MAX_SOCKET_NAME; lmsg.msg_name=alloca(msg.msg_namelen); umoven(pc,(long)msg.msg_name,msg.msg_namelen,lmsg.msg_name); } if (msg.msg_iovlen > 0 && msg.msg_iov != NULL) { if (__builtin_expect((msg.msg_iovlen > IOV_MAX),0)) msg.msg_iovlen=IOV_MAX; iovec=alloca(msg.msg_iovlen * sizeof(struct iovec)); umoven(pc,(long)msg.msg_iov,msg.msg_iovlen * sizeof(struct iovec),iovec); } else { iovec=NULL; msg.msg_iovlen = 0; } if (msg.msg_controllen > 0 && msg.msg_control != NULL) { if (__builtin_expect((msg.msg_controllen > MAX_SOCK_CONTROLLEN),0)) msg.msg_controllen=MAX_SOCK_CONTROLLEN; lmsg.msg_control=alloca(msg.msg_controllen); umoven(pc,(long)msg.msg_control,msg.msg_controllen,lmsg.msg_control); } { unsigned int i,totalsize,size; char *lbuf, *p; for (i=0,totalsize=0;isysargs[0],msg.msg_namelen, msg.msg_iovlen, msg.msg_controllen, totalsize); liovec.iov_base=lbuf; liovec.iov_len=totalsize; lmsg.msg_iov=&liovec; lmsg.msg_iovlen=1; //printk("%d size->%d\n",sfd,size); if ((pc->retval = um_syscall(sfd,&lmsg,flags)) < 0) { size = 0; pc->erno = errno; } else size = pc->retval; if (size > 0) { for (i=0;i0;i++) { int qty=(size > iovec[i].iov_len)?iovec[i].iov_len:size; ustoren(pc,(long)iovec[i].iov_base,qty,p); p += qty; size -= qty; } } if (msg.msg_namelen > 0 && msg.msg_name != NULL) { msg.msg_namelen=lmsg.msg_namelen; ustoren(pc,(long)msg.msg_name,msg.msg_namelen,lmsg.msg_name); } if (msg.msg_controllen > 0 && msg.msg_control != NULL) { msg.msg_controllen=lmsg.msg_controllen; ustoren(pc,(long)msg.msg_control,msg.msg_controllen,lmsg.msg_control); } msg.msg_flags=lmsg.msg_flags; ustoren(pc,pmsg,sizeof(struct msghdr),&msg); lfree(lbuf,totalsize); } } return SC_FAKE; } int wrap_in_sendmsg(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { long pmsg=pc->sysargs[1]; int flags=pc->sysargs[2]; struct msghdr msg; struct msghdr lmsg; umoven(pc,pmsg,sizeof(struct msghdr),&msg); lmsg=msg; struct iovec liovec; struct iovec *iovec; if (msg.msg_namelen > 0 && msg.msg_name != NULL) { if (__builtin_expect((msg.msg_namelen > MAX_SOCKET_NAME),0)) msg.msg_namelen=MAX_SOCKET_NAME; lmsg.msg_name=alloca(msg.msg_namelen); umoven(pc,(long)msg.msg_name,msg.msg_namelen,lmsg.msg_name); } if (msg.msg_iovlen > 0 && msg.msg_iov != NULL) { if (__builtin_expect((msg.msg_iovlen > IOV_MAX),0)) msg.msg_iovlen=IOV_MAX; iovec=alloca(msg.msg_iovlen * sizeof(struct iovec)); umoven(pc,(long)msg.msg_iov,msg.msg_iovlen * sizeof(struct iovec),iovec); } else { iovec=NULL; msg.msg_iovlen = 0; } if (msg.msg_controllen > 0 && msg.msg_control != NULL) { if (__builtin_expect((msg.msg_controllen > MAX_SOCK_CONTROLLEN),0)) msg.msg_controllen=MAX_SOCK_CONTROLLEN; lmsg.msg_control=alloca(msg.msg_controllen); umoven(pc,(long)msg.msg_control,msg.msg_controllen,lmsg.msg_control); } { unsigned int i,totalsize; char *lbuf, *p; for (i=0,totalsize=0;isysargs[0], msg.msg_namelen, msg.msg_iovlen, msg.msg_controllen, totalsize); for (i=0;iretval = um_syscall(sfd,&lmsg,flags)) < 0) pc->erno=errno; //printk("%d size->%d\n",sfd,size); lfree(lbuf,totalsize); } } return SC_FAKE; } umview-0.8.2/xmview/defs_ppc_um.h0000644000175000017500000000752311753517211016077 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * defs.h: interfaces to system call arguments (architecture dependant) * needed for capture_um * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Mattia Belletti, Ludovico Gardenghi, Andrea Gasparini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: defs_ppc_um.h 974 2011-08-08 08:52:20Z rd235 $ * */ #ifndef _DEFS_PPC #define _DEFS_PPC #define _KERNEL_NSIG 64 #define _KERNEL_SIGSET_SIZE _KERNEL_NSIG/8 #include #ifndef PT_ORIG_R3 #define PT_ORIG_R3 34 #endif static inline long getregs(struct pcb *pc) { if (has_ptrace_multi) { struct ptrace_multi req[] = {{PTRACE_PEEKUSER, 0, pc->saved_regs, 10}, {PTRACE_PEEKUSER, 4*PT_NIP, &(pc->saved_regs[10]), 1}, {PTRACE_PEEKUSER, 4*PT_ORIG_R3, &(pc->saved_regs[11]), 1}, {PTRACE_PEEKUSER, 4*PT_CCR, &(pc->saved_regs[12]), 1}}; errno=0; return r_ptrace(PTRACE_MULTI,pc->pid,req,4); } else { register int count; for(count=0;count<10;count++){ r_ptrace(PTRACE_PEEKUSER,pc->pid,(void*)(4*count),&(pc->saved_regs[count])); if(errno!=0) break; } r_ptrace(PTRACE_PEEKUSER,pc->pid,(void*)(4*PT_NIP),&(pc->saved_regs[10])); r_ptrace(PTRACE_PEEKUSER,pc->pid,(void*)(4*PT_ORIG_R3),&(pc->saved_regs[11])); r_ptrace(PTRACE_PEEKUSER,pc->pid,(void*)(4*PT_CCR),&(pc->saved_regs[12])); return (errno!=0)?-1:0; } } /* XXX PTRACE_MULTI ORIG_R3 returns -1 when saved */ static inline long setregs(struct pcb *pc, enum __ptrace_request call, long op, long sig) { if (has_ptrace_multi) { struct ptrace_multi req[] = {{PTRACE_POKEUSER, 0, pc->saved_regs, 10}, {PTRACE_POKEUSER, 4*PT_NIP, &(pc->saved_regs[10]), 1}, {PTRACE_POKEUSER, 4*PT_CCR, &(pc->saved_regs[12]), 1}, {call, op, (void *) sig, 0}}; return r_ptrace(PTRACE_MULTI,pc->pid,req,4); } else { int rv,count; for(count=0;count<10;count++){ rv=r_ptrace(PTRACE_POKEUSER,pc->pid,(void*)(4*count),pc->saved_regs[count]); if(rv!=0)break; } if(rv==0) rv=r_ptrace(PTRACE_POKEUSER,pc->pid,(void*)(4*PT_NIP),pc->saved_regs[10]); if(rv==0) rv=r_ptrace(PTRACE_POKEUSER,pc->pid,(void*)(4*PT_CCR),pc->saved_regs[12]); if(rv==0) rv=r_ptrace(call,pc->pid,op,sig); return rv; } } #define getscno(PC) ( (PC)->saved_regs[PT_R0] ) #define putscno(X,PC) ( (PC)->saved_regs[PT_R0]=(X) ) #define getargn(N,PC) ( (PC)->saved_regs[PT_R3+(N)] ) #define getargp(PC) (&((PC)->saved_regs[PT_R3])) #define putargn(N,X,PC) ( (PC)->saved_regs[PT_R3+(N)]=(X) ) #define getrv(PC) ( (PC)->saved_regs[12] & 0x10000000 ? -1: (PC)->saved_regs[PT_R3] ) #define putrv(RV,PC) ( (PC)->saved_regs[PT_R3]=(RV) , 0 ) #define puterrno(ERR,PC) ({ if(ERR!=0){\ (PC)->saved_regs[12]=(PC)->saved_regs[12] | 0x10000000;\ (PC)->saved_regs[PT_R3]=(ERR);\ } 0;\ }) #define puterrno0(PC) #define getsp(PC) ( (PC)->saved_regs[PT_R1] ) #define getpc(PC) ( (PC)->saved_regs[10] ) #define putsp(SP,PC) ( (PC)->saved_regs[PT_R1]=(SP) ; #define putpc(PCX,PC) ( (PC)->saved_regs[10]=(PCX) ) #define BIGENDIAN #define LONG_LONG(_l,_h) \ ((long long)((unsigned long long)(unsigned)(_h) | ((unsigned long long)(_l)<<32))) #define __NR_setpgrp __NR_doesnotexist #endif // _DEFS_PPC umview-0.8.2/xmview/kmview-main.h0000644000175000017500000000265011753517211016033 0ustar renzorenzo/* This is part of km-ViewOS * The kernel-mode implementation of OSVIEW -- A Process with a View * * kmview.h: generic definitions, not directly related to virtualization * * Copyright 2006 Ludovico Gardenghi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: kmview-main.h 668 2009-05-30 15:08:31Z rd235 $ * */ #include #define KMVIEW_NAME PACKAGE_NAME #define KMVIEW_DESC "kmview: kernel-module implementation of View-OS" #define KMVIEW_VERSION PACKAGE_VERSION #define KMVIEW_URL "http://savannah.nongnu.org/projects/view-os" #define KMVIEW_COPYRIGHT "2007 Renzo Davoli, University of Bologna, Italy" #define KMVIEW_TEAM \ "P. Angelelli, A. Bacchelli, M. Belletti, P. Beverini, D. Billi, A. Forni,\n" \ "L. Gardenghi, A. Gasparini, D. Lacamera, C. Martellini, A. Seraghiti" umview-0.8.2/xmview/ptrace_multi_test.h0000644000175000017500000000256211753517211017340 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: ptrace_multi_test.h 538 2008-05-31 10:42:20Z rd235 $ * */ #include #include #include #include #include #include #include #include "ptrace2.h" #include /* kernel feature test: * exit value =1 means that there is ptrace multi support * vm_mask and viewos_mask are masks of supported features of * PTRACE_SYSVM and PTRACE_VIEWOS tags, respectively*/ unsigned int test_ptracemulti(unsigned int *vm_mask,unsigned int *sysvm_tag); umview-0.8.2/xmview/gdebug.c0000644000175000017500000001212611753517211015036 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * gdebug.c: debugging functions * * Copyright 2005 Ludovico Gardenghi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: gdebug.c 415 2007-11-29 18:16:54Z garden $ * */ #include #include #include #include #include #include #include #include #include //#include "defs.h" #include "gdebug.h" #ifdef MULTI_THREAD #include #endif FILE *gdebug_ofile = NULL; #define BACKTRACE_INITIAL_SIZE 10 static void *libc_handle; static int (*libc_fprintf)(FILE *stream, const char *format, ...); static int (*libc_vfprintf)(FILE *stream, const char *format, va_list ap); static FILE *(*libc_fopen)(const char *path, const char *mode); static int (*libc_getpid)(void); static void **backtrace_array = NULL; static int backtrace_array_size = 0; void gdebug_set_ofile(char* new_ofile) { gdebug_ofile = libc_fopen(new_ofile, "w"); if (!gdebug_ofile) libc_fprintf(stderr, "gdebug: can't open log file %s: %s. Using stderr.\n", new_ofile, strerror(errno)); else setlinebuf(gdebug_ofile); } void fgdebug(FILE *ofile, int gdebug_level, int level, const char *file, const int line, const char *func, const char *fmt, ...) { va_list ap; if (gdebug_level >= level) { va_start(ap, fmt); #ifdef _PTHREAD_H libc_fprintf(ofile, "[%d:%lu] %s:%d %s(): ", libc_getpid(), pthread_self(), file, line, func); #else libc_fprintf(ofile, "[%d] %s:%d %s(): ", libc_getpid(), file, line, func); #endif libc_vfprintf(ofile, fmt, ap); libc_fprintf(ofile, "\n"); va_end(ap); } } void fgmsg(FILE *ofile, const char *fmt, ...) { va_list ap; va_start(ap, fmt); libc_vfprintf(ofile, fmt, ap); libc_fprintf(ofile, "\n"); va_end(ap); } void fghexdump(FILE *ofile, int gdebug_level, int level, const char *file, const int line, const char *func, char* text, int len) { int i; if (gdebug_level >= level) { #ifdef _PTHREAD_H libc_fprintf(ofile, "[%d:%lu] %s:%d %s(): [%d] ", libc_getpid(), pthread_self(), file, line, func, len); #else libc_fprintf(ofile, "[%d] %s:%d %s(): [%d] ", libc_getpid(), file, line, func, len); #endif for (i = 0; i < len; i++) { if ((i != 0) && ((i % 4) == 0)) libc_fprintf(ofile, " "); libc_fprintf(ofile, "%02x", (unsigned char)text[i]); } libc_fprintf(ofile, "\n"); } } void fgbacktrace(FILE *ofile, int gdebug_level, int level, const char *file, const int line, const char *func, int maxdepth) { int i; int btdepth; char **btstrings; /* The first entry is always ignored (it's the call to fgbacktrace), the * user wants maxdepth entries so we must add 1 */ maxdepth++; if (gdebug_level >= level) { if (maxdepth > backtrace_array_size) { backtrace_array_size = maxdepth; backtrace_array = realloc(backtrace_array, sizeof(void*) * backtrace_array_size); } btdepth = backtrace(backtrace_array, maxdepth); btstrings = backtrace_symbols(backtrace_array, btdepth); if (!btstrings) { fgdebug(ofile, gdebug_level, level, file, line, func, "can't obtain backtrace"); return; } /* 1 and not 0 (0 is fgbacktrace and it's not interesting) */ for (i = 1; i < btdepth; i++) fgdebug(ofile, gdebug_level, level, file, line, func, "BT: #%d %s", i-1, btstrings[i]); } } static void __attribute__ ((constructor)) init() { libc_handle = dlopen("libc.so.6", RTLD_LAZY); if (!libc_handle) { fprintf(stderr, "dlopen: %s", dlerror()); fprintf(stderr, "dlopen in gdebug failed, reverting to original fprintf/vfprintf/fopen\n"); libc_fprintf = fprintf; libc_vfprintf = vfprintf; libc_fopen = fopen; libc_getpid = getpid; } else { libc_fprintf = dlsym(libc_handle, "fprintf"); libc_vfprintf = dlsym(libc_handle, "vfprintf"); libc_fopen = dlsym(libc_handle, "fopen"); libc_getpid = dlsym(libc_handle,"getpid"); if (!libc_fprintf || !libc_vfprintf || !libc_fopen || !libc_getpid) { fprintf(stderr, "dlsym: %s", dlerror()); fprintf(stderr, "dlsym in gdebug failed, reverting to original fprintf/vfprintf/fopen\n"); libc_fprintf = fprintf; libc_vfprintf = vfprintf; libc_fopen = fopen; libc_getpid = getpid; } } backtrace_array = malloc(sizeof(void*) * BACKTRACE_INITIAL_SIZE); backtrace_array_size = BACKTRACE_INITIAL_SIZE; } static void __attribute__ ((destructor)) fini() { dlclose(libc_handle); if (backtrace_array) free(backtrace_array); backtrace_array = NULL; backtrace_array_size = 0; } umview-0.8.2/xmview/loginshell.c0000644000175000017500000001060611753517211015742 0ustar renzorenzo/* This is part of km-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * loginshell.c: Support for view-os as login shell * * Copyright 2009 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include int main(int argc,char *argv[]); static void loginshell_error(char *s) { printk("View-OS login configuration error: %s\n",s); sleep(3); exit(1); } #define NEWARG ' ' #define CHAR 'A' /* Finite State Automaton for arg quoting states: NEWARG -> beginning of a new arg CHAR -> a char \ -> protected char ' " -> quoted part '+1 "+1 (i.e. ( or # ) -> protected char inside quote */ static int fsa(char state, char in) { switch (state) { case NEWARG: case CHAR: switch (in) { case ' ': case '\t': state=NEWARG; break; case '\\': case '\'': case '"': state=in; break; default: state=CHAR; /* outchar */ break; } break; case '\\': state=CHAR; /* outchar */ break; case '\'': case '"': if (in == '\\') state = state+1; if (in == state) state=CHAR; /* else outchar */ break; default: state -= 1; break; } return state; } /* first scan: count the args, each trasition NEWARG->something else counts one more arg */ static int argcount(char *s) { int state=NEWARG; int newstate; int argc=0; for(state=NEWARG;*s != 0;state=newstate,s++) { newstate=fsa(state,*s); if (state==NEWARG && newstate!=NEWARG) argc++; } return argc; } /* second scan: split and strip quoting chars at the same time: FSA used as a translator. On site translation (on the same string): the traslation is always not longer than the original string */ static char **splitargs(char *s,char **argv) { int state=NEWARG; int newstate; int argc=0; char *t=s; for(state=NEWARG;*s != 0;state=newstate,s++) { newstate=fsa(state,*s); //printf("%c %c->%c %s\n",*s,state,newstate,s); if (state==NEWARG && newstate!=NEWARG) argv[argc++]=t; switch (state) { case NEWARG: case CHAR: if (newstate==CHAR) *t++=*s; break; case '\\': case '\''+1: case '"'+1: *t++=*s; break; case '\'': case '"': if (newstate==state) *t++=*s; break; } if (state!=NEWARG && newstate==NEWARG) *t++=0; } *t=0; return argv; } /* search the command inside /etc/viewospasswd */ #define LOGINBUFSIZE 1024 static char *loginshell_path(void) { FILE *f=fopen("/etc/viewospasswd","r"); char buf[LOGINBUFSIZE],*line; char *username; int usernamelen; char *loginshell=NULL; struct passwd pwd,*result; getpwuid_r(getuid(),&pwd,buf,LOGINBUFSIZE,&result); if (result==NULL) loginshell_error("This user does not exist!"); asprintf(&username,"%s:",result->pw_name); usernamelen=strlen(username); if (f==NULL) loginshell_error("/etc/viewospasswd missing"); while ((line=fgets(buf,LOGINBUFSIZE,f)) != NULL) { while (*line==' ' || *line=='\t') line++; if (*line=='#' || *line=='\n' || *line==0) continue; if (strncmp(line,username,usernamelen)==0) { loginshell=line+usernamelen; break; } } if (loginshell == NULL) loginshell_error("User not in /etc/viewospasswd"); free(username); line=loginshell+strlen(loginshell); line--; while (*line == '\n' || *line== '\t' || *line== ' ') *line-- = 0; return strdup(loginshell); } /* call the main program again: use the command specified in /etc/viewospasswd */ void loginshell_view(void) { char *command=loginshell_path(); int argc=argcount(command)+1; char *argv[argc+1]; argv[0]=LOGIN_SHELL_ARG0; argv[argc]=0; splitargs(command,argv+1); main(argc,argv); } umview-0.8.2/xmview/kmview.c0000644000175000017500000002631511753517211015110 0ustar renzorenzo/* This is part of km-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * kmview.c: main * * Copyright 2007 Renzo Davoli University of Bologna - Italy * Based on umview: 2005 Renzo Davoli * Modified 2005 Ludovico Gardenghi, Andrea Gasparini, Andrea Seraghiti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: kmview.c 968 2011-08-03 10:16:26Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef OLDVIRSC #include #endif #include #ifndef _VIEWOS_KM #define _VIEWOS_KM #endif #include "defs.h" #include "kmview-main.h" #include "capture_km.h" #include "capture_nested.h" #include "sctab.h" #include "services.h" #include "um_select.h" #include "um_services.h" #include "mainpoll.h" #include "gdebug.h" #include "loginshell.h" #ifdef GDEBUG_ENABLED # define OPTSTRING "+p:f:o:hvxqV:us" #else # define OPTSTRING "+p:f:hvxqV:us" #endif #define KMVIEW_USER_NESTING int _umview_version = 2; /* modules interface version id. modules can test to be compatible with um-viewos kernel*/ unsigned int quiet = 0; unsigned int printk_current_level = PRINTK_STARTUP_LEVEL; unsigned int secure = 0; static char *viewname; extern int nprocs; struct prelist { char *module; struct prelist *next; }; /* module preload list */ static struct prelist *prehead=NULL; /* add a module for pre-loading */ static void preadd(struct prelist **head,char *module) { struct prelist *new=malloc(sizeof(struct prelist)); assert(new); new->module=module; new->next=*head; *head=new; } #ifdef KMVIEW_USER_NESTING /* virtual syscall for the underlying umview */ #ifdef OLDVIRSC static long int_virnsyscall(long virscno,int n,long arg1,long arg2,long arg3,long arg4,long arg5,long arg6) { struct __sysctl_args scarg; long args[6]={arg1,arg2,arg3,arg4,arg5,arg6}; scarg.name=NULL; scarg.nlen=virscno; scarg.oldval=NULL; scarg.oldlenp=NULL; scarg.newval=args; scarg.newlen=n; return native_syscall(__NR__sysctl,&scarg); } #else static long int_virnsyscall(long virscno,int n,long arg1,long arg2,long arg3,long arg4,long arg5,long arg6) { long args[6]={arg1,arg2,arg3,arg4,arg5,arg6}; return native_syscall(__NR_pivot_root,NULL,n,virscno,args); } #endif #endif /* preload of modules */ static int do_preload(struct prelist *head) { if (head != NULL) { int rv=do_preload(head->next); if (add_service(head->module,0) < 0) { printk("module preload %s",strerror(errno)); return -1 ; } else return rv; free(head); } else return 0; } static void do_set_viewname(char *viewname) { if (viewname) { pcb_setviewname(get_pcb(),viewname); free(viewname); } } #ifdef KMVIEW_USER_NESTING /* preload for nexted umview (it is a burst of um_add_module) */ static int do_preload_recursive(struct prelist *head) { if (head != NULL) { do_preload_recursive(head->next); int_virnsyscall(__NR_UM_SERVICE,3,ADD_SERVICE,(long)head->module,0,0,0,0); free(head); return 0; } else return 0; } static void do_set_viewname_recursive(char *viewname) { if (viewname) { int_virnsyscall(__NR_UM_SERVICE,2,VIEWOS_SETVIEWNAME,(long)viewname,0,0,0,0); } } #endif static void version(int verbose) { fprintf(stderr, "%s %s\n", KMVIEW_NAME, KMVIEW_VERSION); if (verbose) fprintf(stderr, "%s\n", KMVIEW_DESC); fprintf(stderr, "Copyright (C) %s\n", KMVIEW_COPYRIGHT); if (verbose) fprintf(stderr, "Development team:\n%s\n", KMVIEW_TEAM); fprintf(stderr, "%s\n\n", KMVIEW_URL); return; } static void usage(char *s) { version(0); fprintf(stderr, "Usage: %s [OPTION] ... command [args]\n" " -h, --help print this help message\n" " -v, --version show version information\n" " -q, --quiet suppress some additional output\n" " -V name, --viewname name set the view name\n" " -f file, --rc file set rc file\n" " -p file, --preload file load plugin named `file' (must be a .so)\n" #ifdef GDEBUG_ENABLED " -o file, --output file send debug messages to file instead of stderr\n" #endif " -x, --nonesting do not permit module nesting\n" " -u, --userrecursion recursive invocation on the existing hypervisor\n" " -s, --secure force permissions and capabilities\n", s); exit(0); } static struct option long_options[] = { {"preload",1,0,'p'}, #ifdef GDEBUG_ENABLED {"output",1,0,'o'}, #endif {"version",0,0,'v'}, {"quiet",0,0,'q'}, {"viewname",1,0,'V'}, {"help",0,0,'h'}, {"nonesting",0,0,'x'}, {"userrecursion",0,0,'u'}, {"secure",0,0,'s'}, {0,0,0,0} }; /* pure_libc loading (by reloading the entire kmview) */ static void load_it_again(int argc,char *argv[],int login) { int nesting=1; optind=1; while (1) { int c; int option_index = 0; /* some options must be parsed before reloading */ c = getopt_long(argc, argv, OPTSTRING, long_options, &option_index); if (c == -1) break; switch (c) { case 'h': usage(basename(argv[0])); break; case 'v': version(1); exit(0); break; case 'x': /* do not use pure_libc */ nesting=0; break; } } if (nesting) { char *path; void *handle; /* does pure_libc exist ? */ if ((handle=dlopen("libpurelibc.so",RTLD_LAZY))!=NULL) { dlclose(handle); /* get the executable from /proc */ asprintf(&path,"/proc/%d/exe",getpid()); /* preload the pure_libc library */ setenv("LD_PRELOAD","libpurelibc.so",1); /* reload the executable with a leading - */ if (login) argv[0]="--kmview-login"; else argv[0]="--kmview"; execv(path,argv); /* useless cleanup */ free(path); } } } #ifdef KMVIEW_USER_NESTING /* recursive kmview invocation (umview started inside a umview machine) */ static void kmview_recursive(int argc,char *argv[]) { char *rcfile=NULL; if (argc < 2) { usage(argv[0]); exit(1); } optind=1; while (1) { int c; int option_index = 0; c = getopt_long(argc, argv, OPTSTRING, long_options, &option_index); if (c == -1) break; switch (c) { case 'h': usage(argv[0]); break; case 'q': quiet = 1; break; case 'v': version(1); exit(0); break; case 'f': rcfile=strdup(optarg); break; case 'V': viewname=strdup(optarg); break; case 'p': preadd(&prehead,optarg); break; } } if (!quiet) fprintf(stderr,"KMView: nested invocation\n\n"); if (rcfile==NULL) asprintf(&rcfile,"%s/%s",getenv("HOME"),".viewosrc"); capture_execrc("/etc/viewosrc","nested"); if (rcfile != NULL && *rcfile != 0) capture_execrc(rcfile,"nested"); do_preload_recursive(prehead); do_set_viewname_recursive(viewname); /* exec the process */ execvp(*(argv+optind),argv+optind); exit(-1); } static int test_recursion(int argc,char *argv[]) { int userrecursion=0; optind=1; while (1) { int c; int option_index = 0; c = getopt_long(argc, argv, OPTSTRING, long_options, &option_index); if (c == -1) break; switch (c) { case 'u': userrecursion = 1; break; } } return userrecursion; } #endif static void root_process_init() { capture_nested_init(); setenv("_INSIDE_VIEWOS_MODULE","",1); do_preload(prehead); do_set_viewname(viewname); } #define PROGNAME "kmview" #include /* KMVIEW MAIN PROGRAM */ int main(int argc,char *argv[]) { char *rcfile=NULL; /*loginshell is true if this execution is driven by a login shell (maybe indirectly: main restarted from /etc/viewospasswd or reloaded for purelibc) */ int loginshell=isloginshell(argv[0]); /* login shell? (directly from /etc/passwd) */ if (argc == 1 && argv[0][0] == '-' && argv[0][1] != '-') loginshell_view(); if (argc < 2) /* NO ARGS */ { usage(PROGNAME); exit(1); } /* try to set the priority to -11 provided umview has been installed * setuid. it is effectiveless elsewhere */ r_setpriority(PRIO_PROCESS,0,-11); /* if it was setuid, return back to the user status immediately, * for safety! */ r_setuid(getuid()); /* Check these cases only when *not* reloaded for purelibc */ if (strncmp(argv[0],"--kmview",8)!=0) { /* if this is a nested invocation of umview, notify the umview monitor * and execute the process, * try the nested invocation notifying virtual syscall, * if it succeeded it is actually a nested invocation, * otherwise nobody is notified and the call fails*/ #ifdef KMVIEW_USER_NESTING if (test_recursion(argc,argv)) { if (int_virnsyscall(__NR_UM_SERVICE,1,RECURSIVE_VIEWOS,0,0,0,0,0) >= 0) kmview_recursive(argc,argv); /* do not return!*/ } #endif /* umview loads itself twice if there is pure_libc, to trace module * generated syscalls, this condition manages the first call */ load_it_again(argc,argv,loginshell); /* do not return (when purelibc and not -x)!*/ } /* does this kernel provide pselect? */ /*has_pselect=has_pselect_test();*/ optind=1; /* set up the scdtab */ scdtab_init(); /* test the ptrace support */ /* option management */ while (1) { int c; int option_index = 0; c = getopt_long(argc, argv, OPTSTRING, long_options, &option_index); if (c == -1) break; switch (c) { case 'h': /* help */ usage(PROGNAME); break; case 'v': /* version */ version(1); exit(0); break; case 'V': viewname=strdup(optarg); break; /* XXX todo preload */ case 'p': /* module preload, here the module requests are just added to a data structure */ preadd(&prehead,optarg); break; case 'f': rcfile=strdup(optarg); break; case 'q': quiet = 1; break; case 's': secure = 1; break; #ifdef GDEBUG_ENABLED case 'o': /* debugging output file redirection */ { if (optarg==NULL){ fprintf(stderr, "%s: must specify an argument after -o\n",argv[0]); break; } gdebug_set_ofile(optarg); } break; #endif } } if (!quiet) { fprintf(stderr, "Kmview: %s\nver: %s\n\n",KMVIEW_DESC,PACKAGE_VERSION); } if (rcfile==NULL && !isloginshell(argv[0])) asprintf(&rcfile,"%s/%s",getenv("HOME"),".viewosrc"); sigset_t unblockchild; sigprocmask(SIG_BLOCK,NULL,&unblockchild); pcb_inits(0); if (quiet) { setenv("_VIEWOS_QUIET","1",1); printk_current_level = PRINTK_QUIET_LEVEL; /* warnings or errors only */ } if (capture_main(argv+optind,root_process_init,rcfile) < 0) { printk("Kmview: kernel module not loaded\n"); exit(1); } mp_add(kmviewfd,POLLIN,tracehand,NULL,1); GDEBUG(3,"ENTERING %d ",kmviewfd); do { mp_ppoll(&unblockchild); } while (nprocs>0); pcb_finis(0); return first_child_exit_status; } umview-0.8.2/xmview/pcb.c0000644000175000017500000000426211753517211014347 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * pcb.c: merge pcb.* files to create the View-OS process control block * * Copyright 2007 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include "pcb.h" voidf #define _PCB_CONSTRUCTOR #include "pcb-all.h" #undef _PCB_CONSTRUCTOR #define _PCB_DESTRUCTORS #include "pcb-all.h" #undef _PCB_DESTRUCTORS dummy; static voidfun constructors[] = { #define _PCB_CONSTRUCTOR #include "pcb-all.h" #undef _PCB_CONSTRUCTOR }; #define NCONSTRUCTORS sizeof(constructors)/sizeof(voidfun) static voidfun destructors[] = { #define _PCB_DESTRUCTOR #include "pcb-all.h" #undef _PCB_DESTRUCTOR }; #define NDESTRUCTORS sizeof(destructors)/sizeof(voidfun) static voidfun inits[] = { #define _PCB_INITS #include "pcb-all.h" #undef _PCB_INITS }; #define NINITS sizeof(inits)/sizeof(voidfun) static voidfun finis[] = { #define _PCB_FINIS #include "pcb-all.h" #undef _PCB_FINIS }; #define NFINIS sizeof(finis)/sizeof(voidfun) void pcb_constructor(struct pcb *pcb,int flags,int npcbflag) { register int i; for (i=0;i=0;i--) destructors[i](pcb,flags,npcbflag); } void pcb_inits(int flags) { register int i; for (i=0;i=0;i--) finis[i](flags); } umview-0.8.2/xmview/umbinwrap.c0000644000175000017500000000635011753517211015607 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * umbinwrap.c: wrapper for executables. In ViewOS "execve" executes * this program. * If mmap does not work for the executable (it is the case of some * virtual file systems) it copies the executable and uses a watchdog * process to clean up the copy when the execution terminates. * * Copyright 2007 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include #include /* return value: 0=the file is mmapable, 1 otherwise */ static int mmap_not_ok(char *path) { int fd=open(path,O_RDONLY); if (fd >= 0) { void *tmp; int rv; tmp=mmap(0,4,PROT_NONE,MAP_PRIVATE,fd,0); rv=(tmp == MAP_FAILED); close(fd); return rv; } else return 0; } /* filecopy copies a file as a tmp file */ char *filecopy(char *from) { char buf[BUFSIZ]; int fdf,fdt; int n; static char tempbin[]="/tmp/.umbinfmtXXXXXX"; mode_t oldmask=umask(0077); fdt=mkstemp(tempbin); umask(oldmask); if (fdt < 0) return NULL; if ((fdf=open(from,O_RDONLY,0)) < 0) return NULL; while ((n=read(fdf,buf,BUFSIZ)) > 0) write (fdt,buf,n); close(fdf); fchmod (fdt,0700); close (fdt); return tempbin; } int execv_nommap(char *cmd,char *argv[]) { char *tempbin=filecopy(argv[1]); char templock[]="/tmp/.umbinfmtlockXXXXXX"; int fdlock=mkstemp(templock); int pid; argv[1]=tempbin; if (tempbin == NULL || fdlock < 0) return -1; else { lockf(fdlock,F_LOCK,0); unlink(templock); if ((pid=fork()) > 0) execv(cmd,argv); else if (pid==0) { /* watchdog process: if it takes the lock it means that * the parent process has exited */ lockf(fdlock,F_LOCK,0); unlink(tempbin); close(fdlock); } else return -1; return 0; } } int main(int argc,char* argv[]) { char *s=argv[0]; char sep=*s; char *cmd; char **newargv=alloca((argc+3)*sizeof(char *)); int i; int sargc=0; *s=0; for(i=1;s[i]!=0;i++) { if (s[i-1]==0) newargv[sargc++]=s+i; if (s[i]==sep) s[i]=0; } cmd=newargv[0]; if (sargc>3) { newargv[0]=newargv[3]; sargc=3; } if (*newargv[1] == 0) { newargv[1]=newargv[2]; sargc--; } sargc--; for (i=1;i #define LIBC_VFORK_DIRTY_TRICKS #define _KERNEL_NSIG 64 #define _KERNEL_SIGSET_SIZE _KERNEL_NSIG/8 // asm-x86_64/ptrace.h declare this as offset in bytes (and I don't want so) //registers as mapped in x_86_64 kernel // syscall argument are in inverted order!!!!!! (from RDI to R11 ! ) // ( sgrunt !! ) #define R15 0 #define R14 1 //8 #define R13 2 //16 #define R12 3 //24 #define RBP 4 //32 #define RBX 5 //40 #define R11 6 //48 #define R10 7 // 56 #define R9 8 //64 #define R8 9 //72 #define RAX 10 //80 #define RCX 11 //88 #define RDX 12 //96 #define RSI 13 //104 #define RDI 14 //112 #define ORIG_RAX 15 //120 /* = ERROR */ #define RIP 16 //128 #define CS 17 //136 #define EFLAGS 18 //144 #define RSP 19 //152 #define SS 20 //160 #define ARGOFFSET R11 // remapped registers: /* * Register setup: * system call number rax * + arg 1 rdi * + arg 2 rsi * + arg 3 rdx * + arg 4 r10 * + arg 5 r8 * + arg 6 r9 */ #define MY_RDI 0 //112 #define MY_RSI 1 //104 #define MY_RDX 2 //96 /* #define MY_RCX 3 //88 #define MY_RAX 4 //80 #define MY_R8 5 //72 #define MY_R9 6 //64 #define MY_R10 7 // 56 */ #define MY_R10 3 #define MY_R8 4 #define MY_R9 5 #define MY_RCX 6 #define MY_RAX 7 #define MY_R11 8 //48 #define MY_RBX 9 //40 #define MY_RBP 10//32 #define MY_R12 11//24 #define MY_R13 12//16 #define MY_R14 13//8 #define MY_R15 14 #define MY_ORIG_RAX 15 //120 /* = ERROR */ #define MY_RIP 16 //128 #define MY_CS 17 //136 #define MY_EFLAGS 18 //144 #define MY_RSP 19 //152 #define MY_SS 20 //160 #define MY_ARGOFFSET 0 #define FS_BASE 21 #define GS_BASE 22 #define DS 23 #define ES 24 #define FS 25 #define GS 26 // arguments in x86_64 are saved in order from RDI to R8 // orig_rax contains syscall number // and rax (i think...) contains return value and errno // for stack pointer -> RSP // for instruction pointer -> RIP static inline long getregs(struct pcb *pc) { struct user_regs_struct temp; long rv = r_ptrace(PTRACE_GETREGS, pc->pid,NULL,(void*) &temp); pc->saved_regs[MY_RDI] = temp.rdi; pc->saved_regs[MY_RSI] = temp.rsi; pc->saved_regs[MY_RDX] = temp.rdx; pc->saved_regs[MY_RCX] = temp.rcx; pc->saved_regs[MY_RAX] = temp.rax; pc->saved_regs[MY_R8] = temp.r8; pc->saved_regs[MY_R9] = temp.r9; pc->saved_regs[MY_R10] = temp.r10; pc->saved_regs[MY_R11] = temp.r11; pc->saved_regs[MY_RBX] = temp.rbx; pc->saved_regs[MY_RBP] = temp.rbp; pc->saved_regs[MY_R12] = temp.r12; pc->saved_regs[MY_R13] = temp.r13; pc->saved_regs[MY_R14] = temp.r14; pc->saved_regs[MY_R15] = temp.r15; pc->saved_regs[MY_ORIG_RAX] = temp.orig_rax; pc->saved_regs[MY_RIP] = temp.rip; pc->saved_regs[MY_CS] = temp.cs; pc->saved_regs[MY_EFLAGS] = temp.eflags; pc->saved_regs[MY_RSP] = temp.rsp; pc->saved_regs[MY_SS] = temp.ss; pc->saved_regs[FS_BASE] = temp.fs_base; pc->saved_regs[GS_BASE] = temp.gs_base; pc->saved_regs[DS] = temp.ds; pc->saved_regs[ES] = temp.es; pc->saved_regs[FS] = temp.fs; pc->saved_regs[GS] = temp.gs; return rv; } static inline long setregs(struct pcb *pc, enum __ptrace_request call, long op, long sig) { struct user_regs_struct temp; temp.rdi = pc->saved_regs[MY_RDI]; temp.rsi = pc->saved_regs[MY_RSI]; temp.rdx = pc->saved_regs[MY_RDX]; temp.rcx = pc->saved_regs[MY_RCX]; temp.rax = pc->saved_regs[MY_RAX]; temp.r8 = pc->saved_regs[MY_R8]; temp.r9 = pc->saved_regs[MY_R9]; temp.r10 = pc->saved_regs[MY_R10]; temp.r11 = pc->saved_regs[MY_R11]; temp.rbx = pc->saved_regs[MY_RBX]; temp.rbp = pc->saved_regs[MY_RBP]; temp.r12 = pc->saved_regs[MY_R12]; temp.r13 = pc->saved_regs[MY_R13]; temp.r14 = pc->saved_regs[MY_R14]; temp.r15 = pc->saved_regs[MY_R15]; temp.orig_rax = pc->saved_regs[MY_ORIG_RAX]; temp.rip = pc->saved_regs[MY_RIP]; temp.cs = pc->saved_regs[MY_CS]; temp.eflags = pc->saved_regs[MY_EFLAGS]; temp.rsp = pc->saved_regs[MY_RSP]; temp.ss = pc->saved_regs[MY_SS]; temp.fs_base = pc->saved_regs[FS_BASE]; temp.gs_base = pc->saved_regs[GS_BASE]; temp.ds = pc->saved_regs[DS]; temp.es = pc->saved_regs[ES]; temp.fs = pc->saved_regs[FS]; temp.gs = pc->saved_regs[GS]; if (has_ptrace_multi) { struct ptrace_multi req[] = { {PTRACE_SETREGS, 0, (void *) &temp, 0}, {call, op, (void*) sig, 0}}; return r_ptrace(PTRACE_MULTI, pc->pid, req, 2); } else { int rv; rv = r_ptrace(PTRACE_SETREGS, pc->pid, NULL, (void*) &temp); if (rv == 0) rv = r_ptrace(call, pc->pid, op, sig); return rv; } } #define getargp(PC) ((long*)(PC)->saved_regs[MY_RDI]) #define printregs(PC) // empty for a while... :P #define getscno(PC) ( (PC)->saved_regs[MY_ORIG_RAX] ) #define putscno(X,PC) ( (PC)->saved_regs[MY_ORIG_RAX]=(X) ) #define getargn(N,PC) ( (PC)->saved_regs[(N)] ) #define putargn(N,X,PC) ( (PC)->saved_regs[(N)]=(X) ) #define getrv(PC) ({ long rax; \ rax = (PC)->saved_regs[MY_RAX];\ (rax<0 && -rax < MAXERR)? -1 : rax; }) #define putrv(RV,PC) ( (PC)->saved_regs[MY_RAX]=(RV), 0 ) #define puterrno(ERR,PC) (((ERR)!=0 && (PC)->retval==-1) ? \ (PC)->saved_regs[MY_RAX]=-((long)(ERR)) : 0 ) #define puterrno0(PC) #define getsp(PC) ( (PC)->saved_regs[MY_RSP] ) #define getpc(PC) ( (PC)->saved_regs[MY_RIP] ) #define putsp(RV,PC) ( (PC)->saved_regs[MY_RSP]=(RV) ) #define putpc(RV,PC) ( (PC)->saved_regs[MY_RIP]=(RV) ) #define LITTLEENDIAN #define LONG_LONG(_l,_h) \ ((long long)((unsigned long long)(unsigned)(_l) | ((unsigned long long)(_h)<<32))) #define MAXERR 4096 #if 0 // let's help vim autoindent :-P } #endif // amd64 syscall stuff // TODO: think how i can solve this problem... :( #define __NR_socketcall __NR_doesnotexist #define __NR__newselect __NR_doesnotexist #define __NR_umount __NR_doesnotexist #define __NR_stat64 __NR_doesnotexist #define __NR_lstat64 __NR_doesnotexist #define __NR_fstat64 __NR_doesnotexist #undef __NR_chown32 #define __NR_chown32 __NR_doesnotexist #undef __NR_lchown32 #define __NR_lchown32 __NR_doesnotexist #undef __NR_fchown32 #define __NR_fchown32 __NR_doesnotexist #define __NR_fcntl64 __NR_doesnotexist #define __NR__llseek __NR_doesnotexist #define __NR_truncate64 __NR_doesnotexist #define __NR_ftruncate64 __NR_doesnotexist #define __NR_send __NR_doesnotexist #define __NR_recv __NR_doesnotexist #define __NR_statfs64 __NR_doesnotexist #define __NR_fstatfs64 __NR_doesnotexist #define __NR_nice __NR_doesnotexist #define __NR_mmap2 __NR_doesnotexist /* XXX: should we find a more elegant solution? */ #define wrap_in_statfs64 NULL #define wrap_in_fstatfs64 NULL #define wrap_in_stat wrap_in_stat64 #define wrap_in_fstat wrap_in_fstat64 #define __NR_setpgrp __NR_doesnotexist #endif // _DEFS_X86_64 umview-0.8.2/xmview/loginshell.h0000644000175000017500000000047211753517211015747 0ustar renzorenzo#ifndef _LOGINSHELL #define _LOGINSHELL #include #define LOGIN_SHELL_ARG0 "viewos-login" void loginshell_view(void); static inline int isloginshell(const char *argv0) { int len=strlen(argv0); /* argv0 has a -login suffix */ return(len>6 && strcmp(argv0+(len-6),LOGIN_SHELL_ARG0+6) == 0); } #endif umview-0.8.2/xmview/kmview.h0000644000175000017500000001136311753517211015112 0ustar renzorenzo#ifndef _KMVIEW_H #define _KMVIEW_H /* * kmview data structures * * Copyright (C) 2007 Andrea Gasparini (gaspa@yattaweb.it), * Renzo Davoli (renzo@cs.unibo.it) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Due to this file being licensed under the GPL there is controversy over * whether this permits you to write a module that #includes this file * without placing your module under the GPL. Please consult a lawyer for * advice before doing this. * */ #include #define KMVIEW_EVENT_NONE 0x00 #define KMVIEW_EVENT_NEWTHREAD 0x01 #define KMVIEW_EVENT_TERMTHREAD 0x02 #define KMVIEW_EVENT_SYSCALL_ENTRY 0x10 #define KMVIEW_EVENT_SOCKETCALL_ENTRY 0x11 #define KMVIEW_EVENT_SYSCALL_EXIT 0x20 struct kmview_event { unsigned long tag; union { struct kmview_event_newthread{ pid_t kmpid; pid_t pid; pid_t umppid; unsigned long flags; } newthread; struct kmview_event_termthread{ pid_t umpid; unsigned long remaining; } termthread; struct kmview_event_ioctl_syscall{ union { pid_t umpid; pid_t kmpid; unsigned long just_for_64bit_alignment; } x; unsigned long scno; unsigned long args[6]; unsigned long pc; unsigned long sp; } syscall; #ifdef __NR_socketcall struct kmview_event_socketcall{ union { pid_t umpid; unsigned long just_for_64bit_alignment; } x; unsigned long scno; unsigned long args[6]; unsigned long pc; unsigned long sp; unsigned long addr; } socketcall; #endif struct kmview_event_ioctl_sysreturn{ union { pid_t umpid; pid_t kmpid; unsigned long just_for_64bit_alignment; } x; long retval; long erno; } sysreturn; } x; }; struct kmview_ioctl_umpid { pid_t kmpid; pid_t umpid; }; struct kmview_ioctl_data { pid_t kmpid; long addr; int len; void *localaddr; }; struct kmview_magicpoll { long magicpoll_addr; long magicpoll_cnt; }; struct kmview_fd { pid_t kmpid; int fd; }; #define GH_SIZE 64 #define GH_TERMINATE 255 #define GH_DUMMY 254 struct ghosthash64 { unsigned char deltalen[GH_SIZE]; unsigned int hash[GH_SIZE]; }; #define KMVIEW_FLAG_SOCKETCALL 0x1 #define KMVIEW_FLAG_FDSET 0x2 #define KMVIEW_FLAG_EXCEPT_CLOSE 0x4 #define KMVIEW_FLAG_EXCEPT_FCHDIR 0x8 #define KMVIEW_FLAG_PATH_SYSCALL_SKIP 0x10 #define KMVIEW_GET_VERSION _IO('v', 1) #define KMVIEW_SET_FLAGS _IO('v', 2) #define KMVIEW_MAGICPOLL _IOR('v', 3, struct kmview_magicpoll) #define KMVIEW_ATTACH _IO('v', 4) #define KMVIEW_UMPID _IOR('v', 5, struct kmview_ioctl_umpid) #define KMVIEW_GET_FLAGS _IO('v', 6) #define KMVIEW_SYSRESUME _IO('v', 10) #define KMVIEW_SYSVIRTUALIZED _IOR('v', 11, struct kmview_event_ioctl_sysreturn) #define KMVIEW_SYSMODIFIED _IOR('v', 12, struct kmview_event_ioctl_syscall) #define KMVIEW_SYSRETURN _IOR('v', 13, struct kmview_event_ioctl_sysreturn) #define KMVIEW_SYSARGMOD _IOR('v', 14, struct kmview_event_ioctl_syscall) #define KMVIEW_READDATA _IOR('v', 20, struct kmview_ioctl_data) #define KMVIEW_READSTRINGDATA _IOR('v', 21, struct kmview_ioctl_data) #define KMVIEW_WRITEDATA _IOR('v', 22, struct kmview_ioctl_data) #define KMVIEW_ADDFD _IOR('v', 30, struct kmview_fd) #define KMVIEW_DELFD _IOR('v', 31, struct kmview_fd) #define KMVIEW_SYSCALLBITMAP _IOR('v', 40, unsigned int) #define KMVIEW_SET_CHROOT _IO('v', 41) #define KMVIEW_CLR_CHROOT _IO('v', 42) #define KMVIEW_GHOSTMOUNTS _IOR('v', 43, struct ghosthash64) #define MAXSYSCALL 384 #define INT_PER_MAXSYSCALL (MAXSYSCALL / (sizeof(unsigned int) * 8)) #define SYSCALLBITMAPEL(x) ((x) >> 5) #define SYSCALLBITMAPOFF(x) ((x)&0x1f) static inline unsigned int scbitmap_isset(unsigned int *bitmap,int scno) { if (scno < MAXSYSCALL) return bitmap[SYSCALLBITMAPEL(scno)] & 1<deltalen[0] = GH_TERMINATE; } #endif umview-0.8.2/xmview/capture.h0000644000175000017500000000221211753517211015244 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * capture.h: wrapper for um/km versions of capture.h * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: capture.h 394 2007-09-18 07:23:01Z rd235 $ * */ #ifndef _CAPTURE_H #define _CAPTURE_H #if defined _VIEWOS_KM # include "capture_km.h" #elif defined _VIEWOS_UM # include "capture_um.h" #else # error "Undefined mode (UM/KM)" #endif #endif umview-0.8.2/xmview/pcb.h0000644000175000017500000000205311753517211014350 0ustar renzorenzo#ifndef _PCB_H #define _PCB_H #include #include #include #include #include #include "treepoch.h" #if defined(__powerpc__) //setregs/getresg for ppc #define FRAME_SIZE 13 #elif defined(__x86_64__) // asm-x86_64 define it as 168 [offset in bytes] ! #define VIEWOS_FRAME_SIZE 28 #endif #ifndef VIEWOS_FRAME_SIZE #define VIEWOS_FRAME_SIZE FRAME_SIZE #endif typedef void (*voidfun)(); typedef void voidf(); #define _PCB_DEFINITIONS #include "pcb-all.h" #undef _PCB_DEFINITIONS struct pcb { #define _PCB_COMMON_FIELDS #include "pcb-all.h" #undef _PCB_COMMON_FIELDS #define _PCB_ONLY_FIELDS #include "pcb-all.h" #undef _PCB_ONLY_FIELDS }; struct npcb { #define _PCB_COMMON_FIELDS #include "pcb-all.h" #undef _PCB_COMMON_FIELDS #define _NPCB_ONLY_FIELDS #include "pcb-all.h" #undef _NPCB_ONLY_FIELDS }; void pcb_constructor(struct pcb *pcb,int flags,int npcbflag); void pcb_destructor(struct pcb *pcb,int flags,int npcbflag); void pcb_inits(int flags); void pcb_finis(int flags); #endif umview-0.8.2/xmview/hashtab.c0000644000175000017500000005065511753517211015224 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * hashtab.c: main hash table * * Copyright 2009 Renzo Davoli University of Bologna - Italy * Credit: some ideas were tested on a preliminary version by * Marcello Stanisci. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include "hashtab.h" static void ht_nullcall(int tag, unsigned char type,const void *obj,int objlen,long mountflags); static void (*ht_upcall)(int, unsigned char,const void *,int,long)=ht_nullcall; /* struct ht_elem: @obj: hash key @mtabline: mount tab line @type: type (see CHECK* in services.c) @trailingnumbers: boolean, match pathnames with trailing numbers @invalid: boolean, the element is logially deleted @service: service associated to this item @private_data: opaque container for module data @objlen: len of the hash key @hashsum: hash sum for quick negative matching @count: usage count @confirmfun: confirmation function for exceptions @prev/next/pprevhash,nexthash: addresses for list linking */ struct ht_elem { void *obj; char *mtabline; unsigned long mountflags; struct timestamp tst; unsigned char type; unsigned char trailingnumbers; unsigned char invalid; struct service *service; struct ht_elem *service_hte; void *private_data; int objlen; long hashsum; int count; confirmfun_t confirmfun; struct ht_elem *prev,*next,**pprevhash,*nexthash; }; /* it must be a power of two (masks are used instead of modulo) */ #define MNTTAB_HASH_SIZE 512 #define MNTTAB_HASH_MASK (MNTTAB_HASH_SIZE-1) static struct ht_elem *ht_hash[MNTTAB_HASH_SIZE]; static struct ht_elem *ht_hash0[NCHECKS]; static struct ht_elem *ht_head[NCHECKS]; //static struct ht_elem *ht_free; static pthread_rwlock_t ht_tab_rwlock = PTHREAD_RWLOCK_INITIALIZER; /* alloc/free of ht_elem */ static inline struct ht_elem *ht_tab_alloc() { return (struct ht_elem *)malloc(sizeof (struct ht_elem)); } static inline void ht_tab_free(struct ht_elem *ht) { free(ht->obj); if (ht->mtabline) free(ht->mtabline); free(ht); } /* hash function */ /* hash sum and mod are separate functions: hash sums are used to quicly elimiate false positives, intermediate results can be completed during the scan */ static inline long hashadd (long prevhash, char c) { return prevhash ^ ((prevhash << 5) + (prevhash >> 2) + c); } static inline int hashmod (long hashsum) { return hashsum & MNTTAB_HASH_MASK; } static inline long hashsum (unsigned char type,const char *c,int len) { long sum=type; int i; for (i=0;iconfirmfun != NULL); } struct carrot { struct ht_elem *elem; epoch_t time; struct carrot *next; }; static struct carrot *carrot_fhead; static inline struct carrot *carrot_alloc(void) { struct carrot *rv=NULL; if (carrot_fhead != NULL) { rv=carrot_fhead; carrot_fhead=rv->next; rv->next=NULL; } else /* XXX maybe we can allocate groups of carrot elems */ rv=malloc(sizeof(struct carrot)); return rv; } static void carrot_free(struct carrot *old) { if (old != NULL) { struct carrot *scan; for (scan=old;scan->next!=NULL;scan=scan->next) ; scan->next=carrot_fhead; carrot_fhead=old; } } static struct carrot *carrot_insert(struct carrot *head, struct ht_elem *elem, epoch_t time) { if (head==NULL || /* empty carrot */ head->time < time) { /* this is newer */ if (head==NULL || ht_elem_has_exceptions(elem)) { struct carrot *rv; rv=carrot_alloc(); rv->elem=elem; rv->time=time; rv->next=head; return rv; } else { head->elem=elem; head->time=time; carrot_free(head->next); head->next=NULL; return head; } } else { if (ht_elem_has_exceptions(head->elem)) head->next=carrot_insert(head->next,elem,time); return head; } } static struct carrot *carrot_delete(struct carrot *head, struct ht_elem *elem) { if (head==NULL) return NULL; else { if (head->elem==elem) { struct carrot *tail=head->next; head->next=NULL; carrot_free(head); return tail; } else { head->next=carrot_delete(head->next,elem); return head; } } } /* true if there are only trailing numbers (and there is at least one) */ /* View-OS permits "mount" of things like /dev/hda[0-9]* */ static inline int trailnum(char *s) { /* "at least one" the first element needs a special case. performance: >'9' is the most frequent case, <'0' are quite rare in pathnames, the end of string is more common */ if (*s > '9' || *s == 0 || *s < '0') return 0; for (s++;*s;s++) if (*s > '9' || *s < '0') return 0; return 1; } /* during the scan: search in the hash table if this returns 1 */ static inline int ht_scan_stop(unsigned char type, char *objc, int len, int exact) { switch (type) { case CHECKPATH: return (*objc == 0 /* this is the end of a string */ || (!exact /* or when subtring match are allowed */ && (*objc=='/' /* test the match if the current char is '/' */ /* or if there are trailing numbers e.g. /dev/hda1, hda2 etc */ || trailnum(objc)))); case CHECKBINFMT: return (*objc == 0 /* this is the end of a string */ || (!exact /* or when subtring match are allowed */ && *objc=='/')); /* test the match if the current char is '/' */ case CHECKSOCKET: case CHECKCHRDEVICE: case CHECKBLKDEVICE: case CHECKSC: /* array of int, or null keys */ return ((len % sizeof(int))==0); case CHECKFSALIAS: /* end of string */ return (*objc == 0); case CHECKMODULE: if (exact) return (*objc == 0); else return 1; /* CHECKFSTYPE char by char */ default: return 0; } } /* terminate the scan */ static inline int ht_scan_terminate(unsigned char type, char *objc, int len, int objlen) { switch (type) { case CHECKPATH: case CHECKBINFMT: case CHECKFSALIAS: case CHECKMODULE: return (*objc == 0); case CHECKSOCKET: case CHECKCHRDEVICE: case CHECKBLKDEVICE: case CHECKSC: return (len==objlen); default: return 0; } } static inline int call_confirmfun(int (*confirmfun)(),unsigned char type,void *checkobj,int len,struct ht_elem *ht) { epoch_t epoch=um_setnestepoch(ht->tst.epoch); struct ht_elem *ht_old=um_mod_get_hte(); um_mod_set_hte(ht); int rv=confirmfun(type,checkobj,len,ht); um_setnestepoch(epoch); if (rv == 0) um_mod_set_hte(ht_old); return rv; } /* unified search, specific searches are defined in hashtab.h as inline functions (for performance) */ static struct ht_elem *ht_tab_internal_search(unsigned char type, void *obj, int objlen, void *checkobj, struct timestamp *tst, int exact) { struct ht_elem *rv=NULL; char *objc=obj; long sum=type; long hash; struct carrot *carh=NULL; struct ht_elem *ht; int len=0; pthread_rwlock_rdlock(&ht_tab_rwlock); while (1) { if (ht_scan_stop(type, objc, len, exact)) { hash=hashmod(sum); ht=(len)?ht_hash[hash]:ht_hash0[type]; /* if (type== XXXXXX ) printk("CHECK %s %ld %d %p\n",obj,sum,hash,ht); */ while (ht != NULL) { epoch_t e; /* if (type== XXXXXXX && type==ht->type) printk("CHECK %s %s\n",obj,ht->obj); */ if (type==ht->type && sum==ht->hashsum && (ht->objlen >= len) && memcmp(obj,ht->obj,len)==0 && (ht->trailingnumbers || !trailnum(objc)) && (tst->epoch > ht->tst.epoch) && (e=tst_matchingepoch(&(ht->tst))) > 0 && (ht->invalid == 0)) { /*carrot add*/ if (ht->confirmfun == NEGATIVE_MOUNT) carh=carrot_delete(carh, ht->private_data); else carh=carrot_insert(carh, ht, e); } ht=ht->nexthash; } if (ht_scan_terminate(type, objc, len, objlen)) break; } sum=hashadd(sum,*objc); objc++; len++; } if (carh != NULL) { struct carrot *curcar=carh; for (curcar=carh; curcar!=NULL;curcar=curcar->next) { ht=curcar->elem; if (ht->confirmfun==NULL || call_confirmfun(ht->confirmfun,type,checkobj,len,ht)) break; } if (curcar != NULL) rv=curcar->elem; carrot_free(carh); } pthread_rwlock_unlock(&ht_tab_rwlock); /*printk("ht_tab_search %s %p\n",(char *)obj,rv);*/ return rv; } static inline struct ht_elem *ht_tab_pathsearch(unsigned char type, void *obj, struct timestamp *tst, int exact) { return ht_tab_internal_search(type,obj,0,obj,tst,exact); } static inline struct ht_elem *ht_tab_binfmtsearch(unsigned char type, struct binfmt_req *req, struct timestamp *tst, int exact) { return ht_tab_internal_search(type,req->path,0,req,tst,exact); } static inline struct ht_elem *ht_tab_search(unsigned char type, void *obj, int objlen, struct timestamp *tst, int exact) { return ht_tab_internal_search(type,obj,objlen,obj,tst,exact); } /* for debugging: otherwise strings are not null terminated, so cannot be printed*/ #if 0 static inline int ht_is_obj_string(unsigned char type) { switch (type) { case CHECKPATH: case CHECKFSTYPE: case CHECKFSALIAS: case CHECKMODULE: return 1; default: return 0; } } #endif /* during normal operation it is safe to keep strings without the final NULL */ #define ht_is_obj_string(X) 0 /* generic add of ht element */ static struct ht_elem *internal_ht_tab_add(unsigned char type, const void *obj, int objlen, unsigned long mountflags, char *mtabline, struct service *service, unsigned char trailingnumbers, confirmfun_t confirmfun, void *private_data) { struct ht_elem *new=ht_tab_alloc(); assert(type < NCHECKS); if (new) { if ((new->obj=malloc(objlen+ht_is_obj_string(type))) != NULL) { struct ht_elem **hashhead; memcpy(new->obj,obj,objlen+ht_is_obj_string(type)); new->objlen=objlen; new->type=type; new->mountflags=mountflags; new->mtabline=mtabline; new->tst=tst_timestamp(); new->trailingnumbers=trailingnumbers; new->invalid=0; new->private_data=private_data; new->service=service; new->service_hte=NULL; /*lazy*/ new->confirmfun=confirmfun; new->count=0; new->hashsum=hashsum(type,new->obj,new->objlen); if (objlen==0) hashhead=&ht_hash0[type]; else hashhead=&ht_hash[hashmod(new->hashsum)]; pthread_rwlock_wrlock(&ht_tab_rwlock); if (ht_head[type]) { new->next=ht_head[type]->next; new->prev=ht_head[type]; new->next->prev=new; new->prev->next=new; ht_head[type]=new; } else ht_head[type]=new->next=new->prev=new; if (*hashhead) (*hashhead)->pprevhash=&(new->nexthash); new->nexthash=*hashhead; new->pprevhash=hashhead; *hashhead=new; pthread_rwlock_unlock(&ht_tab_rwlock); ht_upcall(HT_ADD,new->type,new->obj,new->objlen,mountflags); return new; } else { free(new); return NULL; } } else return NULL; } /* add a "normal" item to the hash table: (tralingnumbers=1 causes scan to skip the check) */ struct ht_elem *ht_tab_add(unsigned char type,void *obj,int objlen, struct service *service, confirmfun_t confirmfun, void *private_data) { return internal_ht_tab_add(type, obj, objlen, 0, NULL, service, 1, confirmfun, private_data); } static int permanent_mount(const char *opts) { char *match; if (opts==NULL) return 0; return (((match=strstr(opts,"permanent")) != NULL && (match == opts || match[-1]==',') && (match[9] == '\0' || match[9] == ',')) || ((match=strstr(opts,"perm")) != NULL && (match == opts || match[-1]==',') && (match[4] == '\0' || match[4] == ','))); } /* add a path to the hashtable (this creates an entry for the mounttab) */ struct ht_elem *ht_tab_pathadd(unsigned char type, const char *source, const char *path, const char *fstype, unsigned long mountflags, const char *mountopts, struct service *service, unsigned char trailingnumbers, confirmfun_t confirmfun, void *private_data) { char *mtabline; const char *addpath; struct ht_elem *rv; if (source) { char opts[PATH_MAX]; opts[0]=0; if (mountflags & MS_REMOUNT) strncat(opts,"remount,",PATH_MAX); if (mountflags & MS_RDONLY) strncat(opts,"ro,",PATH_MAX); if (mountflags & MS_NOATIME) strncat(opts,"noatime,",PATH_MAX); if (mountflags & MS_NODEV) strncat(opts,"nodev,",PATH_MAX); if (mountflags & MS_NOEXEC) strncat(opts,"noexec,",PATH_MAX); if (mountflags & MS_NOSUID) strncat(opts,"nosuid,",PATH_MAX); if (mountflags & MS_SYNCHRONOUS) strncat(opts,"sync,",PATH_MAX); if (mountopts && *mountopts) strncat(opts,mountopts,PATH_MAX); else if (*opts) opts[strlen(opts)-1]=0; else strncpy(opts,"rw",PATH_MAX); asprintf(&mtabline,"%s%s %s %s %s 0 %lld", (confirmfun==NEGATIVE_MOUNT)?"-":"", source,path,fstype,opts,get_epoch()); } else mtabline=NULL; if (path[1]=='\0' && path[0]=='/') addpath=""; else addpath=path; rv=internal_ht_tab_add(type, addpath, strlen(addpath), mountflags, mtabline, service, trailingnumbers, confirmfun, private_data); if (permanent_mount(mountopts)) rv->count++; if (rv == NULL && mtabline != NULL) free(mtabline); return rv; } /* delete an element from the hash table */ static void ht_tab_del_locked(struct ht_elem *ht) { int type=ht->type; if (ht == ht_head[type]) { if (ht->next == ht) ht_head[type]=NULL; else ht_head[type] = ht->prev; } ht->prev->next=ht->next; ht->next->prev=ht->prev; *(ht->pprevhash)=ht->nexthash; if (ht->nexthash) ht->nexthash->pprevhash=ht->pprevhash; ht_tab_free(ht); } /* invalidate: the hash table element is not searchable. It will be deleted later */ void ht_tab_invalidate(struct ht_elem *ht) { if (ht) ht->invalid=1; } /* delete an element (using a write lock) */ int ht_tab_del(struct ht_elem *ht) { if (ht) { ht_upcall(HT_DEL,ht->type,ht->obj,ht->objlen,ht->mountflags); if (ht->invalid==0 && ht->service && ht->service->destructor) ht->service->destructor(ht->type,ht); pthread_rwlock_wrlock(&ht_tab_rwlock); ht_tab_del_locked(ht); pthread_rwlock_unlock(&ht_tab_rwlock); return 0; } else return -ENOENT; } /* searching API */ struct ht_elem *ht_check(int type, void *arg, struct stat64 *st, int setepoch) { struct ht_elem *hte; int size=0; switch (type) { case CHECKPATH: hte=ht_tab_pathsearch(type, arg, um_x_gettst(), 0); if (st) { if (__builtin_expect(S_ISCHR(st->st_mode),0)) { struct ht_elem *devhte; devhte=ht_tab_search(CHECKCHRDEVICE, &st->st_rdev, sizeof(dev_t), um_x_gettst(),0); if (devhte != NULL) hte=devhte; } else if (__builtin_expect(S_ISBLK(st->st_mode),0)) { struct ht_elem *devhte; devhte=ht_tab_search(CHECKBLKDEVICE, &st->st_rdev, sizeof(dev_t), um_x_gettst(),0); if (devhte != NULL) hte=devhte; } } break; case CHECKPATHEXACT: hte=ht_tab_pathsearch(CHECKPATH, arg, um_x_gettst(), 1); break; case CHECKCHRDEVICE: case CHECKBLKDEVICE: size++; case CHECKSOCKET: case CHECKSC: size++; hte=ht_tab_search(type, arg, size*sizeof(int), um_x_gettst(),0); break; case CHECKFSALIAS: case CHECKMODULE: hte=ht_tab_search(type, arg, 0, um_x_gettst(), 1); break; case CHECKFSTYPE: hte=ht_tab_search(CHECKMODULE, arg, 0, um_x_gettst(), 0); break; case CHECKBINFMT: hte=ht_tab_binfmtsearch(type, arg, um_x_gettst(), 0); break; default: hte=NULL; } if (hte && setepoch) um_setnestepoch(hte->tst.epoch); return hte; } static long errnosys() { errno=ENOSYS; return -1; } int isnosys(sysfun f) { return (f==errnosys); } /* utility functions for sctab wrappers */ sysfun ht_syscall(struct ht_elem *hte, int scno) { if (hte) { struct service *s=hte->service; assert( s != NULL); return (s->um_syscall[scno] == NULL) ? errnosys : s->um_syscall[scno]; } else return NULL; } sysfun ht_socketcall(struct ht_elem *hte, int scno) { if (hte) { struct service *s=hte->service; assert(s != NULL); return (s->um_socket[scno] == NULL) ? errnosys : s->um_socket[scno]; } else return NULL; } sysfun ht_virsyscall(struct ht_elem *hte, int scno) { if (hte) { struct service *s=hte->service; assert( s != NULL ); return (s->um_virsc == NULL || s->um_virsc[scno] == NULL) ? errnosys : s->um_virsc[scno]; } else return NULL; } sysfun ht_ioctlparms(struct ht_elem *hte) { struct service *s=hte->service; assert( s != NULL ); return (s->ioctlparms); } sysfun ht_event_subscribe(struct ht_elem *hte) { struct service *s=hte->service; assert( s != NULL ); return (s->event_subscribe); } /* reverse scan of hash table elements, useful to close all files */ static void forall_ht_terminate(unsigned char type) { pthread_rwlock_rdlock(&ht_tab_rwlock); if (ht_head[type]) { struct ht_elem *scanht=ht_head[type]; struct ht_elem *next=scanht; do { scanht=next; if (scanht->invalid == 0) { if (scanht->service != NULL && scanht->service->destructor != NULL) scanht->service->destructor(type, scanht); } next=scanht->prev; //printk("SCAN %p %p %s\n",next,scanht,scanht->obj); } while (ht_head[type] != NULL && next != ht_head[type]); } pthread_rwlock_unlock(&ht_tab_rwlock); } /* forward scan of all valid ht elems */ void forall_ht_tab_do(unsigned char type, void (*fun)(struct ht_elem *ht, void *arg), void *arg) { pthread_rwlock_rdlock(&ht_tab_rwlock); if (ht_head[type]) { struct ht_elem *scanht=ht_head[type]; do { scanht=scanht->next; if (scanht->invalid == 0) { if (tst_matchingepoch(&(scanht->tst)) > 0) fun(scanht, arg); } //printk("SCAN %p %s\n",scanht,scanht->obj); } while (ht_head[type] != NULL && scanht != ht_head[type]); } pthread_rwlock_unlock(&ht_tab_rwlock); } /* mount table creation */ static void ht_tab_getmtab_add(struct ht_elem *ht, void *arg) { FILE *f=arg; if (ht->mtabline) fprintf(f,"%s\n",ht->mtabline); } void ht_tab_getmtab(FILE *f) { if (f) forall_ht_tab_do(CHECKPATH,ht_tab_getmtab_add,f); } void *ht_get_private_data(struct ht_elem *hte) { if (hte) return hte->private_data; else return NULL; } void ht_set_private_data(struct ht_elem *hte,void *private_data) { if (hte) hte->private_data=private_data; } struct ht_elem *ht_search(int type, void *arg, int objlen, struct service *service) { struct ht_elem *hte=ht_check(type,arg,NULL,0); if (hte && ((objlen > 0 && objlen != hte->objlen) || (service != NULL && service != hte->service))) return NULL; return hte; } void ht_renew(struct ht_elem *hte) { if (hte) hte->tst=tst_timestamp(); } char *ht_get_servicename(struct ht_elem *hte) { if (hte && hte->service) return hte->service->name; else return NULL; } struct service *ht_get_service(struct ht_elem *hte) { if (hte) return hte->service; else return NULL; } unsigned long ht_get_mountflags(struct ht_elem *hte) { if (hte) return hte->mountflags; else return 0; } epoch_t ht_get_epoch(struct ht_elem *hte) { /* this check could be eliminated: this function is always called with hte != NULL */ if (hte) return hte->tst.epoch; else return 0; } void ht_count_plus1(struct ht_elem *hte) { if (hte->service_hte == NULL) { if (hte->service) /*ht_check(CHECKMODULE,hte->service->name,NULL,0);*/ hte->service_hte=ht_tab_search(CHECKMODULE, hte->service->name, 0, um_x_gettst(), 1); } if (hte->service_hte) hte->service_hte->count++; hte->count++; } void ht_count_minus1(struct ht_elem *hte) { if (hte->service_hte) hte->service_hte->count--; hte->count--; } int ht_get_count(struct ht_elem *hte) { return hte->count; } static void ht_nullcall(int tag, unsigned char type,const void *obj,int objlen,long mountflags) { } void ht_init(void (*ht_upcall_def)(int, unsigned char,const void *,int,long)) { if (ht_upcall_def != NULL) ht_upcall=ht_upcall_def; } void ht_terminate(void) { forall_ht_terminate(CHECKPATH); } umview-0.8.2/xmview/mainpoll.c0000644000175000017500000001301511753517211015412 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * Mainpoll: management of the main event ppoll * * Copyright 2006 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include #include #include #include #include #include #include #include #include #include "defs.h" #include "services.h" #define STEP_SIZE_POLLFD_TABLE 8 static struct pollfd *gpollfd; static struct pollext **pollext; static int gnfds,maxgnfds; static int bqsignaled; struct pollext { void (*fun)(void *); void *arg; int persistent; }; static struct blockq **blockq; static int gnbq,maxbq; struct blockq { struct pcb *pc; void (*fun)(struct pcb *); }; static int umviewmainpid; static void restart_main_loop(void) { r_kill(umviewmainpid,SIGUSR1); } void bq_add(void (*fun)(struct pcb *), struct pcb *pc) { assert(pc->pollstatus != READY); if (gnbq >= maxbq) { maxbq += STEP_SIZE_POLLFD_TABLE; blockq = realloc(blockq, maxbq * sizeof(struct blockq *)); assert (blockq != 0); } blockq[gnbq]=malloc(sizeof(struct blockq)); blockq[gnbq]->pc=pc; blockq[gnbq]->fun = fun; gnbq++; } void bq_signal(struct pcb *pc) { assert(pc); pc->pollstatus=WAKE_ME_UP; restart_main_loop(); } int bq_pidwake(long pid,int signum) { int i; for (i=0;ipc->pid) { blockq[i]->pc->flags |= PCB_SIGNALED; blockq[i]->pc->signum = signum; bq_signal(blockq[i]->pc); return 1; } return 0; } void bq_terminate(struct pcb *pc) { pc->pollstatus=TERMINATED; restart_main_loop(); } static void bq_try() { int i,j; for (i=0,j=0;ipc->pollstatus) { case WAKE_ME_UP: blockq[i]->fun(blockq[i]->pc); case TERMINATED: free(blockq[i]); break; default: if (j < i) blockq[j]=blockq[i]; j++; break; } } gnbq=j; } void bq_wake(int signal) { bqsignaled=1; } void bq_ppolltry() { if (bqsignaled) { bqsignaled=0; bq_try(); } } /* add a callback related to a fd */ void mp_add(int fd, short events, void (*fun)(void *), void *arg, int persistent) { //printk("mp_add %d %p\n",fd,arg); if (gnfds >= maxgnfds) { maxgnfds += STEP_SIZE_POLLFD_TABLE; gpollfd = realloc(gpollfd,maxgnfds * sizeof(struct pollfd)); pollext = realloc(pollext, maxgnfds * sizeof(struct pollext *)); assert (gpollfd != NULL && pollext != NULL); } gpollfd[gnfds].fd=fd; gpollfd[gnfds].events=events; gpollfd[gnfds].revents=0; pollext[gnfds]=malloc(sizeof(struct pollext)); assert (pollext[gnfds] != NULL); pollext[gnfds]->fun=fun; pollext[gnfds]->arg=arg; pollext[gnfds]->persistent=persistent; gnfds++; } /* delete a callback related to a fd */ void mp_del(int fd,void *arg) { int i; //printk("mp_del %d %p\n",fd,arg); for (i=0;iarg == arg) break; if (ifun=NULL; /* printk("FOUND\n"); free(pollext[i]); memmove(gpollfd+i,gpollfd+(i+1),(gnfds-(i+1))*sizeof(struct pollfd)); memmove(pollext+i,pollext+(i+1),(gnfds-(i+1))*sizeof(struct pollext *)); gnfds--; */ } } static void mp_pack() { int i,j; for (i=0,j=0;ifun == NULL) { free(pollext[i]); } else { if (j < i) { gpollfd[j]=gpollfd[i]; pollext[j]=pollext[i]; } j++; } } gnfds=j; } /* newer linux-es use ppoll */ int mp_ppoll( const sigset_t *sigmask) { int rv; int i; //printk("mp_ppoll %d\n",gnfds); /* if there are just signals to wait use sigsuspend instead of ppoll */ if (gnfds==0) { rv=r_sigsuspend(sigmask); } else { rv=r_ppoll(gpollfd,gnfds,NULL,sigmask,_KERNEL_SIGSET_SIZE); if (rv < 0 && errno != EINTR) printk("ppoll ERR %s\n",strerror(errno)); #if 0 if (gnfds>0) printk("mp_rv (%d,%d,%d) %d %s\n", gpollfd[0].fd, gpollfd[0].events, gpollfd[0].revents, rv,strerror(errno)); if (rv<0 && gnfds>0) { struct stat buf; int x=fstat(gpollfd[0].fd,&buf); printk("%d %d\n",x,buf.st_mode); } #endif /* callbacks for file events */ for (i=0; rv>0; i++) { assert(ifun) { pollext[i]->fun(pollext[i]->arg); if (!pollext[i]->persistent) pollext[i]->fun=NULL; } } } mp_pack(); } bq_ppolltry(); return rv; } void mainpoll_addproc(struct pcb *pc,int flags,int npcbflag) { pc->pollstatus=READY; } void mainpoll_delproc(struct pcb *pc,int flags,int npcbflag) { } void mainpoll_init(int want_ppoll) { struct sigaction sa; sigset_t blockusr1; umviewmainpid=r_getpid(); sigemptyset(&blockusr1); sigaddset(&blockusr1,SIGUSR1); r_sigprocmask(SIG_BLOCK,&blockusr1,NULL); sigfillset(&sa.sa_mask); sa.sa_handler = bq_wake; sa.sa_flags = 0; r_sigaction(SIGUSR1, &sa, NULL); } umview-0.8.2/xmview/hashtab.h0000644000175000017500000000576311753517211015231 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * hashtab.h: hashtable management, fast search for module services. * * Copyright 2008,2009 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: services.h 468 2008-04-23 22:08:52Z rd235 $ * */ #ifndef _HASHTAB_H #define _HASHTAB_H #include "treepoch.h" #include "services.h" struct ht_elem; /* modules can define check functions to test for exceptions */ typedef int (* confirmfun_t)(int type, void *arg, int arglen, struct ht_elem *ht); #define NEGATIVE_MOUNT ((confirmfun_t) 1) #define HT_ERR ((struct ht_elem *) 1) /* add a path to the hashtable (this creates an entry for the mounttab) */ struct ht_elem *ht_tab_pathadd(unsigned char type, const char *source, const char *path, const char *fstype, unsigned long mountflags, const char *flags, struct service *service, unsigned char trailingnumbers, confirmfun_t confirmfun, void *private_data); /* add a generic element to the hashtable */ struct ht_elem *ht_tab_add(unsigned char type,void *obj,int objlen, struct service *service, confirmfun_t confirmfun, void *private_data); int isnosys(sysfun f); struct ht_elem *ht_check(int type, void *arg, struct stat64 *st, int setepoch); sysfun ht_syscall(struct ht_elem *hte, int scno); sysfun ht_socketcall(struct ht_elem *hte, int scno); sysfun ht_virsyscall(struct ht_elem *hte, int scno); sysfun ht_ioctlparms(struct ht_elem *hte); sysfun ht_event_subscribe(struct ht_elem *hte); void ht_tab_invalidate(struct ht_elem *hte); int ht_tab_del(struct ht_elem *mp); void ht_tab_getmtab(FILE *f); void forall_ht_tab_do(unsigned char type, void (*fun)(struct ht_elem *ht, void *arg), void *arg); void *ht_get_private_data(struct ht_elem *hte); void ht_set_private_data(struct ht_elem *hte,void *private_data); char *ht_get_servicename(struct ht_elem *hte); struct service *ht_get_service(struct ht_elem *hte); unsigned long ht_get_mountflags(struct ht_elem *hte); epoch_t ht_get_epoch(struct ht_elem *hte); void ht_count_plus1(struct ht_elem *hte); void ht_count_minus1(struct ht_elem *hte); int ht_get_count(struct ht_elem *hte); #define HT_ADD 0 #define HT_DEL 1 /* define upcall parameters: HT_ADD/HT_DEL, type, obj, objlen */ void ht_init(void (*ht_upcall)(int, unsigned char,const void *,int,long)); void ht_terminate(void); #endif umview-0.8.2/xmview/mainpoll.h0000644000175000017500000000120511753517211015415 0ustar renzorenzo#ifndef _MAINPOLL_H #define _MAINPOLL_H #include #include #include #include #include #include #include #include "defs.h" #ifndef _VIEWOS_KM int hasppolltest(); #endif void bq_add(void (*fun)(struct pcb *), struct pcb *pc); void bq_signal(struct pcb *pc); int bq_pidwake(long pid,int signum); void bq_terminate(struct pcb *pc); void bq_ppolltry(); void mp_add(int fd, short events, void (*fun)(void *), void *arg, int persistent); void mp_del(int fd, void *arg); int mp_poll(); int mp_ppoll( const sigset_t *sigmask); void mainpoll_init(int useppoll); #endif umview-0.8.2/xmview/defs_i386_km.h0000644000175000017500000000263511753517211015773 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * defs.h: interfaces to system call arguments (architecture dependant) * needed for capture_um * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Mattia Belletti, Ludovico Gardenghi, Andrea Gasparini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: defs_i386_km.h 377 2007-08-28 20:36:16Z garden $ * */ #ifndef _DEFS_I386 #define _DEFS_I386 #define MAXERR 4096 #define _KERNEL_NSIG 64 #define _KERNEL_SIGSET_SIZE _KERNEL_NSIG/8 #define __NR_setpgrp __NR_doesnotexist #define LITTLEENDIAN #define LONG_LONG(_l,_h) \ ((long long)((unsigned long long)(unsigned)(_l) | ((unsigned long long)(_h)<<32))) #define MAXERR 4096 #endif umview-0.8.2/xmview/umview.10000644000175000017500000001345411753517211015040 0ustar renzorenzo.\" Copyright (c) 2006 Renzo Davoli .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License, .\" version 2, as published by the Free Software Foundation. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual 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 General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, write to the Free .\" Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, .\" MA 02110-1301 USA. .TH VIEW-OS 1 "June 10, 2006" "VIEW-OS: a process with a view" .SH NAME umview \- User Mode implementation of View-OS .SH SYNOPSIS .B umview [ .I options ] .I prog .br .SH DESCRIPTION The main goal of the View-OS project is to give each process its own view of the system resources. For example, each process can mount filesystems or hide some file or directories. It is also possible to assign virtual network interfaces, IP addresses or define virtual devices for each process (or for hierarchies of processes). .br .B umview is the user mode implementation of View-OS concepts. It is a modular partial virtual machine. .B umview before loading any module is completely transparent, a process behaves inside .B umview as it would have behaved outside. Each module can customize specific entities: there are modules to mount filesystems at user-level .B (umfuse) , to define virtual network interfaces .B (lwipv6) , to define virtual devices .B (umdev) , to provide interpreters for executables, e.g. to support executables for foreign architectures .B (umbinfmt) , to hide, move, overlay parts of the file system .B (viewfs). .br These are some examples of modules provided by the View-OS team. .B umview aims to provide a general interface to customize the system call semantics of process under specified conditions. So more modules will be added both by the View-OS team and by third parties. .SH OPTIONS .PD 0 .IP "\fB\-V\fP \fIname\fP" 4 .PD 0 .IP "\fB\-\-viewname\fP \fIname\fP" 4 set the name of the view. The view can be read and set using .B vuname or .B viewname commands. .PD 0 .IP "\fB\-p\fP \fImodule\fP [ , \fImodule_options\fP ]" 4 .PD 0 .IP "\fB\-\-preload\fR \fImodule\fP [ , \fImodule_options\fP ]" 4 preload modules. Modules will be loaded as shared libraries thus all the rules to load libraries apply. Modules must be loaded from a directory within the ld.so search path or should be specified by their pathnames. If necessary configure the LD_LIBRARY_PATH environment variable appropriately. \fImodule_options\fR are module specific configuration options, thus the reader should refer to each service module manual for a complete description. Modules can be loaded at run time using the .B um_add_service command. .IP "\fB\-s\fP" 4 .PD 0 .IP "\fB\-\-secure\fR" 4 set kmview in \fIhuman mode\fR, i.e. force the check of capabilities and permissions. uid is 0 at startup, in this way it is possible to load modules and mount services. When a process sets its uid as an unprivileged user (via setuid(2) or viewsu(1)), capability and permissions are enforced. .IP "\fB\-f\fP \fIrcfile\fP" 4 .PD 0 .IP "\fB\-\-rc\fR \fIrcfile\fP" 4 Use \fIrcfile\fR as the initialization file for kmview. kmview always executes \fB/etc/viewosrc\fR if exists, then kmview executes the initialization file set by this option or \fB~/.viewosrc\fR. .IP "\fB\-x\fP" 4 .PD 0 .IP "\fB\-\-nonesting\fR" 4 .B umview is able to provide module nesting, i.e. a module can provide services on the basis of virtual services provided by another module or even by the module itself. For example it is possible to mount a file system image which is stored in an already virtually mounted filesystem. This feature requires the pure_libc library. The \fB\-x\fR or \fB\-\-nonesting\fR option disables the nesting feature. .IP "\fB\-n\fP" 4 .PD 0 .IP "\fB\-\-nokernelpatch\fR" 4 .B umview is able to use some specific kernel extensions (when present) to increase its performance. The source distribution of .B umview include the kernel patches for the latest kernels. The kernel extensions are enabled by default when available. This option disables the kernel extensions. .IP "\fB\-\-nokmulti\fR" 4 This option disables the PTRACE_MULTI kernel extension. .IP "\fB\-\-noksysvm\fR" 4 This option disables the PTRACE_SYSVM kernel extension. .IP "\fB\-\-nokviewos\fR" 4 This option disables the PTRACE_SYSVIEWOS kernel extension (already experimental, not yet released). .IP "\fB\-o\fP \fIfile\fP" 4 .PD 0 .IP "\fB\-\-output\fR \fIfile\fP" 4 This option diverts the debugging output to the file specified, it is useful when .B umview has been compiled with debugging extensions. .IP "\fB\-v\fP" 4 .PD 0 .IP "\fB\-\-version\fR" 4 Print the version and exit. .IP "\fB\-h\fP" 4 .PD 0 .IP "\fB\-\-help\fR" 4 Print a short help message and exit. .SH SEE ALSO .BR um_add_service(1) .BR um_del_service(1) .BR um_ls_service(1) .BR um_mov_service(1) .BR umfuse(1viewos) .BR lwipv6(1viewos) .BR umdev(1viewos) .BR umbinfmt(1viewos) .BR viewfs(1viewos) .BR vuname(1viewos) .BR viewname(1viewos) .SH AUTHORS View-OS is a project of the Computer Science Department, University of Bologna. Project Leader: Renzo Davoli. Development Team: P. Angelelli, A. Bacchelli, M. Belletti, P. Beverini, D. Billi, A. Forni, L. Gardenghi, A. Gasparini, D. Lacamera, C. Martellini, A. Seraghiti Howto's and further information can be found on the project wiki . umview-0.8.2/xmview/capture_km.c0000644000175000017500000004627111753517211015743 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * capture_km.c: capture layer for kmview * * Copyright 2008 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "capture_nested.h" #include "defs.h" #include "utils.h" #include "gdebug.h" #include "kmview.h" #define NEVENTS 1 int kmversion; int kmviewfd; long kmflags; struct kmview_event event[NEVENTS]; #define umpid2pcb(X) (pcbtab[(X)-1]) #define PCBSIZE 10 int first_child_exit_status = -1; void (*first_child_init)(void); pthread_key_t pcb_key=0; /* key to grab the current thread pcb */ sfun native_syscall=syscall; /* debugging output, (bypass pure_libc when loaded) */ int vprintk(const char *fmt, va_list ap) { char *s; int rv=0; int level=PRINTK_STANDARD_LEVEL; if (fmt[0] == '<' && fmt[1] != 0 && fmt[2] == '>') { /*level*/ switch (fmt[1]) { case '0' ... '7': level=fmt[1] - '0'; fmt+=3; break; } } if (level <= printk_current_level) { rv=vasprintf(&s, fmt, ap); if (rv>0) rv=r_write(2,s,strlen(s)); free(s); } return rv; } int printk(const char *fmt, ...) { int rv; va_list ap; va_start(ap,fmt); rv=vprintk(fmt,ap); va_end(ap); return rv; } static struct pcb **pcbtab; /* capture_km pcb table */ int nprocs = 0; /* number of active processes */ static int pcbtabsize; /* actual size of the pcb table */ divfun scdtab[_UM_NR_syscalls]; /* upcalls */ char scdnarg[_UM_NR_syscalls]; /*nargs*/ unsigned int scdtab_bitmap[INT_PER_MAXSYSCALL]; /* bitmap */ struct ghosthash64 ghostmounts={{GH_TERMINATE},{}}; #if __NR_socketcall != __NR_doesnotexist divfun sockcdtab[19]; /* upcalls */ #endif /* just an interface to a hidden value */ int pcbtablesize(void) { return pcbtabsize; } /* the "current process" info gets stored as key specific data of the thread */ struct pcb *get_pcb() { return pthread_getspecific(pcb_key); } void set_pcb(void *new) { pthread_setspecific(pcb_key,new); } static pid_t newpcb (pid_t pid,pid_t kmpid,pid_t umppid) { register int i,j; struct pcb *pcb; for (i=0; 1; i++) { if (i==pcbtabsize) { /* expand the pcb table */ /* we double the size, from pcbtabsize to pcbtabsize*2; to do this, we * reallocate the newtab to double the size it was before; then we need * pcbtabsize more pointers; so we allocate a table of pointers of size * pcbtabsize, and the new pointers to pointers now points to that. It's * a bit difficult to understand - graphically: * * newtab: * +---------------------------------------------------------------+ * |0123|45678...| | | * +---------------------------------------------------------------+ * | | | | * V V V V * first second third fourth * calloc calloc calloc calloc * of of of of * newpcbs newpcbs newpcbs newpcbs * * Messy it can be, this way pointers to pcbs still remain valid after * a reallocation. */ struct pcb **newtab = (struct pcb **) realloc(pcbtab, 2 * pcbtabsize * sizeof pcbtab[0]); struct pcb *newpcbs = (struct pcb *) calloc(pcbtabsize, sizeof *newpcbs); if (newtab == NULL || newpcbs == NULL) { if (newtab != NULL) free(newtab); return -1; } for (j = pcbtabsize; j < 2 * pcbtabsize; ++j) newtab[j] = &newpcbs[j - pcbtabsize]; pcbtabsize *= 2; pcbtab = newtab; } pcb=pcbtab[i]; if (! (pcb->flags & PCB_INUSE)) { pcb->pid=pid; pcb->kmpid=kmpid; pcb->umpid=i+1; // umpid==0 is reserved for umview itself pcb->flags = PCB_INUSE; pcb->pp = (umppid < 0)?pcb:umpid2pcb(umppid); nprocs++; return i+1; /*umpid*/ } } /* never reach here! */ assert(0); return -1; } /* this is an iterator on the pcb table */ void forallpcbdo(voidfun f,void *arg) { register int i; for (i = 0; i < pcbtabsize; i++) { struct pcb *pc = pcbtab[i]; if (pc->flags & PCB_INUSE) { GDEBUG(8, "calling @%p with arg %p on pid %d", f, arg, pc->pid); f(pc,arg); GDEBUG(8, "returning from call"); } } } /* pid 2 pcb conversion (by linear search) */ struct pcb *pid2pcb(int pid) { register int i; for (i = 0; i < pcbtabsize; i++) { struct pcb *pc = pcbtab[i]; if (pc->pid == pid && pc->flags & PCB_INUSE) return pc; } return NULL; } /* orphan processes must NULL-ify their parent process pointer */ static void _cut_pp(struct pcb *pc, struct pcb *delpc) { if (pc->pp == delpc) pc->pp = NULL; } /* pcb deallocator */ static void droppcb(struct pcb *pc) { /* the last process descriptor should stay "alive" for * the termination of all modules */ /* otherwise the "nesting" mechanism misunderstands * the pcb by a npcb */ /* XXX rd235 20090805: it seems not a problem any more in the new version. deleted for dup delproc notication for proc #1 */ #ifdef _PROC_MEM_TEST if (pc->memfd >= 0) close(pc->memfd); #endif nprocs--; forallpcbdo(_cut_pp,pc); pcb_destructor(pc,0/*flags*/,0); #if 0 if (nprocs > 0) #endif pc->flags = 0; /*NOT PCB_INUSE */; } /* initial PCB table allocation */ static void allocatepcbtab() { struct pcb *pc; /* Allocate the initial pcbtab. */ /* look at newpcb for some explanations about the structure */ pcbtabsize = PCBSIZE; /* allocation of pointers */ pcbtab = (struct pcb **) malloc (pcbtabsize * sizeof pcbtab[0]); /* allocation of PCBs */ pcbtab[0] = (struct pcb *) calloc (pcbtabsize, sizeof *pcbtab[0]); /* each pointer points to the corresponding PCB */ for (pc = pcbtab[0]; pc < &pcbtab[0][pcbtabsize]; ++pc) pcbtab[pc - pcbtab[0]] = &pcbtab[0][pc - pcbtab[0]]; } /* Tracer core, executed any time an event occurs*/ void tracehand(void *useless) { int i; for (i=0;i pid %d syscall %d (%s) @ %p", pc->pid, scno, SYSCALLNAME(scno), event[i].x.syscall.pc); #if __NR_socketcall != __NR_doesnotexist if (event[i].tag == KMVIEW_EVENT_SOCKETCALL_ENTRY) fun=sockcdtab[scno]; else #endif fun=scdtab[scno]; if (fun == NULL) { pc->behavior=STD_BEHAVIOR; } else { #if __NR_socketcall != __NR_doesnotexist if (event[i].tag == KMVIEW_EVENT_SOCKETCALL_ENTRY) memcpy(&pc->event, &(event[i].x), sizeof(struct kmview_event_socketcall)); else { memcpy(&pc->event, &(event[i].x), sizeof(struct kmview_event_ioctl_syscall)); pc->event.addr=0; } #else memcpy(&pc->event, &(event[i].x), sizeof(struct kmview_event_ioctl_syscall)); #endif pc->behavior=fun(scno,IN,pc); } switch(pc->behavior) { case STD_BEHAVIOR: r_ioctl(kmviewfd,KMVIEW_SYSRESUME,pc->kmpid); break; case SC_FAKE: fun(scno,OUT,pc); pc->outevent.x.kmpid=pc->kmpid; r_ioctl(kmviewfd,KMVIEW_SYSVIRTUALIZED,&pc->outevent); break; case SC_CALLONXIT: case SC_TRACEONLY: pc->event.x.umpid=pc->kmpid; r_ioctl(kmviewfd,KMVIEW_SYSMODIFIED,&pc->event); break; case SC_MODICALL: pc->event.x.umpid=pc->kmpid; r_ioctl(kmviewfd,KMVIEW_SYSARGMOD,&pc->event); break; default: /*SUSPENDED*/ /* do nothing. resume will restart it */ break; } break; } case KMVIEW_EVENT_SYSCALL_EXIT: { struct pcb *pc=umpid2pcb(event[i].x.sysreturn.x.umpid); divfun fun; long scno=pc->event.scno; GDEBUG(3, "<-- pid %d syscall %d (%s) @ %p", pc->pid, scno, SYSCALLNAME(scno), event[i].x.sysreturn.retval); #if __NR_socketcall != __NR_doesnotexist if (pc->event.addr) fun=sockcdtab[scno]; else #endif fun=scdtab[scno]; if (fun == NULL) { pc->behavior=STD_BEHAVIOR; } else { memcpy(&pc->outevent, &(event[i].x), sizeof(struct kmview_event_ioctl_sysreturn)); pc->behavior=fun(scno,OUT,pc); } if ((pc->behavior & SC_SUSPENDED) == 0) { pc->outevent.x.kmpid=pc->kmpid; r_ioctl(kmviewfd,KMVIEW_SYSRETURN,&pc->outevent); } break; } } } } /* pc can be resumed: there is data to unblock (maybe) its system call */ void sc_resume(struct pcb *pc) { int scno=pc->event.scno; int inout=pc->behavior-SC_SUSPENDED; divfun fun; /* set the current process */ pthread_setspecific(pcb_key,pc); #if __NR_socketcall != __NR_doesnotexist if (pc->event.addr) fun=sockcdtab[scno]; else #endif fun=scdtab[scno]; if (fun != NULL) pc->behavior=fun(scno,inout,pc); else pc->behavior=STD_BEHAVIOR; if (inout==IN) { /* resumed in IN phase */ switch(pc->behavior) { case STD_BEHAVIOR: r_ioctl(kmviewfd,KMVIEW_SYSRESUME,pc->kmpid); break; case SC_FAKE: fun(scno,OUT,pc); pc->outevent.x.kmpid=pc->kmpid; r_ioctl(kmviewfd,KMVIEW_SYSVIRTUALIZED,&pc->outevent); break; case SC_CALLONXIT: case SC_TRACEONLY: /*maybe we are using a socketcall struct as it were a syscall*/ pc->event.x.umpid=pc->kmpid; r_ioctl(kmviewfd,KMVIEW_SYSMODIFIED,&pc->event); break; case SC_MODICALL: pc->event.x.umpid=pc->kmpid; r_ioctl(kmviewfd,KMVIEW_SYSARGMOD,&pc->event); break; default: /*SUSPENDED*/ /* do nothing. resume will restart it */ break; } } else { if ((pc->behavior & SC_SUSPENDED) == 0) { pc->outevent.x.kmpid=pc->kmpid; r_ioctl(kmviewfd,KMVIEW_SYSRETURN,&pc->outevent); } } } static void do_wait(int signal) { int exitstatus; wait(&exitstatus); first_child_exit_status=WEXITSTATUS(exitstatus); } static void setsigaction() { struct sigaction sa; sa.sa_handler = SIG_IGN; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; r_sigaction(SIGTTOU, &sa, NULL); r_sigaction(SIGTTIN, &sa, NULL); r_sigaction(SIGHUP, &sa, NULL); r_sigaction(SIGINT, &sa, NULL); r_sigaction(SIGQUIT, &sa, NULL); r_sigaction(SIGPIPE, &sa, NULL); r_sigaction(SIGTERM, &sa, NULL); sa.sa_handler=do_wait; r_sigaction(SIGCHLD, &sa, NULL); } /* destructor: the pcb element is flagged as free */ static void vir_pcb_free(void *arg) { struct pcb *pc=arg; if (pc->flags & PCB_ALLOCATED) { pcb_destructor(pc,0,1); free(arg); } } /* execvp implementation (to avoid pure_libc management) */ static int r_execvp(const char *file, char *const argv[]){ if(strchr(file,'/') != NULL) return r_execve(file,argv,environ); else { char *path; char *envpath; char *pathelem; char buf[PATH_MAX]; if ((envpath=getenv("PATH")) == NULL) envpath="/bin:/usr/bin"; path=strdup(envpath); while((pathelem=strsep(&path,":")) != NULL){ if (*pathelem != 0) { register int i,j; for (i=0; i> 2) + c); } static inline unsigned int hashsum (int sum,const char *path,int len) { int i; for (i=0;ideltalen[i] != GH_TERMINATE;i++) { scanlen += gh->deltalen[i]; if (gh->deltalen[i] != GH_DUMMY) { tmplen[ntmp] = scanlen; tmphash[ntmp] = gh->hash[i]; ntmp++; } } return ntmp; } static int array2gh(unsigned short *tmplen,unsigned int *tmphash,int ntmp, struct ghosthash64 *gh) { int ngh; if (ntmp > 0) { ngh=(tmplen[0]/GH_DUMMY)+1; int i,j; short scanlen; for(i=1;i GH_SIZE) return -ENOMEM; i=j=scanlen=0; while (i= GH_DUMMY) { gh->deltalen[j] = GH_DUMMY; scanlen += GH_DUMMY; gh->hash[j] = -1; j++; } else { gh->deltalen[j] = tmplen[i] - scanlen; gh->hash[j] = tmphash[i]; scanlen=tmplen[i]; i++; j++; } } } else ngh=0; if (ngh < GH_SIZE) gh->deltalen[ngh] = GH_TERMINATE; return ngh; } int ghosthash_add(const char *path,int len) { unsigned short tmplen[GH_SIZE]; unsigned int tmphash[GH_SIZE]; unsigned short ntmp=gh2array(&ghostmounts,tmplen,tmphash); int pos,rv; if (ntmp >= GH_SIZE) return -ENOMEM; for (pos=0;pos= 0 && kmversion >= 2) r_ioctl(kmviewfd, KMVIEW_GHOSTMOUNTS, &ghostmounts); return rv; } int ghosthash_del(const char *path,int len) { unsigned int hash=hashsum(0,path,len); unsigned short tmplen[GH_SIZE]; unsigned int tmphash[GH_SIZE]; unsigned short ntmp=gh2array(&ghostmounts,tmplen,tmphash); int pos; for (pos=0;pos= 0 && kmversion >= 2) r_ioctl(kmviewfd, KMVIEW_GHOSTMOUNTS, &ghostmounts); return rv; } else return -ENOENT; } static void scdtab_bitmap_init() { register int i; scbitmap_fill(scdtab_bitmap); for (i=0; i<_UM_NR_syscalls; i++) if (scdtab[i] != NULL) scbitmap_clr(scdtab_bitmap,i); #if __NR_socketcall != __NR_doesnotexist scbitmap_clr(scdtab_bitmap,__NR_socketcall); #endif /*for (i=0; i= 2) { if (onoff) r_ioctl(kmviewfd, KMVIEW_SET_CHROOT, kmpid); else r_ioctl(kmviewfd, KMVIEW_CLR_CHROOT, kmpid); } } void capture_km_global_get_path_syscalls(void) { if (kmversion >= 2) { kmflags &= ~KMVIEW_FLAG_PATH_SYSCALL_SKIP; r_ioctl(kmviewfd, KMVIEW_SET_FLAGS, kmflags); } } void capture_km_global_skip_path_syscalls(void) { if (kmversion >= 2) { kmflags |= KMVIEW_FLAG_PATH_SYSCALL_SKIP; r_ioctl(kmviewfd, KMVIEW_SET_FLAGS, kmflags); } } /* main capture startup */ int capture_main(char **argv,void (*root_process_init)(void),char *rc) { struct kmview_magicpoll mp={(long)&event,1}; kmviewfd=r_open("/dev/kmview",O_RDONLY,0); if (kmviewfd < 0) return -1; kmversion=r_ioctl(kmviewfd,KMVIEW_GET_VERSION); r_ioctl(kmviewfd, KMVIEW_MAGICPOLL, &mp); kmflags = KMVIEW_FLAG_FDSET|KMVIEW_FLAG_EXCEPT_FCHDIR; #if __NR_socketcall != __NR_doesnotexist kmflags |= KMVIEW_FLAG_SOCKETCALL; #endif if (kmversion >= 2) kmflags |= KMVIEW_FLAG_PATH_SYSCALL_SKIP; else kmflags |= KMVIEW_FLAG_EXCEPT_CLOSE; if (kmversion >= 2) { ghosthash_add("/proc/0",7); ghosthash_add("/proc/1",7); ghosthash_add("/proc/2",7); ghosthash_add("/proc/3",7); ghosthash_add("/proc/4",7); ghosthash_add("/proc/5",7); ghosthash_add("/proc/6",7); ghosthash_add("/proc/7",7); ghosthash_add("/proc/8",7); ghosthash_add("/proc/9",7); } r_ioctl(kmviewfd, KMVIEW_SET_FLAGS, kmflags); if (kmversion >= 2) { scdtab_bitmap_init(); r_ioctl(kmviewfd, KMVIEW_SYSCALLBITMAP, scdtab_bitmap); } allocatepcbtab(); switch (r_fork()) { case -1: GPERROR(0, "strace: fork"); exit(1); break; case 0: unsetenv("LD_PRELOAD"); /* try to set process priority back to standard prio (effective only when * umview runs in setuid mode), useless call elsewhere */ r_setpriority(PRIO_PROCESS,0,0); r_ioctl(kmviewfd, KMVIEW_ATTACH, 0); r_close(kmviewfd); /* maybe it is better to use execvp instead of r_execvp. * the former permits to use a (preloaded) module provided executable as startup process*/ GDEBUG(8, "starting rc files"); capture_execrc("/etc/viewosrc",(char *)0); if (rc != NULL && *rc != 0) capture_execrc(rc,(char *)0); GDEBUG(8, "starting %s",argv[0]); r_execvp(argv[0], argv); GPERROR(0, "strace: exec"); _exit(1); default: /* KMVIEW TRACER startup */ /* create the thread key */ pthread_key_create(&pcb_key,vir_pcb_free); /* init the first child startup fun */ first_child_init=root_process_init; /* set the pcb_key for this process */ setsigaction(); } return 0; } umview-0.8.2/xmview/pcb.02.umproc.h0000644000175000017500000000052711753517211016100 0ustar renzorenzo#ifdef _PCB_DEFINITIONS struct pcb_file; void umproc_addproc(),umproc_delproc(); #endif #ifdef _PCB_COMMON_FIELDS #endif #ifdef _PCB_ONLY_FIELDS /* file descriptors of this process */ struct pcb_file *fds; #endif #ifdef _NPCB_ONLY_FIELDS #endif #ifdef _PCB_CONSTRUCTOR umproc_addproc, #endif #ifdef _PCB_DESTRUCTOR umproc_delproc, #endif umview-0.8.2/xmview/canonicalize.c0000644000175000017500000002357011753517211016245 0ustar renzorenzo/* This is part of ViewOS * umview-kmview -- A Process with a View * * canonicalize.c: recursively canonicalize filenames * * Copyright 2009 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include "services.h" #include "sctab.h" #define PERMIT_NONEXISTENT_LEAF #define DOTDOT 1 #define ROOT 2 /* canonstruct: this struct contains the values that must be shared during the whole recursive scan: .xpc: opaque for um_x_lstat64, um_xaccess, um_readlink, um_getroot .ebuf: source for the relative to absolute path translation. it is allocated on the stack. if the path to translate begins by '/': it contains the root dir followed by the path to translate, otherwise it contains the current working dir followed by the path to translate .start, .end: pointers on ebuf, the boundaries of the current component .resolved: the user provided buffer where the result must be stored .rootlen: the len of the root component (it is not possible to generate shorter pathnames to force the root cage) .num_links: counter of symlink to avoid infinite loops (ELOOP) .statbuf: lstat64 of the last component (of the file at the end) .dontfollowlonks: flag, if the entire path is a link do not follow it, this flag is for l-system calls like lstat, lchmod, lchown etc... */ struct canonstruct { void *xpc; char *ebuf; char *start; char *end; char *resolved; short rootlen; short num_links; struct stat64 *statbuf; int dontfollowlink; }; /* recursive construction of canonical absolute form of a filename. This function gets called recursively for each component of the resolved path. dest is pointer to a char of the "resolved" string (the first char of the new component). return value: 0 successful canonicalize DOTDOT (..) return to the previous level ROOT, canonicalize stepped onto an absolute symlink the translation process must return back to the root (or chroot rootcage) -1 error */ static int rec_realpath(struct canonstruct *cdata, char *dest) { char *newdest; int recoutput=ROOT; /* force the first lstat */ /* LOOP (***) This loop manages '.' '..' (DOTDOT) from an inner call ROOT if this is the root dir layer */ while (1) { *dest=0; /*printk("looprealpath %s -> %s\n",cdata->ebuf,cdata->resolved);*/ /* delete multiple slashes / */ while (*cdata->start == '/') cdata->start++; /* find the next component */ for (cdata->end = cdata->start; *cdata->end && *cdata->end != '/'; ++cdata->end) ; { /* scope of lastlen, a smart compiler should not save this on the stack */ register int lastlen=cdata->end-cdata->start; /* '.': continue with the next component of the path, forget this */ if (lastlen == 1 && cdata->start[0] == '.') { cdata->start=cdata->end; continue; /* CONTINUE: NEXT ITERATION OF THE LOOP (***) */ } /* '..' */ if (lastlen == 2 && cdata->start[0] == '.' && cdata->start[1] == '.') { cdata->start=cdata->end; /* return DOTDOT only if this does not goes outside the current root */ if (dest > cdata->resolved+cdata->rootlen) return DOTDOT; else continue; /* CONTINUE: NEXT ITERATION OF THE LOOP (***) */ } if (recoutput != 0) /* ROOT or DOTDOT */ um_x_lstat64(cdata->resolved,cdata->statbuf,cdata->xpc,recoutput==DOTDOT); /* nothing more to do */ if (lastlen == 0) return 0; /* overflow check */ if (dest + lastlen > cdata->resolved + PATH_MAX) { um_set_errno(cdata->xpc,ENAMETOOLONG); return -1; } /* add the new component */ newdest=dest; if (newdest[-1] != '/') *newdest++='/'; newdest=mempcpy(newdest,cdata->start,lastlen); *newdest=0; } /* does the file exist? */ if (um_x_lstat64(cdata->resolved,cdata->statbuf,cdata->xpc,0) < 0) { cdata->statbuf->st_mode=0; #ifdef PERMIT_NONEXISTENT_LEAF if (errno != ENOENT || *cdata->end == '/') { um_set_errno(cdata->xpc,ENOENT); return -1; } else return 0; #else um_set_errno(cdata->xpc,ENOENT); return -1; #endif } /* Symlink case */ if (S_ISLNK(cdata->statbuf->st_mode) && ((*cdata->end == '/') || !cdata->dontfollowlink)) { /* root dir must be already canonicalized. symlinks navigating inside the root link are errors */ if (dest <= cdata->resolved+cdata->rootlen) { um_set_errno(cdata->xpc,ENOENT); return -1; } else { char buf[PATH_MAX]; int len,n; /* test for symlink loops */ if (++cdata->num_links > MAXSYMLINKS) { um_set_errno(cdata->xpc,ELOOP); return -1; } /* read the link */ n = um_x_readlink(cdata->resolved, buf, PATH_MAX-1, cdata->xpc); if (n<0) { um_set_errno(cdata->xpc,errno); return -1; } buf[n]=0; /* overflow check */ len=strlen(cdata->end); if (n+len >= PATH_MAX) { um_set_errno(cdata->xpc,ENAMETOOLONG); return -1; } /* append symlink and remaining part of the path, the latter part is moved inside ebuf itself */ memmove(cdata->ebuf+n,cdata->end,len+1); cdata->end = memcpy(cdata->ebuf,buf,n); /* if the symlink is absolute the scan must return back to the current root otherwise from the same dir of the symlink */ if (*buf == '/') { cdata->start=cdata->ebuf; return ROOT; } else { cdata->start=cdata->end; continue; /* CONTINUE: NEXT ITERATION OF THE LOOP (***) */ } } } /* consistency checks on dirs: all the components of the path but the last one must be directories and must have 'x' permission */ if (*cdata->end == '/') { if (!S_ISDIR(cdata->statbuf->st_mode)) { um_set_errno(cdata->xpc,ENOTDIR); return -1; } else if (um_x_access(cdata->resolved,X_OK,cdata->xpc,cdata->statbuf) < 0) { um_set_errno(cdata->xpc,errno); return -1; } } /* okay: recursive call for the next component */ cdata->start=cdata->end; switch(recoutput=rec_realpath(cdata,newdest)) { /* success. close recursion */ case 0 : return 0; /* DOTDOT: cycle at this layer */ case DOTDOT: continue; /* CONTINUE: NEXT ITERATION OF THE LOOP (***) */ /* ROOT: close recursive calls up the root */ case ROOT: if (dest > cdata->resolved+cdata->rootlen) return ROOT; else continue; /* CONTINUE: NEXT ITERATION OF THE LOOP (***) */ /* Error */ default: return -1; } } } static inline void cancel_trailing_slash(char *path,int len) { if (len > 1 && path[len-1] == '/') path[len-1]=0; } /* realpath: name: path to be canonicalized, root: current root (chroot), must already be in canonical form cwd: current working directory, must already be in canonical form resolved: a buffer of PATH_MAX chars for the result return resolved or NULL on failures. errno is set consistently */ char *um_realpath(const char *name, const char *cwd, char *resolved, struct stat64 *pst, int dontfollowlink, void *xpc) { char *root=um_getroot(xpc); struct canonstruct cdata= { .ebuf=alloca(PATH_MAX), .resolved=resolved, .rootlen=strlen(root), .statbuf=pst, .dontfollowlink=dontfollowlink, .xpc=xpc, .num_links=0 }; /* arg consistency check */ if (name==NULL) { um_set_errno(xpc,EINVAL); return NULL; } if (*name==0) { um_set_errno(xpc,ENOENT); return NULL; } /* absolute path: append 'name' to the current root */ if (*name=='/') { int namelen=strlen(name); memcpy(cdata.ebuf,root,cdata.rootlen); if (cdata.ebuf[cdata.rootlen-1] != '/') { cdata.ebuf[cdata.rootlen]='/'; cdata.rootlen++; } /* overflow check */ if (cdata.rootlen + namelen >= PATH_MAX) { um_set_errno(xpc,ENAMETOOLONG); return NULL; } memcpy(cdata.ebuf+cdata.rootlen,name+1,namelen); cancel_trailing_slash(cdata.ebuf,cdata.rootlen + namelen - 1); } else { /* relative path append 'name' to the cwd */ /* cwd == NULL (unlikely) means relative filenames forbidden */ if (__builtin_expect((cwd==NULL),0)) { um_set_errno(xpc,EINVAL); return NULL; } else { int namelen=strlen(name); int cwdlen=strlen(cwd); memcpy(cdata.ebuf,cwd,cwdlen); if (cdata.ebuf[cwdlen-1] != '/') { cdata.ebuf[cwdlen]='/'; cwdlen++; } /* cwd inside the current root: set the immutable part of the path (inside the chroot cage) */ if (strncmp(cdata.ebuf,root,cdata.rootlen)==0 && (root[cdata.rootlen-1]=='/' || cdata.ebuf[cdata.rootlen]=='/')) { if (root[cdata.rootlen-1]!='/') cdata.rootlen++; } else cdata.rootlen=1; /* overflow check */ if (cwdlen + namelen>= PATH_MAX) { um_set_errno(xpc,ENAMETOOLONG); return NULL; } memcpy(cdata.ebuf+cwdlen,name,namelen+1); cancel_trailing_slash(cdata.ebuf,cwdlen + namelen); } } /* printk("PATH! %s (inside %s)\n",cdata.ebuf,cdata.ebuf+cdata.rootlen);*/ resolved[0]='/'; cdata.start=cdata.ebuf+1; pst->st_mode=0; /* start the recursive canonicalization function */ if (rec_realpath(&cdata,resolved+1) < 0) { /*printk("PATH! %s ERR\n",name);*/ *resolved=0; return NULL; } else { um_set_errno(xpc,0); /*printk("PATH! %s (resolved %s)\n",name,resolved);*/ return resolved; } } umview-0.8.2/xmview/capture_km.h0000644000175000017500000000424511753517211015743 0ustar renzorenzo/* This is part of km-ViewOS * The kernel-mode implementation of OSVIEW -- A Process with a View * * Copyright 2007 Renzo Davoli University of Bologna - Italy * Based on um-ViewOS 2005 Renzo Davoli * Modified 2005 Ludovico Gardenghi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: capture_km.h 866 2010-08-11 07:17:33Z rd235 $ * */ #ifndef CAPTURE_KM_H_ #define CAPTURE_KM_H_ #include extern divfun scdtab[]; extern char scdnarg[]; #if __NR_socketcall != __NR_doesnotexist extern divfun sockcdtab[]; #endif extern int kmviewfd; extern int first_child_exit_status; /* start a rc file */ void capture_execrc(const char *path,const char *argv1); /* let the game start! */ int capture_main(char **argv,void (*root_process_init)(),char *rc); /* resume a process previously suspended */ void sc_resume(void *pc); /* get the pcb of the current thread (thread safe) */ struct pcb *get_pcb(); /* set the pcb of the current thread */ void set_pcb(void *new); /* just ask for the current size of the pcbtable */ int pcbtablesize(void); /* This is the handler of sigchld from user processes */ void tracehand(void *useless); /* pcb search (linear scan) */ struct pcb *pid2pcb(int pid); /* chroot or virtual cwd for one process */ void capture_km_kmpid_chroot(pid_t kmpid,int onoff); /* zerovirt optimiation */ void capture_km_global_get_path_syscalls(void); void capture_km_global_skip_path_syscalls(void); int ghosthash_add(const char *path,int len); int ghosthash_del(const char *path,int len); int capture_attach(struct pcb *pc,pid_t pid); #endif umview-0.8.2/xmview/utils_um.c0000644000175000017500000002316311753517211015445 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * utils.c: data exchange routines. (umview-processes) * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Some code has been inherited from strace: * Copyright (c) 1991, 1992 Paul Kranenburg * Copyright (c) 1993 Branko Lankester * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey * Copyright (c) 1996-1999 Wichert Akkerman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: utils_um.c 974 2011-08-08 08:52:20Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include "defs.h" #include "utils.h" #include "ptrace2.h" /* LOAD data from the process address space */ int umoven(struct pcb *pc, long addr, int len, void *_laddr) { if (len==0) return 0; /* ptrace_multi is the quickest way */ if (has_ptrace_multi) { struct ptrace_multi req[] = {{PTRACE_PEEKCHARDATA, addr, _laddr, len}}; return r_ptrace(PTRACE_MULTI, pc->pid, req, 1); } else { #ifdef _PROC_MEM_TEST /* try to read from the /proc/nnnn/mem file */ if (pc->memfd >= 0) { int sz; sz=r_pread64(pc->memfd,_laddr,len,0,addr); if (sz>=0) return 1; } #endif { /* unlucky option: we need to use the standard ptrace, * one syscall per memory word */ char *laddr=_laddr; long n, m; //FIXME: started is not changed after check it in "if(started && ..." int started = 0; union { long val; char x[sizeof(long)]; } u; if (addr & (sizeof(long) - 1)) { /* addr not a multiple of sizeof(long) */ n = addr - (addr & -sizeof(long)); /* residue */ addr &= -sizeof(long); /* residue */ if (r_ptrace(PTRACE_PEEKDATA, pc->pid, (char *) addr, &u.val) < 0) { if (started && (errno==EPERM || errno==EIO)) { /* Ran into 'end of memory' - stupid "printpath" */ return 0; } /* But if not started, we had a bogus address. */ /*perror("umoven");*/ return -1; } started = 1; memcpy(laddr, &u.x[n], m = MIN(sizeof(long) - n, len)); addr += sizeof(long), laddr += m, len -= m; } while (len) { if (r_ptrace(PTRACE_PEEKDATA, pc->pid, (char *) addr, &u.val) < 0) { if (started && (errno==EPERM || errno==EIO)) { /* Ran into 'end of memory' - stupid "printpath" */ return 0; } /*if (addr != 0) perror("umoven");*/ return -1; } started = 1; memcpy(laddr, u.x, m = MIN(sizeof(long), len)); addr += sizeof(long), laddr += m, len -= m; } return 0; } } } /* LOAD data (0 terminated string) from the process address space */ int umovestr(struct pcb *pc, long addr, int len, void *_laddr) { if (len==0) return 0; /* quick solution: ptrace_multi is available */ if (has_ptrace_multi) { struct ptrace_multi req[] = {{PTRACE_PEEKSTRINGDATA, addr, _laddr, len}}; long rv=r_ptrace(PTRACE_MULTI, pc->pid, req, 1); if (rv >= 0) return 0; else return -1; } else { #ifdef _PROC_MEM_TEST /* try to read /proc/nnnn/mem */ if (0 && pc->memfd >= 0) { int sz; sz=r_pread64(pc->memfd,_laddr,len,0,addr); if (sz >= 0) return 1; } #endif { /* no hope: use standard ptrace */ char *laddr=_laddr; int started = 0; long n,m; int i; union { long val; char x[sizeof(long)]; } u; if (addr & (sizeof(long) - 1)) { /* addr not a multiple of sizeof(long) */ n = addr - (addr & -sizeof(long)); /* residue */ addr &= -sizeof(long); /* residue */ if (r_ptrace(PTRACE_PEEKDATA, pc->pid, (char *)addr, &u.val) < 0) { if (started && (errno==EPERM || errno==EIO)) { /* Ran into 'end of memory' - stupid "printpath" */ return 0; } /* perror("umovestr");*/ return -1; } started = 1; memcpy(laddr, &u.x[n], m = MIN(sizeof(long)-n,len)); while (n & (sizeof(long) - 1)) if (u.x[n++] == '\0') return 0; addr += sizeof(long), laddr += m, len -= m; } while (len) { if (r_ptrace(PTRACE_PEEKDATA, pc->pid, (char *)addr, &u.val) < 0) { if (started && (errno==EPERM || errno==EIO)) { /* Ran into 'end of memory' - stupid "printpath" */ return 0; } /*if (addr != 0) perror("umovestr");*/ return -1; } started = 1; memcpy(laddr, u.x, m = MIN(sizeof(long), len)); for (i = 0; i < sizeof(long); i++) if (u.x[i] == '\0') return 0; addr += sizeof(long), laddr += m, len -= m; } return 0; } } } /* STORE data into the process address space */ int ustoren(struct pcb *pc, long addr, int len, void *_laddr) { if (len==0) return 0; if (has_ptrace_multi) { /* wow: there is ptrace_multi, this is the quicky way */ struct ptrace_multi req[] = {{PTRACE_POKECHARDATA, addr, _laddr, len}}; return r_ptrace(PTRACE_MULTI, pc->pid, req, 1); } else { #ifdef _PROC_MEM_TEST /* let us try to write on /proc/nnnn/mem */ /* unfortunately /proc//mem does not support writing yet... */ if (pc->memfd >= 0) { int sz; sz=r_pwrite64(pc->memfd,_laddr,len,0,addr); if (sz>=0) return 1; } #endif { /* what a pity: there is only standard ptrace */ char *laddr=_laddr; long n, m; int started = 0; union { long val; char x[sizeof(long)]; } u; if (addr & (sizeof(long) - 1)) { /* addr not a multiple of sizeof(long) */ n = addr - (addr & -sizeof(long)); /* residue */ addr &= -sizeof(long); /* residue */ if (r_ptrace(PTRACE_PEEKDATA, pc->pid, (char *) addr, &u.val) < 0) { if (started && (errno==EPERM || errno==EIO)) { /* Ran into 'end of memory' - stupid "printpath" */ return 0; } /* But if not started, we had a bogus address. */ /*perror("ustoren1");*/ return -1; } started = 1; memcpy(&u.x[n], laddr, m = MIN(sizeof(long) - n, len)); if (r_ptrace(PTRACE_POKEDATA, pc->pid, (char *) addr, u.val) < 0) { /*perror("ustoren2");*/ return -1; } addr += sizeof(long), laddr += m, len -= m; } while (len) { if (len < sizeof(long)) { if (r_ptrace(PTRACE_PEEKDATA, pc->pid, (char *) addr, &u.val) < 0) { if (started && (errno==EPERM || errno==EIO)) { /* Ran into 'end of memory' - stupid "printpath" */ return 0; } if (addr != 0) /*perror("ustoren3");*/ return -1; } } started = 1; memcpy(u.x, laddr, m = MIN(sizeof(long), len)); if (r_ptrace(PTRACE_POKEDATA, pc->pid, (char *) addr, u.val) < 0) { /*perror("ustoren4");*/ return -1; } addr += sizeof(long), laddr += m, len -= m; } return 0; } } } /* STORE data (0 terminated string) into the process address space */ int ustorestr(struct pcb *pc, long addr, int len, void *_laddr) { if (len==0) return 0; if (has_ptrace_multi) { /* ptrace is provided by this kernel -> let's go speedy */ struct ptrace_multi req[] = {{PTRACE_POKECHARDATA, addr, _laddr, len}}; return r_ptrace(PTRACE_MULTI, pc->pid, req, 1); } else { #ifdef _PROC_MEM_TEST /* let us try if we can write /proc/nnnn/mem */ /* /proc//mem: linux does not support writing... yet*/ if (pc->memfd >= 0) { int sz; sz=r_pwrite64(pc->memfd,_laddr,len,0,addr); if (sz >= 0) return 1; } #endif { /* umph, there is nothing better to do than using a * ptrace call per memory word. Snaily way */ char *laddr=_laddr; int started = 0; int i, n, m; union { long val; char x[sizeof(long)]; } u; if (addr & (sizeof(long) - 1)) { /* addr not a multiple of sizeof(long) */ n = addr - (addr & -sizeof(long)); /* residue */ addr &= -sizeof(long); /* residue */ if (r_ptrace(PTRACE_PEEKDATA, pc->pid, (char *)addr, &u.val) < 0) { if (started && (errno==EPERM || errno==EIO)) { /* Ran into 'end of memory' - stupid "printpath" */ return 0; } /*perror("ustorestr");*/ return -1; } started = 1; memcpy(&u.x[n], laddr, m = MIN(sizeof(long)-n,len)); if (r_ptrace(PTRACE_POKEDATA, pc->pid, (char *) addr, u.val) < 0) { /*perror("ustoren");*/ return -1; } while (n & (sizeof(long) - 1)) if (u.x[n++] == '\0') return 0; addr += sizeof(long), laddr += m, len -= m; } while (len) { for (i = 0; i < sizeof(long); i++) { if (laddr[i] == '\0') { if (r_ptrace(PTRACE_PEEKDATA, pc->pid, (char *)addr, &u.val) < 0) { if (started && (errno==EPERM || errno==EIO)) { /* Ran into 'end of memory' - stupid "printpath" */ return 0; } /*perror("ustorestr");*/ return -1; } break; } } started = 1; memcpy(u.x, laddr, m = MIN(sizeof(long), len)); if (r_ptrace(PTRACE_POKEDATA, pc->pid, (char *) addr, u.val) < 0) { /*perror("ustoren");*/ return -1; } for (i = 0; i < sizeof(long); i++) if (u.x[i] == '\0') return 0; addr += sizeof(long), laddr += m, len -= m; } return 0; } } } umview-0.8.2/xmview/canonicalize.h0000644000175000017500000000211011753517211016235 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: canonicalize.h 472 2008-04-28 10:06:51Z rd235 $ * */ #ifndef CANONICALIZE_H_ #define CANONICALIZE_H_ char *um_realpath (const char *name, const char *cwd, char *resolved, struct stat64 *pst,int dontfollowlink, void *xpc); #endif umview-0.8.2/xmview/capture_nested.c0000644000175000017500000011160711753517211016612 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * capture_nested.c : capture and divert system calls from modules * * Copyright 2006 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: capture_nested.c 968 2011-08-03 10:16:26Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "capture_nested.h" #include "capture.h" #include "sctab.h" #include "scmap.h" #include "defs.h" #include "canonicalize.h" #include "mainpoll.h" #include "hashtab.h" #define SOCK_DEFAULT 0 #include "gdebug.h" //#define _NESTED_CALL_DEBUG_ #ifdef _NESTED_CALL_DEBUG_ #include "syscallnames.h" #endif static long nested_call_syscall (int sysno, struct npcb *npc); #if __NR_socketcall != __NR_doesnotexist static long nested_call_sockcall (int sysno, struct npcb *npc); #endif static long nested_call_virsc (int sysno, struct npcb *npc); static struct pcb_file umview_file; /* for modules: nesting select register */ int um_mod_event_subscribe(void (* cb)(), void *arg, int fd, int how) { struct pcb *pc=get_pcb(); struct ht_elem *hte; assert(pc); epoch_t epoch=pc->tst.epoch; epoch_t nestepoch=pc->tst.epoch=pc->nestepoch; int rv; //printk("um_mod_event_subscribe %p %p %d %d ",cb,arg,fd,how); //printk("epoch %lld n %lld \n",epoch,nestepoch); pc->hte=hte=ht_fd(&umview_file,fd,1); //printk("service %p \n",hte); if (hte != NULL) { int sfd=fd2sfd(&umview_file,fd); sysfun local_event_subscribe=ht_event_subscribe(hte); if(local_event_subscribe != NULL) rv=local_event_subscribe(cb,arg,sfd,how); else rv=how; } else { struct pollfd pdf={fd,how,0}; rv=poll(&pdf,1,0); if (cb) { if (rv == 0) mp_add(fd,how,cb,arg,0); }else mp_del(fd,arg); if (rv > 0) rv = pdf.revents; } pc->nestepoch = nestepoch; pc->tst.epoch = epoch; //printk("um_mod_event_subscribe -> %d\n",rv); return rv; } /* convert the path into an absolute path (for nested calls) */ static char *nest_abspath(int dirfd, long laddr,struct npcb *npc,struct stat64 *pst,int dontfollowlink) { char *path=(char*)laddr; char newpath[PATH_MAX]; /* modules/thread call should refer to absolute paths. * management of cwd is missing and should be carefully * studied * if (dirfd==AT_FDCWD) * cwd= ...cwd... * else * cwd= ...path of dirfd... */ npc->hte=NULL; um_realpath(path,NULL,newpath,pst,dontfollowlink,npc); if (npc->erno) return um_patherror; //error else return strdup(newpath); } /* choice function for nested calls: on the process visible fd */ struct ht_elem * nchoice_fd(int sc_number,struct npcb *npc) { int fd=npc->sysargs[0]; //printk("nchoice_fd sc %d %d %lld %p\n",sc_number,fd,npc->tst.epoch,ht_fd(&umview_file,fd,1)); return ht_fd(&umview_file,fd,1); } /* choice function for nested calls: on the private fd */ struct ht_elem * nchoice_sfd(int sc_number,struct npcb *npc) { int fd=npc->sysargs[0]; //printk("nchoice_sfd sc %d %d %lld\n",sc_number,fd,npc->tst.epoch); return ht_fd(&umview_file,fd,1); } /* choice function for nested calls: on the sc number */ struct ht_elem * nchoice_sc(int sc_number,struct npcb *npc) { return ht_check(CHECKSC,&sc_number,NULL,1); } /* choice function for nested calls: mount */ /* currently unused */ struct ht_elem * nchoice_mount(int sc_number,struct npcb *npc) { npc->path=nest_abspath(AT_FDCWD,npc->sysargs[1],npc,&(npc->pathstat),0); if(npc->path==um_patherror) return NULL; else return ht_check(CHECKFSTYPE,(char *)(npc->sysargs[2]),NULL,1); } /* choice function for nested calls: path (1st arg) */ struct ht_elem * nchoice_path(int sc_number,struct npcb *npc) { //printk("nchoice_path %s %lld\n",(char *)(npc->sysargs[0]),npc->tst.epoch); npc->path=nest_abspath(AT_FDCWD,npc->sysargs[0],npc,&(npc->pathstat),0); //printk("nchoice_abspath %s %lld\n",npc->path,npc->tst.epoch); if(npc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,npc->path,&(npc->pathstat),1); } /* choice function for nested calls: dirfd/path (1st,2nd arg) */ struct ht_elem * nchoice_pathat(int sc_number,struct npcb *npc) { npc->path=nest_abspath(npc->sysargs[0],npc->sysargs[1],npc,&(npc->pathstat),0); if(npc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,npc->path,&(npc->pathstat),1); } /* choice function for nested msocket calls: path (1st arg) */ struct ht_elem * nchoice_sockpath(int sc_number,struct npcb *npc) { if (npc->sysargs[0]) { //printk("nchoice_sockpath %s %lld\n",(char *)(npc->sysargs[0]),npc->tst.epoch); npc->path=nest_abspath(AT_FDCWD,npc->sysargs[0],npc,&(npc->pathstat),0); //printk("nchoice_sockabspath %s %lld\n",npc->path,npc->tst.epoch); if(npc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,npc->path,&(npc->pathstat),1); } else { //printk("nchoice_abspath SOCK %ld\n",npc->sysargs[1]); npc->path=NULL; return ht_check(CHECKSOCKET, &(npc->sysargs[1]),NULL,1); } } /* choice function for nested calls: link (1st arg) */ struct ht_elem * nchoice_link(int sc_number,struct npcb *npc) { //printk("nchoice_link %s\n",(char *)(npc->sysargs[0])); npc->path=nest_abspath(AT_FDCWD,npc->sysargs[0],npc,&(npc->pathstat),1); //printk("nchoice_abslink %s\n",npc->path); if(npc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,npc->path,&(npc->pathstat),1); } /* choice function for nested calls: dirfd,link (1st,2nd arg) */ struct ht_elem * nchoice_linkat(int sc_number,struct npcb *npc) { npc->path=nest_abspath(npc->sysargs[0],npc->sysargs[1],npc,&(npc->pathstat),1); if(npc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,npc->path,&(npc->pathstat),1); } /* choice function unlinkat (unlink = rmdir or unlink depending on flag) */ struct ht_elem * nchoice_unlinkat(int sc_number,struct npcb *npc) { npc->path=nest_abspath(npc->sysargs[0],npc->sysargs[1],npc,&(npc->pathstat), !(npc->sysargs[2] & AT_REMOVEDIR)); if(npc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,npc->path,&(npc->pathstat),1); } /* choice function for nested calls: dirfd,link/path (1st,2nd arg,choice on 4th) */ struct ht_elem * nchoice_pl4at(int sc_number,struct npcb *npc) { npc->path=nest_abspath(npc->sysargs[0],npc->sysargs[1],npc,&(npc->pathstat), npc->sysargs[3] & AT_SYMLINK_NOFOLLOW); if(npc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,npc->path,&(npc->pathstat),1); } /* choice function for nested calls: dirfd,link/path (1st,2nd arg,choice on 5th) */ struct ht_elem * nchoice_pl5at(int sc_number,struct npcb *npc) { npc->path=nest_abspath(npc->sysargs[0],npc->sysargs[1],npc,&(npc->pathstat), npc->sysargs[4] & AT_SYMLINK_NOFOLLOW); if(npc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,npc->path,&(npc->pathstat),1); } /* choice function for nested calls: link (2nd arg) */ struct ht_elem * nchoice_link2(int sc_number,struct npcb *npc) { npc->path=nest_abspath(AT_FDCWD,npc->sysargs[1],npc,&(npc->pathstat),1); if(npc->path==um_patherror) return NULL; else { struct ht_elem *hte_new=ht_check(CHECKPATH,npc->path,&(npc->pathstat),1); /* if NEW is real and OLD is virtual ==> EXDEV */ if (hte_new == NULL && sc_number != __NR_symlink) { struct stat64 oldstat; char *oldpath=nest_abspath(AT_FDCWD,npc->sysargs[0],npc,&oldstat,1); if (oldpath != um_patherror) { struct ht_elem *hte_old=ht_check(CHECKPATH,oldpath,&oldstat,0); if (hte_old != NULL) { free(npc->path); npc->path = um_patherror; npc->erno = EXDEV; } free(oldpath); } return NULL; } else return hte_new; } } /* choice function for nested calls: dirfd/link (3rd/4th arg) */ struct ht_elem * nchoice_link3at(int sc_number,struct npcb *npc) { npc->path=nest_abspath(npc->sysargs[2],npc->sysargs[3],npc,&(npc->pathstat),1); if(npc->path==um_patherror) return NULL; else { struct ht_elem *hte_new=ht_check(CHECKPATH,npc->path,&(npc->pathstat),1); /* if NEW is real and OLD is virtual ==> EXDEV */ if (hte_new == NULL) { struct stat64 oldstat; int dontfollowlink; char *oldpath; if (sc_number == __NR_linkat) dontfollowlink=!(npc->sysargs[4] & AT_SYMLINK_FOLLOW); else dontfollowlink=1; oldpath=nest_abspath(npc->sysargs[0],npc->sysargs[1],npc,&oldstat,dontfollowlink); if (oldpath != um_patherror) { struct ht_elem *hte_old=ht_check(CHECKPATH,oldpath,&oldstat,0); if (hte_old != NULL) { free(npc->path); npc->path = um_patherror; npc->erno = EXDEV; } free(oldpath); } return NULL; } else return hte_new; } } /* choice function for nested calls: dirfd/link (3rd/4th arg) */ struct ht_elem * nchoice_link2at(int sc_number,struct npcb *npc) { npc->path=nest_abspath(npc->sysargs[1],npc->sysargs[2],npc,&(npc->pathstat),1); if(npc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,npc->path,&(npc->pathstat),1); } /* choice function for nested calls: socket */ struct ht_elem * nchoice_socket(int sc_number,struct npcb *npc) { //printk("nchoice_socket SOCK %ld %d\n",npc->sysargs[0],um_mod_getumpid()); return ht_check(CHECKSOCKET, &(npc->sysargs[0]),NULL,1); } /* call the implementation */ long do_nested_call(sysfun um_syscall,unsigned long *args,int nargx) { /* int narg=NARGS(nargx)*/ return um_syscall(args[0],args[1],args[2],args[3],args[4],args[5]); } /* nested wrapper for syscall with a path*/ long nw_syspath_std(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { npc->sysargs[0]=(long) npc->path; return do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx); } /* nested wrapper for syscall with a path, add -1 for non 'f' syscall*/ long nw_syspath_std_1(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { npc->sysargs[0]=(long) npc->path; npc->sysargs[NARGS(scmap[uscno(scno)].nargx)] = -1; return do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx+1); } /* nested wrapper for syscall with a path, EEXIST if the file already exists*/ long nw_syspath_stdnew(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { if (npc->pathstat.st_mode != 0) { npc->erno= EEXIST; return -1; } else { npc->sysargs[0]=(long) npc->path; return do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx); } } /* nested wrapper for syscall WITH DIRFD (*at) with a path*/ long nw_sysatpath_std(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { npc->sysargs[0]=(long) npc->path; npc->sysargs[1]=npc->sysargs[2]; npc->sysargs[2]=npc->sysargs[3]; npc->sysargs[3]=npc->sysargs[4]; npc->sysargs[4]=npc->sysargs[5]; return do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx); } /* nested wrapper for fstatat*/ long nw_sysstatat(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { return um_syscall((long) npc->path,npc->sysargs[2],-1); } /* nested wrapper for syscall WITH DIRFD (*at) with a path + EEXIST error*/ long nw_sysatpath_stdnew(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { if (npc->pathstat.st_mode != 0) { npc->erno= EEXIST; return -1; } else return nw_sysatpath_std(scno,npc,hte,um_syscall); } /* nested wrapper for symlinks */ long nw_syssymlink(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { if (npc->pathstat.st_mode != 0) { npc->erno= EEXIST; return -1; } else { /* symlinkat is mapped onto symlink */ return um_syscall(npc->sysargs[0],npc->path); } } /* nested wrapper for link*/ long nw_syslink(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { char *source; int olddirfd; long oldpath; struct stat64 sourcest; #ifdef __NR_linkat if (scno == __NR_linkat || scno == __NR_renameat) { olddirfd=npc->sysargs[0]; oldpath=npc->sysargs[1]; } else #endif { olddirfd=AT_FDCWD; oldpath=npc->sysargs[0]; } source=nest_abspath(olddirfd,oldpath,npc,&sourcest,0); /* nest_abspath sets npc->hte */ if (npc->pathstat.st_mode != 0 && scno != __NR_rename && scno != __NR_renameat) { npc->erno= EEXIST; return -1; } else if (npc->path==um_patherror) { npc->erno= ENOENT; return -1; } else if (hte != npc->hte) { npc->erno= EXDEV; return -1; } else { long rv; npc->sysargs[0]=(long) source; npc->sysargs[1]=(long) npc->path; rv=do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx); free(source); return rv; } } long nw_systruncate(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { __off64_t off; #if (__NR_truncate64 != __NR_doesnotexist) if (scno == __NR_truncate64) off=LONG_LONG(npc->sysargs[1+PALIGN], npc->sysargs[2+PALIGN]); else #endif off=npc->sysargs[1]; return um_syscall(npc->path,off); } long nw_sysftruncate(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int fd=npc->sysargs[0]; __off64_t off; #if (__NR_truncate64 != __NR_doesnotexist) if (scno == __NR_truncate64) off=LONG_LONG(npc->sysargs[1+PALIGN], npc->sysargs[2+PALIGN]); else #endif off=npc->sysargs[1]; return um_syscall(fd2sfd(&umview_file,fd),off); } /* nested wrapper for open*/ long nw_sysopen(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int sfd; npc->sysargs[0]=(long) npc->path; if (scno == __NR_creat) { npc->sysargs[2]=npc->sysargs[1]; npc->sysargs[1]=O_CREAT|O_WRONLY|O_TRUNC; scno=__NR_open; } #ifdef __NR_openat else if (scno == __NR_openat) { npc->sysargs[1]=npc->sysargs[2]; npc->sysargs[2]=npc->sysargs[3]; scno=__NR_open; } #endif sfd=do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx); if (sfd >= 0) { int lfd; int newfd=r_dup(STDOUT_FILENO); /* fake a file descriptor! */ lfd=lfd_open(hte,sfd,NULL,npc->sysargs[2],1); lfd_register(&umview_file,newfd,lfd); return newfd; } else return -1; } /* nested wrapper for close*/ long nw_sysclose(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int rv; int fd=npc->sysargs[0]; int lfd=fd2lfd(&umview_file,fd); if (lfd >= 0 && lfd_getcount(lfd) <= 1) { //no more opened lfd on this file: rv=um_syscall(fd2sfd(&umview_file,fd)); if (rv >= 0) { lfd_nullsfd(lfd); lfd_deregister_n_close(&umview_file,fd); r_close(fd); } return rv; } else return -1; } /* nested wrapper for dup*/ long nw_sysdup(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int fd=npc->sysargs[0]; int sfd; if (scno==__NR_dup) npc->sysargs[1]=-1; scno=__NR_dup2; sfd=fd2sfd(&umview_file,npc->sysargs[0]); if (sfd < 0 && hte != NULL) { npc->erno=EBADF; return -1; }else { int rv; int lfd=fd2lfd(&umview_file,npc->sysargs[0]); rv=do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx); if (rv >= 0) { int newfd; if (npc->sysargs[1] != -1) { lfd_deregister_n_close(&umview_file,npc->sysargs[1]); newfd=fd; } else newfd=r_dup(fd); lfd_dup(lfd); lfd_register(&umview_file,newfd,lfd); return newfd; } else return -1; } } struct um_flock32 { short l_type; short l_whence; off_t l_start; off_t l_len; pid_t l_pid; }; struct um_flock64 { short l_type; short l_whence; loff_t l_start; loff_t l_len; pid_t l_pid; }; static inline void flock32to64(struct um_flock32 *fl32,struct um_flock64 *fl64) { fl64->l_type=fl32->l_type; fl64->l_whence=fl32->l_whence; fl64->l_start=fl32->l_start; fl64->l_len=fl32->l_len; fl64->l_pid=fl32->l_pid; } static inline void flock64to32(struct um_flock64 *fl64,struct um_flock32 *fl32) { fl32->l_type=fl64->l_type; fl32->l_whence=fl64->l_whence; fl32->l_start=fl64->l_start; fl32->l_len=fl64->l_len; fl32->l_pid=fl64->l_pid; } /* nested wrapper for fcntl/fcntl64 */ long nw_sysfcntl(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int sfd; int fd= npc->sysargs[0]; int cmd= npc->sysargs[1]; unsigned long arg=npc->sysargs[2]; long rv; sfd=fd2sfd(&umview_file,npc->sysargs[0]); if (sfd < 0 && hte != NULL) { npc->erno=EBADF; return -1; }else { switch (cmd) { case F_DUPFD: { int newfd; int lfd=fd2lfd(&umview_file,fd); #if (__NR_fcntl64 != __NR_doesnotexist) newfd=r_fcntl64(fd,cmd,arg); #else newfd=r_fcntl(fd,cmd,arg); #endif if (newfd >= 0) { lfd_dup(lfd); lfd_register(&umview_file,newfd,lfd); } rv=newfd; } case F_GETFD: if ((rv=fd_getfdfl(&umview_file,fd)) < 0) npc->erno=EBADF; case F_SETFD: if ((rv=fd_setfdfl(&umview_file,fd,arg)) < 0) npc->erno=EBADF; case F_GETLK: case F_SETLK: case F_SETLKW: #ifdef F_GETLK64 # if (F_GETLK64 != F_GETLK) case F_GETLK64: case F_SETLK64: case F_SETLKW64: # endif #endif { struct um_flock64 *flock=(struct um_flock64 *)npc->sysargs[2]; #ifdef __NR_fcntl64 if (scno == __NR_fcntl && (cmd == F_GETLK || cmd == F_SETLK || cmd == F_SETLKW)) { struct um_flock64 *flock64=alloca(sizeof(struct um_flock64)); struct um_flock32 *flock32=(struct um_flock32 *)npc->sysargs[2]; flock32to64(flock32,flock64); flock=flock64; } #endif rv=um_syscall(sfd,cmd,flock); #ifdef __NR_fcntl64 if (scno == __NR_fcntl && (cmd == F_GETLK || cmd == F_SETLK || cmd == F_SETLKW)) { struct um_flock64 *flock64=flock; struct um_flock32 *flock32=(struct um_flock32 *)npc->sysargs[2]; flock64to32(flock64,flock32); } #endif } default: if ((rv=um_syscall(sfd,cmd,arg)) == -1) { switch (cmd) { case F_GETFL: if ((rv=fd_getflfl(&umview_file,fd)) < 0) npc->erno=EBADF; else npc->erno=0; } } } return rv; } } /* nested wrapper for statfs64*/ long nw_sysstatfs64(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { npc->sysargs[0]=(long) npc->path; npc->sysargs[1]=npc->sysargs[2]; /* there is an extra arg (size) */ return do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx); } /* nested wrapper for fstatfs64*/ long nw_sysfstatfs64(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int fd=npc->sysargs[0]; npc->sysargs[0]=fd2sfd(&umview_file,fd); npc->sysargs[1]=npc->sysargs[2]; /* there is an extra arg (size) */ return do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx); } /* nested wrapper for standard system calls using fd*/ long nw_sysfd_std(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int fd=npc->sysargs[0]; npc->sysargs[0]=fd2sfd(&umview_file,fd); return do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx); } /* nested wrapper for standard system calls using fd converted to path*/ long nw_sysfdpath_std(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int fd=npc->sysargs[0]; npc->sysargs[0]=(long)fd_getpath(&umview_file,fd); npc->sysargs[NARGS(scmap[uscno(scno)].nargx)] = fd2sfd(&umview_file,fd); return do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx+1); } #if (__NR__llseek != __NR_doesnotexist) long nw_syslseek(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int fd=npc->sysargs[0]; int sfd=fd2sfd(&umview_file,fd); long offset=npc->sysargs[1]; int whence=npc->sysargs[2]; long rv; if (isnosys(um_syscall)) { loff_t lresult; um_syscall=ht_syscall(hte,uscno(__NR__llseek)); rv = um_syscall(sfd,(offset>0)?0:-1,offset,&lresult,whence); if (rv != -1) { rv=lresult; if (rv != lresult) { npc->erno = EOVERFLOW; return -1; } } return rv; } else return um_syscall(sfd,offset,whence); } long nw_sysllseek(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int fd=npc->sysargs[0]; int sfd=fd2sfd(&umview_file,fd); unsigned long offhi=npc->sysargs[1]; unsigned long offlo=npc->sysargs[2]; loff_t *result=(loff_t *) npc->sysargs[3]; unsigned int whence=npc->sysargs[4]; if (!isnosys(um_syscall)) return um_syscall(sfd,offhi,offlo,result,whence); else { if ((offhi==0 && !(offlo & 1<<31)) || ((offhi == ~0 && (offlo & 1<<31)))) { long shortresult; um_syscall=ht_syscall(hte,uscno(__NR_lseek)); if ((shortresult=um_syscall(sfd,offlo,whence)) != -1) { *result=shortresult; return 0; } else return -1; } else { npc->erno=EFAULT; return -1; } } } #endif long nw_sysreadv(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int sfd=fd2sfd(&umview_file,npc->sysargs[0]); struct iovec *iovec=(struct iovec *)npc->sysargs[1]; unsigned long count=npc->sysargs[2]; unsigned long i,totalsize,size; char *lbuf,*p; for (i=0,totalsize=0;i= 0) { for (i=0;i0;i++) { long qty=(size > iovec[i].iov_len)?iovec[i].iov_len:size; memcpy(iovec[i].iov_base,p,qty); p += qty; size -= qty; } } lfree(lbuf,totalsize); return size; } long nw_syswritev(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int sfd=fd2sfd(&umview_file,npc->sysargs[0]); struct iovec *iovec=(struct iovec *)npc->sysargs[1]; unsigned long count=npc->sysargs[2]; unsigned long i,totalsize,size; char *lbuf,*p; for (i=0,totalsize=0;isysargs[0]); struct iovec *iovec=(struct iovec *)npc->sysargs[1]; unsigned long count=npc->sysargs[2]; unsigned long i,totalsize,size; char *lbuf,*p; unsigned long long offset; #ifdef __NR_pread64 offset=LONG_LONG(npc->sysargs[3],npc->sysargs[4]); #else offset=npc->sysargs[3]; #endif for (i=0,totalsize=0;i= 0) { for (i=0;i0;i++) { long qty=(size > iovec[i].iov_len)?iovec[i].iov_len:size; memcpy(iovec[i].iov_base,p,qty); p += qty; size -= qty; } } lfree(lbuf,totalsize); return size; } long nw_syspwritev(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int sfd=fd2sfd(&umview_file,npc->sysargs[0]); struct iovec *iovec=(struct iovec *)npc->sysargs[1]; unsigned long count=npc->sysargs[2]; unsigned long i,totalsize,size; char *lbuf,*p; unsigned long long offset; #ifdef __NR_pread64 offset=LONG_LONG(npc->sysargs[3],npc->sysargs[4]); #else offset=npc->sysargs[3]; #endif for (i=0,totalsize=0;isysargs[0]; npc->sysargs[0]=fd2sfd(&umview_file,fd); #if __NR_socketcall != __NR_doesnotexist return do_nested_call(um_syscall,&(npc->sysargs[0]),sockmap[scno].nargx); #else return do_nested_call(um_syscall,&(npc->sysargs[0]),scmap[uscno(scno)].nargx); #endif } long nw_msocket(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { npc->sysargs[0]=(long) npc->path; //printk("nw_msocket %s %d\n",npc->sysargs[0],hte); if (hte != NULL) { if (npc->sysargs[2] /*type*/ == SOCK_DEFAULT) { /* redefine default for recursive calls. * it is not clear yet if it does make sense and * which semantics is has */ npc->erno=EOPNOTSUPP; return -1; } else { int sfd; if ((sfd=do_nested_call(um_syscall,&(npc->sysargs[0]),4)) < 0) { if (errno == ENOSYS && npc->path == NULL) { /* backward compatibility: * modules implementing only "socket". * the code reaches this case only from wrap_in_socket */ #if (__NR_socketcall != __NR_doesnotexist) um_syscall=ht_socketcall(hte,SYS_SOCKET); #else um_syscall=ht_syscall(hte,uscno(__NR_socket)); #endif sfd=do_nested_call(um_syscall,&(npc->sysargs[0]),3); } } if (sfd >= 0) { int lfd; int newfd=r_dup(STDOUT_FILENO); /* fake a file descriptor! */ lfd=lfd_open(hte,sfd,NULL,npc->sysargs[0],1); lfd_register(&umview_file,newfd,lfd); //printk("Fake a lfd msocket %s s%d l%d new%d\n",npc->sysargs[0],sfd,lfd,newfd); return newfd; } else return -1; } } else { /* msocket -> socket translation for native system calls * just for the case path=NULL */ if (npc->path == NULL) { npc->sysargs[0]=npc->sysargs[1]; npc->sysargs[1]=npc->sysargs[2]; npc->sysargs[2]=npc->sysargs[3]; #if (__NR_socketcall != __NR_doesnotexist) return nested_call_sockcall(SYS_SOCKET,npc); #else return nested_call_syscall(__NR_msocket,npc); #endif } else { errno=ENOTSUP; return -1; } } } /* nested wrapper for standard socket calls */ long nw_accept(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { int fd=npc->sysargs[0]; int sfd; npc->sysargs[0]=fd2sfd(&umview_file,fd); sfd=do_nested_call(um_syscall,&(npc->sysargs[0]),3); if (sfd >= 0) { int lfd; int newfd=r_dup(STDOUT_FILENO); /* fake a file descriptor! */ //printk("Fake a accept lfd msocket %d s%d l%d new%d\n",npc->sysargs[0],sfd,lfd,newfd); lfd=lfd_open(hte,sfd,NULL,npc->sysargs[0],1); lfd_register(&umview_file,newfd,lfd); return newfd; } else return -1; } long nw_socket(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { npc->sysargs[3]=npc->sysargs[2]; npc->sysargs[2]=npc->sysargs[1]; npc->sysargs[1]=npc->sysargs[0]; npc->sysargs[0]=(long)NULL; return nw_msocket(__NR_msocket,npc,hte,ht_virsyscall(hte,VIRSYS_MSOCKET)); } /* nested wrapper for not supported call */ long nw_notsupp(int scno,struct npcb *npc,struct ht_elem *hte,sysfun um_syscall) { npc->erno=EOPNOTSUPP; return -1; } /* dcif (index) for syscalls */ static int nested_sysindex(struct npcb *npc, int scno) { return uscno(scno); } /* dcif (index) for sockets or virtual: just the sysno*/ static int nested_sockvirindex(struct npcb *npc, int scno) { return scno; } /* do_kernel_call for syscalls */ static long nested_call_syscall (int sysno, struct npcb *npc) { return native_syscall(sysno, npc->sysargs[0], npc->sysargs[1], npc->sysargs[2], npc->sysargs[3], npc->sysargs[4], npc->sysargs[5]); } #if __NR_socketcall != __NR_doesnotexist /* do_kernel_call for sockets */ static long nested_call_sockcall (int sysno, struct npcb *npc) { return native_syscall(__NR_socketcall,sysno,npc->sysargs); } #endif static long nested_call_virsc (int sysno, struct npcb *npc) { npc->erno=EOPNOTSUPP; return -1; } /* COMMON WRAP FOR NESTED CALLS */ typedef int (*nested_commonwrap_index_function)(struct npcb *pc, int scno); typedef long (*nested_commonwrap_call_function)(int sysno,struct npcb *pc); typedef sysfun (*service_call)(struct ht_elem *hte, int scno); long nested_commonwrap(int sc_number,struct npcb *npc, nested_commonwrap_index_function dcif, nested_commonwrap_call_function do_kernel_call, service_call sc, struct sc_map *sm) { long rv; struct ht_elem *hte; int index = dcif(npc, sc_number); /* index of the call */ if (__builtin_expect(npc->tmpfile2unlink_n_free!=NULL,0)) { r_unlink(npc->tmpfile2unlink_n_free); free(npc->tmpfile2unlink_n_free); npc->tmpfile2unlink_n_free=NULL; } //printk("nested_commonwrap %d -> %lld\n",sc_number,npc->tst.epoch); npc->hte=hte=sm[index].nestchoice(sc_number,npc); /* module code */ #ifdef _UM_MMAP if (hte == HT_ERR) { printk("NESTED BADF!\n"); errno=EBADF; return -1; } else #endif if (npc->path == um_patherror) { errno=npc->erno; return -1; } //printk("nested_commonwrap choice %d -> %lld %x\n",sc_number,npc->tst.epoch,hte); if (hte != NULL || (sm[index].flags & NALWAYS)) { /* SUSPEND MGMT? */ rv=sm[index].nestwrap(sc_number,npc,hte,sc(hte,index)); if (rv<0 && npc->erno > 0) errno=npc->erno; } else { rv=do_kernel_call(sc_number,npc); } if (npc->path != NULL) free(npc->path); return rv; } /* set the args intp the callee temporary pcb*/ static void nsaveargs(struct pcb *caller,struct npcb *callee,long int sysno){ callee->flags=0; callee->sysscno=sysno; callee->erno=0; callee->tst=caller->tst; callee->tst.epoch=caller->nestepoch; callee->nestepoch=callee->tst.epoch; callee->ruid=caller->ruid; callee->euid=caller->euid; callee->suid=caller->suid; callee->fsuid=caller->fsuid; callee->rgid=caller->rgid; callee->egid=caller->egid; callee->sgid=caller->sgid; callee->fsgid=caller->fsgid; callee->grouplist=supgrp_get(caller->grouplist); pcb_constructor((struct pcb *)callee,0,1); } /* restore args (there is nothing to do!) */ static void nrestoreargs(struct pcb *caller,struct npcb *callee){ supgrp_put(callee->grouplist); } static long int capture_nested_virsc(long int sysno, ...); int msocket (char *path, int domain, int type, int protocol) { long rv=capture_nested_virsc(VIRSYS_MSOCKET,path,(long)domain,(long)(type),(long)protocol); //printk("msocket4modules %s %d -> %d\n",path,domain,rv); return rv; } /* management of module generated virtual system calls */ static long int capture_nested_virsc(long int sysno, ...){ va_list ap; register int i; register int narg=NARGS(virscmap[sysno].nargx); long rv; struct pcb *caller_pcb=get_pcb(); /* this is a new pcb, the actual pcb for syscall evaluation */ struct npcb callee_pcb; nsaveargs(caller_pcb, &callee_pcb,__NR_socketcall); /* socketcall ??? */ set_pcb(&callee_pcb); va_start(ap, sysno); for (i=0; iumpid; */ /* commonwrap for nested socket calls, * nested_commonwrap sets errno, so the following code should not * call any system call or errno must be saved*/ callee_pcb.private_scno=sysno | ESCNO_VIRSC; rv=nested_commonwrap(sysno, &callee_pcb, nested_sockvirindex, nested_call_virsc, ht_virsyscall, virscmap); nrestoreargs(caller_pcb, &callee_pcb); set_pcb(caller_pcb); #ifdef _NESTED_CALL_DEBUG_ { int errno_save=errno; printk("->(Sk) %ld: return value:%ld %p\n", sysno,rv,get_pcb()); errno=errno_save; } #endif return rv; } #if __NR_socketcall != __NR_doesnotexist /* management of module generated socket calls */ static long int capture_nested_socketcall(long int sysno, ...){ va_list ap; register int i; register int narg=NARGS(sockmap[sysno].nargx); long rv; struct pcb *caller_pcb=get_pcb(); /* this is a new pcb, the actual pcb for syscall evaluation */ struct npcb callee_pcb; nsaveargs(caller_pcb, &callee_pcb,__NR_socketcall); set_pcb(&callee_pcb); va_start(ap, sysno); for (i=0; iumpid; */ /* commonwrap for nested socket calls */ callee_pcb.private_scno=sysno | ESCNO_SOCKET; rv=nested_commonwrap(sysno, &callee_pcb, nested_sockvirindex, nested_call_sockcall, ht_socketcall, sockmap); nrestoreargs(caller_pcb, &callee_pcb); set_pcb(caller_pcb); #ifdef _NESTED_CALL_DEBUG_ printk("->(Sk) %ld: return value:%ld %p\n", sysno,rv,get_pcb()); #endif return rv; } #endif /* management of module generated syscalls */ static long int capture_nested_syscall(long int sysno, ...) { va_list ap; long rv; struct pcb *caller_pcb=get_pcb(); /* this is a new pcb, the actual pcb for syscall evaluation */ struct npcb callee_pcb; register int i; register int narg=NARGS(scmap[uscno(sysno)].nargx); va_start (ap, sysno); #if 0 if( caller_pcb == NULL ){ GERROR("ERROR: not finding a suitable thread syscall %d",sysno); errno=ENOSYS; return -1; } #endif nsaveargs(caller_pcb, &callee_pcb,sysno); set_pcb(&callee_pcb); for (i=0;i<6;i++){ if(i < narg) callee_pcb.sysargs[i]=va_arg(ap,long int); else callee_pcb.sysargs[i]=0; } va_end(ap); #ifdef _NESTED_CALL_DEBUG_ printk("SyC=%ld - %s %p %lld %lld- args: %x %x %x %x %x %x\n",sysno,SYSCALLNAME(sysno),get_pcb(),callee_pcb.tst.epoch,callee_pcb.nestepoch, (void*)callee_pcb.sysargs[0], (void*)callee_pcb.sysargs[1], (void*)callee_pcb.sysargs[2], (void*)callee_pcb.sysargs[3], (void*)callee_pcb.sysargs[4], (void*)callee_pcb.sysargs[5]); #endif /* * UMPID4NESTED * callee_pcb.umpid=caller_pcb->umpid; */ /* commonwrap for nested calls */ callee_pcb.private_scno = sysno; rv=nested_commonwrap(sysno, &callee_pcb, nested_sysindex, nested_call_syscall, ht_syscall, scmap); nrestoreargs(caller_pcb, &callee_pcb); set_pcb(caller_pcb); #ifdef _NESTED_CALL_DEBUG_ printk("-> %ld - %s: return value:%ld %p\n", sysno,SYSCALLNAME(sysno),rv,get_pcb()); #endif return rv; } /* capture all umview+modules thread creations */ static sysfun libc__clone=(sysfun)clone; struct clonearg { int (*fn) (void *arg); void *arg; void *parentpcb; }; /* create a new (reduced) pcb for a thread */ static struct npcb *new_npcb(struct pcb *old) { struct npcb *npcb; npcb=calloc(1,sizeof(struct npcb)); npcb->flags=PCB_ALLOCATED; /* inherit the treepoch path from the generating thread */ npcb->tst=old->tst; /* inherit the current hash table element during clone*/ npcb->hte=old->hte; /* timestamp the new thread with the current time (is it correct?) */ //npcb->tst.epoch=npcb->nestepoch=get_epoch(); /* XXX rd235 20090805 inherit the time of the creating thread */ npcb->nestepoch=npcb->tst.epoch; //printk("new_npcb %lld\n",npcb->tst.epoch); npcb->ruid=old->ruid; npcb->euid=old->euid; npcb->suid=old->suid; npcb->fsuid=old->fsuid; npcb->rgid=old->rgid; npcb->egid=old->egid; npcb->sgid=old->sgid; npcb->fsgid=old->fsgid; npcb->grouplist=supgrp_get(old->grouplist); pcb_constructor((struct pcb *)npcb,0,1); return npcb; } /* thread wrapper */ static int clonewrap(void *carg){ int (*fn) (void *arg) = ((struct clonearg *)(carg))->fn; void *arg=((struct clonearg *)(carg))->arg; /* create a new pcb for the new thread, and link the pcb with this new * thread */ set_pcb(new_npcb(((struct clonearg *)(carg))->parentpcb)); /* free the data structure used to keep the thread info */ free(carg); /* start the real thread */ return fn(arg); } /* clone management */ int __clone (int (*fn) (void *arg), void *child_stack, int flags, void *arg, void *arg2, void *arg3, void *arg4) { int rv; struct clonearg *carg=malloc(sizeof(struct clonearg)); #ifdef _NESTED_CALL_DEBUG_ GMESSAGE("CLONE\n"); #endif carg->fn=fn; carg->arg=arg; carg->parentpcb=get_pcb(); /* start a wrapper to the real main function of the thread */ rv= libc__clone(clonewrap,child_stack,flags,carg,arg2,arg3,arg4); return rv; } /* capture system call generated by modules, pure_libc initialization */ void capture_nested_init() { sfun (*_pure_start_p)(); /* thread creation must be traced */ libc__clone = dlsym (RTLD_NEXT, "__clone"); /* fake pcb for path management */ umview_file.count=1; umview_file.nolfd=0; umview_file.lfdlist=NULL; /* setting of _pure_syscall and _pure_socketcall, loading * of native_syscall to bypass the library */ if ((_pure_start_p=dlsym(RTLD_DEFAULT,"_pure_start")) != NULL) { printk(KERN_NOTICE "pure_libc library found: syscall tracing allowed\n\n"); #if __NR_socketcall != __NR_doesnotexist native_syscall=_pure_start_p(capture_nested_syscall,capture_nested_socketcall,0); #else native_syscall=_pure_start_p(capture_nested_syscall,NULL,0); #endif } } umview-0.8.2/xmview/capture_nested.h0000644000175000017500000000206511753517211016614 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * Copyright 2006 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: capture_nested.h 377 2007-08-28 20:36:16Z garden $ * */ #ifndef CAPTURE_NESTED_H_ #define CAPTURE_NESTED_H_ int um_mod_event_subscribe(void (* cb)(), void *arg, int fd, int how); void capture_nested_init(void); #endif umview-0.8.2/xmview/um_basicio.c0000644000175000017500000006356211753517211015725 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_basicio: io wrappers * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_basicio.c 1013 2011-10-28 10:54:57Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "defs.h" #include "umproc.h" #include "services.h" #include "um_services.h" #include "sctab.h" #include "scmap.h" #include "utils.h" #include "hashtab.h" #include "gdebug.h" static char mode2accessmode_tab[]={R_OK,W_OK,R_OK|W_OK,0}; #define MODE2ACCESSMODE(mode) mode2accessmode_tab[(mode)&O_ACCMODE] /* OPEN & CREAT wrapper "in" phase * always called (also when service == NULL)*/ int wrap_in_open(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int mode,flags; if (sc_number== __NR_open) { flags=pc->sysargs[1]; mode=pc->sysargs[2]; #ifdef __NR_openat } else if (sc_number == __NR_openat) { flags=pc->sysargs[2]; mode=pc->sysargs[3]; #endif } else { flags=O_CREAT|O_WRONLY|O_TRUNC; mode=pc->sysargs[1]; } if (secure) { int rv=-1; if (pc->pathstat.st_mode == 0) { if (flags & O_CREAT) rv=um_parentwaccess(pc->path,pc); else errno=ENOENT; } else rv=um_x_access(pc->path,MODE2ACCESSMODE(flags),pc,&pc->pathstat); if (rv) { pc->retval=-1; pc->erno=errno; return SC_FAKE; } } if (hte != NULL) { /* call the module's open */ if ((pc->retval = um_syscall(pc->path,flags,mode & ~(pc->fdfs->mask))) < 0) pc->erno = errno; //printk("open exit a %d %d %s\n",pc->retval,pc->erno,pc->path); if (pc->retval >= 0 && (pc->retval=lfd_open(hte,pc->retval,pc->path,flags,0)) >= 0) { /* change the syscall parms, open the fifo instead of the file */ um_x_rewritepath(pc,lfd_getfilename(pc->retval),0,0); putscno(__NR_open,pc); pc->sysargs[1]=O_RDONLY; return SC_CALLONXIT; } else return SC_FAKE; } else { if (__builtin_expect(pc->needs_path_rewrite,0)) { // printk("needs_path_rewrite OPEN %s %d\n",pc->path,pc->sysscno); #ifdef __NR_openat um_x_rewritepath(pc,pc->path,(sc_number == __NR_openat)?1:0,0); #else um_x_rewritepath(pc,pc->path,0,0); #endif pc->retval=lfd_open(hte,-1,pc->path,flags,0); return SC_CALLONXIT; } else { /* do not register non virtualized files */ //pc->retval=lfd_open(hte,-1,pc->path,flags,0); //return SC_TRACEONLY; return STD_BEHAVIOR; } } } /* OPEN & CREAT wrapper: "out" phase */ int wrap_out_open(int sc_number,struct pcb *pc) { /* user mode open succeeded */ if (pc->retval >= 0) { int fd=getrv(pc); //printk("open: true return value: %d %d %d\n", fd,pc->retval,getscno(pc)); /* process syscall succeeded, too */ if (fd >= 0 && (lfd_getht(pc->retval) == NULL || addfd(pc,fd) == 0)) { /* update open file table*/ lfd_register(pc->fds,fd,pc->retval); } else lfd_close(pc->retval); } else { putrv(pc->retval,pc); puterrno(pc->erno,pc); } GDEBUG(3, "end of wrap_out: retval %d errno %d", pc->retval, pc->erno); return SC_MODICALL; } /* CLOSE wrapper: "in" phase ALWAYS called*/ int wrap_in_close(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { //printk("wrap in close %d\n", pc->sysargs[0]); if (hte != NULL) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); int lfd=fd2lfd(pc->fds,pc->sysargs[0]); //printk("UM_SERVICE close %d %d %d\n",pc->sysargs[0],lfd,sfd); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { if (lfd>=0 && lfd_getcount(lfd) <= 1) { /* no more opened lfd on this file: */ pc->retval = um_syscall(sfd); pc->erno=errno; /* nullify sfd to avoid double close */ if (pc->retval >= 0) lfd_nullsfd(lfd); } else pc->retval = pc ->erno = 0; } return SC_CALLONXIT; } else if (fd2lfd(pc->fds,pc->sysargs[0]) >= 0) return SC_TRACEONLY; else return STD_BEHAVIOR; } /* CLOSE wrapper: "out" phase */ int wrap_out_close(int sc_number,struct pcb *pc) { int lfd=fd2lfd(pc->fds,pc->sysargs[0]); //printk("close %d ->%d\n",pc->sysargs[0],lfd); /* delete the lfd table element */ if (lfd>=0) { struct ht_elem *hte=lfd_getht(lfd); lfd_deregister_n_close(pc->fds,pc->sysargs[0]); if (hte != NULL) { delfd(pc,pc->sysargs[0]); putrv(pc->retval,pc); puterrno(pc->erno,pc); } } return SC_MODICALL; } /* wrap_out for all standard i/o calls. * The process level syscall is faked (or skipped when ptrace_sysvm exists * and the module return value/errno must be returned */ int wrap_out_std(int sc_number,struct pcb *pc) { putrv(pc->retval,pc); if (pc->retval<0) puterrno(pc->erno,pc); return SC_MODICALL; } int wrap_in_read(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { unsigned long pbuf=pc->sysargs[1]; unsigned long count=pc->sysargs[2]; int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { char *lbuf=(char *)lalloca(count); if ((pc->retval = um_syscall(sfd,lbuf,count)) < 0) pc->erno=errno; if (pc->retval > 0) ustoren(pc,pbuf,pc->retval,lbuf); lfree(lbuf,count); } return SC_FAKE; } int wrap_in_write(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { unsigned long pbuf=pc->sysargs[1]; unsigned long count=pc->sysargs[2]; int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { char *lbuf=(char *)lalloca(count); umoven(pc,pbuf,count,lbuf); if ((pc->retval = um_syscall(sfd,lbuf,count)) < 0) pc->erno=errno; lfree(lbuf,count); } return SC_FAKE; } int wrap_in_pread(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { unsigned long pbuf=pc->sysargs[1]; unsigned long count=pc->sysargs[2]; unsigned long long offset; char *lbuf=(char *)lalloca(count); #ifdef __NR_pread64 offset=LONG_LONG(pc->sysargs[3+PALIGN],pc->sysargs[4+PALIGN]); #else offset=pc->sysargs[3]; #endif if ((pc->retval = um_syscall(sfd,lbuf,count,offset)) < 0) pc->erno=errno; if (pc->retval > 0) ustoren(pc,pbuf,pc->retval,lbuf); lfree(lbuf,count); } return SC_FAKE; } int wrap_in_pwrite(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { unsigned long pbuf=pc->sysargs[1]; unsigned long count=pc->sysargs[2]; unsigned long long offset; char *lbuf=(char *)lalloca(count); #ifdef __NR_pwrite64 offset=LONG_LONG(pc->sysargs[3+PALIGN],pc->sysargs[4+PALIGN]); #else offset=pc->sysargs[3]; #endif umoven(pc,pbuf,count,lbuf); if ((pc->retval = um_syscall(sfd,lbuf,count,offset)) < 0) pc->erno=errno; lfree(lbuf,count); } return SC_FAKE; } #ifdef __NR_preadv int wrap_in_preadv(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { unsigned long vecp=pc->sysargs[1]; unsigned long count=pc->sysargs[2]; unsigned long i,totalsize,size; struct iovec *iovec; char *lbuf,*p; unsigned long long offset; #ifdef __NR_pread64 offset=LONG_LONG(pc->sysargs[3+PALIGN],pc->sysargs[4+PALIGN]); #else offset=pc->sysargs[3]; #endif if (__builtin_expect((count > IOV_MAX),0)) count=IOV_MAX; iovec=(struct iovec *)alloca(count * sizeof(struct iovec)); umoven(pc,vecp,count * sizeof(struct iovec),(char *)iovec); for (i=0,totalsize=0;iretval = um_syscall(sfd,lbuf,totalsize,offset)) >= 0) { for (i=0;i0;i++) { long qty=(size > iovec[i].iov_len)?iovec[i].iov_len:size; ustoren(pc,(long)iovec[i].iov_base,qty,p); p += qty; size -= qty; } } else pc->erno=errno; lfree(lbuf,totalsize); } return SC_FAKE; } #endif #ifdef __NR_pwritev int wrap_in_pwritev(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { unsigned long vecp=pc->sysargs[1]; unsigned long count=pc->sysargs[2]; unsigned long i,totalsize; struct iovec *iovec; char *lbuf, *p; unsigned long long offset; #ifdef __NR_pwrite64 offset=LONG_LONG(pc->sysargs[3+PALIGN],pc->sysargs[4+PALIGN]); #else offset=pc->sysargs[3]; #endif if (__builtin_expect((count > IOV_MAX),0)) count=IOV_MAX; iovec=(struct iovec *)alloca(count * sizeof(struct iovec)); umoven(pc,vecp,count * sizeof(struct iovec),(char *)iovec); for (i=0,totalsize=0;iretval = um_syscall(sfd,lbuf,totalsize,offset)) < 0) pc->erno=errno; lfree(lbuf,totalsize); } return SC_FAKE; } #endif /* DAMNED! the kernel stat are different! so glibc converts the * kernel structure. We have to make the reverse conversion! */ #ifdef __powerpc__ struct kstat { unsigned kst_dev; ino_t kst_ino; mode_t kst_mode; nlink_t kst_nlink; uid_t kst_uid; gid_t kst_gid; unsigned kst_rdev; off_t kst_size; unsigned long kst_blksize; unsigned long kst_blocks; unsigned long kst_atime; unsigned long kst_atime_nsec; unsigned long kst_mtime; unsigned long kst_mtime_nsec; unsigned long kst_ctime; unsigned long kst_ctime_nsec; unsigned long k__unused4; unsigned long k__unused5; }; #endif #ifdef __i386__ struct kstat { unsigned short kst_dev; unsigned short k__pad1; unsigned long kst_ino; unsigned short kst_mode; unsigned short kst_nlink; unsigned short kst_uid; unsigned short kst_gid; unsigned short kst_rdev; unsigned short k__pad2; unsigned long kst_size; unsigned long kst_blksize; unsigned long kst_blocks; unsigned long kst_atime; unsigned long k__unused1; unsigned long kst_mtime; unsigned long k__unused2; unsigned long kst_ctime; unsigned long k__unused3; unsigned long k__unused4; unsigned long k__unused5; }; #endif #if ! defined(__x86_64__) #if 0 struct kstat { unsigned long kst_dev; unsigned long kst_ino; unsigned long kst_nlink; unsigned int kst_mode; unsigned int kst_uid; unsigned int kst_gid; unsigned int k__pad0; unsigned long kst_rdev; long kst_size; long kst_blksize; long kst_blocks; /* Number 512-byte blocks allocated. */ unsigned long kst_atime; unsigned long kst_atime_nsec; unsigned long kst_mtime; unsigned long kst_mtime_nsec; unsigned long kst_ctime; unsigned long kst_ctime_nsec; long k__unused[3]; }; #else static void stat64_2kstat(struct stat64 *buf,struct kstat *kbuf) { kbuf->kst_dev = (unsigned short) buf->st_dev; kbuf->kst_ino = (unsigned long) buf->st_ino; kbuf->kst_mode = (unsigned short) buf->st_mode; kbuf->kst_nlink = (unsigned short) buf->st_nlink; kbuf->kst_uid = (unsigned short) buf->st_uid; kbuf->kst_gid = (unsigned short) buf->st_gid; kbuf->kst_rdev = (unsigned short) buf->st_rdev; kbuf->kst_size = (unsigned long) buf->st_size; kbuf->kst_blksize = (unsigned long) buf->st_blksize; kbuf->kst_blocks = (unsigned long) buf->st_blocks; kbuf->kst_atime = (unsigned long) buf->st_atime; kbuf->kst_mtime = (unsigned long) buf->st_mtime; kbuf->kst_ctime = (unsigned long) buf->st_ctime; } #endif // if not defined _x86_64 int wrap_in_stat(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pbuf=pc->sysargs[1]; struct stat64 buf64; pc->retval = um_syscall(pc->path,&buf64,-1); if (pc->retval >= 0) { struct kstat kbuf; stat64_2kstat(&buf64,&kbuf); ustoren(pc,pbuf,sizeof(struct kstat),(char *)&kbuf); } else pc->erno=errno; return SC_FAKE; } int wrap_in_fstat(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pbuf=pc->sysargs[1]; char *path =fd_getpath(pc->fds,pc->sysargs[0]); if (path == NULL) { pc->retval= -1; pc->erno= EBADF; } else { struct stat64 buf64; int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if ((pc->retval = um_syscall(path,&buf64,sfd)) >= 0) { struct kstat kbuf; stat64_2kstat(&buf64,&kbuf); ustoren(pc,pbuf,sizeof(struct kstat),(char *)&kbuf); } else pc->erno=errno; } return SC_FAKE; } #endif // if not defined _x86_64 int wrap_in_stat64(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pbuf; struct stat64 buf; #if defined(__NR_fstatat64) || defined(__NR_newfstatat) if (sc_number == #ifdef __NR_fstatat64 __NR_fstatat64 #else __NR_newfstatat #endif ) { pbuf=pc->sysargs[2]; /* it is lstat anyway. if (pc->sysargs[3] & AT_SYMLINK_NOFOLLOW) um_syscall=ht_syscall(hte,uscno(NR64_lstat)); */ } else #endif pbuf=pc->sysargs[1]; if ((pc->retval = um_syscall(pc->path,&buf,-1)) >= 0) ustoren(pc,pbuf,sizeof(struct stat64),&buf); else pc->erno=errno; return SC_FAKE; } int wrap_in_fstat64(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pbuf=pc->sysargs[1]; char *path=fd_getpath(pc->fds,pc->sysargs[0]); if (path==NULL) { pc->retval= -1; pc->erno= EBADF; } else { struct stat64 buf; int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if ((pc->retval = um_syscall(path,&buf,sfd)) >= 0) ustoren(pc,pbuf,sizeof(struct stat64),&buf); else pc->erno=errno; } return SC_FAKE; } int wrap_in_readlink(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { unsigned long pbuf; unsigned long bufsiz; char *lbuf; #ifdef __NR_readlinkat if (sc_number == __NR_readlinkat) { pbuf=pc->sysargs[2]; bufsiz=pc->sysargs[3]; } else #endif { pbuf=pc->sysargs[1]; bufsiz=pc->sysargs[2]; } lbuf=(char *)lalloca(PATH_MAX+1); if ((pc->retval = (long) um_syscall(pc->path,lbuf,PATH_MAX+1)) >= 0) { if (pc->retval > bufsiz) pc->retval = bufsiz; ustoren(pc,pbuf,pc->retval,lbuf); } else pc->erno=errno; lfree(lbuf,bufsiz); GDEBUG(10,"wrap_in_readlink - rv=%ld\n",pc->retval); return SC_FAKE; } /******************************************************************/ /* DIRENTS STRUCTS */ void dents64_to_dents(void* buf,int count){ struct dirent *dirp=buf; struct dirent64 *dirp64=buf; int counter=0; unsigned short int buf_len; for( counter=0; counterd_ino,dirp64->d_off,dirp64->d_reclen,&(dirp64->d_name)); dirp->d_ino = (unsigned long) dirp64->d_ino; dirp->d_off = (unsigned long) dirp64->d_off; buf_len = dirp->d_reclen = dirp64->d_reclen; tmptype = dirp64->d_type; memmove(dirp->d_name,dirp64->d_name,strlen(dirp64->d_name)+1); *((char *) dirp + buf_len - 1)=tmptype; counter= counter + dirp->d_reclen; //bad... GDEBUG(10,"dirent: ino:%ld - off:%ld - reclen:%d - name:%s",dirp->d_ino,dirp->d_off,dirp->d_reclen,(dirp->d_name)); GDEBUG(10,"counter: %d count: %d ",counter,count); dirp = (struct dirent*) ((char*)dirp + buf_len); dirp64 = (struct dirent64*) ((char*)dirp64 + buf_len); } } int wrap_in_getdents(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pbuf=pc->sysargs[1]; unsigned long bufsiz=pc->sysargs[2]; int sfd=fd2sfd(pc->fds,pc->sysargs[0]); //printk("wrap_in_getdents(sc:%d ,pc,service:%s,syscall);\n",sc_number,ht_get_servicename(hte)); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { char *lbuf=(char *)lalloca(bufsiz); if ((pc->retval = um_syscall(sfd,lbuf,bufsiz)) >= 0) { dents64_to_dents(lbuf,pc->retval); ustoren(pc,pbuf,pc->retval,lbuf); } else pc->erno=errno; lfree(lbuf,bufsiz); } return SC_FAKE; } int wrap_in_getdents64(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pbuf=pc->sysargs[1]; unsigned long bufsiz=pc->sysargs[2]; int sfd=fd2sfd(pc->fds,pc->sysargs[0]); //printk("wrap_in_getdents(sc:%d ,pc,service:%s,syscall);\n",sc_number,ht_get_servicename(hte)); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { char *lbuf=(char *)lalloca(bufsiz); if ((pc->retval = um_syscall(sfd,lbuf,bufsiz)) >= 0) ustoren(pc,pbuf,pc->retval,lbuf); else pc->erno=errno; lfree(lbuf,bufsiz); } return SC_FAKE; } int wrap_in_access(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { unsigned long mode; long flags; #ifdef __NR_faccessat if (sc_number == __NR_faccessat) { mode=pc->sysargs[2]; flags=pc->sysargs[3]; } else #endif { mode=pc->sysargs[1]; flags=0; } if (isnosys(um_syscall)) { if ((pc->retval = um_x_access(pc->path,mode,pc,&pc->pathstat) < 0)) pc->erno=errno; } else if ((pc->retval = um_syscall(pc->path,mode,flags)) < 0) pc->erno=errno; return SC_FAKE; } #if (__NR__llseek == __NR_doesnotexist) int wrap_in_lseek(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { long offset =pc->sysargs[1]; long whence =pc->sysargs[2]; if ((pc->retval = um_syscall(sfd,offset,whence)) == -1) pc->erno=errno; } return SC_FAKE; } #else int wrap_in_lseek(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { long offset =pc->sysargs[1]; long whence =pc->sysargs[2]; if (isnosys(um_syscall)) { loff_t lresult; um_syscall=ht_syscall(hte,uscno(__NR__llseek)); pc->retval = um_syscall(sfd, (offset>0)?0:-1,offset,&lresult,whence); if (pc->retval != -1) { pc->retval=lresult; if (pc->retval != lresult) { pc->retval = -1; pc->erno = EOVERFLOW; } } } else { if ((pc->retval = um_syscall(sfd,offset,whence)) == -1) pc->erno=errno; } } return SC_FAKE; } int wrap_in_llseek(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { unsigned long offhi=pc->sysargs[1]; unsigned long offlo=pc->sysargs[2]; unsigned long result=pc->sysargs[3]; unsigned int whence=pc->sysargs[4]; loff_t lresult; if (!isnosys(um_syscall)) { if ((pc->retval = um_syscall(sfd,offhi,offlo,&lresult,whence))< 0) pc->erno=errno; else ustoren(pc,result,sizeof(loff_t),(char *)&lresult); } else {/* backup solution translate it to lseek when possible */ if ((offhi==0 && !(offlo & 1<<31)) || ((offhi == ~0 && (offlo & 1<<31)))) { long shortresult; um_syscall=ht_syscall(hte,uscno(__NR_lseek)); if ((shortresult=um_syscall(sfd,offlo,whence)) == -1) { pc->retval=-1; pc->erno=errno; } else { lresult=result; pc->retval=0; ustoren(pc,result,sizeof(loff_t),(char *)&lresult); } } else { pc->retval=-1; pc->erno=EFAULT; } } } return SC_FAKE; } #endif int wrap_in_notsupp(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { //printk("wrap_in_notsupp %d\n",sc_number); pc->retval= -1; pc->erno= EOPNOTSUPP; return SC_FAKE; } int wrap_in_readv(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { unsigned long vecp=pc->sysargs[1]; unsigned long count=pc->sysargs[2]; unsigned long i,totalsize,size; struct iovec *iovec; char *lbuf,*p; if (__builtin_expect((count > IOV_MAX),0)) count=IOV_MAX; iovec=(struct iovec *)alloca(count * sizeof(struct iovec)); umoven(pc,vecp,count * sizeof(struct iovec),(char *)iovec); for (i=0,totalsize=0;iretval = um_syscall(sfd,lbuf,totalsize)) >= 0) { for (i=0;i0;i++) { long qty=(size > iovec[i].iov_len)?iovec[i].iov_len:size; ustoren(pc,(long)iovec[i].iov_base,qty,p); p += qty; size -= qty; } } else pc->erno=errno; lfree(lbuf,totalsize); } return SC_FAKE; } int wrap_in_writev(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; } else { unsigned long vecp=pc->sysargs[1]; unsigned long count=pc->sysargs[2]; unsigned long i,totalsize; struct iovec *iovec; char *lbuf, *p; if (__builtin_expect((count > IOV_MAX),0)) count=IOV_MAX; iovec=(struct iovec *)alloca(count * sizeof(struct iovec)); umoven(pc,vecp,count * sizeof(struct iovec),(char *)iovec); for (i=0,totalsize=0;iretval = um_syscall(sfd,lbuf,totalsize)) < 0) pc->erno=errno; lfree(lbuf,totalsize); } return SC_FAKE; } /* ATTR management */ #ifdef __NR_getxattr int wrap_in_getxattr(int sc_number, struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pname = pc->sysargs[1]; long pbuf = pc->sysargs[2]; size_t size = pc->sysargs[3]; char name[XATTR_NAME_MAX]; char *buf; if (size > XATTR_SIZE_MAX) size=XATTR_SIZE_MAX; buf = alloca(size); umovestr(pc,pname,XATTR_NAME_MAX,name); if ((pc->retval = um_syscall(pc->path, name, buf, size, -1)) >= 0) ustoren(pc, pbuf, size, buf); else pc->erno = errno; return SC_FAKE; } int wrap_in_fgetxattr(int sc_number, struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pname = pc->sysargs[1]; long pbuf = pc->sysargs[2]; size_t size = pc->sysargs[3]; char name[XATTR_NAME_MAX]; char *path =fd_getpath(pc->fds,pc->sysargs[0]); int sfd=fd2sfd(pc->fds,pc->sysargs[0]); char *buf; if (size > XATTR_SIZE_MAX) size=XATTR_SIZE_MAX; buf = alloca(size); umovestr(pc,pname,XATTR_NAME_MAX,name); if ((pc->retval = um_syscall(path, name, buf, size, sfd)) >= 0) ustoren(pc, pbuf, size, buf); else pc->erno = errno; return SC_FAKE; } int wrap_in_setxattr(int sc_number, struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pname = pc->sysargs[1]; long pbuf = pc->sysargs[2]; size_t size = pc->sysargs[3]; int flags = pc->sysargs[4]; char name[XATTR_NAME_MAX]; char *buf; if (size > XATTR_SIZE_MAX) size=XATTR_SIZE_MAX; buf = alloca(size); umovestr(pc,pname,XATTR_NAME_MAX,name); umoven(pc,pbuf,size,buf); if ((pc->retval = um_syscall(pc->path, name, buf, size, flags, -1)) < 0) pc->erno = errno; return SC_FAKE; } int wrap_in_fsetxattr(int sc_number, struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pname = pc->sysargs[1]; long pbuf = pc->sysargs[2]; size_t size = pc->sysargs[3]; int flags = pc->sysargs[4]; char name[XATTR_NAME_MAX]; char *path =fd_getpath(pc->fds,pc->sysargs[0]); int sfd=fd2sfd(pc->fds,pc->sysargs[0]); char *buf; if (size > XATTR_SIZE_MAX) size=XATTR_SIZE_MAX; buf = alloca(size); umovestr(pc,pname,XATTR_NAME_MAX,name); umoven(pc,pbuf,size,buf); if ((pc->retval = um_syscall(path, name, buf, size, flags, sfd)) < 0) pc->erno = errno; return SC_FAKE; } int wrap_in_listxattr(int sc_number, struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pbuf = pc->sysargs[1]; size_t size = pc->sysargs[2]; char *buf; if (size > XATTR_LIST_MAX) size=XATTR_LIST_MAX; buf = alloca(size); if ((pc->retval = um_syscall(pc->path, buf, size, -1)) >= 0) ustoren(pc, pbuf, size, buf); else pc->erno = errno; return SC_FAKE; } int wrap_in_flistxattr(int sc_number, struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pbuf = pc->sysargs[1]; size_t size = pc->sysargs[2]; char *path =fd_getpath(pc->fds,pc->sysargs[0]); int sfd=fd2sfd(pc->fds,pc->sysargs[0]); char *buf; if (size > XATTR_LIST_MAX) size=XATTR_LIST_MAX; buf = alloca(size); if ((pc->retval = um_syscall(path, buf, size, sfd)) >= 0) ustoren(pc, pbuf, size, buf); else pc->erno = errno; return SC_FAKE; } int wrap_in_removexattr(int sc_number, struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pname = pc->sysargs[1]; char name[XATTR_NAME_MAX]; umovestr(pc,pname,XATTR_NAME_MAX,name); if ((pc->retval = um_syscall(pc->path, name, -1)) < 0) pc->erno = errno; return SC_FAKE; } int wrap_in_fremovexattr(int sc_number, struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { long pname = pc->sysargs[1]; char name[XATTR_NAME_MAX]; char *path =fd_getpath(pc->fds,pc->sysargs[0]); int sfd=fd2sfd(pc->fds,pc->sysargs[0]); umovestr(pc,pname,XATTR_NAME_MAX,name); if ((pc->retval = um_syscall(path, name, sfd)) < 0) pc->erno = errno; return SC_FAKE; } #endif umview-0.8.2/xmview/um_plusio.c0000644000175000017500000005545611753517211015632 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_plusio: io wrappers (second part) * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Ludovico Gardenghi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_plusio.c 1018 2011-11-19 10:51:16Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "defs.h" #include "gdebug.h" #include "umproc.h" #include "services.h" #include "hashtab.h" #include "um_services.h" #include "sctab.h" #include "scmap.h" #include "utils.h" #include "uid16to32.h" #define umNULL ((long) NULL) int wrap_in_mkdir(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int mode; #ifdef __NR_mkdirat if (sc_number == __NR_mkdirat) mode=pc->sysargs[2]; else #endif mode=pc->sysargs[1]; if (pc->pathstat.st_mode != 0) { pc->retval= -1; pc->erno= EEXIST; } else { if (secure && (pc->retval=(um_parentwaccess(pc->path,pc))) < 0) pc->erno=errno; else if ((pc->retval = um_syscall(pc->path,mode & ~ (pc->fdfs->mask))) < 0) pc->erno=errno; } return SC_FAKE; } /* mknod uses a horrible encoding of device major/minor */ /* XXX dunno what is the situation on 64bit machine */ static inline dev_t new_decode_dev(unsigned long dev) { unsigned major = (dev & 0xfff00) >> 8; unsigned minor = (dev & 0xff) | ((dev >> 12) & 0xfff00); return makedev(major, minor); } int wrap_in_mknod(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { unsigned long mode; unsigned long dev; #ifdef __NR_mknodat if (sc_number == __NR_mknodat) { mode=pc->sysargs[2]; dev=pc->sysargs[3]; } else #endif { mode=pc->sysargs[1]; dev=pc->sysargs[2]; } if (secure) { /* mode requested creation of something other than a regular file, FIFO (named pipe), or Unix domain socket, and the caller is not privileged (Linux: does not have the CAP_MKNOD capability); */ if (mode != S_IFREG && mode != S_IFIFO && mode != S_IFSOCK && capcheck(CAP_MKNOD,pc)) { pc->retval = -1; pc->erno = EPERM; return SC_FAKE; } if (um_parentwaccess(pc->path,pc)) { pc->retval = -1; pc->erno = errno; return SC_FAKE; } } if (pc->pathstat.st_mode != 0) { pc->retval= -1; pc->erno= EEXIST; } else if ((pc->retval = um_syscall(pc->path,mode & ~ (pc->fdfs->mask),new_decode_dev(dev))) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_unlink(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { #ifdef __NR_unlinkat if (sc_number == __NR_unlinkat && (pc->sysargs[2] & AT_REMOVEDIR)) { um_syscall=ht_syscall(hte,uscno(__NR_rmdir)); } #endif if (secure && (pc->retval=(um_parentwaccess(pc->path,pc))) < 0) pc->erno=errno; else if ((pc->retval = um_syscall(pc->path)) < 0) pc->erno=errno; return SC_FAKE; } static inline int chown_eperm(struct pcb *pc,unsigned int owner,unsigned int group) { /* Only a privileged process (Linux: one with the CAP_CHOWN capability) may change the owner of a file. The owner of a file may change the group of the file to any group of which that owner is a member. A privileged process (Linux: with CAP_CHOWN) may change the group arbi‐ trarily. */ if (capcheck(CAP_CHOWN,pc)) { if (owner != (unsigned int) -1 && owner != pc->pathstat.st_uid) return 1; if (group != (unsigned int) -1 && group != pc->pathstat.st_gid && in_supgrplist(group,pc) == 0) return 1; } return 0; } int wrap_in_chown(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int owner,group; #ifdef __NR_fchownat if (sc_number == __NR_fchownat) { owner=pc->sysargs[2]; group=pc->sysargs[3]; } else #endif { owner=pc->sysargs[1]; group=pc->sysargs[2]; } #if __NR_chown != __NR_chown32 if (sc_number == __NR_chown || sc_number == __NR_lchown) { owner=id16to32(owner); group=id16to32(group); } #endif if (secure) { if (chown_eperm(pc,owner,group)) { pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } } if ((pc->retval = um_syscall(pc->path,owner,group,-1)) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_fchown(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { char *path=fd_getpath(pc->fds,pc->sysargs[0]); if (path==NULL) { pc->retval= -1; pc->erno= EBADF; return SC_FAKE; } else { unsigned int owner,group; int sfd=fd2sfd(pc->fds,pc->sysargs[0]); owner=pc->sysargs[1]; group=pc->sysargs[2]; #if __NR_fchown != __NR_fchown32 if (sc_number == __NR_fchown) { owner=id16to32(owner); group=id16to32(group); } #endif if (secure) { pc->path=strdup(path); um_x_lstat64(pc->path, &(pc->pathstat), pc, 0); if (chown_eperm(pc,owner,group)) { pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } } if ((pc->retval = um_syscall(path,owner,group,sfd)) < 0) pc->erno=errno; return SC_FAKE; } } static inline int chmod_eperm(struct pcb *pc,int *pmode) { /* The effective UID of the calling process must match the owner of the file, or the process must be privileged (Linux: it must have the CAP_FOWNER capability). */ if (capcheck(CAP_FOWNER,pc) && pc->euid != pc->pathstat.st_uid) return 1; /* If the calling process is not privileged (Linux: does not have the CAP_FSETID capability), and the group of the file does not match the effective group ID of the process or one of its supplementary group IDs, the S_ISGID bit will be turned off, but this will not cause an error to be returned. */ if (capcheck(CAP_FSETID,pc) && pc->egid != pc->pathstat.st_gid && in_supgrplist(pc->pathstat.st_gid,pc) == 0) *pmode &= ~S_ISGID; return 0; } int wrap_in_chmod(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int mode; #ifdef __NR_fchmodat if (sc_number == __NR_fchmodat) mode=pc->sysargs[2]; else #endif mode=pc->sysargs[1]; if (secure) { if (chmod_eperm(pc,&mode)) { pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } } if ((pc->retval = um_syscall(pc->path,mode,-1)) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_fchmod(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { char *path =fd_getpath(pc->fds,pc->sysargs[0]); if (path==NULL) { pc->retval= -1; pc->erno= EBADF; return SC_FAKE; } else { int mode; int sfd=fd2sfd(pc->fds,pc->sysargs[0]); mode=pc->sysargs[1]; if (secure) { pc->path=strdup(path); um_x_lstat64(pc->path, &(pc->pathstat), pc, 0); if (chmod_eperm(pc,&mode)) { pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } } if ((pc->retval = um_syscall(path,mode,sfd)) < 0) pc->erno=errno; return SC_FAKE; } } /* DUP & DUP2. * Always processed in any case. * if the dup fd refers an open file it must be closed (if it is managed by a service * module the close request must be forwarded to that module). */ /* DUP management: dup gets executed both by the process (the fifo is * dup-ped when the file is virtual) and umview records the operation * DUP does not exist for modules */ int wrap_in_dup(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd; int oldfd=(sc_number==__NR_dup)?-1:pc->sysargs[1]; sfd=fd2sfd(pc->fds,pc->sysargs[0]); GDEBUG(4, "DUP %d %d sfd %d %s",pc->sysargs[0],pc->sysargs[1],sfd,fd_getpath(pc->fds,pc->sysargs[0])); if (oldfd == um_mmap_secret || (sfd < 0 && hte != NULL)) { pc->retval= -1; pc->erno= EBADF; return SC_FAKE; } else { pc->retval=fd2lfd(pc->fds,pc->sysargs[0]); pc->erno = 0; if (pc->retval >= 0) { lfd_dup(pc->retval); return SC_CALLONXIT; } /* dup2/dup3: if the file to close is virtual, CALLONEXIT to update the file table if the call succeeds */ else if (fd2lfd(pc->fds,oldfd) >= 0) return SC_CALLONXIT; else return STD_BEHAVIOR; } } int wrap_out_dup(int sc_number,struct pcb *pc) { int oldfd=(sc_number==__NR_dup)?-1:pc->sysargs[1]; /* SC_CALLONXIT both for NULL and module managed files. * FAKE only when the module gave an error */ if (pc->behavior == SC_CALLONXIT) { int fd=getrv(pc); if (fd >= 0 && (pc->retval < 0 || lfd_getht(pc->retval) == NULL || addfd(pc,fd) == 0)) { /* DUP2 case, the previous fd has been closed, umview must * update its lfd table */ if (oldfd != -1) { int oldlfd=fd2lfd(pc->fds,oldfd); if (oldlfd >= 0) /* socket and stdin/out/err are -1*/ { /* set pc->hte: module's um_get_hte/um_get_private data may use it*/ /* pc->hte for newfd is saved and restored */ struct ht_elem *newhte=pc->hte; if ((pc->hte=lfd_getht(oldlfd)) != NULL) delfd(pc,oldfd); lfd_deregister_n_close(pc->fds,oldfd); pc->hte=newhte; } } if (pc->retval >= 0) lfd_register(pc->fds,fd,pc->retval); #ifdef __NR_dup3 if ((sc_number == __NR_dup3) && (pc->sysargs[2] & O_CLOEXEC)) { fd_setfdfl(pc->fds,fd,FD_CLOEXEC); } #endif } else { lfd_close(pc->retval); } } else { putrv(pc->retval,pc); puterrno(pc->erno,pc); } return STD_BEHAVIOR; } struct um_flock32 { short l_type; short l_whence; off_t l_start; off_t l_len; pid_t l_pid; }; struct um_flock64 { short l_type; short l_whence; loff_t l_start; loff_t l_len; pid_t l_pid; }; static inline void get_flock64(struct pcb *pc,unsigned long addr,struct um_flock64 *fl) { umoven(pc,addr,sizeof(struct um_flock64),fl); } static inline void put_flock64(struct pcb *pc,unsigned long addr,struct um_flock64 *fl) { ustoren(pc,addr,sizeof(struct um_flock64),fl); } static inline void get_flock32(struct pcb *pc,unsigned long addr,struct um_flock64 *fl) { struct um_flock32 fl32; umoven(pc,addr,sizeof(struct um_flock32),&fl32); fl->l_type=fl32.l_type; fl->l_whence=fl32.l_whence; fl->l_start=fl32.l_start; fl->l_len=fl32.l_len; fl->l_pid=fl32.l_pid; } static inline void put_flock32(struct pcb *pc,unsigned long addr,struct um_flock64 *fl) { struct um_flock32 fl32; fl32.l_type=fl->l_type; fl32.l_whence=fl->l_whence; fl32.l_start=fl->l_start; fl32.l_len=fl->l_len; fl32.l_pid=fl->l_pid; ustoren(pc,addr,sizeof(struct um_flock32),&fl32); } int wrap_in_fcntl(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int fd= pc->sysargs[0]; int cmd= pc->sysargs[1]; unsigned long arg=pc->sysargs[2]; int sfd=fd2sfd(pc->fds,pc->sysargs[0]); //printk("wrap_in_fcntl %d %d %d %d \n",pc->sysargs[0],sfd,cmd,fd2lfd(pc->fds,pc->sysargs[0])); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; return SC_FAKE; } else { switch (cmd) { case F_DUPFD: pc->retval=fd2lfd(pc->fds,fd); if (pc->retval < 0) return STD_BEHAVIOR; else { lfd_dup(pc->retval); return SC_CALLONXIT; } case F_GETFD: if ((pc->retval=fd_getfdfl(pc->fds,fd)) < 0) pc->erno=EBADF; else pc->erno=0; break; case F_SETFD: if ((pc->retval=fd_setfdfl(pc->fds,fd,arg)) < 0) pc->erno=EBADF; else pc->erno=0; break; case F_GETLK: case F_SETLK: case F_SETLKW: #ifdef F_GETLK64 # if (F_GETLK64 != F_GETLK) case F_GETLK64: case F_SETLK64: case F_SETLKW64: # endif #endif { struct um_flock64 flock; #ifdef __NR_fcntl64 if (sc_number == __NR_fcntl64 #ifdef F_GETLK64 || cmd==F_GETLK64 || cmd==F_SETLK64 || cmd==F_SETLKW64 #endif ) get_flock64(pc,arg,&flock); else get_flock32(pc,arg,&flock); #else get_flock64(pc,arg,&flock); #endif if ((pc->retval = um_syscall(sfd,cmd,&flock)) == -1) pc->erno= errno; if (pc->retval < 0 && pc->erno == ENOSYS) { /* last chance */ printk("Locking unsupported\n"); pc->retval= -1; pc->erno= EBADF; return SC_FAKE; } if (cmd==F_GETLK #ifdef F_GETLK64 || cmd==F_GETLK64 #endif ) { #ifdef __NR_fcntl64 if (sc_number == __NR_fcntl64 #ifdef F_GETLK64 || cmd==F_GETLK64 || cmd==F_SETLK64 || cmd==F_SETLKW64 #endif ) put_flock64(pc,arg,&flock); else put_flock32(pc,arg,&flock); #else put_flock64(pc,arg,&flock); #endif } //printk("LOCK %d %d %d %d\n",sc_number,fd,cmd,pc->retval,pc->erno); break; } default: if ((pc->retval = um_syscall(sfd,cmd,arg)) == -1) pc->erno= errno; /* remember the change (if the syscall succeeded) */ if (pc->retval >= 0 && cmd == F_SETFL) fd_setflfl(pc->fds,fd,arg); if (pc->retval < 0 && pc->erno == ENOSYS) { /* last chance */ switch (cmd) { /* this is just a workaround for module that does not manage * F_SETFL/F_GETFL */ case F_GETFL: if ((pc->retval=fd_getflfl(pc->fds,fd)) < 0) pc->erno=EBADF; else pc->erno=0; break; /* F_SETFL is useless if the module does not change the flags * effectively */ } } } return SC_FAKE; /*except for DUP*/ } } int wrap_out_fcntl(int sc_number,struct pcb *pc) { int fd; switch (pc->sysargs[1]) { case F_DUPFD: fd=getrv(pc); //printk("F_DUPFD %d->%d\n",pc->retval,fd); if (fd>=0 && (lfd_getht(pc->retval) == NULL || addfd(pc,fd) == 0)) lfd_register(pc->fds,fd,pc->retval); else lfd_close(pc->retval); return STD_BEHAVIOR; break; default: //printk("fcntl returns %d %d\n",pc->retval,pc->erno); putrv(pc->retval,pc); puterrno(pc->erno,pc); return SC_MODICALL; break; } } int wrap_in_fsync(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int sfd=fd2sfd(pc->fds,pc->sysargs[0]); if (sfd < 0) { pc->retval= -1; pc->erno= EBADF; return SC_FAKE; } else { if ((pc->retval = um_syscall(sfd)) < 0) pc->erno=errno; } return SC_FAKE; } int wrap_in_link(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { struct stat64 sourcest; char *source; int olddirfd; long oldpath; int dontfollowlink=1; #ifdef __NR_linkat if (sc_number == __NR_linkat || sc_number == __NR_renameat) { olddirfd=pc->sysargs[0]; oldpath=pc->sysargs[1]; if (sc_number == __NR_linkat) { int flags=pc->sysargs[4]; if (flags & AT_SYMLINK_FOLLOW) dontfollowlink=0; } } else #endif { olddirfd=AT_FDCWD; oldpath=pc->sysargs[0]; } source=um_abspath(olddirfd,oldpath,pc,&sourcest,dontfollowlink); /*um_abspath updates pc->hte*/ if (pc->pathstat.st_mode != 0 && sc_number != __NR_rename && sc_number != __NR_renameat) { pc->retval= -1; pc->erno= EEXIST; } else if (source==um_patherror) { pc->retval= -1; pc->erno= ENOENT; } else { /* inter module file hard link are unsupported! */ if (hte != pc->hte) { pc->retval= -1; pc->erno= EXDEV; } else { pc->hte=hte; if (secure && (pc->retval=(um_parentwaccess(pc->path,pc))) < 0) pc->erno=errno; else if (secure && (sc_number == __NR_rename || sc_number == __NR_renameat) && (pc->retval=(um_parentwaccess(source,pc))) < 0) pc->erno=errno; else if ((pc->retval=um_syscall(source,pc->path)) < 0) pc->erno= errno; } free(source); } return SC_FAKE; } int wrap_in_symlink(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { char *source; source=um_getpath(pc->sysargs[0],pc); if (pc->pathstat.st_mode != 0) { pc->retval= -1; pc->erno= EEXIST; } else if (source==um_patherror) { pc->retval= -1; pc->erno= ENOENT; } else { if (secure && (pc->retval=(um_parentwaccess(pc->path,pc))) < 0) pc->erno=errno; else if ((pc->retval=um_syscall(source,pc->path)) < 0) pc->erno= errno; free(source); } return SC_FAKE; } /* UTIME & UTIMES wrap in function */ int wrap_in_utime(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { unsigned long argaddr; struct timeval tv[2]; struct timeval *larg; int sfd = -1; #ifdef __NR_futimesat if (sc_number == __NR_futimesat #ifdef __NR_utimensat || sc_number==__NR_utimensat #endif ) argaddr=pc->sysargs[2]; else #endif argaddr=pc->sysargs[1]; if (argaddr == umNULL) larg=NULL; else { if (sc_number == __NR_utime) { /* UTIME */ struct utimbuf buf; umoven(pc,argaddr,sizeof(struct utimbuf),&buf); tv[0].tv_sec=buf.actime; tv[1].tv_sec=buf.modtime; tv[0].tv_usec=tv[1].tv_usec=0; } else #ifdef __NR_utimensat if (sc_number == __NR_utimensat) { struct timespec times[2]; umoven(pc,argaddr,2*sizeof(struct timespec),times); tv[0].tv_sec=times[0].tv_sec; tv[1].tv_sec=times[1].tv_sec; tv[0].tv_usec=times[0].tv_nsec/1000; tv[1].tv_usec=times[1].tv_nsec/1000; if (pc->sysargs[1] == umNULL) sfd=fd2sfd(pc->fds,pc->sysargs[0]); } else #endif /* UTIMES FUTIMESAT*/ umoven(pc,argaddr,2*sizeof(struct timeval),tv); larg=tv; } if (secure && (pc->retval=(um_x_access(pc->path,W_OK,pc,&pc->pathstat))) < 0) pc->erno=errno; else if ((pc->retval = um_syscall(pc->path,larg,sfd)) < 0) pc->erno=errno; return SC_FAKE; } /* MOUNT */ int wrap_in_mount(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { char *source; char filesystemtype[PATH_MAX]; char data[PATH_MAX]; char *datax=data; unsigned long argaddr=pc->sysargs[0]; unsigned int fstype=pc->sysargs[2]; unsigned int mountflags=pc->sysargs[3]; unsigned long pdata=pc->sysargs[4]; struct stat64 imagestat; if (secure && capcheck(CAP_SYS_ADMIN,pc)) { pc->retval = -1; pc->erno = EPERM; return SC_FAKE; } umovestr(pc,fstype,PATH_MAX,filesystemtype); source = um_abspath(AT_FDCWD,argaddr,pc,&imagestat,0); /* maybe the source is not a path at all. source must exist. * source is not converted to an absolute path if it is not a path * it is simply copied "as is" */ if (source==um_patherror || imagestat.st_mode == 0) { if (source != um_patherror) free(source); source=malloc(PATH_MAX); assert(source); umovestr(pc,argaddr,PATH_MAX,source); } mountflags &= ~MS_GHOST; if (pdata != umNULL) { char *ghost; umovestr(pc,pdata,PATH_MAX,data); if ((ghost=strstr(data,"ghost")) != NULL && (ghost==data || ghost[-1]==',') && (ghost[5]=='\0' || ghost[5]==',')) mountflags |= MS_GHOST; } else datax=NULL; if ((pc->retval = um_syscall(source,pc->path,get_alias(CHECKFSALIAS,filesystemtype), mountflags,datax)) < 0) pc->erno=errno; else ht_count_plus1(hte); free(source); return SC_FAKE; } static int wrap_in_umount_generic(struct pcb *pc,struct ht_elem *hte, sysfun um_syscall,int flags) { if (secure && capcheck(CAP_SYS_ADMIN,pc)) { pc->retval = -1; pc->erno = EPERM; } else if (ht_get_count(hte) > 0) { pc->retval=-1; pc->erno=EBUSY; } else if ((pc->retval = um_syscall(pc->path,flags)) < 0) pc->erno=errno; else { struct ht_elem *module_hte=ht_check(CHECKMODULE,ht_get_servicename(hte),NULL,0); if (module_hte) ht_count_minus1(module_hte); } return SC_FAKE; } int wrap_in_umount(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { return wrap_in_umount_generic(pc,hte,um_syscall,0); } int wrap_in_umount2(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { // flags is defined as int in umount manpage. unsigned int flags= (int) pc->sysargs[1]; return wrap_in_umount_generic(pc,hte,um_syscall,flags); } int wrap_in_truncate(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { __off64_t off; #if (__NR_truncate64 != __NR_doesnotexist) if (sc_number == __NR_truncate64) off=LONG_LONG(pc->sysargs[1+PALIGN], pc->sysargs[2+PALIGN]); else #endif off=pc->sysargs[1]; if (secure && (pc->retval=(um_x_access(pc->path,W_OK,pc,&pc->pathstat))) < 0) pc->erno=errno; else if ((pc->retval=um_syscall(pc->path,off)) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_ftruncate(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { __off64_t off; int sfd=fd2sfd(pc->fds,pc->sysargs[0]); #if (__NR_ftruncate64 != __NR_doesnotexist) if (sc_number == __NR_ftruncate64) off=LONG_LONG(pc->sysargs[1+PALIGN], pc->sysargs[2+PALIGN]); else #endif off=pc->sysargs[1]; if ((pc->retval = um_syscall(sfd,off)) < 0) pc->erno=errno; return SC_FAKE; } static void statfs264(struct statfs *fs,struct statfs64 *fs64) { fs->f_type = fs64->f_type; fs->f_bsize = fs64->f_bsize; fs->f_blocks = fs64->f_blocks; fs->f_bfree = fs64->f_bfree; fs->f_bavail = fs64->f_bavail; fs->f_files = fs64->f_files; fs->f_ffree = fs64->f_ffree; fs->f_fsid = fs64->f_fsid; fs->f_namelen = fs64->f_namelen; fs->f_frsize = fs64->f_frsize; } int wrap_in_statfs(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { struct statfs64 sfs64; long pbuf=pc->sysargs[1]; if ((pc->retval = um_syscall(pc->path,&sfs64)) >= 0) { struct statfs sfs; statfs264(&sfs,&sfs64); ustoren(pc,pbuf,sizeof(struct statfs),(char *)&sfs); } else pc->erno=errno; return SC_FAKE; } int wrap_in_fstatfs(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { struct statfs64 sfs64; long pbuf=pc->sysargs[1]; char *path =fd_getpath(pc->fds,pc->sysargs[0]); if (path==NULL) { pc->retval= -1; pc->erno= EBADF; } else { if ((pc->retval = um_syscall(path,&sfs64)) >= 0) { struct statfs sfs; statfs264(&sfs,&sfs64); ustoren(pc,pbuf,sizeof(struct statfs),(char *)&sfs); } else pc->erno=errno; } return SC_FAKE; } #if (__NR_statfs64 != __NR_doesnotexist) int wrap_in_statfs64(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { struct statfs64 sfs64; long size=pc->sysargs[1]; long pbuf=pc->sysargs[2]; if (size != sizeof(sfs64)) { pc->retval= -1; pc->erno= EINVAL; } else { if ((pc->retval = um_syscall(pc->path,&sfs64)) >= 0) ustoren(pc,pbuf,sizeof(struct statfs64),(char *)&sfs64); else pc->erno=errno; } return SC_FAKE; } int wrap_in_fstatfs64(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { struct statfs64 sfs64; long size=pc->sysargs[1]; long pbuf=pc->sysargs[2]; char *path=fd_getpath(pc->fds,pc->sysargs[0]); if (path==NULL) { pc->retval= -1; pc->erno= EBADF; } else if (size != sizeof(sfs64)) { pc->retval= -1; pc->erno= EINVAL; } else { if ((pc->retval = um_syscall(path,&sfs64)) >= 0) ustoren(pc,pbuf,sizeof(struct statfs64),(char *)&sfs64); else pc->erno=errno; } return SC_FAKE; } #endif umview-0.8.2/xmview/defs_ppc_km.h0000644000175000017500000000257411753517211016066 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * defs.h: interfaces to system call arguments (architecture dependant) * needed for capture_um * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Mattia Belletti, Ludovico Gardenghi, Andrea Gasparini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: defs_ppc_km.h 377 2007-08-28 20:36:16Z garden $ * */ #ifndef _DEFS_PPC #define _DEFS_PPC #define _KERNEL_NSIG 64 #define _KERNEL_SIGSET_SIZE _KERNEL_NSIG/8 #define __NR_setpgrp __NR_doesnotexist #define BIGENDIAN #define LONG_LONG(_l,_h) \ ((long long)((unsigned long long)(unsigned)(_h) | ((unsigned long long)(_l)<<32))) #endif // _DEFS_PPC umview-0.8.2/xmview/viewospasswd.50000644000175000017500000000342011753517211016256 0ustar renzorenzo.\" Copyright (c) 2009 Renzo Davoli .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License, .\" version 2, as published by the Free Software Foundation. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual 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 General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, write to the Free .\" Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, .\" MA 02110-1301 USA. .TH VIEW-OS 5 "May 30, 2009" "VIEW-OS: a process with a view" .SH NAME viewospasswd \- login info for kmview-umview users .SH DESCRIPTION .B /etc/viewospasswd contains one line for each user account aiming to use kmview-umview as his/her user account. Each line contains two fields delimited by colons (\fB:\fR): .sp .RS 4 \h'-04'\(bu\h'+03'login name .RE .sp .RS 4 \h'-04'\(bu\h'+03'command line of the user's startup script .RE The startup script/command should start a shell as its last action using an exec. .SH FILES .PD 0 .IP "\fB/etc/viewospasswd\fR" 4 user startup scripts information for kmview login shells. .SH SEE ALSO .BR umview(1), .BR kmview(1) .SH AUTHORS View-OS is a project of the Computer Science Department, University of Bologna. Project Leader: Renzo Davoli. Howto's and further information can be found on the project wiki . umview-0.8.2/xmview/pcb.01.sctab.h0000644000175000017500000000175111753517211015666 0ustar renzorenzo#ifdef _PCB_DEFINITIONS #define MAX_SOCKET_ARGS 6 struct supgroups { int count; size_t size; gid_t list[0]; }; struct supgroups *supgrp_create(size_t size); struct supgroups *supgrp_get(struct supgroups *supgrp); void supgrp_put(struct supgroups *supgrp); void pcb_plus(),pcb_minus(); /* STATUS DEFINITIONS */ #define READY 0 #endif #ifdef _PCB_COMMON_FIELDS void *path; struct stat64 pathstat; struct ht_elem *hte; void *mod_private_data; struct timestamp tst; epoch_t nestepoch; /* path for tmp files that must be deleted over the next syscall */ /* see execve mgmt */ void *tmpfile2unlink_n_free; uid_t ruid,euid,suid,fsuid; gid_t rgid,egid,sgid,fsgid; struct supgroups *grouplist; uint16_t private_scno; uint8_t needs_path_rewrite; #endif #ifdef _PCB_ONLY_FIELDS /* keep track of file system informations - look at clone 2 * * (CLONE_FS) */ struct pcb_fs *fdfs; #endif #ifdef _NPCB_ONLY_FIELDS #endif #ifdef _PCB_CONSTRUCTOR pcb_plus, #endif #ifdef _PCB_DESTRUCTOR pcb_minus, #endif umview-0.8.2/xmview/pcb.00.capture.h0000644000175000017500000000427011753517211016233 0ustar renzorenzo#ifdef _PCB_DEFINITIONS # ifdef _VIEWOS_KM # include # endif # define PCB_INUSE 0x1 /* INUSE=0: unused element ready for allocation. never = 0 for running processes pcb, INUSE=0 is a flag for pcb managed outside capture_um (capture_nested) */ # define PCB_ALLOCATED 0x2 /* Dynamically allocated pcb, to be freed. */ # define PCB_SIGNALED 0x4 /* awake suspended process as it has been signaled */ # ifdef _VIEWOS_KM # define PCB_KM_PRIVATEDIR 0x8 /* KM_CHROOT has already been sent (KMVIEW only) */ # endif # ifdef _VIEWOS_UM # define PCB_STARTING 0x8 /* the process/thread is starting */ # define NOSC -1 # endif /* constants are compatible with PTRACE_SYS_VM definitions */ # define SC_SKIP_CALL 0x5 /* SKIP_CALL */ # define SC_SKIP_EXIT 0x2 /* SKIP_EXIT */ # define SC_SAVEREGS 0x8 # define SC_SUSPENDED 0x10 # define SC_SUSPIN 0x10 /* SUSPENDED + IN */ # define SC_SUSPOUT 0x11 /* SUSPENDED + OUT */ # define SC_VM_MASK 0x7 /*mask for SYS_VM */ # define STD_BEHAVIOR SC_SKIP_EXIT /* DO_SYSCALL SKIP_EXIT */ # define SC_MODICALL (SC_SKIP_EXIT | SC_SAVEREGS) /* SKIP_EXIT and save regs */ # define SC_FAKE (SC_SKIP_CALL | SC_SKIP_EXIT | SC_SAVEREGS) # define SC_CALLONXIT (SC_SAVEREGS) # define SC_TRACEONLY ( 0 ) # define IN 0 # define OUT 1 #endif #ifdef _PCB_COMMON_FIELDS uint16_t flags; # ifdef _VIEWOS_KM # ifdef __NR_socketcall struct kmview_event_socketcall event; # else struct kmview_event_ioctl_syscall event; # endif struct kmview_event_ioctl_sysreturn outevent; long erno; # endif # ifdef _VIEWOS_UM long sysscno; /* System call number */ unsigned long sysargs[6]; # ifdef __NR_socketcall long sockaddr; # endif unsigned long erno; # endif #endif #ifdef _PCB_ONLY_FIELDS long umpid; # ifdef _VIEWOS_KM long kmpid; # endif pid_t pid; /* Process Id of this entry */ int signum; # ifdef _PROC_MEM_TEST int memfd; /* if !has_ptrace_multi, open /proc/PID/mem */ # endif struct pcb *pp; /* Parent Process */ uint16_t behavior; long retval; # ifdef _VIEWOS_UM long *saved_regs; # endif #endif umview-0.8.2/xmview/defs_x86_64_km.h0000644000175000017500000000460611753517211016240 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * defs.h: interfaces to system call arguments (architecture dependant) * needed for capture_um * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Mattia Belletti, Ludovico Gardenghi, Andrea Gasparini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: defs_x86_64_km.h 559 2008-06-13 11:32:55Z garden $ * */ #ifndef _DEFS_X86_64 #define _DEFS_X86_64 #define _KERNEL_NSIG 64 #define _KERNEL_SIGSET_SIZE _KERNEL_NSIG/8 #define __NR_socketcall __NR_doesnotexist #define __NR__newselect __NR_doesnotexist #define __NR_umount __NR_doesnotexist #define __NR_stat64 __NR_doesnotexist #define __NR_lstat64 __NR_doesnotexist #define __NR_fstat64 __NR_doesnotexist #undef __NR_chown32 #define __NR_chown32 __NR_doesnotexist #undef __NR_lchown32 #define __NR_lchown32 __NR_doesnotexist #undef __NR_fchown32 #define __NR_fchown32 __NR_doesnotexist #define __NR_fcntl64 __NR_doesnotexist #define __NR__llseek __NR_doesnotexist #define __NR_truncate64 __NR_doesnotexist #define __NR_ftruncate64 __NR_doesnotexist #define __NR_send __NR_doesnotexist #define __NR_recv __NR_doesnotexist #define __NR_statfs64 __NR_doesnotexist #define __NR_fstatfs64 __NR_doesnotexist #define __NR_nice __NR_doesnotexist #define __NR_mmap2 __NR_doesnotexist /* XXX: should we find a more elegant solution? */ #define wrap_in_statfs64 NULL #define wrap_in_fstatfs64 NULL #define wrap_in_stat wrap_in_stat64 #define wrap_in_fstat wrap_in_fstat64 #define __NR_setpgrp __NR_doesnotexist #define LITTLEENDIAN #define LONG_LONG(_l,_h) \ ((long long)((unsigned long long)(unsigned)(_l) | ((unsigned long long)(_h)<<32))) #define MAXERR 4096 #endif // _DEFS_X86_64 umview-0.8.2/xmview/um_mmap.c0000644000175000017500000003720411753517211015240 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_mmap: MMAP implementation * * Copyright 2006 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation version 2 of the License. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * */ #include #include #include #include #include #include #include #include #include #include #include "defs.h" #include "gdebug.h" #include "umproc.h" #include "hashtab.h" #include "um_services.h" #include "sctab.h" #include "scmap.h" #include "utils.h" #include "uid16to32.h" #ifdef _UM_MMAP /* one entry per chunk on the mmap secret file */ struct mmap_sf_entry { char *path; epoch_t epoch; time_t mtime; struct ht_elem *hte; unsigned long prot; unsigned long length; unsigned long pgoffset; unsigned long pgsize; unsigned long counter; /* lastuse: each use set the MSB, shift right as time flows * (now each time a new file is needed), when 0 is the chunk is considered * useless */ unsigned long lastuse; struct mmap_sf_entry *next; }; /* this is the global table used to manage the chunks */ /* the global table is sorted on chunk starting address */ static struct mmap_sf_entry *mmap_sf_head; /* this is an entry of the *process* mmap table */ /* elements in the process mmap table are unordered */ struct pcb_mmap_entry { long start; long len; struct mmap_sf_entry *sf_entry; struct pcb_mmap_entry *next; }; /* create a new element in the *process* mmap table */ static struct pcb_mmap_entry *pcb_mmap_add( struct pcb_mmap_entry *head, unsigned long start, unsigned long len, struct mmap_sf_entry *sf_entry) { struct pcb_mmap_entry *new=malloc(sizeof (struct pcb_mmap_entry)); //printk("pcb_mmap_add %ld %ld\n",start,len); new->start=start; new->len=len; new->sf_entry=sf_entry; new->next=head; return new; } #if 0 static struct mmap_sf_entry *pcb_mmap_sfsearch( struct pcb_mmap_entry *head, unsigned long start, unsigned long len) { while (head) { if (head->start == start && head->len == len) return head->sf_entry; head=head->next; } return NULL; } #endif static void store_mmap_secret(struct ht_elem *hte,const char *to, unsigned long pgoffset, unsigned long length); static inline void mmap_sf_del(struct mmap_sf_entry *sf_entry, int error) { sf_entry->counter--; if (!error && sf_entry->counter == 0 && sf_entry->prot & PROT_WRITE) { store_mmap_secret(sf_entry->hte,sf_entry->path, sf_entry->pgoffset, sf_entry->length); } } /* delete the first element in the *process* mmap list */ static void pcb_mmap_deletehead(struct pcb_mmap_entry **head,int error) { struct pcb_mmap_entry *this=*head; if (this != NULL) { mmap_sf_del(this->sf_entry,error); *head=this->next; free(this); } } /* sfsearch: find a mmap chunk in a process mmap table (and move it to head, * to support the deletehead if necessary) */ static int pcb_mmap_sfsearch_n_movetohead( struct pcb_mmap_entry **head, unsigned long start, unsigned long len) { struct pcb_mmap_entry **scan=head; struct pcb_mmap_entry *this; while ((this = *scan) != NULL) { //printk("CMP! %p %p %ld %ld\n",this->start,start,this->len,len); if (this->start == start && this->len == len) { if (*scan != *head) { /* it is not already the first one*/ *scan=this->next; /* delete from its position */ this->next=*head; /* join the old queue */ *head=this; /* the new head is this */ } return 1; } scan=&(this->next); } return 0; } #if 0 static void pcb_mmap_sfsearch_n_delete( struct pcb_mmap_entry **head, unsigned long start, unsigned long len) { struct pcb_mmap_entry *this; while ((this = *head) != NULL) { if (this->start == start && this->len == len) { this->sf_entry->counter--; *head=this->next; free(this); } head=&(this->next); } } #endif /* when a process terminates, all the mmap chunks used by the process * have one less refernce. * unused chunks (counter==0) will be reused by the insertion. * lazy: if the mmap-ed file is needed again (and unchanged) the previous * chunk is re-used */ void um_mmap_recdelproc(struct pcb_mmap_entry *head) { if (head) { head->sf_entry->counter--; um_mmap_recdelproc(head->next); free(head); } } void um_mmap_addproc(struct pcb *pc,int flags,int npcbflag) { if (!npcbflag) pc->um_mmap=NULL; } void um_mmap_delproc(struct pcb *pc,int flags,int npcbflag) { if (!npcbflag) { um_mmap_recdelproc(pc->um_mmap); } } /* search for a mmap chunk (given path, epoch, and mtime of the file) * XXX why there is not the "bitstring" of the file? */ static struct mmap_sf_entry *mmap_sf_find ( char *path, epoch_t epoch, time_t mtime, unsigned long pgsize) { struct mmap_sf_entry *scan=mmap_sf_head; while (scan) { /* integers are faster to compare, it is better to test them first */ //printk("scan find %s %lld %d %d %x\n",scan->path,scan->epoch,scan->mtime,scan->pgsize, scan->lastuse); if (epoch == scan->epoch && mtime == scan->mtime && pgsize <= scan->pgsize && (strcmp(path,scan->path) == 0)) { scan->lastuse |= 1 << (sizeof (unsigned long) * 4 - 1); return scan; } scan = scan->next; } return NULL; } /* LRU approximation: lastuse is a bitstring, when a process uses a chunk * the MSB is set, lastuse is right shifted at each attempt to load a * mmap-ed file */ static void mmap_compact() { struct mmap_sf_entry *scan=mmap_sf_head; /* mark the empty - reusable parts of the file */ while (scan) { /* unused for a long time... free the area */ if (scan->path && scan->counter == 0 && scan->lastuse == 0) { free(scan->path); scan->path=NULL; scan->epoch=0; } else scan->lastuse >>= 1; scan = scan->next; } /* second traversal: compact the free space*/ scan=mmap_sf_head; while (scan) { /* this is unused, and the next one is also unused */ if (!(scan->path) && (scan->next) && !(scan->next->path)) { struct mmap_sf_entry *victim=scan->next; scan->pgsize += victim->pgsize; scan->next = victim->next; free(victim); } else scan = scan->next; } } /* allocate a free space on the secret file*/ static struct mmap_sf_entry *mmap_sf_allocate ( char *path, epoch_t epoch, time_t mtime, unsigned long pgsize, unsigned long prot,struct ht_elem *hte,unsigned long length) { struct mmap_sf_entry *scan=mmap_sf_head; mmap_compact(); if (!scan) { /* first time! empty list */ struct mmap_sf_entry *new=malloc(sizeof (struct mmap_sf_entry)); new->path=NULL; new->pgoffset=0; new->pgsize=pgsize; new->next=NULL; mmap_sf_head = scan = new; } while (scan) { /* first fit */ if (scan->path == NULL && scan->pgsize >= pgsize) { if (scan->pgsize > pgsize) { /* split the empty space */ struct mmap_sf_entry *new=malloc(sizeof (struct mmap_sf_entry)); new->path=NULL; new->epoch=0; new->mtime=0; new->pgoffset=scan->pgoffset+pgsize; new->pgsize=scan->pgsize-pgsize; new->counter=0; new->lastuse=1 << (sizeof(unsigned long) * 4 - 1); scan->pgsize=pgsize; new->next=scan->next; scan->next=new; } scan->path=strdup(path); scan->prot=prot; scan->hte=hte; scan->length=length; scan->epoch=epoch; scan->mtime=mtime; scan->counter=scan->lastuse=0; return scan; } /* no reusable chunks, allocate new space on the file */ if (scan->next == NULL) { /* the next and last element is unused: resize it */ if (scan->path == NULL) scan->pgsize=pgsize; else { /* the next/last is used, create an empty element of the right size * after it */ struct mmap_sf_entry *new=malloc(sizeof (struct mmap_sf_entry)); new->path=NULL; new->pgoffset=scan->pgoffset+scan->pgsize; new->pgsize=pgsize; new->next=NULL; scan->next = new; scan=new; } /* now there is a new element of the right size for the allocation, * it will be found in the next iteration */ } else scan = scan->next; } /* this point should never be reached */ return NULL; } /* get the stat info of the mmapped file */ static int um_mmap_getstat(char *filename, struct ht_elem *hte, struct stat64 *buf, struct pcb *pc) { if (hte == NULL) return r_lstat64(filename,buf); else return ht_syscall(hte,uscno(NR64_lstat))(filename,buf,-1); } /* add_mmap_secret copies the virtual mmap-ed file in a section of the * secret file */ static long add_mmap_secret(struct ht_elem *hte,const char *from, unsigned long pgoffset) { char buf[BUFSIZ]; int fdf; int n; unsigned long long size=0; //printk("add_mmap_secret %s %ld\n",from, pgoffset); #if __NR__llseek != __NR_doesnotexist loff_t result; r_llseek(um_mmap_secret, pgoffset >> ((sizeof (long)*8) - um_mmap_pageshift), pgoffset << um_mmap_pageshift, &result, SEEK_SET); #else r_lseek(um_mmap_secret,pgoffset << um_mmap_pageshift,SEEK_SET); #endif /* No need for hte search. from is the mmap path so hte and private data is already set for submodules */ if ((fdf=ht_syscall(hte,uscno(__NR_open))(from,O_RDONLY,0)) < 0) return -errno; while ((n=ht_syscall(hte,uscno(__NR_read))(fdf,buf,BUFSIZ)) > 0) { r_write (um_mmap_secret,buf,n); size += n; } ht_syscall(hte,uscno(__NR_close))(fdf); return (size >> um_mmap_pageshift)+1; } /* store_mmap_secret copies a section of the secret file back in the * virtual file*/ static void store_mmap_secret(struct ht_elem *hte,const char *to, unsigned long pgoffset, unsigned long length) { char buf[BUFSIZ]; int fdf; int n; //printk("store_mmap_secret %s %ld %p\n",to, pgoffset,hte); #if __NR__llseek != __NR_doesnotexist loff_t result; r_llseek(um_mmap_secret, pgoffset >> ((sizeof (long)*8) - um_mmap_pageshift), pgoffset << um_mmap_pageshift, &result, SEEK_SET); #else r_lseek(um_mmap_secret,pgoffset << um_mmap_pageshift,SEEK_SET); #endif /* hte is *not* set. search for "to".*/ #ifdef NDEBUG ht_check(CHECKPATH,(void *)to,NULL,0); #else { struct ht_elem *shte; shte=ht_check(CHECKPATH,(void *)to,NULL,0); assert(hte==shte); } #endif if ((fdf=ht_syscall(hte,uscno(__NR_open))(to,O_WRONLY | O_TRUNC | O_CREAT,0)) < 0) return; while (length > 0) { n=(length < BUFSIZ)?length:BUFSIZ; n=r_read(um_mmap_secret,buf,n); if (n<=0) break; ht_syscall(hte,uscno(__NR_write))(fdf,buf,n); length -= n; } ht_syscall(hte,uscno(__NR_close))(fdf); return; } /* both mmap and mmap2 management */ int wrap_in_mmap(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { unsigned long length=pc->sysargs[1]; unsigned long prot=pc->sysargs[2]; // unsigned long flags=pc->sysargs[3]; unsigned long fd=pc->sysargs[4]; long offset=pc->sysargs[5]; unsigned long pgsize; struct stat64 sbuf; char *path=fd_getpath(pc->fds,fd); /*if ((!(flags & MAP_PRIVATE)) && (prot & PROT_WRITE)) printk("MMAP: %s only MAP_PRIVATE has been implemented\n",path);*/ /* convert mmap into mmap2 */ if (sc_number == __NR_mmap) offset >>= um_mmap_pageshift; /* compute the size in pages */ pgsize=offset+(length >> um_mmap_pageshift)+1; epoch_t nestepoch=um_setnestepoch(0); /* get the stat info about the file */ if (um_mmap_getstat(path, hte, &sbuf, pc) < 0) { pc->retval = -1; return SC_FAKE; } else { struct mmap_sf_entry *sf_entry; if ((sbuf.st_size >> um_mmap_pageshift) + 1 > pgsize) pgsize = (sbuf.st_size >> um_mmap_pageshift) + 1; //printk("%s(%s/%o): MMAP SIZE %lld pgsize %ld %ld \n", path, ht_get_servicename(hte), fd,sbuf.st_size,(unsigned long)((sbuf.st_size >> um_mmap_pageshift) + 1),pgsize); /* there is already in the secret file? */ if ((sf_entry=mmap_sf_find(path,nestepoch,sbuf.st_mtime,pgsize)) == NULL) { /* NO. must be loaded */ if ((sf_entry=mmap_sf_allocate(path,nestepoch,sbuf.st_mtime,pgsize, prot,hte,length)) == NULL) { /* there is something wrong, we cannot allocate space on the secret file*/ pc->retval = -1; return SC_FAKE; } if (add_mmap_secret(hte, path, sf_entry->pgoffset) <= 0) { /* there is something wrong, cannot load the file! */ pc->retval = -1; return SC_FAKE; } } /* add the new item in the *process* mmap table */ pc->um_mmap = pcb_mmap_add(pc->um_mmap, 0, length, sf_entry); sf_entry->counter++; pc->retval = 0; /* rewrite the syscall parms: mmap->mmap2 if needed, using the secret * file at the correct offset */ # if __NR_mmap2 != __NR_doesnotexist /* On 32-bit interfaces we convert every call to mmap2 which takes the * offset in pages (not bytes */ putscno(__NR_mmap2,pc); pc->sysargs[4] = um_mmap_secret; pc->sysargs[5] = sf_entry->pgoffset+offset; # else /* If there is no mmap2 (it's probably a 64 bit architecture) we stay * with the original mmap but the offset must be in bytes, rounded up * to a multiple of the page size. */ pc->sysargs[4] = um_mmap_secret; pc->sysargs[5] = (sf_entry->pgoffset + offset) * pgsize; # endif //printk("MMAP2 path %s epoch %lld %ld %ld %ld\n", path, nestepoch, sf_entry->pgoffset, offset,pgsize); return SC_CALLONXIT; } } /* unmap: search the chunk to be unmapped, if found it is moved to the * head of the process mmap table */ int wrap_in_munmap(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { unsigned long start=pc->sysargs[0]; unsigned long length=pc->sysargs[1]; //printk("======== wrap_in_munmap %lx %ld!!!\n",start,length); if (pcb_mmap_sfsearch_n_movetohead(&(pc->um_mmap),start,length)) return SC_CALLONXIT; else return STD_BEHAVIOR; } /* remap: search the chunk and move it to the head of the process mmap table */ int wrap_in_mremap(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { unsigned long start=pc->sysargs[0]; unsigned long length=pc->sysargs[1]; //unsigned long new_length=pc->sysargs[2]; //printk("======== wrap_in_mremap %lx %ld!!!\n",start,length,new_length); if (pcb_mmap_sfsearch_n_movetohead(&(pc->um_mmap),start,length)) { /* TODO check that remap does not overlap next mmap chunk on the secret * file */ return SC_CALLONXIT; } else return STD_BEHAVIOR; } /* mmap after system call management */ int wrap_out_mmap(int sc_number,struct pcb *pc) { if (pc->retval >= 0) { long rv=getrv(pc); /* user-mode syscall succeeded */ if (pc->um_mmap) { /* should be always true, just for safety*/ if (rv != -1) /* the new mmap entry is the first. update the user-mode address */ pc->um_mmap->start=rv; else /* user mode failed, the mapping must be deleted here, too */ pcb_mmap_deletehead(&(pc->um_mmap),1); } return STD_BEHAVIOR; } else { putrv(pc->retval,pc); puterrno(pc->erno,pc); return SC_MODICALL; } } /* unmap after syscall management, delete the element only if the * user mode syscall succeeded */ int wrap_out_munmap(int sc_number,struct pcb *pc) { //printk("======== wrap_out_munmap !!!\n"); long rv=getrv(pc); if (rv != -1) pcb_mmap_deletehead(&(pc->um_mmap),0); return STD_BEHAVIOR; } /* unmap after syscall management, change the size only if the * user mode syscall succeeded */ int wrap_out_mremap(int sc_number,struct pcb *pc) { unsigned long new_length=pc->sysargs[2]; long rv=getrv(pc); if (rv != -1 && pc->um_mmap) { pc->um_mmap->start=rv; pc->um_mmap->len = new_length; } return STD_BEHAVIOR; } #endif umview-0.8.2/xmview/sctab.c0000644000175000017500000012210411753517211014673 0ustar renzorenzo/* This is iart of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * sctab.c: um-ViewOS interface to capture_* * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Mattia Belletti, Ludovico Gardenghi, Andrea Gasparini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: sctab.c 995 2011-08-17 14:56:22Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef OLDVIRSC #include #endif #include #include "defs.h" #include "umproc.h" #include "services.h" #include "um_services.h" #include "sctab.h" #include "um_select.h" #include "scmap.h" #include "utils.h" #include "canonicalize.h" #include "capture.h" #include "capture_nested.h" #include "hashtab.h" #include "gdebug.h" uid_t host_uid; gid_t host_gid; static const char *const _sys_sigabbrev[NSIG] = { #define init_sig(sig, abbrev, desc) [sig] = abbrev, #include #undef init_sig }; /* set the errno */ void um_set_errno(struct pcb *pc,int i) { if (pc->flags && PCB_INUSE) pc->erno=i; else { struct npcb *npc=(struct npcb *)pc; npc->erno=i; } } char *um_getroot(struct pcb *pc) { if (pc->flags && PCB_INUSE) return pc->fdfs->root; else /* nested chroot: TODO */ return "/"; } /* internal call: get the timestamp */ struct timestamp *um_x_gettst() { struct pcb *pc=get_pcb(); if (pc) return &(pc->tst); else return NULL; } /* set the epoch for nesting (further system calls) * this call returns the previous value. * If epoch == 0, the new epoch is not set */ epoch_t um_setnestepoch(epoch_t epoch) { struct pcb *pc=get_pcb(); epoch_t oldepoch=pc->nestepoch; if (epoch > 0) pc->nestepoch=epoch; return oldepoch; } /* internal call: load the stat info for a file */ int um_x_lstat64(char *filename, struct stat64 *buf, struct pcb *pc, int isdotdot) { struct ht_elem *hte; int retval; long oldscno; epoch_t epoch; /* printk("-> um_lstat: %s %p %d\n",filename,pc->hte,isdotdot); */ /* internal nested call save data */ oldscno = pc->sysscno; pc->sysscno = NR64_lstat; epoch=pc->nestepoch; if ((hte=ht_check(CHECKPATH,filename,NULL,1)) == NULL) { if (pc->hte!=NULL && isdotdot) { pc->needs_path_rewrite=1; // printk("dotdot cage error %s %d\n",filename,pc->sysscno); } pc->hte=hte; retval = r_lstat64(filename,buf); } else { pc->hte=hte; retval = ht_syscall(hte,uscno(NR64_lstat))(filename,buf,-1); } /* internal nested call restore data */ //printk("%s %lld->%lld\n",filename,epoch,pc->nestepoch); pc->sysscno = oldscno; pc->nestepoch=epoch; return retval; } static int um_stat2access(int mode, struct pcb *pc, struct stat64 *stbuf, int real_uid) { if (stbuf->st_mode == 0) { errno=ENOENT; return -1; } else if ((mode & W_OK) && (ht_get_mountflags(pc->hte) & MS_RDONLY)) { errno=EROFS; return -1; } else { uid_t uid; gid_t gid; if (pc->hte == NULL) { uid=host_uid; gid=host_gid; } else { uid=(real_uid)?pc->ruid:pc->fsuid; gid=(real_uid)?pc->rgid:pc->fsgid; } if (uid == 0 || secure == 0) { if ((mode & X_OK) && !(stbuf->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) { errno=EACCES; return -1; } else return 0; } else { if (uid == stbuf->st_uid && (((stbuf->st_mode & S_IRWXU) >> 6) & mode) == mode) return 0; else if ((gid == stbuf->st_gid || in_supgrplist(stbuf->st_gid, pc)) && (((stbuf->st_mode & S_IRWXG) >> 3) & mode) == mode) return 0; else if ((stbuf->st_mode & S_IRWXO & mode) == mode) return 0; else { errno=EACCES; return -1; } } } } /* internal call: check the permissions for a file, search for module */ int um_xx_access(char *filename, int mode, struct pcb *pc) { struct ht_elem *hte; int retval; long oldscno; epoch_t epoch; /* printk("-> um_xx_access: %s\n",filename); */ /* internal nested call save data */ oldscno = pc->sysscno; epoch=pc->nestepoch; pc->sysscno = __NR_access; if ((hte=ht_check(CHECKPATH,filename,NULL,1)) == NULL) retval = r_access(filename,mode); else{ pc->hte=hte; retval = ht_syscall(hte,uscno(__NR_access))(filename,mode); } /* internal nested call restore data */ pc->sysscno=oldscno; pc->nestepoch=epoch; return retval; } int um_parentwaccess(char *filename, struct pcb *pc) { int lastslash=strlen(filename)-1; char *parent=filename; struct ht_elem *hte; struct stat64 stbuf; long oldscno; int retval; epoch_t epoch,nestepoch; //printk("%s \n",filename); while ((parent[lastslash]!='/') && (lastslash>0)) lastslash--; if (lastslash==0) parent="/"; parent[lastslash]='\0'; //printk("-> um_parentwaccess: %s\n",parent); /* internal nested call save data */ oldscno = pc->sysscno; epoch=pc->tst.epoch; nestepoch=pc->nestepoch; pc->sysscno = NR64_lstat; pc->tst.epoch=pc->nestepoch=get_epoch(); if ((hte=ht_check(CHECKPATH,parent,NULL,0)) == NULL) { retval = r_lstat64(filename,&stbuf); } else { struct ht_elem *oldhte=pc->hte; pc->hte=hte; retval = ht_syscall(hte,uscno(NR64_lstat))(filename,&stbuf,-1); pc->hte=oldhte; } pc->sysscno = oldscno; pc->tst.epoch=epoch; pc->nestepoch=nestepoch; filename[lastslash]='/'; if (retval < 0) { errno=EIO; return -1; } else if (pc->suid == stbuf.st_uid && (stbuf.st_mode & S_IWUSR)) return 0; else if ((stbuf.st_mode & S_IWGRP) && (pc->sgid == stbuf.st_gid || in_supgrplist(stbuf.st_gid, pc))) return 0; else if (stbuf.st_mode & S_IWOTH) return 0; else { errno=EACCES; return -1; } return 0; } #define FASTACCESS /* internal call: check the permissions for a file, this must follow a um_x_lstat64 */ #ifdef FASTACCESS int um_x_access(char *filename, int mode, struct pcb *pc, struct stat64 *stbuf) { return um_stat2access(mode, pc, stbuf, 0); } #else int um_x_access(char *filename, int mode, struct pcb *pc, struct stat64 *stbuf) { int retval; long oldscno; /* printk("-> um_x_access: %s %p\n",filename,pc->hte); */ /* internal nested call save data */ oldscno = pc->sysscno; pc->sysscno = __NR_access; if (pc->hte == NULL) retval = r_access(filename,mode); else { epoch_t epoch=pc->nestepoch; pc->nestepoch=ht_get_epoch(pc->hte); retval = ht_syscall(pc->hte,uscno(__NR_access))(filename,mode); #if 0 { int test; test=um_stat2access(mode, pc, stbuf, 0); if (test != retval) printk("diff %s %d -> %d %d %o %s\n",filename, mode, retval, test, pc->pathstat.st_mode, strerror(errno)); } #endif pc->nestepoch=epoch; } /* internal nested call restore data */ pc->sysscno=oldscno; return retval; } #endif /* internal call: read a symbolic link target this must follow a um_x_lstat64 */ int um_x_readlink(char *path, char *buf, size_t bufsiz, struct pcb *pc) { long oldscno = pc->sysscno; int retval; /* printk("-> um_x_readlink: %s %p\n",path,pc->hte); */ oldscno = pc->sysscno; pc->sysscno = __NR_readlink; if (pc->hte == NULL) retval = r_readlink(path,buf,bufsiz); else { epoch_t epoch=pc->nestepoch; pc->nestepoch=ht_get_epoch(pc->hte); retval = ht_syscall(pc->hte,uscno(__NR_readlink))(path,buf,bufsiz); pc->nestepoch=epoch; } /* internal nested call restore data */ pc->sysscno = oldscno; return retval; } /* rewrite the path argument of a call */ int um_x_rewritepath(struct pcb *pc, char *path, int arg, long offset) { long sp=getsp(pc); int pathlen=WORDALIGN(strlen(path)); long pos=sp-(pathlen+offset); ustoren(pc, pos, pathlen, path); pc->sysargs[arg]=pos; return offset+pathlen; } /* one word string used as a tag for mistaken paths */ char um_patherror[]="PE"; /* get a path (and strdup it) from the process address space */ char *um_getpath(long laddr,struct pcb *pc) { char path[PATH_MAX]; if (umovestr(pc,laddr,PATH_MAX,path) == 0) return strdup(path); else return um_patherror; } /* utimensat has a (crazy) behavior with filename==NULL */ static char *utimensat_nullpath(int dirfd,struct pcb *pc,struct stat64 *pst,int dontfollowlink) { if (dirfd==AT_FDCWD) { pc->erno = EFAULT; return um_patherror; } else if (dontfollowlink) { pc->erno = EINVAL; return um_patherror; } else { char *path=fd_getpath(pc->fds,dirfd); if (path==NULL) { int rv; path=alloca(PATH_MAX); snprintf(path,PATH_MAX,"/proc/%d/fd/%d",pc->pid,dirfd); if ((rv=readlink(path,path,PATH_MAX)) < 0) { pc->erno = EBADF; return um_patherror; } else path[rv]=0; } return strdup(path); } } /* get a path, convert it as an absolute path (and strdup it) * from the process address space */ char *um_abspath(int dirfd, long laddr,struct pcb *pc,struct stat64 *pst,int dontfollowlink) { char path[PATH_MAX]; if (umovestr(pc,laddr,PATH_MAX,path) == 0) { char newpath[PATH_MAX]; char *cwd; char *root=um_getroot(pc); if (dirfd==AT_FDCWD) cwd=pc->fdfs->cwd; else { cwd=fd_getpath(pc->fds,dirfd); if (cwd==NULL) { int rv; cwd=alloca(PATH_MAX); snprintf(cwd,PATH_MAX,"/proc/%d/fd/%d",pc->pid,dirfd); if ((rv=readlink(cwd,cwd,PATH_MAX)) < 0) { pc->erno = EBADF; return um_patherror; } else cwd[rv]=0; } } pc->hte=NULL; um_realpath(path,cwd,newpath,pst,dontfollowlink,pc); /* View-OS core chroot management: if root is not '/' always rewrite pathnames */ if (root[1] != 0 && pc->hte == NULL) pc->needs_path_rewrite=1; /* printk("PATH %s (%s,%s) NEWPATH %s (%p,%d) %lld\n",path,um_getroot(pc),pc->fdfs->cwd,newpath,pc->hte,pc->erno,pc->nestepoch); */ if (pc->erno) return um_patherror; //error else return strdup(newpath); } else { pc->erno = EINVAL; return um_patherror; } } /* Common framework for the dsys_{megawrap,socketwrap,virscwrap,...} - they all * do the usual work, but with different parameter handling. * What a dsys_* function do is, in general, receiving the notification of an * IN/OUT phase of syscall about a certain process, and decide what to do. What * it has to do is to deliver the notification to the correct functions. * This common framework asks for three more parameters to make such a * decision: * - An argument parser function (dcpa): this function extracts the arguments * from the process registers/memory into our data structures (usually * arg{0,1,...}, but also others - e.g., sockregs). * - An index function (dcif): returns the index inside the system call table * that regards the current system call. * - A service call function (sc): the service code and system call number is * given to this function, and it must return the function of the * module/service which manage the syscall * - A system call table (sm): this is a table of sc_map entries - look at that * structure for more informations. */ typedef void (*dsys_commonwrap_parse_arguments)(struct pcb *pc, int scno); typedef int (*dsys_commonwrap_index_function)(struct pcb *pc, int scno); typedef sysfun (*service_call)(struct ht_elem *hte, int scno); int dsys_commonwrap(int sc_number,int inout,struct pcb *pc, dsys_commonwrap_parse_arguments dcpa, dsys_commonwrap_index_function dcif, service_call sc, struct sc_map *sm) { /* some tmp files must be removed at the next invocation (e.g. * exec creates tmp files), here is the removal */ if (__builtin_expect(pc->tmpfile2unlink_n_free!=NULL,0)) { r_unlink(pc->tmpfile2unlink_n_free); free(pc->tmpfile2unlink_n_free); pc->tmpfile2unlink_n_free=NULL; } /* -- IN phase -- */ if (inout == IN) { struct ht_elem *hte; int index; puterrno0(pc); /* timestamp the call */ pc->tst.epoch=pc->nestepoch=get_epoch(); /* extract argument */ dcpa(pc, sc_number); /* and get the index of the system call table * regarding this syscall */ index = dcif(pc, sc_number); /* dotdot cage: syscalls need path rewriting when leaving a virtual area by a relative .. path */ pc->needs_path_rewrite=0; //printk("nested_commonwrap %d -> %lld\n",sc_number,pc->tst.epoch); /* looks in the system call table what is the 'choice function' * and ask it the service to manage */ pc->hte=hte=sm[index].scchoice(sc_number,pc); /* something went wrong during a path lookup - fake the * syscall, we do not want to make it run */ if (pc->path == um_patherror) { pc->retval = -1; return SC_FAKE; } #ifdef _UM_MMAP /* it returns EBADF when somebody tries to access * secret files (mmap_secret) */ if (hte == HT_ERR) { pc->path = um_patherror; pc->erno = EBADF; pc->retval = -1; return SC_FAKE; } #endif //printk("commonwrap choice %d -> %lld %x\n",sc_number,pc->tst.epoch,hte); /* if some service want to manage the syscall (or the ALWAYS * flag is set), we process it */ if (hte != NULL || (sm[index].flags & ALWAYS)) { /* suspend management: * when howsusp has at least one bit set (CB_R, CB_W, CB_X) * the system checks with a select if the call is blocking or not. * when the call would be blocking the process is suspended and an event * event callback is loaded. */ int howsusp = sm[index].flags & 0x7; int what; errno=0; if (howsusp != 0 && (what=check_suspend_on(pc, pc->sysargs[0], howsusp))!=STD_BEHAVIOR) { if (what == SC_CALLONXIT) { if (pc->path != NULL) free(pc->path); pc->path = um_patherror; } return what; } else /* normal management: call the wrapin function, * with the correct service syscall function */ return sm[index].wrapin(sc_number,pc,hte,sc(hte,index)); #if 0 int retval; errno=0; retval=sm[index].wrapin(sc_number,pc,hte,sc(hte,index)); if (pc->erno==EUMWOULDBLOCK) return SC_SUSPIN; else return retval; #endif } else { int retval; if (__builtin_expect(pc->needs_path_rewrite,0)) { // printk("needs_path_rewrite %s %d\n",pc->path,pc->sysscno); if (ISPATHARG(sm[index].nargx)) um_x_rewritepath(pc,pc->path,PATHARG(sm[index].nargx),0); retval=SC_MODICALL; } else retval=STD_BEHAVIOR; /* we do not want to manage the syscall: free the path * field in case, since we do not need it, and ask for * a standard behavior */ if (pc->path != NULL) free(pc->path); return retval; } /* -- OUT phase -- */ } else { if (pc->path != um_patherror) { /* ok, try to call the wrapout */ int retval; /* and get the index of the system call table * regarding this syscall */ int index = dcif(pc, sc_number); errno=0; /* call the wrapout */ retval=sm[index].wrapout(sc_number,pc); /* check if we can free the path (not NULL and not * used) */ if (pc->path != NULL && (retval & SC_SUSPENDED) == 0) free(pc->path); return retval; } else { /* during the IN phase path resolution something went wrong * simply pass return value and errno to the process */ putrv(pc->retval,pc); puterrno(pc->erno,pc); return SC_MODICALL; } } } #if (__NR_socketcall != __NR_doesnotexist) /* socketcall parse arguments, (only for architectures where there is * one shared socketcall system call). Args must be retrieved from the * caller process memory */ void dsys_socketwrap_parse_arguments(struct pcb *pc, int scno) { pc->private_scno = pc->sysscno | ESCNO_SOCKET; pc->path = NULL; } /* sysargs[0] is the socketcall number */ int dsys_socketwrap_index_function(struct pcb *pc, int scno) { return pc->sysscno; } /* megawrap call for socket calls (only for architectures where there is * one shared socketcall system call) */ int dsys_socketwrap(int sc_number,int inout,struct pcb *pc) { return dsys_commonwrap(sc_number, inout, pc, dsys_socketwrap_parse_arguments, dsys_socketwrap_index_function, ht_socketcall, sockmap); } #endif /* virsc argument parsing function */ #ifdef OLDVIRSC void dsys_um_virsc_parse_arguments(struct pcb *pc, int scno) { struct __sysctl_args sysctlargs; sysctlargs.name=NULL; sysctlargs.nlen=0; pc->path = NULL; umoven(pc,pc->sysargs[0],sizeof(sysctlargs),&sysctlargs); /* private system calls are encoded with name==NULL and nlen != 0 * (it is usually an error case for sysctl) */ if (sysctlargs.name == NULL && sysctlargs.nlen != 0) { /* virtual system call */ if (sysctlargs.newval != NULL && sysctlargs.newlen >0 && sysctlargs.newlen <= 6) umoven(pc,(long)(sysctlargs.newval),sysctlargs.newlen * sizeof(long), pc->sysargs); /* the private system call number is encoded in the nlen field */ pc->private_scno = sysctlargs.nlen | ESCNO_VIRSC; } else { /* real sysctl, mapped on 0 */ pc->sysargs[1] = 0; } } #else void dsys_um_virsc_parse_arguments(struct pcb *pc, int scno) { if (pc->sysargs[0] == umNULL && pc->sysargs[1] <= 6) { /* virtual syscall */ pc->private_scno = pc->sysargs[2] | ESCNO_VIRSC; umoven(pc,pc->sysargs[3], pc->sysargs[1] * sizeof(long), pc->sysargs); } else pc->private_scno = ESCNO_VIRSC; } #endif /* index function for sysctl: parse args above puts the * number of syscall in sysargs[1]*/ int dsys_um_virsc_index_function(struct pcb *pc, int scno) { return (pc->private_scno & ESCNO_MASK); } /* megawrap for virsc */ int dsys_um_virsc(int sc_number,int inout,struct pcb *pc) { return dsys_commonwrap(sc_number, inout, pc, dsys_um_virsc_parse_arguments, dsys_um_virsc_index_function, ht_virsyscall, virscmap); } /* just the function executed by the following function (iterator) */ static void _reg_processes(struct pcb *pc,char *destination) { service_ctl(MC_PROC | MC_ADD, NULL, destination, pc->umpid, (pc->pp) ? pc->pp->umpid : -1, pcbtablesize()); } /* when a new service gets registerd all the existing processes are added * as a whole to the private data structures of the module, if it asked for * them */ static int reg_processes(char *destination) { forallpcbdo(_reg_processes, destination); return 0; } /* just the function executed by the following function (iterator) */ static void _dereg_processes(struct pcb *pc,char *destination) { service_ctl(MC_PROC | MC_REM, NULL, destination, pc->umpid); } /* when a service gets deregistered, all the data structures managed by the * module related to the processes must be deleted (if the module asked for * the processes birth history upon insertion */ static int dereg_processes(char *destination) { forallpcbdo(_dereg_processes, destination); return 0; } /* UM actions for a new process entering the game*/ static void um_proc_add(struct pcb *pc) { GDEBUG(0, "calling service_ctl %d %d %d %d %d %d", MC_PROC|MC_ADD, UM_NONE, -1, pc->umpid, (pc->pp)?pc->pp->umpid:-1, pcbtablesize()); service_ctl(MC_PROC | MC_ADD, NULL, NULL, pc->umpid, (pc->pp) ? pc->pp->umpid : -1, pcbtablesize()); } /* UM actions for a terminated process */ static void um_proc_del(struct pcb *pc) { service_ctl(MC_PROC | MC_REM, NULL, NULL, pc->umpid); } #if 0 static mode_t local_getumask(void) { mode_t mask = r_umask(0); r_umask(mask); return mask; } #endif /* set up all the data of the extended pcb for a new process */ void pcb_plus(struct pcb *pc,int flags,int npcflag) { pc->path=pc->tmpfile2unlink_n_free=NULL; if (!npcflag) { /* CLONE_PARENT = I'm not your child, I'm your brother. So, parent is * different from what we thought */ int rootprocess=(pc->pp == pc); if (flags & CLONE_PARENT) pc->pp=pc->pp->pp; /* CLONE_FS = share filesystem information */ if (flags & CLONE_FS) { pc->fdfs = pc->pp->fdfs; pc->fdfs->count++; } else { pc->fdfs = (struct pcb_fs *) malloc(sizeof (struct pcb_fs)); pc->fdfs->count=1; /* ROOT process: the first one activated by umview */ if (rootprocess) { char *path=malloc(PATH_MAX); r_getcwd(path,PATH_MAX); pc->fdfs->cwd=realloc(path,strlen(path)+1); pc->fdfs->root=strdup("/"); /*pc->fdfs->mask=local_getumask();*/ pc->fdfs->mask=r_umask(0); } else { pc->fdfs->cwd=strdup(pc->pp->fdfs->cwd); pc->fdfs->root=strdup(pc->pp->fdfs->root); pc->fdfs->mask=pc->pp->fdfs->mask; } } if (rootprocess) { int ngroups=r_getgroups(0,NULL); r_umask(pc->fdfs->mask); /* create the root of the treepoch */ pc->tst=tst_newfork(NULL); /* set the initial uid */ if (secure) { pc->ruid=pc->euid=pc->suid=0; pc->rgid=pc->egid=pc->sgid=0; r_getresuid(NULL,&host_uid,NULL); r_getresgid(NULL,&host_gid,NULL); } else { r_getresuid(&pc->ruid,&pc->euid,&pc->suid); r_getresgid(&pc->rgid,&pc->egid,&pc->sgid); host_uid=pc->euid; host_gid=pc->egid; } pc->fsuid=pc->euid; pc->fsgid=pc->egid; pc->hte=NULL; pc->grouplist=supgrp_create(ngroups); r_getgroups(ngroups,pc->grouplist->list); } else { pc->ruid=pc->pp->ruid; pc->euid=pc->fsuid=pc->pp->euid; pc->suid=pc->pp->suid; pc->rgid=pc->pp->rgid; pc->egid=pc->fsgid=pc->pp->egid; pc->sgid=pc->pp->sgid; pc->hte=pc->pp->hte; pc->grouplist=supgrp_get(pc->pp->grouplist); } pc->tst=tst_newproc(&(pc->pp->tst)); #if 0 /* if CLONE_FILES, file descriptor table is shared */ if (flags & CLONE_FILES) pc->fds = pc->pp->fds; lfd_addproc(&(pc->fds),flags); #endif um_proc_add(pc); } } /* clean up all the data structure related to a terminated process */ void pcb_minus(struct pcb *pc,int flags,int npcbflag) { if (!npcbflag) { //printk("pcb_desctructor %d\n",pc->pid); #if 0 /* delete all the file descriptors */ lfd_delproc(pc->fds); #endif /* notify services */ um_proc_del(pc); assert (pc->fdfs != NULL); /* decrement the usage couter for shared info and clean up * when there are no more processes sharing the data*/ pc->fdfs->count--; if (pc->fdfs->count == 0) { free (pc->fdfs->cwd); free (pc->fdfs->root); free (pc->fdfs); } /* notify the treepoch */ tst_delproc(&(pc->tst)); /*if (pc->data != NULL) { free(pc->data->fdfs->cwd); free(pc->data); }*/ supgrp_put(pc->grouplist); } } /* this is the root process of a new recursive invocation for umview */ /* the process already exists, the timestamp gets converted */ int pcb_newfork(struct pcb *pc) { struct treepoch *te=pc->tst.treepoch; pc->tst=tst_newfork(&(pc->tst)); return (te == pc->tst.treepoch)?-1:0; } void pcb_getviewinfo(struct pcb *pc,struct viewinfo *vi) { char *viewname; uname(&(vi->uname)); vi->serverid=r_getpid(); vi->viewid=te_getviewid(pc->tst.treepoch); viewname=te_getviewname(pc->tst.treepoch); if (viewname != NULL) strncpy(vi->viewname,viewname,_UTSNAME_LENGTH-1); else vi->viewname[0]=0; } void pcb_setviewname(struct pcb *pc,char *name) { te_setviewname(pc->tst.treepoch,name); } struct killstruct { int signo; struct treepoch *te; }; static void killone(struct pcb *pc, struct killstruct *ks) { if (te_sameview_or_next(ks->te,pc->tst.treepoch)) kill(pc->pid,ks->signo); } void killall(struct pcb *pc, int signo) { struct killstruct ks={signo, pc->tst.treepoch}; char *viewname=te_getviewname(pc->tst.treepoch); viewid_t viewid=te_getviewid(pc->tst.treepoch); if (viewname) printk("View %d (%s): Sending processes the %s signal\n",viewid,viewname,_sys_sigabbrev[signo]); else printk("View %d: Sending processes the %s signal\n",viewid,_sys_sigabbrev[signo]); forallpcbdo(killone,&ks); } #if 0 int dsys_dummy(int sc_number,int inout,struct pcb *pc) { if (inout == IN) { GDEBUG(1, "dummy diverted syscall pid %d call %d",pc->pid,sc_number); return STD_BEHAVIOR; } else { } return STD_BEHAVIOR; } int dsys_error(int sc_number,int inout,struct pcb *pc) { GDEBUG(1, "dsys_error pid %d call %d",pc->pid,sc_number); pc->retval = -1; pc->erno = ENOSYS; return STD_BEHAVIOR; } #endif /* choice function for system calls using a file descriptor */ struct ht_elem *choice_fd(int sc_number,struct pcb *pc) { int fd=pc->sysargs[0]; return ht_fd(pc->fds,fd,1); } /* choice sd (just the system call number is the choice parameter) */ struct ht_elem *choice_sc(int sc_number,struct pcb *pc) { return ht_check(CHECKSC,&sc_number,NULL,1); } /* choice mount (mount point must be defined + filesystemtype is used * instead of the pathname for service selection) */ struct ht_elem *choice_mount(int sc_number,struct pcb *pc) { pc->path=um_abspath(AT_FDCWD,pc->sysargs[1],pc,&(pc->pathstat),0); if (pc->path!=um_patherror) { char filesystemtype[PATH_MAX]; unsigned long fstype=pc->sysargs[2]; if (umovestr(pc,fstype,PATH_MAX,filesystemtype) == 0) return ht_check(CHECKFSTYPE,get_alias(CHECKFSALIAS,filesystemtype),NULL,0); else return NULL; } else return NULL; } /* choice path (filename must be defined) */ struct ht_elem *choice_path(int sc_number,struct pcb *pc) { pc->path=um_abspath(AT_FDCWD,pc->sysargs[0],pc,&(pc->pathstat),0); //printk("choice_path %d %s\n",sc_number,pc->path); if (pc->path==um_patherror){ /* char buff[PATH_MAX]; umovestr(pc,pc->sysargs[0],PATH_MAX,buff); printk("um_patherror: %s",buff);*/ return NULL; } else return ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); } struct ht_elem *choice_path_exact(int sc_number,struct pcb *pc) { pc->path=um_abspath(AT_FDCWD,pc->sysargs[0],pc,&(pc->pathstat),1); //printk("choice_path_exact %d %s\n",sc_number,pc->path); if (pc->path==um_patherror){ return NULL; } else if (strcmp(pc->path,"/")==0) return ht_check(CHECKPATHEXACT,"",&(pc->pathstat),1); else return ht_check(CHECKPATHEXACT,pc->path,&(pc->pathstat),1); } /* choice pathat (filename must be defined) */ struct ht_elem *choice_pathat(int sc_number,struct pcb *pc) { pc->path=um_abspath(pc->sysargs[0],pc->sysargs[1],pc,&(pc->pathstat),0); if (pc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); } /* choice sockpath (filename can be NULL) */ struct ht_elem *choice_sockpath(int sc_number,struct pcb *pc) { if (pc->sysargs[0] != 0) { pc->path=um_abspath(AT_FDCWD,pc->sysargs[0],pc,&(pc->pathstat),0); if (pc->path==um_patherror){ /* char buff[PATH_MAX]; umovestr(pc,pc->sysargs[0],PATH_MAX,buff); printk("um_patherror: %s",buff);*/ return NULL; } else return ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); } else return ht_check(CHECKSOCKET, &(pc->sysargs[1]),NULL,1); } /* choice link (dirname must be defined, basename can be non-existent) */ struct ht_elem *choice_link(int sc_number,struct pcb *pc) { pc->path=um_abspath(AT_FDCWD,pc->sysargs[0],pc,&(pc->pathstat),1); //printk("choice_path %d %s\n",sc_number,pc->path); if (pc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); } /* choice linkat (dirname must be defined, basename can be non-existent) */ struct ht_elem *choice_linkat(int sc_number,struct pcb *pc) { pc->path=um_abspath(pc->sysargs[0],pc->sysargs[1],pc,&(pc->pathstat),1); if (pc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); } /* choice unlinkat (unlink = rmdir or unlink depending on flag) */ struct ht_elem *choice_unlinkat(int sc_number,struct pcb *pc) { pc->path=um_abspath(pc->sysargs[0],pc->sysargs[1],pc,&(pc->pathstat), !(pc->sysargs[2] & AT_REMOVEDIR)); if (pc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); } /* utimensat has a (crazy) behavior with filename==NULL */ struct ht_elem *choice_utimensat(int sc_number,struct pcb *pc) { if (pc->sysargs[1] == umNULL) pc->path=utimensat_nullpath(pc->sysargs[0],pc,&(pc->pathstat), pc->sysargs[3] & AT_SYMLINK_NOFOLLOW); else pc->path=um_abspath(pc->sysargs[0],pc->sysargs[1],pc,&(pc->pathstat), pc->sysargs[3] & AT_SYMLINK_NOFOLLOW); if (pc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); } /* choice path or link at (filename must be defined or can be non-existent) */ /* depending on AT_SYMLINK_NOFOLLOW on the 4th parameter */ struct ht_elem *choice_pl4at(int sc_number,struct pcb *pc) { pc->path=um_abspath(pc->sysargs[0],pc->sysargs[1],pc,&(pc->pathstat), pc->sysargs[3] & AT_SYMLINK_NOFOLLOW); if (pc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); } /* depending on AT_SYMLINK_NOFOLLOW on the 5th parameter */ struct ht_elem *choice_pl5at(int sc_number,struct pcb *pc) { pc->path=um_abspath(pc->sysargs[0],pc->sysargs[1],pc,&(pc->pathstat), pc->sysargs[4] & AT_SYMLINK_NOFOLLOW); if (pc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); } /* choice link (dirname must be defined, basename can be non-existent second arg)*/ struct ht_elem *choice_link2(int sc_number,struct pcb *pc) { pc->path=um_abspath(AT_FDCWD,pc->sysargs[1],pc,&(pc->pathstat),1); //printk("choice_link2 %d %s\n",sc_number,pc->path); if (pc->path==um_patherror) return NULL; else { struct ht_elem *hte_new=ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); /* if NEW is real and OLD is virtual ==> EXDEV */ if (hte_new == NULL && sc_number != __NR_symlink) { struct stat64 oldstat; char *oldpath=um_abspath(AT_FDCWD,pc->sysargs[0],pc,&oldstat,1); if (oldpath != um_patherror) { struct ht_elem *hte_old=ht_check(CHECKPATH,oldpath,&oldstat,0); if (hte_old != NULL) { free(pc->path); pc->path = um_patherror; pc->erno = EXDEV; } free(oldpath); } return NULL; } else return hte_new; } } struct ht_elem *choice_link2at(int sc_number,struct pcb *pc) { pc->path=um_abspath(pc->sysargs[1],pc->sysargs[2],pc,&(pc->pathstat),1); //printk("choice_path %d %s\n",sc_number,pc->path); if (pc->path==um_patherror) return NULL; else return ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); } struct ht_elem *choice_link3at(int sc_number,struct pcb *pc) { pc->path=um_abspath(pc->sysargs[2],pc->sysargs[3],pc,&(pc->pathstat),1); //printk("choice_path %d %s\n",sc_number,pc->path); if (pc->path==um_patherror) return NULL; else { struct ht_elem *hte_new=ht_check(CHECKPATH,pc->path,&(pc->pathstat),1); /* if NEW is real and OLD is virtual ==> EXDEV */ if (hte_new == NULL) { struct stat64 oldstat; int dontfollowlink; char *oldpath; if (sc_number == __NR_linkat) dontfollowlink=!(pc->sysargs[4] & AT_SYMLINK_FOLLOW); else dontfollowlink=1; oldpath=um_abspath(pc->sysargs[0],pc->sysargs[1],pc,&oldstat,dontfollowlink); if (oldpath != um_patherror) { struct ht_elem *hte_old=ht_check(CHECKPATH,oldpath,&oldstat,0); if (hte_old != NULL) { free(pc->path); pc->path = um_patherror; pc->erno = EXDEV; } free(oldpath); } return NULL; } else return hte_new; } } /* choice function for 'socket', usually depends on the Protocol Family */ struct ht_elem *choice_socket(int sc_number,struct pcb *pc) { return ht_check(CHECKSOCKET, &(pc->sysargs[0]),NULL,1); } /* choice function for mmap: only *non anonymous* mmap must be mapped * depending on the service responsible for the fd. */ struct ht_elem *choice_mmap(int sc_number,struct pcb *pc) { long fd=pc->sysargs[4]; long flags=pc->sysargs[3]; if (flags & MAP_ANONYMOUS) return NULL; else return ht_fd(pc->fds,fd,1); } /* dummy choice function for unimplemented syscalls */ struct ht_elem *always_null(int sc_number,struct pcb *pc) { return NULL; } /* dummy choice function for unimplemented syscalls */ char always_umnone(int sc_number,struct pcb *pc) { return UM_NONE; } /* preload arguments: convert socket args in case socket calls are * ordinary system calls */ void dsys_megawrap_parse_arguments(struct pcb *pc, int scno) { pc->private_scno = pc->sysscno; pc->path = NULL; } /* index function for system call: uscno gives the index */ int dsys_megawrap_index_function(struct pcb *pc, int scno) { return uscno(scno); } /* system call megawrap */ int dsys_megawrap(int sc_number,int inout,struct pcb *pc) { return dsys_commonwrap(sc_number, inout, pc, dsys_megawrap_parse_arguments, dsys_megawrap_index_function, ht_syscall, scmap); } /* for modules: get the caller pid */ int um_mod_getpid() { struct pcb *pc=get_pcb(); return ((pc && (pc->flags & PCB_INUSE))?pc->pid:0); } /* for modules: get data from the caller process */ void um_mod_set_hte(struct ht_elem *hte) { struct pcb *pc=get_pcb(); pc->hte=hte; } struct ht_elem *um_mod_get_hte(void) { struct pcb *pc=get_pcb(); return pc->hte; } int um_mod_umoven(long addr, int len, void *_laddr) { struct pcb *pc=get_pcb(); if (pc) { if (pc->flags && PCB_INUSE) return (umoven(pc,addr,len,_laddr)); else { memcpy(_laddr,(void *)addr,len); return 0; } } else return -1; } /* for modules: get string data from the caller process */ int um_mod_umovestr(long addr, int len, void *_laddr) { struct pcb *pc=get_pcb(); if (pc) { if (pc->flags && PCB_INUSE) return (umovestr(pc,addr,len,_laddr)); else { strncpy((char *)_laddr,(char *)addr, len); return 0; } } else return -1; } /* for modules: store data to the caller process memory */ int um_mod_ustoren(long addr, int len, void *_laddr) { struct pcb *pc=get_pcb(); if (pc) { if (pc->flags && PCB_INUSE) return (ustoren(pc,addr,len,_laddr)); else { memcpy((void *)addr,_laddr,len); return 0; } } else return -1; } /* for modules: store string data to the caller process memory */ int um_mod_ustorestr(long addr, int len, void *_laddr) { struct pcb *pc=get_pcb(); if (pc) { if (pc->flags && PCB_INUSE) return (ustorestr(pc,addr,len,_laddr)); else { strncpy((char *)addr,(char *)_laddr,len); return 0; } } else return -1; } /* for modules: get the syscall number */ int um_mod_getsyscallno(void) { struct pcb *pc=get_pcb(); if (pc) { if (pc->flags && PCB_INUSE) return (pc->private_scno); else { struct npcb *npc=(struct npcb *)pc; return (npc->private_scno); } } else return 0; } /* for modules: get the syscall args */ unsigned long *um_mod_getargs(void) { struct pcb *pc=get_pcb(); if (pc) { if (pc->flags && PCB_INUSE) return (pc->sysargs); else { struct npcb *npc=(struct npcb *)pc; return (npc->sysargs); } } else{ return NULL; } } /* for modules: get the user-mode process id (small integer, * suitable for storing private data into arrays) */ int um_mod_getumpid(void) { struct pcb *pc=get_pcb(); /* this returns 0 for nested calls */ return ((pc && (pc->flags & PCB_INUSE))?pc->umpid:0); /* this returns the id of the caller process that originally made the * call * UMPID4NESTED * return pc->umpid; */ } /* for modules: get the stat info for the current path */ struct stat64 *um_mod_getpathstat(void) { struct pcb *pc=get_pcb(); if (pc) { if (pc->pathstat.st_mode == 0) return NULL; else return &(pc->pathstat); } else return NULL; } /* for modules: get the absolute path*/ char *um_mod_getpath(void) { struct pcb *pc=get_pcb(); if (pc) return pc->path; else return NULL; } int um_mod_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) { struct pcb *pc=get_pcb(); if (pc) { if (ruid) *ruid=pc->ruid; if (euid) *euid=pc->euid; if (suid) *suid=pc->suid; return 0; } else return -1; } int um_mod_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) { struct pcb *pc=get_pcb(); if (pc) { if (rgid) *rgid=pc->rgid; if (egid) *egid=pc->egid; if (sgid) *sgid=pc->sgid; return 0; } else return -1; } int um_mod_setresuid(uid_t ruid, uid_t euid, uid_t suid) { struct pcb *pc=get_pcb(); if (pc) { if (ruid != -1) pc->ruid=ruid; if (euid != -1) pc->euid=euid; if (suid != -1) pc->suid=suid; return 0; } else return -1; } int um_mod_setresgid(gid_t rgid, gid_t egid, gid_t sgid) { struct pcb *pc=get_pcb(); if (pc) { if (rgid != -1) pc->rgid=rgid; if (egid != -1) pc->egid=egid; if (sgid != -1) pc->sgid=sgid; return 0; } else return -1; } int um_mod_getfs_uid_gid(uid_t *fsuid, gid_t *fsgid) { struct pcb *pc=get_pcb(); if (pc) { if (fsuid) *fsuid=pc->fsuid; if (fsgid) *fsgid=pc->fsgid; return 0; } else return -1; } int um_mod_setfs_uid_gid(uid_t fsuid, gid_t fsgid) { struct pcb *pc=get_pcb(); if (pc) { if (fsuid != -1) pc->fsuid=fsuid; if (fsgid != -1) pc->fsgid=fsgid; return 0; } else return -1; } /* for modules: get the system call type*/ int um_mod_getsyscalltype(int escno) { return escmapentry(escno)->setofcall; /* int usc=uscno(scno); if (usc >= 0) return USC_TYPE(usc); else return -1;*/ } /* for modules: get the number of syscall for this architecture * (not all the archs define NR_SYSCALLS*/ int um_mod_nrsyscalls(void) { return _UM_NR_syscalls; } /* management of supplementary groups */ struct supgroups *supgrp_create(size_t size) { struct supgroups *rv=malloc(sizeof(struct supgroups) + size*sizeof(gid_t)); assert(rv != NULL); rv->size=size; rv->count=1; return rv; } /* atomic operations as different umview threads may have access to this */ struct supgroups *supgrp_get(struct supgroups *supgrp) { __sync_fetch_and_add(&(supgrp->count),1); return supgrp; } void supgrp_put(struct supgroups *supgrp) { int oldval = __sync_fetch_and_sub(&(supgrp->count),1); if (oldval == 1) free(supgrp); } int capcheck(int capability, struct pcb *pc) { if (pc->euid == 0) return 0; else { return -1; } } /* for modules: management of module filetab. */ #define FILETABSTEP 4 /* must be a power of two */ #define FILETABSTEP_1 (FILETABSTEP-1) static pthread_mutex_t g_filetab_mutex = PTHREAD_MUTEX_INITIALIZER; static void **g_filetab=NULL; static long g_filetabmax=0; static long g_filetabsize=0; static long g_filetabfree=-1; int addfiletab(int size) { int rv; pthread_mutex_lock( &g_filetab_mutex ); if (g_filetabfree>=0) { rv=g_filetabfree; g_filetabfree=(long)(g_filetab[rv]); } else { rv=g_filetabmax++; if (rv>=g_filetabsize) { g_filetabsize=(rv + FILETABSTEP) & ~FILETABSTEP_1; g_filetab=realloc(g_filetab,g_filetabsize* sizeof(void *)); assert(g_filetab); } } g_filetab[rv]=malloc(size); assert(g_filetab[rv]); pthread_mutex_unlock( &g_filetab_mutex ); return rv; } void delfiletab(int i) { free(g_filetab[i]); pthread_mutex_lock( &g_filetab_mutex ); /* unused elements gets linked by re-using the void pointers as the index of the next element */ g_filetab[i]=(void *)g_filetabfree; g_filetabfree=i; pthread_mutex_unlock( &g_filetab_mutex ); } void *getfiletab(int i) { void *rv; pthread_mutex_lock( &g_filetab_mutex ); rv=g_filetab[i]; pthread_mutex_unlock( &g_filetab_mutex ); return rv; } #ifdef _VIEWOS_KM /* upcall: hashtable calls this function when an element gets added/deleted */ static void ht_zerovirt_upcall(int tag, unsigned char type,const void *obj,int objlen,long mountflags) { /* ghost mount: this mount does not switch off/on zerovirt. update the ghosthash table instead */ if (type==CHECKPATH && (mountflags & MS_GHOST)) { switch (tag) { case HT_ADD: ghosthash_add(obj,objlen); break; case HT_DEL: ghosthash_del(obj,objlen); break; } } else { /* ht_count keeps track of the number of elements in the hashtable for each tag*/ static unsigned long ht_count[NCHECKS]; int oldsum=ht_count[CHECKPATH] + ht_count[CHECKCHRDEVICE] + ht_count[CHECKBLKDEVICE]; int newsum; switch (tag) { case HT_ADD: ht_count[type]++; break; case HT_DEL: ht_count[type]--; break; } newsum=ht_count[CHECKPATH] + ht_count[CHECKCHRDEVICE] + ht_count[CHECKBLKDEVICE]; /* if this is the first (non ghost) element turn zerovirt off */ if (oldsum == 0 && newsum == 1) capture_km_global_get_path_syscalls(); /* if this is the last (non ghost) element turn zerovirt on */ if (oldsum == 1 && newsum == 0) capture_km_global_skip_path_syscalls(); } } #endif /* scdtab: interface between capture_* and the wrapper (wrap-in/out) * implemented for each system call (see um_*.c files) */ /* capture_* call a "megawrap" that implements all the common code * and then forwards the call to the functions defined in scmap.c */ void scdtab_init() { register int i; _service_init(); /* init service management */ service_addregfun(MC_PROC, (sysfun)reg_processes, (sysfun)dereg_processes); #ifdef OLDVIRSC /* sysctl is used to define private system calls */ scdtab[__NR__sysctl]=dsys_um_virsc; scdnarg[__NR__sysctl]=1; #else /* pivot_root is used to define private system calls */ scdtab[__NR_pivot_root]=dsys_um_virsc; scdnarg[__NR_pivot_root]=4; #endif /* initialize scmap */ init_scmap(); /* define the megawrap for the syscalls defined in scmap */ for (i=0; i= 0) { scdtab[scno]=dsys_megawrap; scdnarg[scno]=NARGS(scmap[i].nargx); } } /* linux has a single call for all the socket calls * in several architecture (i386, ppc), socket calls are standard * system calls in others (x86_64) */ #if (__NR_socketcall != __NR_doesnotexist) for (i=1; i #include #include #include #include #include #include #include #include #include "defs.h" #include "services.h" #include "hashtab.h" #include "sctab.h" #include "utils.h" #include "capture.h" #include "uid16to32.h" #define umNULL ((long) NULL) static int checksecureuid(struct pcb *pc, uid_t ruid, uid_t euid, uid_t suid, uid_t fsuid) { if (capcheck(CAP_SETUID,pc)) { if ((ruid != -1 && ruid != pc->ruid && ruid != pc->suid) || (euid != -1 && euid != pc->ruid && euid != pc->euid && euid != pc->suid) || (suid != -1 && suid != pc->suid) || (fsuid != -1 && fsuid != pc->fsuid)) return -1; else return 0; } else return 0; } static int checksecuregid(struct pcb *pc, gid_t rgid, gid_t egid, gid_t sgid, gid_t fsgid) { if (capcheck(CAP_SETGID,pc)) return 0; else { if ((rgid != -1 && rgid != pc->rgid && rgid != pc->sgid) || (egid != -1 && egid != pc->rgid && egid != pc->egid && egid != pc->sgid) || (sgid != -1 && sgid != pc->sgid) || (fsgid != -1 && fsgid != pc->fsgid)) return -1; else return 0; } } /* getuid, geteuid, getgid, getegid */ int wrap_in_getxid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { if (hte != NULL) { int rv=0; switch (sc_number) { case __NR_getuid: #if __NR_getuid != __NR_getuid32 case __NR_getuid32: #endif case __NR_getgid: #if __NR_getgid != __NR_getgid32 case __NR_getgid32: #endif rv=um_syscall(&(pc->retval),NULL,NULL); break; case __NR_geteuid: #if __NR_geteuid != __NR_geteuid32 case __NR_geteuid32: #endif case __NR_getegid: #if __NR_getegid != __NR_getegid32 case __NR_getegid32: #endif rv=um_syscall(NULL,&(pc->retval),NULL); break; } if (rv < 0) { pc->retval=-1; pc->erno=errno; } } else { switch (sc_number) { case __NR_getuid: #if __NR_getuid != __NR_getuid32 case __NR_getuid32: #endif pc->retval=pc->ruid; break; case __NR_getgid: #if __NR_getgid != __NR_getgid32 case __NR_getgid32: #endif pc->retval=pc->rgid; break; case __NR_geteuid: #if __NR_geteuid != __NR_geteuid32 case __NR_geteuid32: #endif pc->retval=pc->euid; break; case __NR_getegid: #if __NR_getegid != __NR_getegid32 case __NR_getegid32: #endif pc->retval=pc->egid; break; } /*printk("%d->%d\n",sc_number,pc->retval);*/ pc->erno=0; } return SC_FAKE; } int wrap_in_getxid16(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { wrap_in_getxid(sc_number,pc,hte,um_syscall); pc->retval=id32to16(pc->retval); return SC_FAKE; } /* setuid, setfsuid*/ int wrap_in_setuid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { uid_t uid=pc->sysargs[0]; if (sc_number != __NR_setuid32 && sc_number != __NR_setfsuid32) uid=id16to32(uid); if (secure) { int rv=0; switch (sc_number) { case __NR_setuid: #if __NR_setuid != __NR_setuid32 case __NR_setuid32: #endif rv=checksecureuid(pc,uid,-1,-1,-1); break; case __NR_setfsuid: #if __NR_setfsuid != __NR_setfsuid32 case __NR_setfsuid32: #endif rv=checksecureuid(pc,-1,-1,-1,uid); } if (rv) { pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } } if (hte != NULL) { switch (sc_number) { case __NR_setuid: #if __NR_setuid != __NR_setuid32 case __NR_setuid32: #endif pc->retval=um_syscall(uid,-1,-1); break; case __NR_setfsuid: #if __NR_setfsuid != __NR_setfsuid32 case __NR_setfsuid32: #endif pc->retval = um_syscall(uid); break; } if (pc->retval < 0) pc->erno=errno; } else { switch (sc_number) { case __NR_setuid: #if __NR_setuid != __NR_setuid32 case __NR_setuid32: #endif if (pc->euid == 0) pc->ruid=pc->euid=pc->fsuid=uid; else pc->euid=pc->fsuid=uid; break; case __NR_setfsuid: #if __NR_setfsuid != __NR_setfsuid32 case __NR_setfsuid32: #endif pc->fsuid=uid; break; } pc->erno=pc->retval=0; } return SC_FAKE; } /* setgid, setfsgid */ int wrap_in_setgid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { gid_t gid=pc->sysargs[0]; if (sc_number != __NR_setgid32 && sc_number != __NR_setfsgid32) gid=id16to32(gid); if (secure) { int rv=0; switch (sc_number) { case __NR_setgid: #if __NR_setgid != __NR_setgid32 case __NR_setgid32: #endif rv=checksecuregid(pc,gid,-1,-1,-1); break; case __NR_setfsgid: #if __NR_setfsgid != __NR_setfsgid32 case __NR_setfsgid32: #endif rv=checksecuregid(pc,-1,-1,-1,gid); } if (rv) { pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } } if (hte != NULL) { switch (sc_number) { case __NR_setgid: #if __NR_setgid != __NR_setgid32 case __NR_setgid32: #endif pc->retval=um_syscall(gid,-1,-1); break; case __NR_setfsgid: #if __NR_setfsgid != __NR_setfsgid32 case __NR_setfsgid32: #endif (pc->retval = um_syscall(gid)); break; } if (pc->retval < 0) pc->erno=errno; } else { switch (sc_number) { case __NR_setgid: #if __NR_setgid != __NR_setgid32 case __NR_setgid32: #endif if (pc->egid == 0) pc->rgid=pc->egid=pc->fsgid=gid; else pc->egid=pc->fsgid=gid; break; case __NR_setfsgid: #if __NR_setfsgid != __NR_setfsgid32 case __NR_setfsgid32: #endif pc->fsgid=gid; break; } pc->erno=pc->retval=0; } return SC_FAKE; } int wrap_in_setreuid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { uid_t uid1=pc->sysargs[0]; uid_t uid2=pc->sysargs[1]; if (sc_number != __NR_setreuid32) { uid1=id16to32(uid1); uid2=id16to32(uid2); } if (secure && checksecureuid(pc,uid1,uid2,-1,-1)) { pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } if (hte != NULL) { if ((pc->retval = um_syscall(uid1,uid2,-1)) < 0) pc->erno=errno; } else { if (uid1 != -1) pc->ruid=uid1; if (uid2 != -1) pc->euid=pc->fsuid=uid2; pc->erno=pc->retval=0; } return SC_FAKE; } int wrap_in_setregid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { gid_t gid1=pc->sysargs[0]; gid_t gid2=pc->sysargs[1]; if (sc_number != __NR_setregid32) { gid1=id16to32(gid1); gid2=id16to32(gid2); } if (secure && checksecuregid(pc,gid1,gid2,-1,-1)) { pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } if (hte != NULL) { if ((pc->retval = um_syscall(gid1,gid2,-1)) < 0) pc->erno=errno; } else { if (gid1 != -1) pc->rgid=gid1; if (gid2 != -1) pc->egid=pc->fsgid=gid2; pc->erno=pc->retval=0; } return SC_FAKE; } int wrap_in_setresuid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { uid_t uid1=pc->sysargs[0]; uid_t uid2=pc->sysargs[1]; uid_t uid3=pc->sysargs[2]; if (sc_number != __NR_setresuid32) { uid1=id16to32(uid1); uid2=id16to32(uid2); uid3=id16to32(uid3); } if (secure && checksecureuid(pc,uid1,uid2,uid3,-1)) { pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } if (hte != NULL) { if ((pc->retval = um_syscall(uid1,uid2,uid3)) < 0) pc->erno=errno; } else { if (uid1 != -1) pc->ruid=uid1; if (uid2 != -1) pc->euid=pc->fsuid=uid2; if (uid3 != -1) pc->suid=uid2; pc->erno=pc->retval=0; } return SC_FAKE; } int wrap_in_setresgid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { gid_t gid1=pc->sysargs[0]; gid_t gid2=pc->sysargs[1]; gid_t gid3=pc->sysargs[2]; if (sc_number != __NR_setresgid32) { gid1=id16to32(gid1); gid2=id16to32(gid2); gid3=id16to32(gid3); } if (secure && checksecuregid(pc,gid1,gid2,gid3,-1)) { pc->retval=-1; pc->erno=EPERM; return SC_FAKE; } if (hte != NULL) { if ((pc->retval = um_syscall(gid1,gid2,gid3)) < 0) pc->erno=errno; } else { if (gid1 != -1) pc->rgid=gid1; if (gid2 != -1) pc->egid=pc->fsgid=gid2; if (gid3 != -1) pc->sgid=gid2; pc->erno=pc->retval=0; } return SC_FAKE; } int wrap_in_getresuid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { uid_t uid1,uid2,uid3; if (hte != NULL) pc->retval = um_syscall(&uid1,&uid2,&uid3); else { uid1=pc->ruid; uid2=pc->euid; uid3=pc->suid; pc->retval=pc->erno=0; } if (pc->retval >= 0) { long uid1p=pc->sysargs[0]; long uid2p=pc->sysargs[1]; long uid3p=pc->sysargs[2]; if (sc_number != __NR_getresuid32) { unsigned short int suid1=id32to16(uid1); unsigned short int suid2=id32to16(uid2); unsigned short int suid3=id32to16(uid3); if (uid1p != umNULL) ustoren(pc,uid1p,sizeof(suid1),&suid1); if (uid2p != umNULL) ustoren(pc,uid2p,sizeof(suid2),&suid2); if (uid3p != umNULL) ustoren(pc,uid3p,sizeof(suid3),&suid3); } else { if (uid1p != umNULL) ustoren(pc,uid1p,sizeof(uid_t),&uid1); if (uid2p != umNULL) ustoren(pc,uid2p,sizeof(uid_t),&uid2); if (uid3p != umNULL) ustoren(pc,uid3p,sizeof(uid_t),&uid3); } } else pc->erno=errno; return SC_FAKE; } int wrap_in_getresgid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { gid_t gid1,gid2,gid3; if (hte != NULL) pc->retval = um_syscall(&gid1,&gid2,&gid3); else { gid1=pc->rgid; gid2=pc->egid; gid3=pc->sgid; pc->retval=pc->erno=0; } if (pc->retval >= 0) { long gid1p=pc->sysargs[0]; long gid2p=pc->sysargs[1]; long gid3p=pc->sysargs[2]; if (sc_number != __NR_getresgid32) { unsigned short int sgid1=id32to16(gid1); unsigned short int sgid2=id32to16(gid2); unsigned short int sgid3=id32to16(gid3); if (gid1p != umNULL) ustoren(pc,gid1p,sizeof(sgid1),&sgid1); if (gid2p != umNULL) ustoren(pc,gid2p,sizeof(sgid2),&sgid2); if (gid3p != umNULL) ustoren(pc,gid3p,sizeof(sgid3),&sgid3); } else { if (gid1p != umNULL) ustoren(pc,gid1p,sizeof(gid_t),&gid1); if (gid2p != umNULL) ustoren(pc,gid2p,sizeof(gid_t),&gid2); if (gid3p != umNULL) ustoren(pc,gid3p,sizeof(gid_t),&gid3); } } else pc->erno=errno; return SC_FAKE; } int wrap_in_nice(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int inc=pc->sysargs[0]; if ((pc->retval = um_syscall(inc)) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_getpriority(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int which=pc->sysargs[0]; int who=pc->sysargs[1]; if ((pc->retval = um_syscall(which, who)) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_setpriority(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int which=pc->sysargs[0]; int who=pc->sysargs[1]; int prio=pc->sysargs[2]; if (secure) { if (capcheck(CAP_SYS_NICE,pc)) { /* A process was located, but its effective user ID did not match either the effective or the real user ID of the caller, and was not privileged (on Linux: did not have the CAP_SYS_NICE capabil‐ ity).*/ if ((which == PRIO_PROCESS || which == PRIO_PGRP) && who != 0) { struct pcb *target=pid2pcb(who); if (target != NULL && pc->ruid != target->euid && pc->euid != target->euid) { pc->retval=-1; pc->erno=EPERM; } } } } if ((pc->retval = um_syscall(which, who, prio)) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_getpid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { if ((pc->retval = um_syscall()) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_setpid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { if ((pc->retval = um_syscall()) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_getpgrp(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { /* mapped onto getpgid(0) */ if ((pc->retval = um_syscall(0)) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_setpgrp(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { /* mapped onto setpgid(0,0) */ if ((pc->retval = um_syscall(0,0)) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_getpid_1(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { pid_t pid=pc->sysargs[0]; if ((pc->retval = um_syscall(pid)) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_setpgid(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { pid_t pid1=pc->sysargs[0]; pid_t pid2=pc->sysargs[1]; if ((pc->retval = um_syscall(pid1,pid2)) < 0) pc->erno=errno; return SC_FAKE; } int wrap_in_getgroups(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int size=pc->sysargs[0]; long plist=pc->sysargs[1]; if (size == 0) { pc->retval = pc->grouplist->size; pc->erno = 0; } else { if (size < pc->grouplist->size) { pc->retval = -1; pc->erno = EINVAL; } else { pc->retval = pc->grouplist->size; #if __NR_getgroups32 != __NR_getgroups if (sc_number == __NR_getgroups) { int i; unsigned short *gid16=alloca(size * sizeof(unsigned short)); for (i=0;igrouplist->list[i]); ustoren(pc, plist, pc->retval * sizeof(unsigned short), gid16); } else #endif ustoren(pc, plist, pc->retval * sizeof(gid_t), pc->grouplist->list); pc->erno=0; } } return SC_FAKE; } int wrap_in_setgroups(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { size_t size=pc->sysargs[0]; long plist=pc->sysargs[1]; if (size > NGROUPS_MAX) { pc->retval = -1; pc->erno = EINVAL; } else { supgrp_put(pc->grouplist); pc->grouplist=supgrp_create(size); if (size > 0) { #if __NR_setgroups32 != __NR_setgroups if (sc_number == __NR_setgroups) { int i; unsigned short *gid16=alloca(size * sizeof(unsigned short)); umoven(pc, plist, size * sizeof(unsigned short), gid16); for (i=0;igrouplist->list[i]= id16to32(gid16[i]); } else #endif umoven(pc, plist, size * sizeof(gid_t), pc->grouplist->list); } pc->erno=0; pc->retval=1; } return SC_FAKE; } #ifdef VIEW_CAPABILITY int wrap_in_capget(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { unsigned long hdrp=pc->sysargs[0]; unsigned long datap=pc->sysargs[1]; struct __user_cap_header_struct hdr; umoven(pc, hdrp, sizeof(struct __user_cap_header), hdr); /* XXX TBD */ } int wrap_in_capset(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { unsigned long hdrp=pc->sysargs[0]; unsigned long datap=pc->sysargs[1]; struct __user_cap_header_struct hdr; umoven(pc, hdrp, sizeof(struct __user_cap_header), hdr); /* XXX TBD */ } #endif umview-0.8.2/xmview/modutils.c0000644000175000017500000000503611753517211015443 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * modutils.c: misc utilites for modules * * Copyright 2007 Ludovico Gardenghi University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: modutils.c 573 2008-06-18 10:41:29Z garden $ * */ #include #include #include #include #include #include #include #include "gdebug.h" /* This will be prefixed with getent("$HOME") */ #define USER_MODULES_DIR "/.umview/modules" #ifndef MAX # define MAX(a, b) ((a) > (b) ? (a) : (b)) #endif /* * Try to dlopen a module (o submodule) trying different names and locations: * * 1) dlopen(modname) * 2) dlopen(modname.so) * 3) dlopen(user_umview_plugin_directory/modname) * 4) dlopen(user_umview_plugin_directory/modname.so) * 5) dlopen(global_umview_plugin_directory/modname) * 6) dlopen(global_umview_plugin_directory/modname.so) * */ #define TRY_DLOPEN(fmt...) \ { \ snprintf(testpath, tplen, fmt); \ if ((handle = dlopen(testpath, flag))) \ { \ free(testpath); \ return handle; \ } \ } void *openmodule(const char *modname, int flag) { void *handle; char *testpath; int tplen; char *homedir = getenv("HOME"); if (!modname) return NULL; if ((handle = dlopen(modname, flag))) return handle; /* If there is no home directory, use CWD */ if (!homedir) homedir = "."; tplen = strlen(modname) + strlen(MODULES_EXT) + 2 + // + 1 is for a '/' and + 1 for \0 MAX(strlen(MODULES_DIR), strlen(homedir) + strlen(USER_MODULES_DIR)); testpath = malloc(tplen); TRY_DLOPEN("%s%s", modname, MODULES_EXT); TRY_DLOPEN("%s%s/%s", homedir, USER_MODULES_DIR, modname); TRY_DLOPEN("%s%s/%s%s", homedir, USER_MODULES_DIR, modname, MODULES_EXT); TRY_DLOPEN("%s%s", MODULES_DIR, modname); TRY_DLOPEN("%s/%s%s", MODULES_DIR, modname, MODULES_EXT); return NULL; } umview-0.8.2/xmview/sctab.h0000644000175000017500000000730511753517211014705 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * sctab.h: extension to pcb for sctab.c * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Mattia Belletti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: sctab.h 866 2010-08-11 07:17:33Z rd235 $ * */ #ifndef __SCTAB_H #define __SCTAB_H #include #include #include #include #include #include #include "umproc.h" #include "defs.h" #include "treepoch.h" extern int _umview_version; extern uid_t host_uid; extern gid_t host_gid; //extern pthread_key_t pcb_key; /* key to grab the current thread pcb */ struct pcb_fs { /* more than one process can share this structure - look at clone 2 * (CLONE_FS) */ int count; /* filesystem informations (current working directory, root filesystem * [chroot...], and umask) */ char *cwd; char *root; mode_t mask; }; #ifdef _UM_MMAP struct pcb_mmap_entry; void um_mmap_recdelproc(struct pcb_mmap_entry *head); #endif extern int um_errno; extern char um_patherror[]; void scdtab_init(); char *um_getpath(long laddr,struct pcb *pc); char *um_abspath(int dirfd, long laddr,struct pcb *pc,struct stat64 *pst,int dontfollowlink); int pcb_newfork(struct pcb *pc); void pcb_getviewinfo(struct pcb *pc,struct viewinfo *vi); void pcb_setviewname(struct pcb *pc,char *name); void killall(struct pcb *pc, int signo); void um_set_errno(struct pcb *pc,int i); //char *um_getcwd(struct pcb *pc,char *buf,int size); char *um_getroot(struct pcb *pc); int um_x_lstat64(char *filename, struct stat64 *buf, struct pcb *pc, int isdotdot); /* um_x_access and um_x_readlink must follow a um_x_lstat64 */ int um_x_access(char *filename,int mode, struct pcb *pc, struct stat64 *stbuf); int um_x_readlink(char *path, char *buf, size_t bufsiz, struct pcb *pc); int um_parentwaccess(char *filename, struct pcb *pc); int um_xx_access(char *filename,int mode, struct pcb *pc); /* rewrite the path argument of a call */ int um_x_rewritepath(struct pcb *pc, char *path, int arg, long offset); epoch_t um_setnestepoch(epoch_t epoch); int capcheck(int capability, struct pcb *pc); static inline int in_supgrplist(gid_t gid, struct pcb *pc) { int i; struct supgroups *grouplist=pc->grouplist; assert(grouplist != NULL); for (i=0;isize;i++) if (grouplist->list[i] == gid) return 1; return 0; } struct timestamp *um_x_gettst(); /* modules callbacks for extra args */ int um_mod_getpid(void); void um_mod_set_hte(struct ht_elem *hte); struct ht_elem *um_mod_get_hte(void); extern void *um_mod_get_private_data(void); int um_mod_umoven(long addr, int len, void *_laddr); int um_mod_umovestr(long addr, int len, void *_laddr); int um_mod_ustoren(long addr, int len, void *_laddr); int um_mod_ustorestr(long addr, int len, void *_laddr); int um_mod_getsyscallno(void); int um_mod_getumpid(void); unsigned long* um_mod_getargs(void); struct stat64 *um_mod_getpathstat(void); char *um_mod_getpath(void); int um_mod_getsyscalltype(int scno); //struct pcb* pid2pcb(int pid); #endif umview-0.8.2/xmview/scmap.c0000644000175000017500000007400411753517211014707 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * scmap: map for system call wrappers * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: scmap.c 1019 2011-11-22 13:50:10Z rd235 $ * */ #include #include #include #include #include "defs.h" #include "scmap.h" #include "uid16to32.h" int scmap_scmapsize; int scmap_sockmapsize; int scmap_virscmapsize; htfunt choice_path, choice_link, choice_fd, choice_socket, choice_link2; htfunt choice_sockpath; htfunt choice_pathat, choice_linkat, choice_pl5at, choice_pl4at, choice_link3at; htfunt choice_link2at, choice_unlinkat, choice_utimensat; htfunt always_null, choice_mount, choice_sc; htfunt choice_path_exact; #ifdef _UM_MMAP htfunt choice_mmap; #endif wrapinfun wrap_in_getcwd, wrap_in_chdir, wrap_in_fchdir; wrapinfun wrap_in_open, wrap_in_read, wrap_in_write, wrap_in_close; wrapinfun wrap_in_select, wrap_in_poll, wrap_in_ioctl; wrapinfun wrap_in_readv, wrap_in_writev; wrapinfun wrap_in_stat, wrap_in_fstat; wrapinfun wrap_in_stat64, wrap_in_fstat64; wrapinfun wrap_in_getxattr,wrap_in_fgetxattr; wrapinfun wrap_in_setxattr,wrap_in_fsetxattr; wrapinfun wrap_in_listxattr,wrap_in_flistxattr; wrapinfun wrap_in_removexattr,wrap_in_fremovexattr; wrapinfun wrap_in_readlink, wrap_in_getdents,wrap_in_getdents64, wrap_in_access; wrapinfun wrap_in_fcntl, wrap_in_notsupp, wrap_in_llseek, wrap_in_lseek; wrapinfun wrap_in_mkdir, wrap_in_unlink, wrap_in_chown, wrap_in_fchown; wrapinfun wrap_in_chmod, wrap_in_fchmod, wrap_in_dup, wrap_in_fsync; wrapinfun wrap_in_link, wrap_in_symlink, wrap_in_pread, wrap_in_pwrite; wrapinfun wrap_in_preadv, wrap_in_pwritev; wrapinfun wrap_in_utime, wrap_in_mount, wrap_in_umount,wrap_in_umount2; wrapinfun wrap_in_umask, wrap_in_chroot, wrap_in_mknod; wrapinfun wrap_in_truncate, wrap_in_ftruncate, wrap_in_execve; wrapinfun wrap_in_statfs, wrap_in_fstatfs; wrapinfun wrap_in_getgroups, wrap_in_setgroups; #ifdef VIEW_CAPABILITY wrapinfun wrap_in_capget, wrap_in_capset; #endif /* XXX: find a better way (see defs_x86_64*.h) */ #if __NR_statfs64 != __NR_doesnotexist wrapinfun wrap_in_statfs64, wrap_in_fstatfs64; #endif #ifdef _UM_MMAP wrapinfun wrap_in_mmap,wrap_in_mremap,wrap_in_munmap; #endif wrapinfun wrap_in_kill; wrapinfun wrap_in_getxid16; wrapinfun wrap_in_getxid,wrap_in_setuid,wrap_in_setreuid; wrapinfun wrap_in_getresuid, wrap_in_setresuid,wrap_in_setgid; wrapinfun wrap_in_getresgid, wrap_in_setresgid,wrap_in_setregid; wrapinfun wrap_in_nice, wrap_in_getpriority, wrap_in_setpriority; wrapinfun wrap_in_getpid, wrap_in_setpid, wrap_in_getpid_1, wrap_in_setpgid; wrapinfun wrap_in_getpgrp, wrap_in_setpgrp; wrapoutfun wrap_out_open, wrap_out_std, wrap_out_close, wrap_out_chdir; wrapoutfun wrap_out_dup, wrap_out_select, wrap_out_poll, wrap_out_fcntl; wrapoutfun wrap_out_execve; #ifdef _UM_MMAP wrapoutfun wrap_out_mmap,wrap_out_mremap,wrap_out_munmap; #endif wrapoutfun wrap_out_kill; wrapoutfun wrap_out_chroot; htfunt nchoice_fd, nchoice_sfd, nchoice_sc, nchoice_mount, nchoice_path, nchoice_link, nchoice_link2, nchoice_socket; htfunt nchoice_sockpath; htfunt nchoice_pathat, nchoice_linkat, nchoice_pl5at, nchoice_pl4at, nchoice_link3at; htfunt nchoice_link2at, nchoice_unlinkat; wrapfun nw_syspath_std,nw_syspath_stdnew,nw_syspath_std_1; wrapfun nw_sysfd_std,nw_sysfcntl; wrapfun nw_sysfdpath_std,nw_sockfd_std,nw_sysopen,nw_syslink,nw_syssymlink, nw_notsupp; wrapfun nw_sysdup,nw_sysclose; wrapfun nw_sysstatfs64,nw_sysfstatfs64; wrapfun nw_socket,nw_msocket,nw_accept; wrapfun nw_sysatpath_std,nw_sysatpath_stdnew,nw_sysstatat; wrapfun nw_sysreadv, nw_syswritev; wrapfun nw_syspreadv, nw_syspwritev; wrapfun nw_systruncate, nw_sysftruncate; wrapfun nw_syslseek, nw_sysllseek; wrapinfun wrap_in_socket, wrap_out_socket; wrapinfun wrap_in_bind_connect, wrap_in_listen, wrap_in_getsock, wrap_in_send; wrapinfun wrap_in_recv, wrap_in_shutdown, wrap_in_setsockopt, wrap_in_getsockopt; wrapinfun wrap_in_sendmsg, wrap_in_recvmsg, wrap_in_accept; wrapinfun wrap_in_msocket; wrapinfun wrap_in_sendto, wrap_in_recvfrom; wrapinfun wrap_in_umservice, wrap_out_umservice; wrapinfun wrap_in_time, wrap_in_gettimeofday, wrap_in_settimeofday; wrapinfun wrap_in_adjtimex, wrap_in_clock_gettime, wrap_in_clock_settime; wrapinfun wrap_in_clock_getres; wrapinfun wrap_in_uname, wrap_in_gethostname, wrap_in_sethostname; #ifdef _UM_EPOLL #ifndef __NR_epoll_create1 #define __NR_epoll_create1 __NR_epoll_create #endif wrapinfun wrap_in_epoll_create,wrap_in_epoll_ctl,wrap_in_epoll_wait; wrapoutfun wrap_out_epoll_create,wrap_out_epoll_ctl,wrap_out_epoll_wait; #endif /* we should keep this structure unique. the indexes can be used to forward * the call on a different computer.*/ #if (__NR_socketcall != __NR_doesnotexist) #define __NR_socket SYS_SOCKET #define __NR_bind SYS_BIND #define __NR_connect SYS_CONNECT #define __NR_listen SYS_LISTEN #define __NR_accept SYS_ACCEPT #ifdef SYS_ACCEPT4 #define __NR_accept4 SYS_ACCEPT4 #endif #define __NR_getsockname SYS_GETSOCKNAME #define __NR_getpeername SYS_GETPEERNAME #define __NR_socketpair SYS_SOCKETPAIR #define __NR_send SYS_SEND #define __NR_recv SYS_RECV #define __NR_sendto SYS_SENDTO #define __NR_recvfrom SYS_RECVFROM #define __NR_shutdown SYS_SHUTDOWN #define __NR_setsockopt SYS_SETSOCKOPT #define __NR_getsockopt SYS_GETSOCKOPT #define __NR_sendmsg SYS_SENDMSG #define __NR_recvmsg SYS_RECVMSG #endif #define __NR_msocket VIRSYS_MSOCKET #if defined(__powerpc__) #define AL64 1 #else #define AL64 0 #endif /* * SYSTEM CALL MAP, columns: * num of syscall (unistd.h) * choice function * wrap_in function * wrap out function * nested call choice function * nested call wrap function * flags * number of args * category of calls * * Care should be taken in order to leave the length of this table constant * for every architecture, and with the system calls in the same order. If a * system call does not appear in one or more architectures it is enough to * #define __NR_ __NR_doesnotexist in the corresponding * defs_*.h header. * */ struct sc_map scmap[]={ {__NR_doesnotexist, always_null, NULL, NULL,always_null,NULL,0,6,0}, {__NR_execve, choice_path, wrap_in_execve, wrap_out_execve,always_null, NULL, ALWAYS, PATH0 | 3, SOC_NONE}, {__NR_chdir, choice_path, wrap_in_chdir, wrap_out_chdir, always_null, NULL, ALWAYS, PATH0 | 1, SOC_FILE}, {__NR_fchdir, choice_fd, wrap_in_fchdir, wrap_out_chdir, always_null, NULL, ALWAYS, 1, SOC_FILE}, {__NR_getcwd, always_null, wrap_in_getcwd, wrap_out_std, always_null, NULL, ALWAYS, 2, SOC_NONE}, {__NR_open, choice_path, wrap_in_open, wrap_out_open, nchoice_path, nw_sysopen, ALWAYS, PATH0 | 3, SOC_FILE}, {__NR_creat, choice_path, wrap_in_open, wrap_out_open, nchoice_path, nw_sysopen, ALWAYS, PATH0 | 2, SOC_FILE}, {__NR_close, choice_fd, wrap_in_close, wrap_out_close, nchoice_fd, nw_sysclose, ALWAYS, 1, SOC_FILE|SOC_NET}, {__NR_select, always_null, wrap_in_select, wrap_out_select,always_null, NULL, ALWAYS, 5, SOC_FILE|SOC_NET}, {__NR_poll, always_null, wrap_in_poll, wrap_out_poll, always_null, NULL, ALWAYS, 3, SOC_FILE|SOC_NET}, {__NR__newselect,always_null, wrap_in_select, wrap_out_select,always_null, NULL, ALWAYS, 5, SOC_FILE|SOC_NET}, {__NR_pselect6, always_null, wrap_in_select, wrap_out_select,always_null, NULL, ALWAYS, 6, SOC_FILE|SOC_NET}, {__NR_ppoll, always_null, wrap_in_poll, wrap_out_poll, always_null, NULL, ALWAYS, 4, SOC_FILE|SOC_NET}, #ifdef _UM_EPOLL {__NR_epoll_create, always_null, wrap_in_epoll_create, wrap_out_epoll_create, always_null, NULL, ALWAYS, 1, SOC_FILE|SOC_NET}, {__NR_epoll_create1, always_null, wrap_in_epoll_create, wrap_out_epoll_create, always_null, NULL, ALWAYS, 1, SOC_FILE|SOC_NET}, {__NR_epoll_ctl, always_null, wrap_in_epoll_ctl, wrap_out_epoll_ctl, always_null, NULL, ALWAYS, 4, SOC_FILE|SOC_NET}, {__NR_epoll_wait, always_null, wrap_in_epoll_wait, wrap_out_epoll_wait, always_null, NULL, ALWAYS, 4, SOC_FILE|SOC_NET}, {__NR_epoll_pwait, always_null, wrap_in_epoll_wait, wrap_out_epoll_wait, always_null, NULL, ALWAYS, 5, SOC_FILE|SOC_NET}, #endif {__NR_umask, always_null, wrap_in_umask, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_FILE|SOC_NET}, {__NR_chroot, choice_path, wrap_in_chroot, wrap_out_chroot, always_null, NULL, ALWAYS, 1, SOC_FILE|SOC_NET}, {__NR_dup, choice_fd, wrap_in_dup, wrap_out_dup, nchoice_fd, nw_sysdup, ALWAYS, 1, SOC_FILE|SOC_NET}, {__NR_dup2, choice_fd, wrap_in_dup, wrap_out_dup, nchoice_fd, nw_sysdup, ALWAYS, 2, SOC_FILE|SOC_NET}, {__NR_dup3, choice_fd, wrap_in_dup, wrap_out_dup, nchoice_fd, nw_sysdup, ALWAYS, 3, SOC_FILE|SOC_NET}, {__NR_mount, choice_mount, wrap_in_mount, wrap_out_std, always_null, NULL, 0, 5, SOC_FILE}, {__NR_umount, choice_path_exact, wrap_in_umount, wrap_out_std, always_null, NULL, 0, PATH0 | 1, SOC_FILE}, {__NR_umount2, choice_path_exact, wrap_in_umount2,wrap_out_std, always_null, NULL, 0, PATH0 | 2, SOC_FILE}, {__NR_ioctl, choice_fd, wrap_in_ioctl, wrap_out_std, nchoice_fd, nw_sysfd_std, 0, 3, SOC_FILE}, {__NR_read, choice_fd, wrap_in_read, wrap_out_std, nchoice_fd, nw_sysfd_std, CB_R, 3, SOC_FILE|SOC_NET}, {__NR_write, choice_fd, wrap_in_write, wrap_out_std, nchoice_fd, nw_sysfd_std, 0, 3, SOC_FILE|SOC_NET}, {__NR_readv, choice_fd, wrap_in_readv, wrap_out_std, nchoice_fd, nw_sysreadv, CB_R, 3, SOC_FILE|SOC_NET}, {__NR_writev, choice_fd, wrap_in_writev, wrap_out_std, nchoice_fd, nw_syswritev, 0, 3, SOC_FILE|SOC_NET}, {__NR_stat, choice_path, wrap_in_stat, wrap_out_std, nchoice_path, nw_syspath_std_1, 0, PATH0 | 2, SOC_FILE|SOC_NET}, {__NR_lstat, choice_link, wrap_in_stat, wrap_out_std, nchoice_link, nw_syspath_std_1, 0, PATH0 | 2, SOC_FILE|SOC_NET}, {__NR_fstat, choice_fd, wrap_in_fstat, wrap_out_std, nchoice_fd, nw_sysfdpath_std, 0, 2, SOC_FILE|SOC_NET}, {__NR_stat64, choice_path, wrap_in_stat64, wrap_out_std, nchoice_path, nw_syspath_std_1, 0, PATH0 | 2, SOC_FILE|SOC_NET}, {__NR_lstat64, choice_link, wrap_in_stat64, wrap_out_std, nchoice_link, nw_syspath_std_1, 0, PATH0 | 2, SOC_FILE|SOC_NET}, {__NR_fstat64, choice_fd, wrap_in_fstat64,wrap_out_std, nchoice_fd, nw_sysfdpath_std, 0, 2, SOC_FILE|SOC_NET}, {__NR_chown, choice_path, wrap_in_chown, wrap_out_std, nchoice_path, nw_syspath_std_1, 0, PATH0 | 3, SOC_FILE|SOC_UID}, {__NR_lchown, choice_link, wrap_in_chown, wrap_out_std, nchoice_link, nw_syspath_std_1, 0, PATH0 | 3, SOC_FILE|SOC_UID}, {__NR_fchown, choice_fd, wrap_in_fchown, wrap_out_std, nchoice_fd, nw_sysfdpath_std, 0, 3, SOC_FILE|SOC_UID}, {__NR_chown32, choice_path, wrap_in_chown, wrap_out_std, nchoice_path, nw_syspath_std_1, 0, PATH0 | 3, SOC_FILE|SOC_UID}, {__NR_lchown32, choice_link, wrap_in_chown, wrap_out_std, nchoice_link, nw_syspath_std_1, 0, PATH0 | 3, SOC_FILE|SOC_UID}, {__NR_fchown32, choice_fd, wrap_in_fchown, wrap_out_std, nchoice_fd, nw_sysfdpath_std, 0, 3, SOC_FILE|SOC_UID}, {__NR_chmod, choice_path, wrap_in_chmod, wrap_out_std, nchoice_path, nw_syspath_std_1, 0, PATH0 | 2, SOC_FILE}, {__NR_fchmod, choice_fd, wrap_in_fchmod, wrap_out_std, nchoice_fd, nw_sysfdpath_std, 0, 2, SOC_FILE}, {__NR_readlink, choice_link, wrap_in_readlink,wrap_out_std, nchoice_link, nw_syspath_std, 0, PATH0 | 3, SOC_FILE}, {__NR_getdents, choice_fd, wrap_in_getdents,wrap_out_std, nchoice_fd, nw_sysfd_std, 0, 3, SOC_FILE}, {__NR_getdents64,choice_fd, wrap_in_getdents64,wrap_out_std, nchoice_fd, nw_sysfd_std, 0, 3, SOC_FILE}, {__NR_access, choice_path, wrap_in_access, wrap_out_std, nchoice_path, nw_syspath_std, 0, PATH0 | 2, SOC_FILE}, {__NR_fcntl, choice_fd, wrap_in_fcntl, wrap_out_fcntl, nchoice_fd, nw_sysfcntl, 0, 3, SOC_FILE}, {__NR_fcntl64, choice_fd, wrap_in_fcntl, wrap_out_fcntl, nchoice_fd, nw_sysfcntl, 0, 3, SOC_FILE}, #if (__NR__llseek == __NR_doesnotexist) {__NR_lseek, choice_fd, wrap_in_lseek, wrap_out_std, nchoice_fd, nw_sysfd_std, 0, 3, SOC_FILE}, {__NR__llseek, always_null, NULL, NULL,always_null,NULL,0,6,0}, #else {__NR_lseek, choice_fd, wrap_in_lseek, wrap_out_std, nchoice_fd, nw_syslseek, 0, 3, SOC_FILE}, {__NR__llseek, choice_fd, wrap_in_llseek, wrap_out_std, nchoice_fd, nw_sysllseek, 0, 5, SOC_FILE}, #endif {__NR_mkdir, choice_link, wrap_in_mkdir, wrap_out_std, nchoice_link, nw_syspath_stdnew, 0, PATH0 | 2, SOC_FILE}, {__NR_rmdir, choice_path, wrap_in_unlink, wrap_out_std, nchoice_path, nw_syspath_std, 0, PATH0 | 1, SOC_FILE}, {__NR_link, choice_link2, wrap_in_link, wrap_out_std, nchoice_link2, nw_syslink, 0, PATH1 | 2, SOC_FILE}, {__NR_symlink, choice_link2, wrap_in_symlink, wrap_out_std, nchoice_link2, nw_syssymlink, 0, PATH1 | 2, SOC_FILE}, {__NR_rename, choice_link2, wrap_in_link, wrap_out_std, nchoice_link2, nw_syslink, 0, PATH1 | 2, SOC_FILE}, {__NR_unlink, choice_link, wrap_in_unlink, wrap_out_std, nchoice_link, nw_syspath_std, 0, PATH0 | 1, SOC_FILE}, {__NR_statfs, choice_path, wrap_in_statfs, wrap_out_std, nchoice_path, nw_syspath_std, 0, PATH0 | 2, SOC_FILE}, {__NR_fstatfs, choice_fd, wrap_in_fstatfs, wrap_out_std, nchoice_fd, nw_sysfdpath_std, 0, 2, SOC_FILE}, {__NR_statfs64, choice_path, wrap_in_statfs64, wrap_out_std, nchoice_path, nw_sysstatfs64, 0, PATH0 | 3, SOC_FILE}, {__NR_fstatfs64,choice_fd, wrap_in_fstat64, wrap_out_std, nchoice_fd, nw_sysfstatfs64, 0, 3, SOC_FILE}, {__NR_utime, choice_path, wrap_in_utime, wrap_out_std, nchoice_path, nw_syspath_std, 0, PATH0 | 2, SOC_FILE|SOC_TIME}, {__NR_utimes, choice_path, wrap_in_utime, wrap_out_std, nchoice_path, nw_syspath_std, 0, PATH0 | 2, SOC_FILE|SOC_TIME}, {__NR_fsync, choice_fd, wrap_in_fsync, wrap_out_std, nchoice_fd, nw_sysfd_std, 0, 1, SOC_FILE}, {__NR_fdatasync,choice_fd, wrap_in_fsync, wrap_out_std, nchoice_fd, nw_sysfd_std, 0, 1, SOC_FILE}, {__NR_truncate, choice_path, wrap_in_truncate, wrap_out_std, nchoice_path, nw_systruncate, 0, PATH0 | 2, SOC_FILE}, {__NR_ftruncate,choice_fd, wrap_in_ftruncate, wrap_out_std, nchoice_fd, nw_sysftruncate, 0, 2, SOC_FILE}, {__NR_truncate64,choice_path, wrap_in_truncate, wrap_out_std, nchoice_path, nw_systruncate, 0, PATH0 | (AL64+3), SOC_FILE}, {__NR_ftruncate64,choice_fd, wrap_in_ftruncate, wrap_out_std, nchoice_fd, nw_sysftruncate, 0, AL64+3, SOC_FILE}, #ifdef __NR_pread64 {__NR_pread64, choice_fd, wrap_in_pread, wrap_out_std, nchoice_fd, nw_sysfd_std, 0, AL64+5, SOC_FILE}, #else {__NR_pread, choice_fd, wrap_in_pread, wrap_out_std, nchoice_fd, nw_sysfd_std, 0, 4, SOC_FILE}, #endif #ifdef __NR_pwrite64 {__NR_pwrite64, choice_fd, wrap_in_pwrite, wrap_out_std, nchoice_fd, nw_sysfd_std, 0, AL64+5, SOC_FILE}, #else {__NR_pwrite, choice_fd, wrap_in_pwrite, wrap_out_std, nchoice_fd, nw_sysfd_std, 0, 4, SOC_FILE}, #endif #ifdef __NR_pread64 {__NR_preadv, choice_fd, wrap_in_preadv, wrap_out_std, nchoice_fd, nw_syspreadv, 0, AL64+5, SOC_FILE}, #else {__NR_preadv, choice_fd, wrap_in_preadv, wrap_out_std, nchoice_fd, nw_syspreadv, 0, 4, SOC_FILE}, #endif #ifdef __NR_pwrite64 {__NR_pwritev, choice_fd, wrap_in_pwritev, wrap_out_std, nchoice_fd, nw_syspwritev, 0, AL64+5, SOC_FILE}, #else {__NR_pwritev, choice_fd, wrap_in_pwritev, wrap_out_std, nchoice_fd, nw_syspwritev, 0, 4, SOC_FILE}, #endif {__NR_mknod, choice_link, wrap_in_mknod, wrap_out_std, nchoice_link, nw_syspath_stdnew, 0, PATH0 | 3, SOC_FILE}, {__NR_openat, choice_pathat, wrap_in_open, wrap_out_open, nchoice_pathat, nw_sysopen, ALWAYS, PATH1 | 4, SOC_FILE}, {__NR_mkdirat, choice_linkat, wrap_in_mkdir, wrap_out_std, nchoice_linkat, nw_sysatpath_stdnew, 0, PATH1 | 3, SOC_FILE}, {__NR_mknodat, choice_linkat, wrap_in_mknod, wrap_out_std, nchoice_linkat, nw_sysatpath_stdnew, 0, PATH1 | 4, SOC_FILE}, {__NR_fchownat, choice_pl5at, wrap_in_chown, wrap_out_std, nchoice_pl5at, nw_sysatpath_std, 0, PATH1 | 5, SOC_FILE}, {__NR_futimesat, choice_pathat, wrap_in_utime, wrap_out_std, nchoice_pathat, nw_sysatpath_std, 0, PATH1 | 3, SOC_FILE}, #ifdef __NR_newfstatat /* 64 bit */ {__NR_newfstatat, choice_pl4at, wrap_in_stat64, wrap_out_std, nchoice_pl4at, nw_sysstatat, 0, PATH1 | 4, SOC_FILE}, #else {__NR_fstatat64, choice_pl4at, wrap_in_stat64, wrap_out_std, nchoice_pl4at, nw_sysstatat, 0, PATH1 | 4, SOC_FILE}, #endif {__NR_unlinkat, choice_unlinkat, wrap_in_unlink, wrap_out_std, nchoice_unlinkat, nw_sysatpath_std, 0, PATH1 | 3, SOC_FILE}, {__NR_renameat, choice_link3at, wrap_in_link, wrap_out_std, nchoice_link3at, nw_syslink, 0, PATH3 | 4, SOC_FILE}, {__NR_linkat, choice_link3at, wrap_in_link, wrap_out_std, nchoice_link3at, nw_syslink, 0, PATH3 | 5, SOC_FILE}, {__NR_symlinkat, choice_link2at, wrap_in_symlink, wrap_out_std, nchoice_link2at, nw_syssymlink, 0, PATH2 | 3, SOC_FILE}, {__NR_readlinkat, choice_linkat, wrap_in_readlink, wrap_out_std, nchoice_linkat, nw_sysatpath_std, 0, PATH1 | 4, SOC_FILE}, {__NR_fchmodat, choice_pl4at, wrap_in_chmod, wrap_out_std, nchoice_pl4at, nw_sysatpath_std, 0, PATH1 | 4, SOC_FILE}, {__NR_faccessat, choice_pl4at, wrap_in_access, wrap_out_std, nchoice_pl4at, nw_sysatpath_std, 0, PATH1 | 4, SOC_FILE}, {__NR_utimensat, choice_utimensat, wrap_in_utime, wrap_out_std, nchoice_pl4at, nw_sysatpath_std, 0, PATH1 | 4, SOC_FILE}, /* ATTR */ {__NR_getxattr, choice_path, wrap_in_getxattr, wrap_out_std, nchoice_path, nw_syspath_std_1, 0, PATH0 | 4, SOC_FILE}, {__NR_lgetxattr,choice_link, wrap_in_getxattr, wrap_out_std, nchoice_link, nw_syspath_std_1, 0, PATH0 | 4, SOC_FILE}, {__NR_fgetxattr,choice_fd, wrap_in_fgetxattr, wrap_out_std, nchoice_fd, nw_sysfdpath_std, 0, 4, SOC_FILE}, {__NR_setxattr, choice_path, wrap_in_setxattr, wrap_out_std, nchoice_path, nw_syspath_std_1, 0, PATH0 | 5, SOC_FILE}, {__NR_lsetxattr,choice_link, wrap_in_setxattr, wrap_out_std, nchoice_link, nw_syspath_std_1, 0, PATH0 | 5, SOC_FILE}, {__NR_fsetxattr,choice_fd, wrap_in_fsetxattr, wrap_out_std, nchoice_fd, nw_sysfdpath_std, 0, 5, SOC_FILE}, {__NR_listxattr,choice_path, wrap_in_listxattr, wrap_out_std, nchoice_path, nw_syspath_std_1, 0, PATH0 | 3, SOC_FILE}, {__NR_llistxattr,choice_link, wrap_in_listxattr, wrap_out_std, nchoice_link, nw_syspath_std_1, 0, PATH0 | 3, SOC_FILE}, {__NR_flistxattr,choice_fd, wrap_in_flistxattr, wrap_out_std, nchoice_fd, nw_sysfdpath_std, 0, 3, SOC_FILE}, {__NR_removexattr,choice_path, wrap_in_removexattr, wrap_out_std, nchoice_path, nw_syspath_std_1, 0, PATH0 | 2, SOC_FILE}, {__NR_lremovexattr,choice_link, wrap_in_removexattr, wrap_out_std, nchoice_link, nw_syspath_std_1, 0, PATH0 | 2, SOC_FILE}, {__NR_fremovexattr,choice_fd, wrap_in_fremovexattr, wrap_out_std, nchoice_fd, nw_sysfdpath_std, 0, 2, SOC_FILE}, #ifdef _UM_MMAP /* MMAP management */ {__NR_mmap, choice_mmap, wrap_in_mmap, wrap_out_mmap, always_null, NULL, 0, 6, SOC_MMAP}, {__NR_mmap2, choice_mmap, wrap_in_mmap, wrap_out_mmap, always_null, NULL, 0, 6, SOC_MMAP}, {__NR_munmap, always_null, wrap_in_munmap, wrap_out_munmap,always_null, NULL, ALWAYS, 2, SOC_MMAP}, {__NR_mremap, always_null, wrap_in_mremap, wrap_out_mremap,always_null, NULL, ALWAYS, 4, SOC_MMAP}, #endif /* time related calls */ {__NR_time, choice_sc, wrap_in_time, wrap_out_std, always_null, NULL, 0, 1, SOC_TIME}, {__NR_gettimeofday, choice_sc, wrap_in_gettimeofday, wrap_out_std, always_null, NULL, 0, 2, SOC_TIME}, {__NR_settimeofday, choice_sc, wrap_in_settimeofday, wrap_out_std, always_null, NULL, 0, 2, SOC_TIME}, {__NR_adjtimex, choice_sc, wrap_in_adjtimex, wrap_out_std, always_null, NULL, 0, 1, SOC_TIME}, {__NR_clock_gettime, choice_sc, wrap_in_clock_gettime, wrap_out_std, always_null, NULL, 0, 2, SOC_TIME}, {__NR_clock_settime, choice_sc, wrap_in_clock_settime, wrap_out_std, always_null, NULL, 0, 2, SOC_TIME}, {__NR_clock_getres, choice_sc, wrap_in_clock_getres, wrap_out_std, always_null, NULL, 0, 2, SOC_TIME}, /* host id */ {__NR_oldolduname, choice_sc, wrap_in_uname, wrap_out_std, always_null, NULL, 0, 1, SOC_HOSTID}, {__NR_olduname, choice_sc, wrap_in_uname, wrap_out_std, always_null, NULL, 0, 1, SOC_HOSTID}, {__NR_uname, choice_sc, wrap_in_uname, wrap_out_std, always_null, NULL, 0, 1, SOC_HOSTID}, {__NR_gethostname, choice_sc, wrap_in_gethostname, wrap_out_std, always_null, NULL, 0, 2, SOC_HOSTID}, {__NR_sethostname, choice_sc, wrap_in_sethostname, wrap_out_std, always_null, NULL, 0, 2, SOC_HOSTID}, {__NR_getdomainname, choice_sc, wrap_in_gethostname, wrap_out_std, always_null, NULL, 0, 2, SOC_HOSTID}, {__NR_setdomainname, choice_sc, wrap_in_sethostname, wrap_out_std, always_null, NULL, 0, 2, SOC_HOSTID}, /* user mgmt calls */ {__NR_getuid, choice_sc, wrap_in_getxid16, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setuid, choice_sc, wrap_in_setuid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_geteuid, choice_sc, wrap_in_getxid16, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setfsuid, choice_sc, wrap_in_setuid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setreuid, choice_sc, wrap_in_setreuid, wrap_out_std, always_null, NULL, ALWAYS, 2, SOC_UID}, {__NR_getresuid, choice_sc, wrap_in_getresuid, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, {__NR_setresuid, choice_sc, wrap_in_setresuid, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, {__NR_getgid, choice_sc, wrap_in_getxid16, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setgid, choice_sc, wrap_in_setgid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_getegid, choice_sc, wrap_in_getxid16, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setfsgid, choice_sc, wrap_in_setgid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setregid, choice_sc, wrap_in_setregid, wrap_out_std, always_null, NULL, ALWAYS, 2, SOC_UID}, {__NR_getresgid, choice_sc, wrap_in_getresgid, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, {__NR_setresgid, choice_sc, wrap_in_setresgid, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, {__NR_getgroups, choice_sc, wrap_in_getgroups, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, {__NR_setgroups, choice_sc, wrap_in_setgroups, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, {__NR_getuid32, choice_sc, wrap_in_getxid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setuid32, choice_sc, wrap_in_setuid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_geteuid32, choice_sc, wrap_in_getxid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setfsuid32, choice_sc, wrap_in_setuid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setreuid32, choice_sc, wrap_in_setreuid, wrap_out_std, always_null, NULL, ALWAYS, 2, SOC_UID}, {__NR_getresuid32, choice_sc, wrap_in_getresuid, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, {__NR_setresuid32, choice_sc, wrap_in_setresuid, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, {__NR_getgid32, choice_sc, wrap_in_getxid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setgid32, choice_sc, wrap_in_setgid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_getegid32, choice_sc, wrap_in_getxid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setfsgid32, choice_sc, wrap_in_setgid, wrap_out_std, always_null, NULL, ALWAYS, 1, SOC_UID}, {__NR_setregid32, choice_sc, wrap_in_setregid, wrap_out_std, always_null, NULL, ALWAYS, 2, SOC_UID}, {__NR_getresgid32, choice_sc, wrap_in_getresgid, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, {__NR_setresgid32, choice_sc, wrap_in_setresgid, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, {__NR_getgroups32, choice_sc, wrap_in_getgroups, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, {__NR_setgroups32, choice_sc, wrap_in_setgroups, wrap_out_std, always_null, NULL, ALWAYS, 3, SOC_UID}, /* priority related calls */ {__NR_nice, choice_sc, wrap_in_nice, wrap_out_std, always_null, NULL, 0, 1, SOC_PRIO}, {__NR_getpriority, choice_sc, wrap_in_getpriority, wrap_out_std, always_null, NULL, 0, 2, SOC_PRIO}, {__NR_setpriority, choice_sc, wrap_in_setpriority, wrap_out_std, always_null, NULL, 0, 3, SOC_PRIO}, /* process id related */ {__NR_getpid, choice_sc, wrap_in_getpid, wrap_out_std, always_null, NULL, 0, 0, SOC_PID}, {__NR_getppid, choice_sc, wrap_in_getpid, wrap_out_std, always_null, NULL, 0, 0, SOC_PID}, {__NR_getpgrp, choice_sc, wrap_in_getpgrp, wrap_out_std, always_null, NULL, 0, 0, SOC_PID}, {__NR_setpgrp, choice_sc, wrap_in_setpgrp, wrap_out_std, always_null, NULL, 0, 0, SOC_PID}, {__NR_getpgid, choice_sc, wrap_in_getpid_1, wrap_out_std, always_null, NULL, 0, 1, SOC_PID}, {__NR_setpgid, choice_sc, wrap_in_setpgid, wrap_out_std, always_null, NULL, 0, 2, SOC_PID}, {__NR_getsid, choice_sc, wrap_in_getpid_1, wrap_out_std, always_null, NULL, 0, 1, SOC_PID}, {__NR_setsid, choice_sc, wrap_in_setpid, wrap_out_std, always_null, NULL, 0, 0, SOC_PID}, #ifdef VIEW_CAPABILITY {__NR_capget, choice_sc, wrap_in_capget, wrap_out_std, always_null, NULL, 0, 0, 0}, {__NR_capset, choice_sc, wrap_in_capset, wrap_out_std, always_null, NULL, 0, 0, 0}, #endif #if 0 {__NR_sysctl, choice_sysctl, wrap_in_sysctl, wrap_out_sysctl, always_null, NULL, 0, 2, 0} /* this is a trip */ {__NR_ptrace, always_null, wrap_in_ptrace, wrap_out_ptrace, always_null, NULL, 0, 4, 0} #endif /* signal management for unblocking processes */ {__NR_kill, always_null, wrap_in_kill, wrap_out_kill, always_null, NULL, ALWAYS, 4, SOC_SIGNAL}, /* When socketcall does not exist it means that all the socket system calls * are normal syscall, thus the tables must be merged together */ #if (__NR_socketcall != __NR_doesnotexist) }; struct sc_map sockmap[]={ /* 0*/ {__NR_doesnotexist, always_null, NULL, NULL, always_null, NULL, 0, 0, SOC_NET}, #endif /* 1*/ {__NR_socket, choice_socket, wrap_in_socket, wrap_out_socket,nchoice_socket, nw_socket, 0, 3, SOC_SOCKET|SOC_NET}, /* 2*/ {__NR_bind, choice_fd, wrap_in_bind_connect, wrap_out_std, nchoice_sfd, nw_sockfd_std, 0, 3, SOC_SOCKET|SOC_NET}, /* 3*/ {__NR_connect, choice_fd, wrap_in_bind_connect, wrap_out_std, nchoice_sfd, nw_sockfd_std, 0, 3, SOC_SOCKET|SOC_NET}, /* 4*/ {__NR_listen, choice_fd, wrap_in_listen, wrap_out_std, nchoice_sfd, nw_sockfd_std, 0, 2, SOC_SOCKET|SOC_NET}, /* 5*/ {__NR_accept, choice_fd, wrap_in_accept, wrap_out_socket,nchoice_sfd, nw_accept, CB_R, 3, SOC_SOCKET|SOC_NET}, /* 6*/ {__NR_getsockname,choice_fd, wrap_in_getsock, wrap_out_std, nchoice_sfd, nw_sockfd_std, 0, 3, SOC_SOCKET|SOC_NET}, /* 7*/ {__NR_getpeername,choice_fd, wrap_in_getsock, wrap_out_std, nchoice_sfd, nw_sockfd_std, 0, 3, SOC_SOCKET|SOC_NET}, /* 8*/ {__NR_socketpair,always_null, NULL, NULL, always_null, NULL, 0, 4, SOC_SOCKET|SOC_NET}, /* not used */ /* 9*/ {__NR_send, choice_fd, wrap_in_send, wrap_out_std, nchoice_sfd, nw_sockfd_std, 0, 4, SOC_SOCKET|SOC_NET}, /*10*/ {__NR_recv, choice_fd, wrap_in_recv, wrap_out_std, nchoice_sfd, nw_sockfd_std, CB_R, 4, SOC_SOCKET|SOC_NET}, /*11*/ {__NR_sendto, choice_fd, wrap_in_sendto, wrap_out_std, nchoice_sfd, nw_sockfd_std, 0, 6, SOC_SOCKET|SOC_NET}, /*12*/ {__NR_recvfrom, choice_fd, wrap_in_recvfrom, wrap_out_std, nchoice_sfd, nw_sockfd_std, CB_R, 6, SOC_SOCKET|SOC_NET}, /*13*/ {__NR_shutdown, choice_fd, wrap_in_shutdown, wrap_out_std, nchoice_sfd, nw_sockfd_std, 0, 2, SOC_SOCKET|SOC_NET}, /*14*/ {__NR_setsockopt,choice_fd, wrap_in_setsockopt, wrap_out_std, nchoice_sfd, nw_sockfd_std, 0, 5, SOC_SOCKET|SOC_NET}, /*15*/ {__NR_getsockopt,choice_fd, wrap_in_getsockopt, wrap_out_std, nchoice_sfd, nw_sockfd_std, 0, 5, SOC_SOCKET|SOC_NET}, /*16*/ {__NR_sendmsg, choice_fd, wrap_in_sendmsg, wrap_out_std, nchoice_sfd, nw_sockfd_std, 0, 3, SOC_SOCKET|SOC_NET}, /*17*/ {__NR_recvmsg, choice_fd, wrap_in_recvmsg, wrap_out_std, nchoice_sfd, nw_sockfd_std, CB_R, 3, SOC_SOCKET|SOC_NET}, #ifdef __NR_accept4 /*18*/ {__NR_accept4, choice_fd, wrap_in_accept, wrap_out_socket, nchoice_sfd, nw_accept, CB_R, 4, SOC_SOCKET|SOC_NET}, #endif }; /* fake sockmap when socket system calls are normal syscalls */ #if (__NR_socketcall == __NR_doesnotexist) struct sc_map sockmap[]={ {__NR_doesnotexist, always_null, NULL, NULL, always_null, NULL, 0, 0, SOC_NET}, }; #endif #ifdef OLDVIRSC /* virtual system calls, emulated on sysctl with name==NULL, * nlen is the number of call * oldval, oldlenp unused * newval is the args array * newlen is the number of arguments (NOT bytes, number of "long" args) * when name != NULL the entry 0 is used thus sysctl could be virtualized */ #else /* virtual system calls, emulated on pivot_root with newroot==NULL, 4 args: NULL, the number of virtual syscall, the number orf args, the address of the arg array (max 6 long ints) */ #endif struct sc_map virscmap[]={ {__NR_doesnotexist, always_null, NULL, NULL, always_null, NULL, 0, 0, 0}, {VIRSYS_UMSERVICE, always_null, wrap_in_umservice, wrap_out_umservice, always_null, NULL, ALWAYS, 1, SOC_NONE}, {VIRSYS_MSOCKET, choice_sockpath, wrap_in_msocket, wrap_out_socket,nchoice_sockpath, nw_msocket, ALWAYS|NALWAYS, 4, SOC_SOCKET|SOC_NET}, }; #define SIZESCMAP (sizeof(scmap)/sizeof(struct sc_map)) #define SIZESOCKMAP (sizeof(sockmap)/sizeof(struct sc_map)) #define SIZEVIRSCMAP (sizeof(virscmap)/sizeof(struct sc_map)) /* unistd syscall number -> scmap table index conversion */ static short scremap[_UM_NR_syscalls]; void init_scmap() { register int i; /* initialize the scremap table */ for (i=0; i=0) scremap[scno]=i; } /* these global variables can be read from (dynamically loaded) * modules */ scmap_scmapsize = SIZESCMAP; scmap_sockmapsize = SIZESOCKMAP; scmap_virscmapsize = SIZEVIRSCMAP; } /* unistd number to scmap index remap, 0 if non-existent */ int uscno(int scno) { if (scno >= 0 && scno < _UM_NR_syscalls) return scremap[scno]; else return 0; } // vim: ts=8 umview-0.8.2/xmview/umproc.c0000644000175000017500000005640511753517211015116 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_proc.c: process file table and fake files mgmt * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Mattia Belletti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: umproc.c 968 2011-08-03 10:16:26Z rd235 $ * */ /* FILE management: * there are three different "file descriptors" * fd -> file descriptors seen by the processes * lfd -> local file descriptors fd of umview itself * sfd -> service fd, fd as seen by the service modules. * The three set are independent, sfd can be numbers created by modules, * meaningless for umview, umview should just keep the mapping between * fd, lfd and sfd */ #include #include #include #include #include #include #include #include #include #include #include "treepoch.h" #include "sctab.h" #include "umproc.h" #include "scmap.h" #include "defs.h" #include "hashtab.h" #include "gdebug.h" #define FAKECWD "fakecwd" /* management of FD flags stored in lfdlist * MST = invalid (usually closed fd are set to -1) i.e. <0 means invalid * MST-1 = FD_CLOEXEC * (for now there are no more flags, in case add here, provided the * space for fd is large enough) * Lower bits: lfd; */ #define X_FD_FLAGS 0xc0000000 #define X_FD_INVALID 0x80000000 #define X_FD_CLOEXEC 0x40000000 #define X_FD_NBITS 30 #define FD2LFD(p,fd) (((p)->lfdlist[(fd)]) & ~X_FD_FLAGS) #define FD2FDFLAGS(p,fd) (((p)->lfdlist[(fd)]) >> X_FD_NBITS) static char *um_proc_root; static char *um_tmpfile; static char *um_tmpfile_tail; static int um_tmpfile_len; #ifdef _UM_MMAP int um_mmap_secret; int um_mmap_pageshift; #define MMAP_SECRET_FD 1023 #endif struct lfd_vtable; #ifdef _UM_EPOLL #include struct lfd_epoll; #endif struct lfd_table { short count; /*how many pcbs have opened this lfd - look at dup implementation */ struct ht_elem *hte; /*the hash table element */ int sfd; /* the fd as seen from the service */ int flags; /*open flags*/ char *path; /* the real path */ epoch_t epoch; struct lfd_vtable *pvtab; #ifdef _UM_EPOLL struct lfd_epoll *epoll; #endif }; struct lfd_vtable { int signaled; /* set when there some data on the fifo, telling that some blocking call have to be unblocked, not yet read - a flag */ char *filename; /* the fifo */ int ififo,ofifo; }; #ifdef _UM_EPOLL #define UM_EPOLL_STEP 3 struct lfd_epoll { int ep_n; struct lfd_epoll_item *ep_list[UM_EPOLL_STEP]; }; #endif static int lfd_tabmax=0; static struct lfd_table **lfd_tab=NULL; #define O1LFD #ifndef O1LFD /* look for a free local file descriptor */ static int lfd_alloc(void) { int lfd; for (lfd=0; lfd= lfd_tabmax) { int i=lfd_tabmax; //printk("lfd_tab realloc oldndf %d\n",lfd_tabmax); lfd_tabmax = (lfd + OLFD_STEP) & ~OLFD_STEP_1; //printk("lfd_tab realloc newnfd %d\n",lfd_tabmax); lfd_tab=(struct lfd_table **) realloc (lfd_tab, (lfd_tabmax * sizeof (struct lfd_table *))); assert (lfd_tab); /* Clean the new entries in lfd_tab or lfd_cleanall will not work properly */ for (;i < lfd_tabmax;i++) { lfd_tab[i]=NULL; } } assert(lfd_tab[lfd] == NULL); lfd_tab[lfd] = (struct lfd_table *)malloc (sizeof(struct lfd_table)); assert(lfd_tab[lfd] != NULL); return lfd; } static inline void lfd_free(int lfd) { free(lfd_tab[lfd]); lfd_tab[lfd]=NULL; } static inline void lfd_forall(void (*f)(int lfd,void *arg),void *arg) { register int lfd; for (lfd=0; lfd=0) { rv=lfd_tabfree; lfd_tabfree=(long)(lfd_tab[rv]); } else { rv=lfd_tabmax++; if (rv>=lfd_tabsize) { lfd_tabsize=(rv + OLFD_STEP) & ~OLFD_STEP_1; lfd_tab=realloc(lfd_tab,lfd_tabsize* sizeof(void *)); assert(lfd_tab); } } lfd_tab[rv]=malloc(sizeof(struct lfd_table)); assert(lfd_tab[rv]); //pthread_mutex_unlock( &lfd_tab_mutex ); return rv; } void lfd_free(int lfd) { free(lfd_tab[lfd]); //pthread_mutex_lock( &lfd_tab_mutex ); /* unused elements get linked together by using the pointers as the index of the next unused element */ lfd_tab[lfd]=(void *)lfd_tabfree; lfd_tabfree=lfd; //pthread_mutex_unlock( &lfd_tab_mutex ); } static inline void lfd_forall(void (*f)(int lfd,void *arg),void *arg) { int lfd; //pthread_mutex_lock( &lfd_tab_mutex ); /* the unused elements list gets deleted and recreated */ while (lfd_tabfree>=0) { lfd=lfd_tabfree; lfd_tabfree=(long)(lfd_tab[lfd]); lfd_tab[lfd]=NULL; } for (lfd=0; lfd=0) { lfd=lfd_tabfree; lfd_tabfree=(long)(lfd_tab[lfd]); lfd_tab[lfd]=NULL; } for (lfd=0; lfd=0) { r_close(um_mmap_secret); um_mmap_secret = MMAP_SECRET_FD; } #endif /* compute the pageshift value (log2(pagesize)) */ pagesize = sysconf(_SC_PAGESIZE); for (um_mmap_pageshift = -1;pagesize > 0; um_mmap_pageshift++, pagesize >>= 1) ; #else strcat(path,"/lfd.xxXXXXX"); #endif /* set the um_tmpfile variable, it is used to (quickly) create * tmp file names. The tail is overwritten each time */ um_tmpfile=strdup(path); strcpy(um_tmpfile,path); um_tmpfile_tail=um_tmpfile+(strlen(path)-7); um_tmpfile_len=strlen(um_tmpfile); strcpy(um_tmpfile_tail,FAKECWD); if(r_mkdir(um_tmpfile,0700) < 0) { perror("um_proc mkdir"); exit (-1); } } /* final cleanup: all the directory is deleted (something like rm -rf) */ static void rec_rm_all(char *name) { int fd; fd = r_open(name,O_RDONLY | O_DIRECTORY,0); if (fd > 0) { char buf[1024]; int size=0; int pos; struct dirent64 *this; while ((size=r_getdents64(fd,buf,1023))>0) { for (pos=0, this=(struct dirent64 *)buf; posd_reclen, this=(struct dirent64 *)(&(buf[pos]))) { if (strcmp(this->d_name,".") != 0 && strcmp(this->d_name,"..") != 0) { char *path; asprintf(&path,"%s/%s",name,this->d_name); if (this->d_type == DT_DIR) rec_rm_all(path); else r_unlink(path); free(path); } } } r_close(fd); r_rmdir(name); } } /* um_proc destructor: all the files get closed and the dir removed */ void um_proc_close() { /* printk("um_proc_close %s\n",um_proc_root);*/ lfd_closeall(); rec_rm_all(um_proc_root); } char *um_proc_fakecwd() { strcpy(um_tmpfile_tail,FAKECWD); return um_tmpfile; } /* create a temporary file name, unique names are guaranteed by using * service name+lfd index in the name */ static char *um_proc_tmpfile(struct ht_elem *hte, int lfd) { snprintf(um_tmpfile_tail,um_tmpfile_len,"%s%02d",ht_get_servicename(hte),lfd); //printk("um_proc_tmpfile %s\n",um_tmpfile); return um_tmpfile; } /* create a temporary file name, unique names are guaranteed by using * a counter */ #define NMAX 1000000 char *um_proc_tmpname() { static int n; n = (n+1) % NMAX; snprintf(um_tmpfile_tail,um_tmpfile_len,"%06d",n); //printk("um_proc_tmpname %s\n",um_tmpfile); return um_tmpfile; } /* set up the umproc data structure needed by a new process */ void umproc_addproc(struct pcb *pc,int flags,int npcbflag) { //printk("umproc_addproc %d %x %x %d\n", npcbflag, flags, pc->pp, pc->pp->fds); //if (pc) //printk("umproc_addproc %d(%d) %d %x\n", pc->pid, (pc->pp)?pc->pp->pid:0, npcbflag, flags); if (!npcbflag) { if (flags & CLONE_FILES) { pc->fds=pc->pp->fds; pc->fds->count++; } else { struct pcb_file *p=pc->fds=(struct pcb_file *)malloc(sizeof(struct pcb_file)); p->count=1; p->nolfd=0; p->lfdlist=NULL; if (pc->pp->fds->nolfd > 0) { int i; p->nolfd=pc->pp->fds->nolfd; p->lfdlist=(int *)malloc(p->nolfd * sizeof(int)); memcpy(p->lfdlist,pc->pp->fds->lfdlist,p->nolfd * sizeof(int)); for (i=0; inolfd; i++) { if (p->lfdlist[i] >=0) ++lfd_tab[FD2LFD(p,i)]->count; } } } } } void umproc_delproc(struct pcb *pc,int flags,int npcbflag) { if (!npcbflag) { struct pcb_file *p=pc->fds; p->count--; /* if there are no processes left sharing this data structure * free all the data */ if (p->count == 0) { int i; for (i=0; inolfd; i++) { register int lfd=fd2lfd(p,i); if (lfd >= 0) { pc->hte=lfd_tab[lfd]->hte; lfd_close(lfd); } } if (p->lfdlist != NULL) free(p->lfdlist); free(p); } } } /* open file/socket has two phases: the real open and the register. * in the second phase registers the map between the fd as seen by the process and * our lfd */ /* lfd table contains a record for each file opened by a process, * if it is not "virtualized" it is used to keep the path of the open file * (e.g. to manage a fchdir call!) * When the file is virtualized there is the pvtab part*/ int lfd_open (struct ht_elem *hte, int sfd, char *path, int flags, int nested) { int lfd; GDEBUG(3, "lfd_open sfd %d, path %s, nested %d", sfd, path, nested); /*printk("lfd_open sfd %d, path %s, nested %d\n", sfd, path, nested);*/ /*printk("lfd_open %s sfd %d %s",ht_get_servicename(hte),sfd,(path==NULL)?"":path);*/ lfd=lfd_alloc(); if (hte) ht_count_plus1(hte); //printk("LEAK %x %x path=%s\n",lfd_tab,lfd_tab[lfd],path); lfd_tab[lfd]->path=(path==NULL)?NULL:strdup(path); lfd_tab[lfd]->hte=hte; lfd_tab[lfd]->sfd=sfd; lfd_tab[lfd]->flags=flags; lfd_tab[lfd]->epoch=um_setnestepoch(0); lfd_tab[lfd]->count=1; lfd_tab[lfd]->pvtab=NULL; #if _UM_EPOLL lfd_tab[lfd]->epoll=NULL; #endif if (hte != NULL && !nested) { char *filename; lfd_tab[lfd]->pvtab = (struct lfd_vtable *)malloc (sizeof(struct lfd_vtable)); assert(lfd_tab[lfd]->pvtab != NULL); /* create the fifo to fake the file for the process, * it will be used to give a fd to the process and to unblock * select/pselect/poll/ppoll operations */ filename=lfd_tab[lfd]->pvtab->filename=strdup(um_proc_tmpfile(hte,lfd)); #ifdef NDEBUG mkfifo(filename,0600); #else { int fifo; fifo=mkfifo(filename,0600); assert(fifo==0); } #endif /* the fifo is opened on both ends input and output, so that * 1- the call is not blocking * 2- it is possible to reread the data after the process gets unblocked */ lfd_tab[lfd]->pvtab->ififo=r_open(filename,O_RDONLY|O_NONBLOCK,0); assert(lfd_tab[lfd]->pvtab->ififo >= 0); lfd_tab[lfd]->pvtab->ofifo=r_open(filename,O_WRONLY,0); assert(lfd_tab[lfd]->pvtab->ofifo >= 0); lfd_tab[lfd]->pvtab->signaled=0; } else { //printk("add lfd %d file %s\n",lfd,lfd_tab[lfd]->path); lfd_tab[lfd]->pvtab=NULL; } //printk("lfd_open: lfd %d sfd %d file %s\n",lfd,sfd,lfd_tab[lfd]->path); return lfd; } /* close a file */ void lfd_close (int lfd) { GDEBUG(5, "close %d %x",lfd,lfd_tab[lfd]); /*printk("lfd close %d %d %x %d %s\n",lfd_tab[lfd]->count,lfd,lfd_tabmax,lfd_tab[lfd],lfd_tab[lfd]->path);*/ assert (lfd < 0 || (lfd < lfd_tabmax && lfd_tab[lfd] != NULL)); /* if this is the last reference to the lfd * close everything*/ if (lfd >= 0 && --(lfd_tab[lfd]->count) == 0) { register struct ht_elem *hte; /* if it is a virtual fifo, close the fifo files, unlink * the fifo itself, and free the malloc'ed data */ if (lfd_tab[lfd]->pvtab != NULL) { #ifdef NDEBUG r_close(lfd_tab[lfd]->pvtab->ififo); r_close(lfd_tab[lfd]->pvtab->ofifo); r_unlink(lfd_tab[lfd]->pvtab->filename); #else int rv; rv=r_close(lfd_tab[lfd]->pvtab->ififo); assert(rv==0); rv=r_close(lfd_tab[lfd]->pvtab->ofifo); assert(rv==0); rv=r_unlink(lfd_tab[lfd]->pvtab->filename); assert(rv==0); #endif free(lfd_tab[lfd]->pvtab->filename); free(lfd_tab[lfd]->pvtab); } //else //printk("del lfd %d file %s\n",lfd,lfd_tab[lfd]->path); hte=lfd_tab[lfd]->hte; /* call the close method of the service module */ if (hte != NULL && lfd_tab[lfd]->sfd >= 0) ht_syscall(hte,uscno(__NR_close))(lfd_tab[lfd]->sfd); #ifdef _UM_EPOLL if (lfd_tab[lfd]->epoll != NULL) { int i; struct lfd_epoll *epoll=lfd_tab[lfd]->epoll; for (i=0;iep_n;i++) { if (epoll->ep_list[i] != NULL) free(epoll->ep_list[i]); } free(lfd_tab[lfd]->epoll); } #endif /* free path and structure */ if (lfd_tab[lfd]->path != NULL) free(lfd_tab[lfd]->path); if (hte) ht_count_minus1(hte); lfd_free(lfd); } } /* dup: just increment the count, lfd is shared */ int lfd_dup(int lfd) { if (lfd >= 0) { assert (lfd < lfd_tabmax && lfd_tab[lfd] != NULL); return ++lfd_tab[lfd]->count; } else return 1; } /* access method to read how many process fd share the same lfd element */ int lfd_getcount(int lfd) { assert (lfd < lfd_tabmax && lfd_tab[lfd] != NULL); return lfd_tab[lfd]->count; } /* set sfd to null (to avoid double close) */ void lfd_nullsfd(int lfd) { //printk("lfd_nullsfd %d %d %x\n", //lfd,lfd_tabmax,lfd_tab[lfd]); assert (lfd < lfd_tabmax && lfd_tab[lfd] != NULL); lfd_tab[lfd]->sfd= -1; } /* lfd 2 sfd conversion */ int lfd_getsfd(int lfd) { assert (lfd < lfd_tabmax && lfd_tab[lfd] != NULL); return lfd_tab[lfd]->sfd; } /* lfd: get the hash table element */ struct ht_elem *lfd_getht(int lfd) { //printk("getht %d -> %x\n",lfd,lfd_tab[lfd]); assert (lfd < lfd_tabmax && lfd_tab[lfd] != NULL); if (lfd >= lfd_tabmax || lfd_tab[lfd] == NULL) return NULL; return lfd_tab[lfd]->hte; } /* lfd: get the filename (of the fifo): for virtualized files*/ char *lfd_getfilename(int lfd) { assert (lfd < lfd_tabmax && lfd_tab[lfd] != NULL && lfd_tab[lfd]->pvtab != NULL); return lfd_tab[lfd]->pvtab->filename; } /* lfd: get the path */ char *lfd_getpath(int lfd) { assert (lfd < lfd_tabmax && lfd_tab[lfd] != NULL); return lfd_tab[lfd]->path; } /* fd 2 ldf mapping (in a process file table) */ int fd2lfd(struct pcb_file *p, int fd) { if (fd>=0 && fd < p->nolfd && p->lfdlist[fd]>=0) return FD2LFD(p,fd); else return -1; } /* fd set flags */ int fd_getfdfl(struct pcb_file *p, int fd) { if (fd>=0 && fd < p->nolfd && p->lfdlist[fd]>=0) return FD2FDFLAGS(p,fd); else return -1; } /* fd get flags */ int fd_setfdfl(struct pcb_file *p, int fd, int val) { if (fd>=0 && fd < p->nolfd && p->lfdlist[fd]>=0) { if (val & FD_CLOEXEC) p->lfdlist[fd] |= X_FD_CLOEXEC; else p->lfdlist[fd] &= ~X_FD_CLOEXEC; return 0; } else return -1; } int fd_getflfl(struct pcb_file *p, int fd) { if (fd>=0 && fd < p->nolfd && p->lfdlist[fd]>=0) { int lfd=FD2LFD(p,fd); return lfd_tab[lfd]->flags; } else return -1; } #define SETFLSET (O_APPEND | O_ASYNC | O_DIRECT | O_NOATIME | O_NONBLOCK) int fd_setflfl(struct pcb_file *p, int fd, int flags) { if (fd>=0 && fd < p->nolfd && p->lfdlist[fd]>=0) { int lfd=FD2LFD(p,fd); lfd_tab[lfd]->flags &= ~SETFLSET; lfd_tab[lfd]->flags |= (flags & SETFLSET); return 0; } else return -1; } /* fd 2 path mapping (given the file table of a process) */ char *fd_getpath(struct pcb_file *p, int fd) { if (fd>=0 && fd < p->nolfd) { int lfd=FD2LFD(p,fd); //assert (lfd >= 0 && lfd < lfd_tabmax && lfd_tab[lfd] != NULL); if (lfd >= 0 && lfd < lfd_tabmax && lfd_tab[lfd] != NULL) { return lfd_tab[lfd]->path; } else return NULL; } else return NULL; } /* fd 2 sfd conversion (given the file table of a process) */ int fd2sfd(struct pcb_file *p, int fd) { if (fd>=0 && fd < p->nolfd && p->lfdlist[fd] >= 0) return lfd_tab[FD2LFD(p,fd)]->sfd; else return -1; } /* tell the identifier of the service which manages given fd, or NULL if no * service handle it */ struct ht_elem *ht_fd(struct pcb_file *p, int fd, int setepoch) { /*printk("service fd p=%x\n",p); if (p != NULL) printk("service fd p->lfdlist=%x\n",p->lfdlist); if (fd < p->nolfd) printk("service fd p=%d %x\n",fd, p->lfdlist[fd]); else printk("service fd p=%d xxx\n",fd); */ #ifdef _UM_MMAP /* ummap secret file is not accessible by processes, it is just a * non-existent descriptor */ if (fd == um_mmap_secret) return HT_ERR; else #endif if (fd >= 0 && fd < p->nolfd && p->lfdlist[fd] >= 0) { /* XXX side effect: when ht_fd finds a virtual file, * it sets also the epoch */ if (setepoch) um_setnestepoch(lfd_tab[FD2LFD(p,fd)]->epoch); return lfd_tab[FD2LFD(p,fd)]->hte; } else return NULL; } /* second phase of lfd_open: map the process fd to to lfd, * fd is known only after the kernel has completed its open * of the fifo */ void lfd_register (struct pcb_file *p, int fd, int lfd) { //printk("lfd_register fd %d lfd %d\n",fd,lfd); if (fd >= p->nolfd) { int i=p->nolfd; /* adds about OLDFD_STEP=8 entries in the array */ /* FIXME: if file descriptors aren't allocated linearly by * Linux (e.g.: security extensions which gives random fds), * very large arrays are allocated in this step. */ p->nolfd = (fd + OLFD_STEP) & ~OLFD_STEP_1; p->lfdlist = (int *) realloc(p->lfdlist, p->nolfd * sizeof(int)); assert (p->lfdlist); //printk("lfd_add realloc oldndf %d new %d\n",i,p->nolfd); if (p->lfdlist == NULL) { perror("no mem"); } for (;i < p->nolfd; i++) p->lfdlist[i]= -1; } p->lfdlist[fd]=lfd; /* CLOEXEC unset */ //printk("lfd_register fd %d lfd %d %x\n", fd, lfd, lfd_tab[lfd]); } /* when a process closes a file must be closed (lfd element) and deregistered * from the process file table */ void lfd_deregister_n_close(struct pcb_file *p, int fd) { //printk("lfd_deregister_n_close %d %d %d\n",fd,p->nolfd,p->lfdlist[fd]); //assert(fd < p->nolfd && p->lfdlist[fd] != -1); if (p->lfdlist != NULL && fd < p->nolfd && p->lfdlist[fd] >= 0) { //printk("lfd_deregister_n_close LFD %d\n",FD2LFD(p,fd)); lfd_close(FD2LFD(p,fd)); p->lfdlist[fd] = -1; } } /* final clean up of all the fifos */ static void lfd_closeall_item(int lfd, void *arg) { if (lfd_tab[lfd]->pvtab != NULL) { r_close(lfd_tab[lfd]->pvtab->ififo); r_close(lfd_tab[lfd]->pvtab->ofifo); r_unlink(lfd_tab[lfd]->pvtab->filename); } } void lfd_closeall() { lfd_forall(lfd_closeall_item,NULL); } /* unblock a process waiting on a select/poll call */ void lfd_signal(int lfd) { char ch=0; //printk("lfd_signal %d\n",lfd); assert (lfd < lfd_tabmax && lfd_tab[lfd] != NULL); if (lfd < lfd_tabmax && lfd_tab[lfd] != NULL && lfd_tab[lfd]->pvtab != NULL) { if (lfd_tab[lfd]->pvtab->signaled == 0) { lfd_tab[lfd]->pvtab->signaled = 1; r_write(lfd_tab[lfd]->pvtab->ofifo,&ch,1); } } } /* when the process has restarted, empty the fifo for the next time */ void lfd_delsignal(int lfd) { char buf[1024]; assert (lfd < lfd_tabmax && lfd_tab[lfd] != NULL && lfd_tab[lfd]->pvtab != NULL); if (lfd_tab[lfd]->pvtab->signaled == 1) { lfd_tab[lfd]->pvtab->signaled = 0; r_read(lfd_tab[lfd]->pvtab->ififo,buf,1024); } } #ifdef _UM_EPOLL /* management of epoll structure */ void lfd_epoll_add(struct pcb_file *p,int epfd,struct lfd_epoll_item *ep_item) { int lfd=FD2LFD(p,epfd); struct lfd_epoll *epoll; int new; if (lfd < 0) return; epoll=lfd_tab[lfd]->epoll; if (epoll == NULL) { int i; epoll = lfd_tab[lfd]->epoll = malloc(sizeof(struct lfd_epoll)); if (epoll == NULL) return; epoll->ep_n=UM_EPOLL_STEP; for (i=0;iep_list[i] = NULL; } for (new = 0; new < epoll->ep_n && epoll->ep_list[new] != NULL; new++) ; if (new >= epoll->ep_n) { int i; epoll->ep_n += UM_EPOLL_STEP; epoll = lfd_tab[lfd]->epoll = realloc(lfd_tab[lfd]->epoll, sizeof(struct lfd_epoll *) + sizeof(struct lfd_epoll_item) * (epoll->ep_n - UM_EPOLL_STEP)); if (epoll == NULL) { printk("Out of memory on epoll\n"); return; } for (i=new;iep_n;i++) epoll->ep_list[i]= NULL; } epoll->ep_list[new] = ep_item; } void lfd_epoll_del(struct pcb_file *p,int epfd,int fd) { int lfd=FD2LFD(p,epfd); struct lfd_epoll *epoll; if (lfd < 0) return; epoll=lfd_tab[lfd]->epoll; if (epoll != NULL) { int i; for (i=0;iep_n;i++) { if (epoll->ep_list[i] && epoll->ep_list[i]->fd == fd) { struct lfd_epoll_item *old=epoll->ep_list[i]; epoll->ep_list[i] = NULL; free(old); break; } } } } struct lfd_epoll_item *lfd_epoll_search(struct pcb_file *p,int epfd,int fd) { int lfd=FD2LFD(p,epfd); struct lfd_epoll *epoll; if (lfd < 0) return NULL; epoll=lfd_tab[lfd]->epoll; if (epoll != NULL) { int i; for (i=0;iep_n;i++) { if (epoll->ep_list[i] && epoll->ep_list[i]->fd == fd) { return epoll->ep_list[i]; } } } return NULL; } void lfd_epoll_forall(struct pcb_file *p, int epfd, void (* fun)(struct lfd_epoll_item *epoll,void *arg), void *arg) { int lfd=FD2LFD(p,epfd); struct lfd_epoll *epoll; if (lfd < 0) return; epoll=lfd_tab[lfd]->epoll; if (epoll != NULL) { int i; for (i=0;iep_n;i++) { if (epoll->ep_list[i] != NULL) fun(epoll->ep_list[i], arg); } } } #endif /* sfd + service --2--> path conversion * linear scan, slow! */ static void *sfd_getpath_check(int lfd, void *arg1, void *arg2) { struct ht_elem *hte=arg1; int *psfd=arg2; if (lfd_tab[lfd]->hte == hte && lfd_tab[lfd]->sfd == *psfd) return lfd_tab[lfd]->path; else return NULL; } char *sfd_getpath(struct ht_elem *hte, int sfd) { return lfd_forall_r(sfd_getpath_check,hte,&sfd); } umview-0.8.2/xmview/modutils.h0000644000175000017500000000210211753517211015437 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * modutils.h: misc utilites for modules (header for core use only) * * Copyright 2007 Ludovico Gardenghi University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: modutils.h 377 2007-08-28 20:36:16Z garden $ * */ #ifndef MODUTILS_H #define MODUTILS_H void *openmodule(const char *modname, int flag); #endif umview-0.8.2/xmview/scmap.h0000644000175000017500000001044311753517211014711 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * scmap.h: structures for system call wrapping table * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: scmap.h 786 2009-09-11 13:49:57Z rd235 $ * */ #ifndef _SCMAP_H #define _SCMAP_H #include #include "hashtab.h" #include "defs.h" #define VIRSYS_UMSERVICE 1 #define VIRSYS_MSOCKET 2 #define __NR_msocket VIRSYS_MSOCKET /* macro for privatescno (as viewed by modules) * E-xtended scno (max 16384 syscall per type) */ #if __NR_socketcall != __NR_doesnotexist #define ESCNO_SOCKET 0x4000 #else #define ESCNO_SOCKET 0x0000 #endif #define ESCNO_VIRSC 0x8000 #define ESCNO_MASK 0x3fff #define ESCNO_MAP 0xC000 //typedef struct service *sss; typedef struct ht_elem *(*htfun)(); typedef struct ht_elem *htfunt(); typedef long sysfunt(); typedef long wrapinfun(); typedef long wrapoutfun(); typedef long wrapfun(); /* typedef int wrapinfun(int sc_number,struct pcb *pc, struct ht *hte, sysfun um_syscall); typedef int wrapoutfun(int sc_number,struct pcb *pc); */ // remap real syscall number to a nu int uscno(int scno); void init_scmap(); /* An entry in the system call table. Every such structure tells how to process * a system call */ struct sc_map { /* the number of the system call this row is about */ int scno; /* the choice function: this function tells the service which have to * manage the system call */ htfun scchoice; /* wrapin function: this function is called in the IN phase of the * syscall */ sysfun wrapin; /* ...guess... */ sysfun wrapout; /* the choice function: this function tells the service which have to * manage the nested system call */ htfun nestchoice; /* wrapin function: this function is called for wrapped syscalls. syscall */ sysfun nestwrap; /* flags: dependant on the table; contains stuff such that the ALWAYS * flag, the CB_R flag, etc... (look below) */ short flags; /* number of arguments of this system call - used for some * optimizations (lower three bits) */ /* path argument (for rewriting) in three more bits bits 7,6 unused bits 5,4,3 path arg (+1 !! path is arg 0 bits 2,1,0 nargs */ char nargx; /* set of calls, for a better selection (choice fun)*/ unsigned char setofcall; }; #define NARGS(X) ((int)(X & 0x7)) #define ISPATHARG(X) ((X >> 3) & 0x7) #define PATHARG(X) (((X >> 3) & 0x7) - 1) #define PATH0 (1<<3) #define PATH1 (2<<3) #define PATH2 (3<<3) #define PATH3 (4<<3) #define PATH4 (5<<3) #define PATH5 (6<<3) extern struct sc_map scmap[]; extern int scmap_scmapsize; extern struct sc_map virscmap[]; extern int scmap_virscmapsize; extern struct sc_map sockmap[]; extern int scmap_sockmapsize; #define CB_R POLLIN|POLLHUP #define CB_W POLLOUT /* if set, the wrapin function must be called anyway, even if the choice * function tell noone is interested - useful for some system call we must * process internally, e.g. to keep fd table updated, or mmap mappings, * etc... */ #define ALWAYS 0x8000 #define NALWAYS 0x4000 static inline struct sc_map *escmapentry(long esysno) { long index=esysno & ESCNO_MASK; switch (esysno & ESCNO_MAP) { #if __NR_socketcall != __NR_doesnotexist case ESCNO_SOCKET: return &(sockmap[index]); #endif case ESCNO_VIRSC: return &(virscmap[index]); default: return &(scmap[uscno(index)]); } } /* #define USC_TYPE(X) (scmap[(X)].setofcall)*/ #define SOC_NONE 0x00 #define SOC_SOCKET 0x80 #define SOC_FILE 0x40 #define SOC_NET 0x20 #define SOC_TIME 0x1 #define SOC_UID 0x2 #define SOC_PRIO 0x3 #define SOC_PID 0x4 #define SOC_HOSTID 0x5 #define SOC_MMAP 0x6 #define SOC_SIGNAL 0x7 #endif umview-0.8.2/xmview/pcb.04.select.h0000644000175000017500000000052211753517211016047 0ustar renzorenzo#ifdef _UM_MMAP #ifdef _PCB_DEFINITIONS void um_select_addproc(),um_select_delproc(); #endif #ifdef _PCB_COMMON_FIELDS /* struct seldata* */ void *selset; #endif #ifdef _PCB_ONLY_FIELDS #endif #ifdef _NPCB_ONLY_FIELDS #endif #ifdef _PCB_CONSTRUCTOR um_select_addproc, #endif #ifdef _PCB_DESTRUCTOR um_select_delproc, #endif #endif umview-0.8.2/xmview/treepoch.c0000644000175000017500000003144611753517211015420 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * treepoch.c: management of epoch count for nesting * (TODO mgmt of tree for partial nesting, i.e. running a umview inside another umview) * * Copyright 2006 Renzo Davoli University of Bologna - Italy * Some code Copyright 2006 Andrea Gasparini University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: treepoch.c 775 2009-09-01 21:15:23Z rd235 $ * */ /* TODO lazy garbage collection: treepoch nodes*/ #include #include #include #include #include #include #include #include #include "treepoch.h" #include "sctab.h" /* a treepoch is a binary tree. * each node represent a temporal interval of common history between * umview istances. * The two subtree of a node are named 0-subtree and 1-subtree, thus a * binary number is naturally assigned to each node. * (LSB is root choice) * * When a new istance starts two nodes get created in the treepoch * the 0-subtree represents the original istance after while the 1-subtree * represents the new istance. * * Each node is timestamped with its starting epoch. * Processes are always assigned to the leaves. * */ #if (__WORDSIZE == 32 ) /* 32 bits */ # define __LOG_WORDSIZE (5) # define __WORDSIZEMASK 0x1f #elif (__WORDSIZE == 64) /* 64 bits */ # define __LOG_WORDSIZE (6) # define __WORDSIZEMASK 0x3f #else # error sorry this program has been tested only on 32 or 64 bit machines #endif #define MAXDEPTH (sizeof(long) * 8) #define DEPTH_BYTES ((MAXDEPTH + 7)/8) #define DEPTH_WORDS ((DEPTH_BYTES + sizeof(long) - 1)/sizeof(long)) struct treepoch { struct treepoch *parent; struct treepoch *sub[2]; /*structure pointers*/ epoch_t rise; /*when this element was created */ unsigned long nproc; /* number of processes in this node */ unsigned long nref; /* number of references to this node */ unsigned short subheight;/* height of the subtree rooted here*/ unsigned short len; /* len of the string (distance to the root) */ unsigned long bitstr[DEPTH_WORDS]; /*bitstring of this node*/ viewid_t viewid; char *viewname; }; static unsigned long nextviewid; static struct treepoch *te_root; /* root of the treepoch structure */ /* static struct treepoch tst_useless={ .len=__SHRT_MAX__, }; */ /* epoch now is a (long long) counter, it is used to timestamp all the state * changes in the system */ static epoch_t epoch_now=2; /* mutex for multithreading */ static pthread_mutex_t epoch_mutex = PTHREAD_MUTEX_INITIALIZER; /* bit string management, the string is splitted into word-sized elements */ static int getbit(unsigned long *v,short b) { return (v && (v[b >> __LOG_WORDSIZE] & (1<< (b & __WORDSIZEMASK)))); } static void setbit(unsigned long *v,short b,int val) { if (v) { if (val) v[b >> __LOG_WORDSIZE] |= (1<< (b & __WORDSIZEMASK)); else v[b >> __LOG_WORDSIZE] &= ~(1<< (b & __WORDSIZEMASK)); } } /* TRUE if two strings differs up to the "len"th element */ static inline int diffbitstr(unsigned long *a,unsigned long *b,short len) { int i; int w=len >> __LOG_WORDSIZE; unsigned long mask= (1<<(len & __WORDSIZEMASK)) - 1; int rv=0; for (i=0;i %d\n",a[0],b[0],len,rv);*/ return rv; } /* one tick of the global timestap clock epoch_now */ static epoch_t new_epoch(){ epoch_t tmp; pthread_mutex_lock(&epoch_mutex); tmp=epoch_now; epoch_now++; pthread_mutex_unlock(&epoch_mutex); /*printk("NEW EPOCH %lld\n",epoch_now);*/ return tmp; } epoch_t get_epoch(){ return epoch_now; } /* it is > 0 if the operation time is consistent with the service time. * in such a case it returns the epoch of the matching */ epoch_t tst_matchingepoch(struct timestamp *service_tst) { /* if service_tst refers to a dead branch service_tst->epoch is updated*/ struct timestamp *process_tst=um_x_gettst(); /*printk("SE = %lld - PE = %lld\n",service_tst->epoch,process_tst->epoch);*/ while (service_tst->treepoch->parent && service_tst->treepoch->nproc==0) service_tst->treepoch = service_tst->treepoch->parent; /*printk("MATCH up %lld %lld\n",service_tst->epoch,service_tst->treepoch->rise);*/ while (service_tst->epoch < service_tst->treepoch->rise) service_tst->treepoch = service_tst->treepoch->parent; /* process_tst->treepoch is NULL only for garbage collection final calls. Always match! */ if (process_tst) { if (!process_tst->treepoch) { printk("tst_matchingepoch process err %d\n",um_mod_getpid()); return 0; } /* if service_tst->treepoch is a subset of process_tst->treepoch * return service_tst->epoch */ if (service_tst->treepoch->len > process_tst->treepoch->len || diffbitstr(service_tst->treepoch->bitstr,process_tst->treepoch->bitstr,service_tst->treepoch->len)) return 0; else if (service_tst->epoch < process_tst->epoch) return service_tst->epoch; else return 0; } else return service_tst->epoch; } /* create a complete timestamp of an event */ struct timestamp tst_timestamp() { struct timestamp *process_tst=um_x_gettst(); struct timestamp rv; rv.treepoch=process_tst->treepoch; rv.epoch=new_epoch(); return rv; } /* update the treepoch: substring and len are updated towards the leaves * by a recursive depth first search */ static void de_update_substr(struct treepoch *node,int v01) { if (node) { node->len=node->parent->len; setbit(node->bitstr,node->len,v01); (node->len)++; de_update_substr(node->sub[0],0); de_update_substr(node->sub[1],1); } } /* update the treepoch: the subtree height must be updated towards the root: * this recursive scan terminates when the root has been reached or * when the other subtree is deeper */ static void de_update_height(struct treepoch *node) { if (node) { short subheight0=node->sub[0]->subheight; short subheight1=node->sub[1]->subheight; short subheight=(subheight0>subheight1)?subheight0:subheight1; subheight++; if (node->subheight != subheight) { node->subheight=subheight; de_update_height(node->parent); } } } #if 0 /* just for debugging */ static void te_printtree(struct treepoch *node,int l) { if (node != NULL) { printk("%d-printtree par %p np%d h%d l%d >%x\n",l,node,node->nproc,node->subheight,node->len,node->bitstr[0]); te_printtree(node->sub[0],l+1); te_printtree(node->sub[1],l+1); } } #endif /* delete a process form the treepoch */ static void te_delproc(struct treepoch *node) { if (node != NULL){ struct treepoch *parent=node->parent; /* if there are no more processes depending on this node */ if (--node->nproc == 0 && parent) { /* treepoch node removal */ struct treepoch *other; /* other is the "surviving" branch from the parent */ other=(node==parent->sub[0])?parent->sub[1]:parent->sub[0]; /* internal nodes have always two branches (sub[0] != NULL & sub[1] != NULL) */ /* two nodes of the treepoch gets deleted, the empty leaf and its * parent, the other branch root node gets the role of the former * parent */ /* deleting X (parent is A, deleted, and other is B) * | | * A B * / \ / \ * X B * / \ */ other->parent=parent->parent; /* the timestamp of the new parent is the timestamp of the old parent */ other->rise=parent->rise; /* special case: root of treepoch redefined */ if (other->parent ==NULL) te_root=other; else /* normal case: set the pointer of grandparent's son to 'other' */ other->parent->sub[getbit(parent->bitstr,parent->len-1)]=other; other->len=parent->len; /* copy the string of parent (other takes the role of its parent) */ memcpy(&other->bitstr,&parent->bitstr,DEPTH_WORDS*sizeof(long)); /* the node is kept for lazy garbage collection */ node->parent=other; /* delete the deleted node viewname*/ if (node->viewname != NULL) { free(node->viewname); node->viewname=NULL; } /* update the structure */ de_update_substr(other->sub[0],0); de_update_substr(other->sub[1],1); de_update_height(other->parent); /*te_printtree(te_root,0);*/ } /* nproc must be updated also on the ancestors */ te_delproc(parent); } } /* add a new process (nproc++ for the node and for all its ancestors)*/ static void te_newproc(struct treepoch *node) { if (node != NULL){ node->nproc++; te_newproc(node->parent); } } /* interface function: generate a new fork */ struct timestamp tst_newfork(struct timestamp *old_tst) { struct timestamp rv; struct treepoch *new_te; assert ((old_tst != NULL && old_tst->treepoch != NULL) || te_root == NULL); /* if there is one process only no fork takes place */ if (old_tst && (old_tst->treepoch->nproc == 1 || /* if the branch has already reached the max height no fork*/ (old_tst->treepoch->subheight + old_tst->treepoch->len) >= MAXDEPTH)) return *old_tst; else { new_te=calloc(1,sizeof(struct treepoch)); assert(new_te); rv.treepoch=new_te; /* a new fork *is* a relevant event for the system timestamping */ rv.epoch=new_te->rise=new_epoch(); new_te->viewid = nextviewid++; if (te_root == NULL) { /* special case: first node= root */ te_root=new_te; } else { /* treepoch creation */ /* when a treepoch forks two nodes get created. ex:old_te forks: * | | *old_te par_te * / \ * old_te new_te */ struct treepoch *old_te=old_tst->treepoch; struct treepoch *par_te=calloc(1,sizeof(struct treepoch)); assert(old_te); assert(par_te); /* old and new have the timestamp of the fork, while par_te * gets the old timestamp of old_te */ par_te->rise=old_te->rise; old_te->rise=new_te->rise; /* the new fork has a process (the caller), old_te has lost * one process */ par_te->nproc=old_te->nproc; old_te->nproc=old_te->nproc-1; new_te->nproc=1; par_te->nref=2; new_te->nref=0; /* re-link the binary tree structure */ par_te->sub[0]=old_te; par_te->sub[1]=new_te; par_te->parent=old_te->parent; old_te->parent=new_te->parent=par_te; /* update the grandparent's son pointer */ if (par_te->parent ==NULL) te_root=par_te; else par_te->parent->sub[getbit(old_te->bitstr,old_te->len-1)]=par_te; /* update the bit strings */ par_te->len=old_te->len; memcpy(&par_te->bitstr,&old_te->bitstr,DEPTH_WORDS*sizeof(long)); memcpy(&new_te->bitstr,&old_te->bitstr,DEPTH_WORDS*sizeof(long)); new_te->subheight=0; par_te->subheight=old_te->subheight+1; /* update strings (in the subtree) and height towards the ancestors */ de_update_substr(old_te,0); de_update_substr(new_te,1); de_update_height(par_te->parent); /*te_printtree(te_root,0);*/ } return rv; } } /* interface functions: add a process/delete a process */ struct timestamp tst_newproc(struct timestamp *parent_tst) { struct timestamp rv; rv=*parent_tst; te_newproc(rv.treepoch); /* printk("NEW PROC %d %p %d %d %x\n",um_mod_getpid(),rv.treepoch,rv.treepoch->nproc,rv.treepoch->len,rv.treepoch->bitstr[0]);*/ return rv; } void tst_delproc(struct timestamp *tst) { /*printk("DEL PROC %p %d %d %x\n",parent_tst->treepoch,parent_tst->treepoch->nproc,parent_tst->treepoch->len,parent_tst->treepoch->bitstr[0]);*/ te_delproc(tst->treepoch); } /* return the view_id of the current view */ viewid_t te_getviewid(struct treepoch *te) { return(te->viewid); } /* set the view name of the current view */ void te_setviewname(struct treepoch *te,char *name) { if (te->viewname != NULL) free(te->viewname); te->viewname=strndup(name,_UTSNAME_LENGTH-1); } /* return the view name of the current view */ char *te_getviewname(struct treepoch *te) { return(te->viewname); } /* boolean: return true if both te refer to the same view */ int te_sameview(struct treepoch *te1,struct treepoch *te2) { return te1->len == te2->len && diffbitstr(te1->bitstr,te2->bitstr,te1->len) == 0; } /* boolean: return true if both te refer to the same view or te2 * refer to a subview of te1*/ int te_sameview_or_next(struct treepoch *te1,struct treepoch *te2) { return diffbitstr(te1->bitstr,te2->bitstr,te1->len) == 0; } umview-0.8.2/xmview/umproc.h0000644000175000017500000000654411753517211015122 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_proc.h: mgmt of process fd's, services fd's and fake files * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Mattia Belletti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: umproc.h 886 2010-08-23 15:48:38Z rd235 $ * */ #ifndef _UMPROC_H #define _UMPROC_H #define OLFD_STEP 8 /*only power of 2 values */ #define OLFD_STEP_1 (OLFD_STEP - 1) #include "hashtab.h" #include "treepoch.h" #ifdef _UM_MMAP extern int um_mmap_secret; extern int um_mmap_pageshift; #endif #ifdef _UM_EPOLL #include struct lfd_epoll_item { int fd; struct epoll_event event; }; #endif /* informations about the full set of file descriptors of a process */ struct pcb_file { /* with CLONE_FILES, more than one process can refer to the same file * descriptors, so we must count them in order to make free at the * right time */ int count; /* lfdlist is an array of local file descriptors (which are indexes in * the global lfd_tab); nolfd is the length of lfdlist; lfdlist[real * file descriptor] = local file descriptor */ int nolfd; int *lfdlist; }; void um_proc_open(); void um_proc_close(); char *um_proc_fakecwd(); char *um_proc_tmpname(); #if 0 void lfd_addproc (struct pcb_file **p,int flag); void lfd_delproc (struct pcb_file *p); #endif int lfd_open (struct ht_elem *hte, int sfd, char *path, int flags, int nested); void lfd_close (int lfd); int lfd_dup(int lfd); int lfd_getcount(int lfd); void lfd_nullsfd(int lfd); int lfd_getsfd(int lfd); struct ht_elem *lfd_getht(int lfd); char *lfd_getfilename(int lfd); char *lfd_getpath(int lfd); int fd2lfd (struct pcb_file *p, int fd); int fd_getfdfl(struct pcb_file *p, int fd); int fd_setfdfl(struct pcb_file *p, int fd, int val); int fd_getflfl(struct pcb_file *p, int fd); int fd_setflfl(struct pcb_file *p, int fd, int flags); int fd2sfd (struct pcb_file *p, int fd); char *fd_getpath(struct pcb_file *p, int fd); void lfd_register (struct pcb_file *p, int fd, int lfd); void lfd_deregister_n_close(struct pcb_file *p, int fd); void lfd_closeall(); void lfd_signal(int lfd); void lfd_delsignal(int lfd); struct ht_elem *ht_fd(struct pcb_file *p, int fd, int setepoch); char *sfd_getpath(struct ht_elem *hte, int sfd); #ifdef _UM_EPOLL void lfd_epoll_add(struct pcb_file *p,int epfd,struct lfd_epoll_item *ep_item); //void lfd_epoll_mod(struct pcb_file *p,int epfd,struct lfd_epoll_item *ep_item); void lfd_epoll_del(struct pcb_file *p,int epfd,int fd); struct lfd_epoll_item *lfd_epoll_search(struct pcb_file *p,int epfd,int fd); void lfd_epoll_forall(struct pcb_file *p, int epfd, void (* fun)(struct lfd_epoll_item *epoll,void *arg), void *arg); #endif #endif umview-0.8.2/xmview/umview.c0000644000175000017500000002746311753517211015127 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * umview.c: main * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Ludovico Gardenghi, Andrea Gasparini, Andrea Seraghiti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: umview.c 974 2011-08-08 08:52:20Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef OLDVIRSC #include #endif #include #include #ifndef _VIEWOS_UM #define _VIEWOS_UM #endif #include "defs.h" #include "umview.h" #include "capture_um.h" #include "sctab.h" #include "services.h" #include "um_select.h" #include "um_services.h" #include "ptrace_multi_test.h" #include "mainpoll.h" #include "gdebug.h" #ifdef GDEBUG_ENABLED # define OPTSTRING "+p:f:o:hvnxqV:s" #else # define OPTSTRING "+p:f:hvnxqV:s" #endif int _umview_version = 2; /* modules interface version id. modules can test to be compatible with um-viewos kernel*/ unsigned int has_ptrace_multi; unsigned int ptrace_vm_mask; unsigned int ptrace_sysvm_tag; unsigned int quiet = 0; unsigned int printk_current_level = PRINTK_STARTUP_LEVEL; unsigned int secure = 0; static char *viewname; extern int nprocs; struct prelist { char *module; struct prelist *next; }; /* module preload list */ static struct prelist *prehead=NULL; /* add a module for pre-loading */ static void preadd(struct prelist **head,char *module) { struct prelist *new=malloc(sizeof(struct prelist)); assert(new); new->module=module; new->next=*head; *head=new; } /* virtual syscall for the underlying umview */ #ifdef OLDVIRSC static long int_virnsyscall(long virscno,int n,long arg1,long arg2,long arg3,long arg4,long arg5,long arg6) { struct __sysctl_args scarg; long args[6]={arg1,arg2,arg3,arg4,arg5,arg6}; scarg.name=NULL; scarg.nlen=virscno; scarg.oldval=NULL; scarg.oldlenp=NULL; scarg.newval=args; scarg.newlen=n; return native_syscall(__NR__sysctl,&scarg); } #else static long int_virnsyscall(long virscno,int n,long arg1,long arg2,long arg3,long arg4,long arg5,long arg6) { long args[6]={arg1,arg2,arg3,arg4,arg5,arg6}; return native_syscall(__NR_pivot_root,NULL,n,virscno,args); } #endif /* preload of modules */ static int do_preload(struct prelist *head) { if (head != NULL) { int rv=do_preload(head->next); if (add_service(head->module,0) < 0) { printk("module preload %s",strerror(errno)); return -1 ; } else return rv; free(head); } else return 0; } static void do_set_viewname(char *viewname) { if (viewname) { pcb_setviewname(get_pcb(),viewname); free(viewname); } } /* preload for nexted umview (it is a burst of um_add_module) */ static int do_preload_recursive(struct prelist *head) { if (head != NULL) { do_preload_recursive(head->next); int_virnsyscall(__NR_UM_SERVICE,3,ADD_SERVICE,(long)head->module,0,0,0,0); free(head); return 0; } else return 0; } static void do_set_viewname_recursive(char *viewname) { if (viewname) { int_virnsyscall(__NR_UM_SERVICE,2,VIEWOS_SETVIEWNAME,(long)viewname,0,0,0,0); } } static void version(int verbose) { fprintf(stderr, "%s %s\n", UMVIEW_NAME, UMVIEW_VERSION); if (verbose) fprintf(stderr, "%s\n", UMVIEW_DESC); fprintf(stderr, "Copyright (C) %s\n", UMVIEW_COPYRIGHT); if (verbose) fprintf(stderr, "Development team:\n%s\n", UMVIEW_TEAM); fprintf(stderr, "%s\n\n", UMVIEW_URL); return; } static void usage(char *s) { version(0); fprintf(stderr, "Usage: %s [OPTION] ... command [args]\n" " -h, --help print this help message\n" " -v, --version show version information\n" " -q, --quiet suppress some additional output\n" " -V name, --viewname name set the view name\n" " -f file, --rc file set rc file\n" " -p file, --preload file load plugin named `file' (must be a .so)\n" #ifdef GDEBUG_ENABLED " -o file, --output file send debug messages to file instead of stderr\n" #endif " -x, --nonesting do not permit module nesting\n" " -n, --nokernelpatch avoid using kernel patches\n" " --nokmulti avoid using PTRACE_MULTI\n" " --noksysvm avoid using PTRACE_SYSVM\n" " --nokviewos avoid using PTRACE_VIEWOS\n\n" " -s, --secure force permissions and capabilities\n", s); exit(0); } static struct option long_options[] = { {"preload",1,0,'p'}, {"rc",1,0,'f'}, #ifdef GDEBUG_ENABLED {"output",1,0,'o'}, #endif {"version",0,0,'v'}, {"quiet",0,0,'q'}, {"viewname",1,0,'V'}, {"help",0,0,'h'}, {"nonesting",0,0,'x'}, {"nokernelpatch",0,0,'n'}, {"nokmulti",0,0,0x100}, {"noksysvm",0,0,0x101}, {"nokviewos",0,0,0x102}, {"secure",0,0,'s'}, {0,0,0,0} }; /* pure_libc loading (by reloading the entire umview) */ static void load_it_again(int argc,char *argv[],int login) { int nesting=1; optind=1; while (1) { int c; int option_index = 0; /* some options must be parsed before reloading */ c = getopt_long(argc, argv, OPTSTRING, long_options, &option_index); if (c == -1) break; switch (c) { case 'h': usage(argv[0]); break; case 'v': version(1); exit(0); break; case 'x': /* do not use pure_libc */ nesting=0; break; } } if (nesting) { char *path; void *handle; /* does pure_libc exist ? */ if ((handle=dlopen("libpurelibc.so",RTLD_LAZY))!=NULL) { dlclose(handle); /* get the executable from /proc */ asprintf(&path,"/proc/%d/exe",getpid()); /* preload the pure_libc library */ setenv("LD_PRELOAD","libpurelibc.so",1); /* reload the executable with a leading - */ if (login) argv[0]="--umview-login"; else argv[0]="--umview"; execv(path,argv); /* useless cleanup */ free(path); } } } /* recursive umview invocation (umview started inside a umview machine) */ static void umview_recursive(int argc,char *argv[]) { char *rcfile=NULL; if (argc < 2) { usage(argv[0]); exit(1); } while (1) { int c; int option_index = 0; c = getopt_long(argc, argv, OPTSTRING, long_options, &option_index); if (c == -1) break; switch (c) { case 'h': usage(argv[0]); break; case 'q': quiet = 1; break; case 'v': version(1); exit(0); break; case 'f': rcfile=strdup(optarg); break; case 'V': viewname=strdup(optarg); break; case 'p': preadd(&prehead,optarg); break; } } if (!quiet) fprintf(stderr,"UMView: nested invocation\n\n"); if (rcfile==NULL) asprintf(&rcfile,"%s/%s",getenv("HOME"),".viewosrc"); capture_execrc("/etc/viewosrc","nested"); if (rcfile != NULL && *rcfile != 0) capture_execrc(rcfile,"nested"); do_preload_recursive(prehead); do_set_viewname_recursive(viewname); /* exec the process */ execvp(*(argv+optind),argv+optind); exit(-1); } #include /* UMVIEW MAIN PROGRAM */ int main(int argc,char *argv[]) { char *rcfile=NULL; unsigned int want_ptrace_multi, want_ptrace_vm, want_ptrace_viewos; sigset_t unblockchild; if (argc == 1 && argv[0][0] == '-' && argv[0][1] != '-') /* login shell */ loginshell_view(); /* try to set the priority to -11 provided umview has been installed * setuid. it is effectiveless elsewhere */ r_setpriority(PRIO_PROCESS,0,-11); /* if it was setuid, return back to the user status immediately, * for safety! */ r_setuid(getuid()); /* Check these cases only when *not* reloaded for purelibc */ if (strncmp(argv[0],"--umview",8)!=0) { /* if this is a nested invocation of umview, notify the umview monitor * and execute the process, * try the nested invocation notifying virtual syscall, * if it succeeded it is actually a nested invocation, * otherwise nobody is notified and the call fails*/ if (int_virnsyscall(__NR_UM_SERVICE,1,RECURSIVE_VIEWOS,0,0,0,0,0) >= 0) umview_recursive(argc,argv); /* do not return!*/ /* umview loads itself twice if there is pure_libc, to trace module * generated syscalls, this condition manages the first call */ load_it_again(argc,argv,isloginshell(argv[0])); /* do not return (when purelibc and not -x)!*/ } if (argc < 2) { usage(argv[0]); exit(1); } /* does this kernel provide pselect? */ /*has_pselect=has_pselect_test();*/ optind=1; argv[0]="umview"; /* set up the scdtab */ scdtab_init(); /* test the ptrace support */ has_ptrace_multi=test_ptracemulti(&ptrace_vm_mask,&ptrace_sysvm_tag); want_ptrace_multi = has_ptrace_multi; want_ptrace_vm = ptrace_vm_mask; /* option management */ while (1) { int c; int option_index = 0; c = getopt_long(argc, argv, OPTSTRING, long_options, &option_index); if (c == -1) break; switch (c) { case 'h': /* help */ usage(argv[0]); break; case 'v': /* version */ version(1); exit(0); break; case 'V': viewname=strdup(optarg); break; case 'p': /* module preload, here the module requests are just added to a data structure */ preadd(&prehead,optarg); break; case 'f': rcfile=strdup(optarg); break; case 'q': quiet = 1; break; #ifdef GDEBUG_ENABLED case 'o': /* debugging output file redirection */ { if (optarg==NULL){ fprintf(stderr, "%s: must specify an argument after -o\n",argv[0]); break; } gdebug_set_ofile(optarg); } break; #endif case 'n': /* do not use kernel extensions */ want_ptrace_multi = 0; want_ptrace_vm = 0; want_ptrace_viewos = 0; break; case 's': secure=1; break; case 0x100: /* do not use ptrace_multi */ want_ptrace_multi = 0; break; case 0x101: /* do not use ptrace_vm */ want_ptrace_vm = 0; break; case 0x102: /* do not use ptrace_viewos */ want_ptrace_viewos = 0; break; } } if (!quiet) { if (has_ptrace_multi || ptrace_vm_mask) { fprintf(stderr, "This kernel supports: "); if (has_ptrace_multi) fprintf(stderr, "PTRACE_MULTI "); if (ptrace_vm_mask) fprintf(stderr, "PTRACE_SYSVM "); fprintf(stderr, "\n"); } if (has_ptrace_multi || ptrace_vm_mask || want_ptrace_multi || want_ptrace_vm || want_ptrace_viewos) { fprintf(stderr, "%s will use: ", UMVIEW_NAME); if (want_ptrace_multi) fprintf(stderr,"PTRACE_MULTI "); if (want_ptrace_vm) fprintf(stderr,"PTRACE_SYSVM "); if (want_ptrace_viewos) fprintf(stderr,"PTRACE_VIEWOS "); if (!want_ptrace_multi && !want_ptrace_vm && !want_ptrace_viewos) fprintf(stderr,"nothing"); fprintf(stderr,"\n\n"); } } has_ptrace_multi = want_ptrace_multi; ptrace_vm_mask = want_ptrace_vm; if (rcfile==NULL && !isloginshell(argv[0])) asprintf(&rcfile,"%s/%s",getenv("HOME"),".viewosrc"); if (quiet) { setenv("_VIEWOS_QUIET","1",1); printk_current_level = PRINTK_QUIET_LEVEL; /* warnings or errors only */ } sigprocmask(SIG_BLOCK,NULL,&unblockchild); pcb_inits(1); capture_main(argv+optind,rcfile); setenv("_INSIDE_VIEWOS_MODULE","",1); do_preload(prehead); do_set_viewname(viewname); while (nprocs) { mp_ppoll(&unblockchild); tracehand(); } pcb_finis(1); return first_child_exit_status; } umview-0.8.2/xmview/treepoch.h0000644000175000017500000000367011753517211015423 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * treepoch.c: management of epoch count for nesting * (TODO mgmt of tree for partial nesting, i.e. running a umview inside another umview) * * Copyright 2006 Renzo Davoli University of Bologna - Italy * Some code Copyright 2006 Andrea Gasparini University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: treepoch.h 404 2007-10-11 08:55:50Z rd235 $ * */ #ifndef _TREEPOCH_H #define _TREEPOCH_H typedef long long epoch_t; typedef epoch_t (*epochfun)(); typedef unsigned long viewid_t; struct treepoch; struct timestamp { epoch_t epoch; struct treepoch *treepoch; }; epoch_t get_epoch(); epoch_t tst_matchingepoch(struct timestamp *service_tst); struct timestamp tst_timestamp(); struct timestamp tst_newfork(struct timestamp *old_tst); /*these should be transformed into constructors/destructors */ struct timestamp tst_newproc(struct timestamp *parent_tst); void tst_delproc(struct timestamp *tst); viewid_t te_getviewid(struct treepoch *te); void te_setviewname(struct treepoch *te,char *name); char *te_getviewname(struct treepoch *te); int te_sameview(struct treepoch *te1,struct treepoch *te2); int te_sameview_or_next(struct treepoch *te1,struct treepoch *te2); #endif umview-0.8.2/xmview/um_select.c0000644000175000017500000004536511753517211015574 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_select: select management (partial VM can have some files managed * by the hosting computer kernel and some by the partial VM). * * Copyright 2005,2006 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_select.c 968 2011-08-03 10:16:26Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "defs.h" #include "umproc.h" #include "services.h" #include "hashtab.h" #include "um_services.h" #include "sctab.h" #include "um_select.h" #include "scmap.h" #include "utils.h" #include "capture.h" #include "mainpoll.h" enum {RX, WX, XX} stype; struct pendingdata { int fd; short how; }; struct seldata { /* one of the lfd from the last select(), the process is waiting * at the other end of this named pipe */ int lfd; int len; struct pendingdata *pending; // fd_set origfds[3]; }; #define WAKEONRFD 0 /*there are rfd in the set*/ #define WAKEONCB 1 /*only callbacks pending */ #define WAKEUP 2 /*the process must wake up!*/ static void cleanup_pending(struct pcb *pc) { epoch_t oldepoch=um_setnestepoch(0); struct seldata *sd=pc->selset; if (sd) { int i; assert(sd->pending); for (i=0; ilen; i++) { struct ht_elem *hte=ht_fd(pc->fds,sd->pending[i].fd,1); sysfun local_event_subscribe=ht_event_subscribe(hte); int sfd=fd2sfd(pc->fds,sd->pending[i].fd); assert(local_event_subscribe != NULL && sfd >= 0); local_event_subscribe(NULL,pc,sfd,sd->pending[i].how); um_setnestepoch(oldepoch); } pc->selset=NULL; bq_terminate(pc); free(sd->pending); free(sd); } } /* how is a bit field: look CB_R, CB_W */ /* check for possibly blocking operation. * e.g. READ or recvmsg can block if there is no pending data */ static void suspend_signaled(struct pcb *pc) { epoch_t oldepoch=um_setnestepoch(0); struct seldata *sd=pc->selset; if (!sd) printk("suspend_signaled warning %d\n",pc->pid); assert(sd); assert(sd->pending); struct ht_elem *hte=ht_fd(pc->fds,sd->pending[0].fd,1); sysfun local_event_subscribe=ht_event_subscribe(hte); int sfd=fd2sfd(pc->fds,sd->pending[0].fd); assert(local_event_subscribe != NULL && sfd >= 0); local_event_subscribe(NULL,pc,sfd,sd->pending[0].how); pc->selset=NULL; um_setnestepoch(oldepoch); free(sd->pending); free(sd); sc_resume(pc); } int check_suspend_on(struct pcb *pc, int fd, int how) { epoch_t oldepoch=um_setnestepoch(0); struct ht_elem *hte=ht_fd(pc->fds,fd,1); int sfd; /*int i;*/ assert (pc->selset == NULL); /* do not suspend signaled processes */ if (pc->flags & PCB_SIGNALED) { pc->flags &= ~PCB_SIGNALED; pc->retval=-1; pc->erno=EINTR; //pc->retval=0; //pc->erno=0; return SC_CALLONXIT; } /* check the fd is managed by some service and gets its service fd (sfd) */ if (hte != NULL && (sfd=fd2sfd(pc->fds,fd)) >= 0) { sysfun local_event_subscribe; int flfl=fd_getflfl(pc->fds,fd); if ((local_event_subscribe=ht_event_subscribe(hte)) != NULL && !(flfl & O_NONBLOCK)) { bq_block(pc); if (local_event_subscribe(bq_signal, pc, sfd, how) == 0) { struct seldata *sd=malloc(sizeof(struct seldata)); /*printk("check_suspend_on_block %d %x\n",sfd,how);*/ sd->pending=malloc(sizeof(struct pendingdata)); sd->len=1; sd->lfd=-1; sd->pending[0].fd=fd; sd->pending[0].how=how; pc->selset=sd; bq_add(suspend_signaled,pc); um_setnestepoch(oldepoch); return SC_SUSPENDED; } else bq_unblock(pc); } } um_setnestepoch(oldepoch); return STD_BEHAVIOR; } /* optimization: copy only the useful part given the max fd */ static void getfdset(long addr,struct pcb* pc, int max, fd_set *lfds) { FD_ZERO(lfds); if (addr != umNULL) umoven(pc,addr,(__FDELT(max)+1)*sizeof(__fd_mask),lfds); } static void putfdset(long addr, struct pcb* pc, int max, fd_set *lfds) { if (addr != umNULL) ustoren(pc,addr,(__FDELT(max)+1)*sizeof(__fd_mask),lfds); } static void selectpoll_signal(struct pcb *pc) { struct seldata *sd=pc->selset; if (!sd) printk("sd err %p\n",sd); else if (sd->lfd < 0) printk("lfd err\n",sd->lfd); else { assert(sd->lfd >= 0); lfd_signal(sd->lfd); } } static short select2poll[]={POLLIN,POLLOUT,POLLPRI}; int wrap_in_select(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { register int n=pc->sysargs[0]; int i,fd,count; long pfds[3]; fd_set wfds[3]; /* modified waiting fds virtual files are R-waiting on the FIFOs */ epoch_t oldepoch=um_setnestepoch(0); /*long ptimeout=pc->sysargs[4]; struct timeval *lptimeout; struct timeval ltimeout;*/ //printk("SELECT %d PID %d\n",sc_number,pc->pid); /* Does two things: * - copies the sets passed as arguments to the syscall in lfds[i] * - copies the same data on wfds[i] */ for (i=0;i<3;i++) { pfds[i]=pc->sysargs[i+1]; getfdset(pfds[i],pc,n,&wfds[i]); //dumpfdset(n,stype_str[i],&wfds[i]); } /* count how many virtual file are there */ for(fd=0,count=0;fdfds,fd,0); if (hte != NULL && (fd2sfd(pc->fds,fd)) >= 0 && (ht_event_subscribe(hte)) != NULL) count++; } } /* no virtual file: nothing to do here */ if (count == 0) { return STD_BEHAVIOR; } else { /* ok, let's do the hard work */ struct seldata *sd=(struct seldata *)malloc(sizeof(struct seldata)); int signaled=0; sd->pending=malloc(sizeof(struct pendingdata) * count); sd->len=count; sd->lfd=-1; pc->selset=sd; for(fd=0,count=0;fdfds,fd,1); if (hte != NULL) { int sfd=fd2sfd(pc->fds,fd); sysfun local_event_subscribe=ht_event_subscribe(hte); if (sfd >= 0 && local_event_subscribe) { /* virtual file: split components */ /* how encodes the requested waiting flags for event_subscribe */ /* wfds gets modified for the select syscall of the usermode process*/ int lfd=fd2lfd(pc->fds,fd); sd->pending[count].fd = fd; sd->pending[count].how = how; if (sd->lfd < 0) sd->lfd = lfd; FD_SET(fd,&wfds[RX]); FD_CLR(fd,&wfds[WX]); /* needed? maybe no*/ FD_CLR(fd,&wfds[XX]); /* needed? maybe no*/ if (signaled==0 && local_event_subscribe(selectpoll_signal, pc, sfd, how) > 0) { /* if local_event_subscribe returned with a nonzero value, it * means there's *already* data! */ signaled++; lfd_signal(lfd); } count++; } } um_setnestepoch(oldepoch); } } for (i=0;i<3;i++) putfdset(pfds[i],pc,n,&wfds[i]); return SC_CALLONXIT; } } int wrap_out_select(int sc_number,struct pcb *pc) { struct seldata *sd=pc->selset; if (sd != NULL) { epoch_t oldepoch=um_setnestepoch(0); register int n=pc->sysargs[0]; long pfds[3]; fd_set lfds[3]; /* local copy of the signaled SC fds */ int i,j,fd; pc->retval=getrv(pc); if (pc->retval >= 0) { for (i=0;i<3;i++) { pfds[i]=pc->sysargs[i+1]; getfdset(pfds[i],pc,n,&lfds[i]); } } for (i=0; ilen; i++) { struct ht_elem *hte=ht_fd(pc->fds,sd->pending[i].fd,1); sysfun local_event_subscribe=ht_event_subscribe(hte); int sfd=fd2sfd(pc->fds,sd->pending[i].fd); assert(local_event_subscribe != NULL && sfd >= 0); int howret=local_event_subscribe(NULL,pc,sfd,sd->pending[i].how); int lfd=fd2lfd(pc->fds,sd->pending[i].fd); lfd_delsignal(lfd); for (j=0;j<3;j++) { //if (howret & 1<pending[i].fd,&lfds[j]); else FD_CLR(sd->pending[i].fd,&lfds[j]); } um_setnestepoch(oldepoch); } pc->selset=NULL; /* retval must be evaluated again */ if (pc->retval >= 0) { for(fd=0,pc->retval=0;fdretval++; } for (i=0;i<3;i++) { putfdset(pfds[i],pc,n,&lfds[i]); } putrv(pc->retval,pc); } free(sd->pending); free(sd); } return SC_MODICALL; } int wrap_in_poll(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { struct pollfd *ufds; /*local copy*/ unsigned int nfds=pc->sysargs[1]; unsigned long pufds=pc->sysargs[0]; int i,count; epoch_t oldepoch=um_setnestepoch(0); int rv; ufds=lalloca(nfds*sizeof(struct pollfd)); umoven(pc,pufds,nfds*sizeof(struct pollfd),ufds); /* count how many virtual file are there */ for(i=0,count=0;ifds,fd,1); if (ufds[i].events && hte != NULL && fd2sfd(pc->fds,fd) >= 0 && ht_event_subscribe(hte)) count++; } /* no virtual file: nothing to do here */ if (count == 0) { rv = STD_BEHAVIOR; } else { /* ok, let's do the hard work */ struct seldata *sd=(struct seldata *)malloc(sizeof(struct seldata)); int signaled=0; sd->pending=malloc(sizeof(struct pendingdata) * count); sd->len=count; sd->lfd= -1; pc->selset=sd; for(i=0,count=0;ifds,fd,1); if (hte != NULL) { int sfd=fd2sfd(pc->fds,fd); sysfun local_event_subscribe=ht_event_subscribe(hte); if (sfd >= 0 && local_event_subscribe) { int lfd=fd2lfd(pc->fds,fd); if (sd->lfd < 0) sd->lfd=lfd; sd->pending[count].fd = fd; sd->pending[count].how = ufds[i].events; ufds[i].events=POLLIN; //printk("POLL %d %x\n",sfd,sd->pending[count].how); if (signaled==0 && local_event_subscribe(selectpoll_signal, pc, sfd, sd->pending[count].how) > 0) { signaled++; lfd_signal(lfd); } count++; } } um_setnestepoch(oldepoch); } } ustoren(pc,pufds,nfds*sizeof(struct pollfd),ufds); rv = SC_CALLONXIT; } lfree(ufds,nfds*sizeof(struct pollfd)); return rv; } int wrap_out_poll(int sc_number,struct pcb *pc) { struct seldata *sd=pc->selset; if (sd != NULL) { epoch_t oldepoch=um_setnestepoch(0); struct pollfd *ufds; unsigned long pufds=pc->sysargs[0]; unsigned int nfds=pc->sysargs[1]; int i,j; pc->retval=getrv(pc); ufds=lalloca(nfds*sizeof(struct pollfd)); umoven(pc,pufds,nfds*sizeof(struct pollfd),ufds); if (pc->retval >= 0) { pc->retval=0; for(i=0,j=0;ilen && ufds[i].fd == sd->pending[j].fd) {/* virtual file */ struct ht_elem *hte=ht_fd(pc->fds,sd->pending[j].fd,1); sysfun local_event_subscribe=ht_event_subscribe(hte); int sfd=fd2sfd(pc->fds,sd->pending[j].fd); assert(local_event_subscribe != NULL && sfd >= 0); int lfd=fd2lfd(pc->fds,sd->pending[j].fd); int howret=local_event_subscribe(NULL,pc ,sfd,sd->pending[j].how); //printk("POLLOUT %d %x %x\n",sfd,sd->pending[j].how,howret); lfd_delsignal(lfd); ufds[i].events=sd->pending[j].how; ufds[i].revents=howret; /* XXX ERR/HUP ??? */ um_setnestepoch(oldepoch); j++; } if (ufds[i].revents) pc->retval++; } pc->selset=NULL; ustoren(pc,pufds,nfds*sizeof(struct pollfd),ufds); putrv(pc->retval,pc); free(sd->pending); free(sd); } else { for(i=0,j=0;ilen;i++) { if(ufds[i].fd == sd->pending[j].fd) {/* virtual file */ ufds[i].events=sd->pending[j].how; ufds[i].revents=0; j++; } ustoren(pc,pufds,nfds*sizeof(struct pollfd),ufds); } cleanup_pending(pc); } lfree(ufds,nfds*sizeof(struct pollfd)); } return SC_MODICALL; } #ifdef _UM_EPOLL /* The support of epoll is still under development */ static char *epoll_tag = "EP"; int wrap_in_epoll_create(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int flags=0; #if __NR_epoll_create1 != __NR_epoll_create if (sc_number== __NR_epoll_create1) flags = pc->sysargs[0]; #endif /* Linux: EPOLL_CLOEXEC==O_CLOEXEC && EPOLL_NONBLOCK==O_NONBLOCK */ flags &= (EPOLL_CLOEXEC | EPOLL_NONBLOCK); //printk("wrap_in_epoll_create %x\n",flags); pc->retval=lfd_open(NULL,-1,epoll_tag,flags,0); return SC_CALLONXIT; } int wrap_out_epoll_create(int sc_number,struct pcb *pc) { if (pc->retval >= 0) { int fd=getrv(pc); //printk("wrap_out_epoll_create %d\n",fd); if (fd >= 0) lfd_register(pc->fds,fd,pc->retval); else lfd_close(pc->retval); } else { putrv(pc->retval,pc); puterrno(pc->erno,pc); } return SC_MODICALL; } int wrap_in_epoll_ctl(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int epfd=pc->sysargs[0]; int op=pc->sysargs[1]; int fd=pc->sysargs[2]; long pevent=pc->sysargs[3]; char *tag=fd_getpath(pc->fds,epfd); struct lfd_epoll_item *ep_item; if (tag==NULL) return STD_BEHAVIOR; //printk("wrap_in_epoll_ctl %d %d %s %p %p\n",op,fd,tag,tag,epoll_tag); switch (op) { case EPOLL_CTL_ADD: ep_item=malloc(sizeof(struct lfd_epoll_item)); if (ep_item) { struct epoll_event user_event; struct ht_elem *hte=ht_fd(pc->fds,fd,1); umoven(pc,pevent,sizeof(struct epoll_event),&user_event); ep_item->fd=fd; ep_item->event=user_event; user_event.data.ptr = ep_item; if (hte != NULL && fd2sfd(pc->fds,fd) >= 0 && ht_event_subscribe(hte)) user_event.events = EPOLLIN; ustoren(pc,pevent,sizeof(struct epoll_event),&user_event); /*printk("ADD real_data = %llx our_data = %llx ptr = %p\n", ep_item->event.data.u64, user_event.data.u64, user_event.data.ptr);*/ } pc->retval = (long) ep_item; break; case EPOLL_CTL_MOD: ep_item=malloc(sizeof(struct lfd_epoll_item)); if (ep_item) { struct epoll_event user_event; struct ht_elem *hte=ht_fd(pc->fds,fd,1); umoven(pc,pevent,sizeof(struct epoll_event),&user_event); ep_item->fd=fd; ep_item->event=user_event; user_event.data.ptr = lfd_epoll_search(pc->fds, epfd, fd); if (hte != NULL && fd2sfd(pc->fds,fd) >= 0 && ht_event_subscribe(hte)) user_event.events = EPOLLIN; ustoren(pc,pevent,sizeof(struct epoll_event),&ep_item->event); } break; case EPOLL_CTL_DEL: pc->retval = (long) NULL; break; } return SC_CALLONXIT; } int wrap_out_epoll_ctl(int sc_number,struct pcb *pc) { int epfd=pc->sysargs[0]; int op=pc->sysargs[1]; int fd=pc->sysargs[2]; long pevent=pc->sysargs[3]; struct lfd_epoll_item *ep_item=(struct lfd_epoll_item *)pc->retval; int rv=getrv(pc); //printk("wrap_out_epoll_ctl %d %d\n",rv,fd); if (rv >= 0) { switch (op) { case EPOLL_CTL_ADD: if (ep_item) { lfd_epoll_add(pc->fds, epfd, ep_item); /*printk("ADD reset real data %llx\n", ep_item->event.data.u64);*/ ustoren(pc,pevent,sizeof(struct epoll_event *),&ep_item->event); } break; case EPOLL_CTL_MOD: if (ep_item) { struct lfd_epoll_item *ep_mod_item = lfd_epoll_search(pc->fds, epfd, fd); if (ep_mod_item != NULL) ep_mod_item->event = ep_item->event; ustoren(pc,pevent,sizeof(struct epoll_event *),&ep_item->event); free(ep_item); } break; case EPOLL_CTL_DEL: lfd_epoll_del(pc->fds, epfd, fd); } } else { if (ep_item != NULL) free(ep_item); } return SC_MODICALL; } static void epoll_signal (void *arg) { int lfd=(int)arg; //printk("epoll_signal ---------> lfd %d\n",lfd); lfd_signal(lfd); } static void wrap_in_epoll_wait_test(struct lfd_epoll_item *ep_item, void *arg) { struct pcb *pc=arg; int fd=ep_item->fd; struct ht_elem *hte=ht_fd(pc->fds,fd,1); if (hte != NULL) { int sfd=fd2sfd(pc->fds,fd); sysfun local_event_subscribe=ht_event_subscribe(hte); if (sfd >= 0 && local_event_subscribe) { int lfd=fd2lfd(pc->fds,fd); if (local_event_subscribe(epoll_signal, (void *)lfd, sfd, ep_item->event.events) > 0) { lfd_signal(lfd); } } } } int wrap_in_epoll_wait(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { int epfd = pc->sysargs[0]; char *tag = fd_getpath(pc->fds,epfd); if (tag == NULL) return STD_BEHAVIOR; lfd_epoll_forall(pc->fds, epfd, wrap_in_epoll_wait_test, pc); //printk("wrap_in_epoll_wait\n"); return SC_CALLONXIT; } static void wrap_out_epoll_wait_unsubscribe(struct lfd_epoll_item *ep_item, void *arg) { struct pcb *pc=arg; int fd=ep_item->fd; struct ht_elem *hte=ht_fd(pc->fds,fd,1); if (hte != NULL) { int sfd=fd2sfd(pc->fds,fd); sysfun local_event_subscribe=ht_event_subscribe(hte); if (sfd >= 0 && local_event_subscribe) { int lfd=fd2lfd(pc->fds,fd); local_event_subscribe(NULL, (void *)lfd, sfd, ep_item->event.events); } } } int wrap_out_epoll_wait(int sc_number,struct pcb *pc) { int epfd = pc->sysargs[0]; long pevents = pc->sysargs[1]; int maxevents = pc->sysargs[2]; int size_events = maxevents * sizeof(struct epoll_event *); int nevents = getrv(pc); if (nevents > 0) { struct epoll_event *events=lalloca(size_events); if(events) { int i; umoven(pc,pevents,size_events,events); for (i = 0; i < nevents; i++) { struct lfd_epoll_item *ep_item = events[i].data.ptr; struct ht_elem *hte; //printk("wrap_out_epoll_wait reset from %p\n",ep_item); events[i].data = ep_item->event.data; hte=ht_fd(pc->fds,ep_item->fd,1); if (hte != NULL) { int sfd=fd2sfd(pc->fds,ep_item->fd); sysfun local_event_subscribe=ht_event_subscribe(hte); if (sfd >= 0 && local_event_subscribe) { int lfd=fd2lfd(pc->fds,ep_item->fd); events[i].events = local_event_subscribe(NULL, (void *)lfd, sfd, ep_item->event.events); lfd_delsignal(lfd); } } //printk("wrap_out_epoll_wait reset data %llx\n",events[i].data.u64); } ustoren(pc,pevents,size_events,events); } lfree(events,size_events); } lfd_epoll_forall(pc->fds, epfd, wrap_out_epoll_wait_unsubscribe, pc); //printk("wrap_out_epoll_wait\n"); return SC_MODICALL; } #endif void um_select_addproc(struct pcb *pc,int flags,int npcbflag) { pc->selset=NULL; } void um_select_delproc(struct pcb *pc,int flags,int npcbflag) { if (pc->selset) cleanup_pending(pc); } umview-0.8.2/xmview/kmview.10000644000175000017500000001243111753517211015020 0ustar renzorenzo.\" Copyright (c) 2006 Renzo Davoli .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License, .\" version 2, as published by the Free Software Foundation. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual 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 General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, write to the Free .\" Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, .\" MA 02110-1301 USA. .TH VIEW-OS 1 "August 18, 2007" "VIEW-OS: a process with a view" .SH NAME kmview \- Kernel Mode implementation of View-OS .SH SYNOPSIS .B kmview [ .I options ] .I prog .br .SH DESCRIPTION The main goal of the View-OS project is to give each process its own view of the system resources. For example, each process can mount filesystems or hide some file or directories. It is also possible to assign virtual network interfaces, IP addresses or define virtual devices for each process (or for hierarchies of processes). .br .B kmview is the kernel module implementation of View-OS concepts. It works on a linux kernel providing utrace and it needs the .B kmview kernel module already loaded to work. It is a modular partial virtual machine. .B kmview before loading any module is completely transparent, a process behaves inside .B kmview as it would have behaved outside. Each module can customize specific entities: there are modules to mount filesystems at user-level .B (umfuse) , to define virtual networking stacks .B (net) , to define virtual devices .B (umdev) , to provide interpreters for executables, e.g. to support executables for foreign architectures .B (umbinfmt) , to hide, move, overlay parts of the file system .B (viewfs). .br These are some examples of modules provided by the View-OS team. .B kmview aims to provide a general interface to customize the system call semantics of process under specified conditions. So more modules will be added both by the View-OS team and by third parties. .SH OPTIONS .PD 0 .IP "\fB\-V\fP \fIname\fP" 4 .PD 0 .IP "\fB\-\-viewname\fP \fIname\fP" 4 set the name of the view. The view can be read and set using .B vuname or .B viewname commands. .PD 0 .IP "\fB\-p\fP \fImodule\fP [ , \fImodule_options\fP ]" 4 .PD 0 .IP "\fB\-\-preload\fR \fImodule\fP [ , \fImodule_options\fP ]" 4 preload modules. Modules will be loaded as shared libraries thus all the rules to load libraries apply. Modules must be loaded from a directory within the ld.so search path or should be specified by their pathnames. If necessary configure the LD_LIBRARY_PATH environment variable appropriately. \fImodule_options\fR are module specific configuration options, thus the reader should refer to each service module manual for a complete description. Modules can be loaded at run time using the .B um_add_service command. .IP "\fB\-s\fP" 4 .PD 0 .IP "\fB\-\-secure\fR" 4 set kmview in \fIhuman mode\fR, i.e. force the check of capabilities and permissions. uid is 0 at startup, in this way it is possible to load modules and mount services. When a process sets its uid as an unprivileged user (via setuid(2) or viewsu(1)), capability and permissions are enforced. .IP "\fB\-f\fP \fIrcfile\fP" 4 .PD 0 .IP "\fB\-\-rc\fR \fIrcfile\fP" 4 Use \fIrcfile\fR as the initialization file for kmview. kmview always executes \fB/etc/viewosrc\fR if exists, then kmview executes the initialization file set by this option or \fB~/.viewosrc\fR. .IP "\fB\-x\fP" 4 .PD 0 .IP "\fB\-\-nonesting\fR" 4 .B umview is able to provide module nesting, i.e. a module can provide services on the basis of virtual services provided by another module or even by the module itself. For example it is possible to mount a file system image which is stored in an already virtually mounted filesystem. This feature requires the pure_libc library. The \fB\-x\fR or \fB\-\-nonesting\fR option disables the nesting feature. .IP "\fB\-o\fP \fIfile\fP" 4 .PD 0 .IP "\fB\-\-output\fR \fIfile\fP" 4 This option diverts the debugging output to the file specified, it is useful when .B umview has been compiled with debugging extensions. .IP "\fB\-v\fP" 4 .PD 0 .IP "\fB\-\-version\fR" 4 Print the version and exit. .IP "\fB\-h\fP" 4 .PD 0 .IP "\fB\-\-help\fR" 4 Print a short help message and exit. .SH SEE ALSO .BR um_add_service(1) .BR um_del_service(1) .BR um_ls_service(1) .BR um_mov_service(1) .BR umfuse(1viewos) .BR lwipv6(1viewos) .BR umdev(1viewos) .BR umbinfmt(1viewos) .BR viewfs(1viewos) .BR vuname(1viewos) .BR viewname(1viewos) .SH AUTHORS View-OS is a project of the Computer Science Department, University of Bologna. Project Leader: Renzo Davoli. Development Team: P. Angelelli, A. Bacchelli, M. Belletti, P. Beverini, D. Billi, A. Forni, L. Gardenghi, A. Gasparini, D. Lacamera, C. Martellini, A. Seraghiti Howto's and further information can be found on the project wiki . umview-0.8.2/xmview/umview.h0000644000175000017500000000267311753517211015130 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * umview.h: generic definitions, not directly related to virtualization * * Copyright 2006 Ludovico Gardenghi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: umview.h 668 2009-05-30 15:08:31Z rd235 $ * */ #include #define UMVIEW_NAME PACKAGE_NAME #define UMVIEW_DESC "umview: The user-mode implementation of View-OS" #define UMVIEW_VERSION PACKAGE_VERSION #define UMVIEW_URL "http://view-os.sourceforge.net" #define UMVIEW_COPYRIGHT "2005-2008 Renzo Davoli, University of Bologna, Italy" #define UMVIEW_TEAM \ "P. Angelelli, A. Bacchelli, M. Belletti, P. Beverini, L. Bigliardi, D. Billi,\n" \ "A. Forni, L. Gardenghi, A. Gasparini, F. Giunchedi, D. Lacamera, C. Martellini,\n" \ "A. Seraghiti" umview-0.8.2/xmview/pcb.03.mmap.h0000644000175000017500000000053511753517211015525 0ustar renzorenzo#ifdef _UM_MMAP #ifdef _PCB_DEFINITIONS struct pcb_mmap_entry; void um_mmap_addproc(),um_mmap_delproc(); #endif #ifdef _PCB_COMMON_FIELDS #endif #ifdef _PCB_ONLY_FIELDS struct pcb_mmap_entry *um_mmap; #endif #ifdef _NPCB_ONLY_FIELDS #endif #ifdef _PCB_CONSTRUCTOR um_mmap_addproc, #endif #ifdef _PCB_DESTRUCTOR um_mmap_delproc, #endif #endif umview-0.8.2/xmview/um_services.c0000644000175000017500000001237211753517211016130 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_services: system call access to services mgmt * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_services.c 866 2010-08-11 07:17:33Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "defs.h" #include "sctab.h" #include "hashtab.h" #include "capture.h" #include "utils.h" #include "gdebug.h" static inline void add_alias(int type,char *alias,char *fsname) { struct ht_elem *hte=ht_check(type,alias,NULL,0); if (hte) { free(ht_get_private_data(hte)); if (*fsname==0) ht_tab_del(hte); else ht_set_private_data(hte,strdup(fsname)); } else { if (*fsname!=0) ht_tab_add(type,alias,strlen(alias),NULL,NULL,strdup(fsname)); } } static char *rec_alias(int type,char *alias,int depth) { struct ht_elem *hte=ht_check(type,alias,NULL,0); if (hte) { if (depth > MAXSYMLINKS) return alias; else return rec_alias(type,ht_get_private_data(hte),depth+1); } else return alias; } char *get_alias(int type,char *alias) { return rec_alias(type,alias,0); } int wrap_in_umservice(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) { char buf[PATH_MAX]; switch (pc->sysargs[0]) { case ADD_SERVICE: if (secure && capcheck(CAP_SYS_MODULE,pc)) { pc->retval= -1; pc->erno=EPERM; } else { if (umovestr(pc,pc->sysargs[1],PATH_MAX,buf) == 0) { int permanent=pc->sysargs[2]; if (add_service(buf,permanent) < 0) { pc->retval=-1; pc->erno=errno; } } else { pc->retval= -1; pc->erno=EINVAL; } } break; case DEL_SERVICE: if (secure && capcheck(CAP_SYS_MODULE,pc)) { pc->retval= -1; pc->erno=EPERM; } else { if (umovestr(pc,pc->sysargs[1],PATH_MAX,buf) == 0) { if ((pc->retval=del_service(buf)) != 0) { pc->erno=errno; } } else { pc->retval= -1; pc->erno=EINVAL; } } break; case LIST_SERVICE: if (pc->sysargs[2]>PATH_MAX) pc->sysargs[2]=PATH_MAX; pc->retval=list_services(buf,pc->sysargs[2]); pc->erno=errno; if (pc->retval > 0) ustorestr(pc,pc->sysargs[1],pc->retval,buf); break; case NAME_SERVICE: if (umovestr(pc,pc->sysargs[1],PATH_MAX,buf) == 0) { if (pc->sysargs[3]>PATH_MAX) pc->sysargs[3]=PATH_MAX; /* buf can be reused both for name and description */ pc->retval=name_service(buf,buf,pc->sysargs[3]); pc->erno=errno; if (pc->retval == 0) ustorestr(pc,pc->sysargs[2],pc->sysargs[3],buf); } else { pc->retval= -1; pc->erno=EINVAL; } break; case RECURSIVE_VIEWOS: if (pcb_newfork(pc) >= 0) { pc->retval=0; pc->erno = 0; } else { pc->retval= -1; pc->erno = ENOMEM; } break; case VIEWOS_GETINFO: { struct viewinfo vi; memset (&vi,0,sizeof(struct viewinfo)); pcb_getviewinfo(pc,&vi); ustoren(pc,pc->sysargs[1],sizeof(struct viewinfo),&vi); pc->retval=0; pc->erno = 0; } break; case VIEWOS_SETVIEWNAME: { if (secure && capcheck(CAP_SYS_ADMIN,pc)) { pc->retval= -1; pc->erno=EPERM; } else { char name[_UTSNAME_LENGTH]; umovestr(pc,pc->sysargs[1],_UTSNAME_LENGTH,name); name[_UTSNAME_LENGTH-1]=0; pcb_setviewname(pc,name); pc->retval=0; pc->erno = 0; } } break; case VIEWOS_KILLALL: killall(pc,pc->sysargs[1]); pc->retval=0; pc->erno = 0; break; case VIEWOS_ATTACH: if (secure && capcheck(CAP_SYS_ADMIN,pc)) { pc->retval= -1; pc->erno=EPERM; } else { pc->retval=capture_attach(pc,pc->sysargs[1]); if (pc->retval < 0) { pc->erno = - pc->retval; pc->retval = -1; } } break; case VIEWOS_FSALIAS: { if (secure && capcheck(CAP_SYS_ADMIN,pc)) { pc->retval= -1; pc->erno=EPERM; } else { char fsalias[256]; char fsname[256]; umovestr(pc,pc->sysargs[1],256,fsalias); umovestr(pc,pc->sysargs[2],256,fsname); add_alias(CHECKFSALIAS,fsalias,fsname); pc->retval=0; pc->erno = 0; } } break; default: pc->retval = -1; pc->erno = ENOSYS; } return SC_FAKE; } int wrap_out_umservice(int sc_number,struct pcb *pc) { putrv(pc->retval,pc); puterrno(pc->erno,pc); return SC_MODICALL; } umview-0.8.2/xmview/um_select.h0000644000175000017500000000177511753517211015576 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_select.h 377 2007-08-28 20:36:16Z garden $ * */ #ifndef _UM_SELECT_H #define _UM_SELECT_H int check_suspend_on(struct pcb *pc, int fd, int how); #endif umview-0.8.2/xmview/defs.h0000644000175000017500000003207211753517211014531 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * defs.h: interfaces to system call arguments (architecture dependant) * needed for capture_um * * Copyright 2005 Renzo Davoli University of Bologna - Italy * Modified 2005 Mattia Belletti, Ludovico Gardenghi, Andrea Gasparini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: defs.h 974 2011-08-08 08:52:20Z rd235 $ * */ #ifndef _DEFS_H #define _DEFS_H #include #include #include #include #include #include #ifdef _VIEWOS_UM # include "ptrace2.h" #endif #include "nrsyscalls.h" #include #include #include #include #include #define umNULL ((long) NULL) #undef SNDRCVMSGUNIFY #ifdef _VIEWOS_UM # define EUMWOULDBLOCK 1024 # if defined(__powerpc__) //setregs/getresg for ppc # define FRAME_SIZE 13 # elif defined(__x86_64__) // asm-x86_64 define it as 168 [offset in bytes] ! # define VIEWOS_FRAME_SIZE 28 # endif # ifndef VIEWOS_FRAME_SIZE # define VIEWOS_FRAME_SIZE FRAME_SIZE # endif #endif #include "pcb.h" #ifdef GDEBUG_ENABLED #include #endif // #define FAKESIGSTOP #ifndef MS_KERNMOUNT #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ #endif #define MS_GHOST MS_KERNMOUNT /* ghost mount */ #ifdef _VIEWOS_KM # define sysargs event.args # define sockargs event.args # define sockaddr event.addr # define sysscno event.scno # define getscno(PC) ( (PC)->event.scno ) # define putscno(X,PC) ( (PC)->event.scno = (X) ) # define getrv(PC) ( (PC)->outevent.retval) # define putrv(RV,PC) ( (PC)->outevent.retval = (RV) ) # define geterrno(PC) ( (PC)->outevent.erno ) # define puterrno(ERR,PC) ( (PC)->outevent.erno = (ERR) ) # define puterrno0(PC) puterrno(0,(PC)) # define getsp(PC) ((PC)->event.sp) # define getpc(PC) ((PC)->event.pc) # define putsp(RV,PC) ( (PC)->event.sp=(RV) ) # define putpc(RV,PC) ( (PC)->event.ps=(RV) ) #endif /* Real SysCalls ! r_ prefixed calls do not enter the nidification * process and go straight to the kernel */ #include typedef long int (*sfun)(long int __sysno, ...); extern sfun native_syscall; #define r_open(p,f,m) (native_syscall(__NR_open,(p),(f),(m))) #define r_read(f,b,c) (native_syscall(__NR_read,(f),(b),(c))) #define r_write(f,b,c) (native_syscall(__NR_write,(f),(b),(c))) #define r_close(f) (native_syscall(__NR_close,(f))) #define r_getdents64(f,b,c) (native_syscall(__NR_getdents64,(f),(b),(c))) #define r_unlink(p) (native_syscall(__NR_unlink,(p))) #define r_dup(f) (native_syscall(__NR_dup,(f))) #define r_dup2(f,g) (native_syscall(__NR_dup2,(f),(g))) #define r_poll(f,n,t) (native_syscall(__NR_poll,(f),(n),(t))) #define r_ppoll(f,n,t,s,l) (native_syscall(__NR_ppoll,(f),(n),(t),(s),(l))) #ifdef __NR__newselect #define r_select(n,r,w,e,t) (native_syscall(__NR__newselect,(n),(r),(w),(e),(t))) #else #define r_select(n,r,w,e,t) (native_syscall(__NR_select,(n),(r),(w),(e),(t))) #endif #define r_pselect6(n,r,w,e,t,m) (native_syscall(__NR_pselect6,(n),(r),(w),(e),(t),(m))) #define r_waitpid(p,s,o) (native_syscall(__NR_wait4,(p),(s),(o),NULL)) #define r_lstat64(p,b) (native_syscall(NR64_lstat,(p),(b))) #define r_readlink(p,b,sz) (native_syscall(__NR_readlink,(p),(b),(sz))) #define r_fcntl(f,c,a) (native_syscall(__NR_fcntl,(f),(c),(a))) #ifdef __NR_fcntl64 #define r_fcntl64(f,c,a) (native_syscall(__NR_fcntl64,(f),(c),(a))) #endif #define r_umask(m) (native_syscall(__NR_umask,(m))) #define r_pipe(v) (native_syscall(__NR_pipe,(v))) #define r_access(p,m) (native_syscall(__NR_access,(p),(m))) #define r_setpriority(w,p,o) (native_syscall(__NR_setpriority,(w),(p),(o))) #define r_setuid(u) (native_syscall(__NR_setresuid,(u),(u),(u))) #define r_getuid() (native_syscall(__NR_getuid)) #define r_getpid() (native_syscall(__NR_getpid)) /* be careful getcwd syscall does not allocate the string for path=NULL */ #define r_getcwd(p,l) (native_syscall(__NR_getcwd,(p),(l))) #define r_mkdir(d,m) (native_syscall(__NR_mkdir,(d),(m))) #define r_rmdir(d) (native_syscall(__NR_rmdir,(d))) #define r_kill(p,s) (native_syscall(__NR_kill,(p),(s))) #define r_execve(p,a,e) (native_syscall(__NR_execve,(p),(a),(e))) #define r_lseek(f,o,w) (native_syscall(__NR_close,(f),(o),(w))) #define r_getresuid(r,e,s) (native_syscall(__NR_getresuid,(r),(e),(s))) #define r_getresgid(r,e,s) (native_syscall(__NR_getresgid,(r),(e),(s))) #if 0 #define r_sigsuspend(m) (native_syscall(__NR_sigsuspend,(m))) #define r_sigaction(s,a,o) (native_syscall(__NR_sigaction,(s),(a),(o))) #define r_sigprocmask(h,s,o) (native_syscall(__NR_sigprocmask,(h),(s),(o))) #endif #if 1 /* rd 20070818 There were these lines in the code instead of the * "bypass lpurelibc" standard r_ call. * who inserted them and why?*/ /* Don't know who and when and why, but it does not work if you change this. */ #define r_sigsuspend(m) (sigsuspend(m)) #define r_sigaction(s,a,o) (sigaction((s),(a),(o))) #define r_sigprocmask(h,s,o) (sigprocmask((h),(s),(o))) #endif #define r_ioctl(...) (native_syscall(__NR_ioctl,__VA_ARGS__)) #define r_fork() (native_syscall(__NR_fork)) #ifdef __NR__llseek #define r_llseek(f,ohi,olo,r,w) (native_syscall(__NR__llseek,(f),(ohi),(olo),(r),(w))) #endif #if defined(__powerpc__) #define r_pread64(f,b,c,o1,o2) (native_syscall(__NR_pread64,(f),(b),(c),0,__LONG_LONG_PAIR((o1),(o2)))) #define r_pwrite64(f,b,c,o1,o2) (native_syscall(__NR_pwrite64,(f),(b),(c),0,__LONG_LONG_PAIR((o1),(o2)))) #else #define r_pread64(f,b,c,o1,o2) (native_syscall(__NR_pread64,(f),(b),(c),__LONG_LONG_PAIR((o1),(o2)))) #define r_pwrite64(f,b,c,o1,o2) (native_syscall(__NR_pwrite64,(f),(b),(c),__LONG_LONG_PAIR((o1),(o2)))) #endif #ifdef __NR_getgroups32 #define r_getgroups(s,g) (native_syscall(__NR_getgroups32,(s),(g))) #define r_setgroups(s,g) (native_syscall(__NR_setgroups32,(s),(g))) #else #define r_getgroups(s,g) (native_syscall(__NR_getgroups,(s),(g))) #define r_setgroups(s,g) (native_syscall(__NR_setgroups,(s),(g))) #endif #define r_ptrace(r,p,a,d) (native_syscall(__NR_ptrace,(r),(p),(a),(d))) #define r_tkill(t,s) (native_syscall(__NR_tkill,(t),(s))) #define r_tgkill(t,g,s) (native_syscall(__NR_tgkill,(t),(g),(s))) /* debugging functions */ #define KERN_EMERG "<0>" /* system is unusable */ #define KERN_ALERT "<1>" /* action must be taken immediately */ #define KERN_CRIT "<2>" /* critical conditions */ #define KERN_ERR "<3>" /* error conditions */ #define KERN_WARNING "<4>" /* warning conditions */ #define KERN_NOTICE "<5>" /* normal but significant condition */ #define KERN_INFO "<6>" /* informational */ #define KERN_DEBUG "<7>" /* debug-level messages */ #define PRINTK_STANDARD_LEVEL 4 #define PRINTK_STARTUP_LEVEL 5 #define PRINTK_QUIET_LEVEL 4 extern int printk(const char *fmt, ...); extern int vprintk(const char *fmt, va_list ap); /* verbosity/quietness */ extern unsigned int quiet; extern unsigned int printk_current_level; /* omnipotent/human */ extern unsigned int secure; #ifdef _VIEWOS_UM /* flags on the underlying kernel support */ extern unsigned int has_ptrace_multi; extern unsigned int ptrace_vm_mask; /* skipexit and some kind of syscall must be implemented */ # define PT_VM_OK ((ptrace_vm_mask & PTRACE_VM_SKIPOK) > PTRACE_VM_SKIPEXIT) extern unsigned int ptrace_sysvm_tag; # define PTRACE_SYSVM (ptrace_sysvm_tag) #endif #define WORDLEN sizeof(int *) #define WORDALIGN(X) (((X) + WORDLEN) & ~(WORDLEN-1)) #define MAX_SOCKET_NAME 1024 #define MAX_SOCKOPT_LEN 4096 #define MAX_SOCK_CONTROLLEN (1<<16) /*64K*/ #define _LARGE_ALLOCA_PROTECTION #ifdef _LARGE_ALLOCA_PROTECTION #define lalloca(L) ({ void *m; if (__builtin_expect(((L)>>16),0)) \ { if ((m=malloc(L))==NULL) \ { pc->retval= -1; pc->erno=ENOMEM; return SC_FAKE; } \ } \ else m=alloca(L); m; }) #define lnalloca(L) ({ void *m; if (__builtin_expect(((L)>>16),0)) \ { if ((m=malloc(L))==NULL) \ { errno=ENOMEM; return -1; } \ } \ else m=alloca(L); m; }) #define lfree(B,L) ({if (__builtin_expect(((L)>>16),0)) free(B); }) #define lfree(B,L) ({if (__builtin_expect(((L)>>16),0)) free(B); }) #else #define lalloca(L) alloca(L) #define lnalloca(L) alloca(L) #define lfree(B,L) #endif /* there is a memory alignment problem in these architectures */ /* long long syscall args are 2 regs aligned */ #if (defined(__powerpc__) && !defined(__powerpc64__)) || (defined (MIPS) && !defined(__mips64)) #define PALIGN 1 #else #define PALIGN 0 #endif #if 0 #ifdef _MALLOC_DEBUG #define free(X) ({ printf("MDBG-FREE %x %s %d\n",(X),__FILE__,__LINE__); \ free(X); }) #define malloc(X) ({ void *x; x=malloc(X); \ printf("MDBG-MALLOC %x %s %d\n",x,__FILE__,__LINE__); \ x; }) #define strdup(X) ({ void *x; x=strdup(X); \ printf("MDBG-STRDUP %x %s %d\n",x,__FILE__,__LINE__); \ x; }) #define realloc(Y,X) ({ void *x,*old; \ old=(Y);\ x=realloc(old,(X)); \ printf("MDBG-REALLOC %x->%x %s %d\n",old,x,__FILE__,__LINE__); \ x; }) #endif #endif void forallpcbdo(voidfun f,void *arg); #ifdef FAKESIGSTOP #define PCB_FAKEWAITSTOP 0x4000 #define PCB_FAKESTOP 0x8000 #endif typedef int (*divfun)(int sc_number,int inout,struct pcb *ppcb); //##################################### // SYSCALL STRANGE STUFF // define __NR_doesnotexist all non-existent syscall // in this way the sequence in scmap is preserved through // different architectures #define __NR_doesnotexist -1 #if defined(__x86_64__) #define NR64_stat __NR_stat #define NR64_lstat __NR_lstat #define NR64_fstat __NR_fstat #else #define NR64_stat __NR_stat64 #define NR64_lstat __NR_lstat64 #define NR64_fstat __NR_fstat64 #endif #ifndef __NR_pselect6 #define __NR_pselect6 __NR_doesnotexist #endif #ifndef __NR_ppoll #define __NR_ppoll __NR_doesnotexist #endif #ifndef __NR_gethostname #define __NR_gethostname __NR_doesnotexist #endif #ifndef __NR_getdomainname #define __NR_getdomainname __NR_doesnotexist #endif /* UNAME HISTORY */ #ifndef __NR_oldolduname #define __NR_oldolduname __NR_doesnotexist #endif #ifndef __NR_olduname #define __NR_olduname __NR_doesnotexist #endif #ifndef __NR_dup3 #define __NR_dup3 __NR_doesnotexist #endif #ifndef __NR_openat #define __NR_openat __NR_doesnotexist #define __NR_mkdirat __NR_doesnotexist #define __NR_mknodat __NR_doesnotexist #define __NR_fchownat __NR_doesnotexist #define __NR_futimesat __NR_doesnotexist #endif #ifndef __NR_utimensat #define __NR_utimensat __NR_doesnotexist #endif #ifndef __NR_getxattr #define __NR_getxattr __NR_doesnotexist #define __NR_lgetxattr __NR_doesnotexist #define __NR_fgetxattr __NR_doesnotexist #define __NR_setxattr __NR_doesnotexist #define __NR_lsetxattr __NR_doesnotexist #define __NR_fsetxattr __NR_doesnotexist #define __NR_listxattr __NR_doesnotexist #define __NR_llistxattr __NR_doesnotexist #define __NR_flistxattr __NR_doesnotexist #define __NR_removexattr __NR_doesnotexist #define __NR_lremovexattr __NR_doesnotexist #define __NR_fremovexattr __NR_doesnotexist #endif #ifndef __NR_preadv #define __NR_preadv __NR_doesnotexist #endif #ifndef __NR_pwritev #define __NR_pwritev __NR_doesnotexist #endif //##################################### // part of defs that's strictly architecture dependent #if defined _VIEWOS_UM # if defined(__i386__) //getregs/setregs and so on, for ia32 # include "defs_i386_um.h" # elif defined(__powerpc__) //setregs/getresg and so on, for ppc # include "defs_ppc_um.h" # elif defined(__x86_64__) //setregs/getresg and so on, for ppc # include "defs_x86_64_um.h" # else # error Unsupported HW Architecure # endif /* architecture */ #elif defined _VIEWOS_KM # if defined(__i386__) //getregs/setregs and so on, for ia32 # include "defs_i386_km.h" # elif defined(__powerpc__) //setregs/getresg and so on, for ppc # include "defs_ppc_km.h" # elif defined(__x86_64__) //setregs/getresg and so on, for ppc # include "defs_x86_64_km.h" # else # error Unsupported HW Architecure # endif /* architecture */ #else # error Unspecified mode (UM/KM) #endif /* XXX should be moved from here! */ struct viewinfo { struct utsname uname; pid_t serverid; viewid_t viewid; char viewname[_UTSNAME_LENGTH]; }; #define __NR_UM_SERVICE 1 #define ADD_SERVICE 0 #define DEL_SERVICE 1 #define MOV_SERVICE 2 #define LIST_SERVICE 3 #define NAME_SERVICE 4 #define LOCK_SERVICE 5 #define RECURSIVE_VIEWOS 0x100 #define VIEWOS_GETINFO 0x101 #define VIEWOS_SETVIEWNAME 0x102 #define VIEWOS_KILLALL 0x103 #define VIEWOS_ATTACH 0x104 #define VIEWOS_FSALIAS 0x105 #endif // _DEFS_H umview-0.8.2/xmview/Makefile.am0000644000175000017500000000516211753517211015473 0ustar renzorenzoDEBUGLEVEL = 10 PCB_MODULES = \ pcb.00.capture.h \ pcb.00.mainpoll.h \ pcb.01.sctab.h \ pcb.02.umproc.h \ pcb.03.mmap.h \ pcb.04.select.h COMMON_SOURCES = \ canonicalize.c canonicalize.h \ capture.h \ capture_nested.c capture_nested.h \ defs.h \ gdebug.c \ mainpoll.c mainpoll.h \ modutils.c modutils.h \ pcb.c pcb.h \ scmap.c scmap.h \ sctab.c sctab.h \ siglist.h \ services.c services.h \ treepoch.c treepoch.h \ uid16to32.h \ um_basicio.c \ um_exec.c \ um_ioctl.c \ um_misc.c \ um_mmap.c \ um_plusio.c \ um_select.c um_select.h \ um_services.c um_services.h \ um_signal.c \ um_socket.c \ um_time.c \ um_uname.c \ um_wdm.c \ umproc.c umproc.h \ utils.h \ loginshell.c loginshell.h \ hashtab.c hashtab.h \ kmview.h # kmview.h must be removed, it will be part of the dev package of the # kmview.ko kernel module bin_PROGRAMS = kmview umview kmview_SOURCES = \ $(COMMON_SOURCES) \ capture_km.c capture_km.h \ defs_i386_km.h defs_ppc_km.h defs_x86_64_km.h \ kmview.c kmview-main.h nodist_kmview_SOURCES = \ pcb-all.h umview_SOURCES = \ $(COMMON_SOURCES) \ capture_um.c capture_um.h \ defs_i386_um.h defs_ppc_um.h defs_x86_64_um.h \ ptrace2.h \ ptrace_multi_test.c ptrace_multi_test.h \ umview.c umview.h \ utils_um.c nodist_umview_SOURCES = \ pcb-all.h EXTRA_DIST = $(PCB_MODULES) kmview_LDADD = -ldl -lpthread umview_LDADD = -ldl -lpthread BUILT_SOURCES = pcb-all.h CLEANFILES = pcb-all.h libexec_PROGRAMS = umbinwrap umbinwrap_SOURCES = \ umbinwrap.c dist_man1_MANS = kmview.1 umview.1 dist_man2_MANS = msocket.2viewos dist_man5_MANS = viewospasswd.5 CBASEFLAGS = -DNDEBUG CDEBUGFLAGS = -g3 -ggdb3 CPPBASEFLAGS = -Wall -I../include -D_GNU_SOURCE -DLIBEXECDIR=\"$(libexecdir)\" -DMODULES_DIR=\"$(pkglibdir)/modules\" -D_UM_MMAP -D_UM_EPOLL CPPDEBUGFLAGS = -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) if ENABLE_DEBUG CFULLFLAGS = $(CBASEFLAGS) $(CDEBUGFLAGS) CPPFULLFLAGS = $(CPPBASEFLAGS) $(CPPDEBUGFLAGS) release: clean $(MAKE) CFULLFLAGS='$(CBASEFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS)' debug: all else CFULLFLAGS = $(CBASEFLAGS) CPPFULLFLAGS = $(CPPBASEFLAGS) release: all debug: clean $(MAKE) CFULLFLAGS='$(CBASEFLAGS) $(CDEBUGFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS) $(CPPDEBUGFLAGS)' endif AM_LDFLAGS = -rdynamic AM_CFLAGS = $(CFULLFLAGS) kmview_CPPFLAGS = $(CPPFULLFLAGS) -D_VIEWOS_KM umview_CPPFLAGS = $(CPPFULLFLAGS) -D_VIEWOS_UM pcb-all.h: $(PCB_MODULES) echo "/* DO NOT EDIT. File Automagically generated */" > pcb-all.h cat $(PCB_MODULES) >> pcb-all.h #ifeq ($(PIVOTING),true) # #syscall_code.c syscall_code.h: compile_code.sh # ./compile_code.sh syscall_code.h syscall_code.c # #endif umview-0.8.2/xmview/um_services.h0000644000175000017500000000211311753517211016125 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_services.h: system call access to services * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_services.h 775 2009-09-01 21:15:23Z rd235 $ * */ #ifndef _UM_SERVICES_H #define _UM_SERVICES_H char *get_alias(int type,char *fsalias); //void *open_dllib(char *name); #endif umview-0.8.2/umnet_modules/0000755000175000017500000000000011753517351015001 5ustar renzorenzoumview-0.8.2/umnet_modules/Makefile.in0000644000175000017500000004466011753517330017055 0ustar renzorenzo# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/modules-common.mk subdir = umnet_modules ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moddir)" LTLIBRARIES = $(mod_LTLIBRARIES) umnetcurrent_la_LIBADD = umnetcurrent_la_SOURCES = umnetcurrent.c umnetcurrent_la_OBJECTS = umnetcurrent.lo umnetlink_la_LIBADD = umnetlink_la_SOURCES = umnetlink.c umnetlink_la_OBJECTS = umnetlink.lo umnetnull_la_LIBADD = umnetnull_la_SOURCES = umnetnull.c umnetnull_la_OBJECTS = umnetnull.lo DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = umnetcurrent.c umnetlink.c umnetnull.c DIST_SOURCES = umnetcurrent.c umnetlink.c umnetnull.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB20_CFLAGS = @GLIB20_CFLAGS@ GLIB20_LIBS = @GLIB20_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = ../um_lib/libumlib.la LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DEBUGLEVEL = 3 moddir = $(pkglibdir)/modules CBASEFLAGS = CDEBUGFLAGS = -g3 -ggdb3 CPPBASEFLAGS = -I../include -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CPPDEBUGFLAGS = -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) @ENABLE_DEBUG_FALSE@CFULLFLAGS = $(CBASEFLAGS) @ENABLE_DEBUG_TRUE@CFULLFLAGS = $(CBASEFLAGS) $(CDEBUGFLAGS) @ENABLE_DEBUG_FALSE@CPPFULLFLAGS = $(CPPBASEFLAGS) @ENABLE_DEBUG_TRUE@CPPFULLFLAGS = $(CPPBASEFLAGS) $(CPPDEBUGFLAGS) AM_CFLAGS = $(CFULLFLAGS) AM_CPPFLAGS = $(CPPFULLFLAGS) AM_LDFLAGS = -module -avoid-version -export-dynamic AM_LIBTOOLFLAGS = --tag=disable-static mod_LTLIBRARIES = umnetnull.la umnetcurrent.la umnetlink.la all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/modules-common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign umnet_modules/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign umnet_modules/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/modules-common.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-modLTLIBRARIES: $(mod_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(moddir)" || $(MKDIR_P) "$(DESTDIR)$(moddir)" @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moddir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moddir)"; \ } uninstall-modLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moddir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moddir)/$$f"; \ done clean-modLTLIBRARIES: -test -z "$(mod_LTLIBRARIES)" || rm -f $(mod_LTLIBRARIES) @list='$(mod_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done umnetcurrent.la: $(umnetcurrent_la_OBJECTS) $(umnetcurrent_la_DEPENDENCIES) $(EXTRA_umnetcurrent_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(umnetcurrent_la_OBJECTS) $(umnetcurrent_la_LIBADD) $(LIBS) umnetlink.la: $(umnetlink_la_OBJECTS) $(umnetlink_la_DEPENDENCIES) $(EXTRA_umnetlink_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(umnetlink_la_OBJECTS) $(umnetlink_la_LIBADD) $(LIBS) umnetnull.la: $(umnetnull_la_OBJECTS) $(umnetnull_la_DEPENDENCIES) $(EXTRA_umnetnull_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(umnetnull_la_OBJECTS) $(umnetnull_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umnetcurrent.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umnetlink.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umnetnull.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(moddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-modLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-modLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-modLTLIBRARIES .MAKE: install-am install-data-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-modLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-modLTLIBRARIES install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-modLTLIBRARIES @ENABLE_DEBUG_TRUE@release: clean @ENABLE_DEBUG_TRUE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS)' @ENABLE_DEBUG_TRUE@debug: all @ENABLE_DEBUG_FALSE@release: all @ENABLE_DEBUG_FALSE@debug: clean @ENABLE_DEBUG_FALSE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS) $(CDEBUGFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS) $(CPPDEBUGFLAGS)' install-data-hook: cd "$(DESTDIR)/$(moddir)" && rm -f $(mod_LTLIBRARIES) debug release: all # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: umview-0.8.2/umnet_modules/umnetnative.c0000644000175000017500000000667511753517211017515 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMNETNATIVE: Virtual Native Network * Copyright (C) 2008 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include "umnet.h" static int umnetnative_ioctlparms(int fd, int req, struct umnet *nethandle) { switch (req) { case FIONREAD: return sizeof(int) | IOCTL_W; case FIONBIO: return sizeof(int) | IOCTL_R; case SIOCGIFCONF: return sizeof(struct ifconf) | IOCTL_R | IOCTL_W; case SIOCGSTAMP: return sizeof(struct timeval) | IOCTL_W; case SIOCGIFTXQLEN: return sizeof(struct ifreq) | IOCTL_R | IOCTL_W; case SIOCGIFFLAGS: case SIOCGIFADDR: case SIOCGIFDSTADDR: case SIOCGIFBRDADDR: case SIOCGIFNETMASK: case SIOCGIFMETRIC: case SIOCGIFMEM: case SIOCGIFMTU: case SIOCGIFHWADDR: case SIOCGIFINDEX: return sizeof(struct ifreq) | IOCTL_R | IOCTL_W; case SIOCSIFFLAGS: case SIOCSIFADDR: case SIOCSIFDSTADDR: case SIOCSIFBRDADDR: case SIOCSIFNETMASK: case SIOCSIFMETRIC: case SIOCSIFMEM: case SIOCSIFMTU: case SIOCSIFHWADDR: return sizeof(struct ifreq) | IOCTL_R; default: return 0; } } int umnetnative_msocket (int domain, int type, int protocol, struct umnet *nethandle){ return msocket(NULL,domain, type, protocol); } int umnetnative_init (char *source, char *mountpoint, unsigned long flags, char *args, struct umnet *nethandle) { return 0; } int umnetnative_fini (struct umnet *nethandle){ return 0; } int um_mod_event_subscribe(void (* cb)(), void *arg, int fd, int how); static int umnetnative_ioctl(int d, int request, void *arg) { if (request == SIOCGIFCONF) { int rv; void *save; struct ifconf *ifc=(struct ifconf *)arg; save=ifc->ifc_buf; ioctl(d,request,arg); ifc->ifc_buf=malloc(ifc->ifc_len); um_mod_umoven((long) save,ifc->ifc_len,ifc->ifc_buf); rv=ioctl(d,request,arg); if (rv>=0) um_mod_ustoren((long) save,ifc->ifc_len,ifc->ifc_buf); free(ifc->ifc_buf); ifc->ifc_buf=save; return rv; } return ioctl(d,request,arg); } struct umnet_operations umnet_ops={ .msocket=umnetnative_msocket, .bind=bind, .connect=connect, .listen=listen, .accept=accept, .getsockname=getsockname, .getpeername=getpeername, .send=send, .sendto=sendto, .recvfrom=recvfrom, .sendmsg=sendmsg, .recvmsg=recvmsg, .getsockopt=getsockopt, .setsockopt=setsockopt, .read=read, .write=write, .ioctl=umnetnative_ioctl, .close=close, .ioctlparms=umnetnative_ioctlparms, .init=umnetnative_init, .fini=umnetnative_fini, .event_subscribe=um_mod_event_subscribe }; umview-0.8.2/umnet_modules/umnetnull.c0000644000175000017500000000262311753517211017166 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMMISCNONE: Virtual Null Network * Copyright (C) 2008 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include "umnet.h" int umnetnull_msocket (int domain, int type, int protocol, struct umnet *nethandle){ errno=EAFNOSUPPORT; return -1; } int umnetnull_init (char *source, char *mountpoint, unsigned long flags, char *args, struct umnet *nethandle) { return 0; } int umnetnull_fini (struct umnet *nethandle){ return 0; } struct umnet_operations umnet_ops={ .msocket=umnetnull_msocket, .init=umnetnull_init, .fini=umnetnull_fini, }; umview-0.8.2/umnet_modules/umnetlink.c0000644000175000017500000001405111753517211017147 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMNETNATIVE: Virtual Native Network * Copyright (C) 2008 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include "umnet.h" #define UMNETLINK_OVERRIDE 1 struct umnetlink { char *source; char *mountpoint; char flags; char proto[AF_MAXMAX]; }; static int umnetlink_ioctlparms(int fd, int req, struct umnet *nethandle) { switch (req) { case FIONREAD: return sizeof(int) | IOCTL_W; case FIONBIO: return sizeof(int) | IOCTL_R; case SIOCGIFCONF: return sizeof(struct ifconf) | IOCTL_R | IOCTL_W; case SIOCGSTAMP: return sizeof(struct timeval) | IOCTL_W; case SIOCGIFFLAGS: case SIOCGIFADDR: case SIOCGIFDSTADDR: case SIOCGIFBRDADDR: case SIOCGIFNETMASK: case SIOCGIFMETRIC: case SIOCGIFMEM: case SIOCGIFMTU: case SIOCGIFHWADDR: case SIOCGIFINDEX: case SIOCGIFTXQLEN: return sizeof(struct ifreq) | IOCTL_R | IOCTL_W; case SIOCSIFFLAGS: case SIOCSIFADDR: case SIOCSIFDSTADDR: case SIOCSIFBRDADDR: case SIOCSIFNETMASK: case SIOCSIFMETRIC: case SIOCSIFMEM: case SIOCSIFMTU: case SIOCSIFHWADDR: case SIOCSIFTXQLEN: return sizeof(struct ifreq) | IOCTL_R; default: return 0; } } static int umnetlink_ioctl(int d, int request, void *arg) { if (request == SIOCGIFCONF) { int rv; void *save; struct ifconf *ifc=(struct ifconf *)arg; save=ifc->ifc_buf; ioctl(d,request,arg); ifc->ifc_buf=malloc(ifc->ifc_len); um_mod_umoven((long) save,ifc->ifc_len,ifc->ifc_buf); rv=ioctl(d,request,arg); if (rv>=0) um_mod_ustoren((long) save,ifc->ifc_len,ifc->ifc_buf); free(ifc->ifc_buf); ifc->ifc_buf=save; return rv; } return ioctl(d,request,arg); } int umnetlink_msocket (int domain, int type, int protocol, struct umnet *nethandle){ struct umnetlink *umnl=umnet_getprivatedata(nethandle); if (domain > 0 && domain <= AF_MAXMAX && umnl->proto[domain]) return msocket(umnl->source,domain, type, protocol); else { if (umnl->flags & UMNETLINK_OVERRIDE) return msocket(umnl->mountpoint,domain, type, protocol); else return msocket(NULL,domain, type, protocol); } } static uint32_t hash4(char *s) { uint32_t result=0; uint32_t wrap=0; while (*s) { wrap = result >> 24; result <<= 8; result |= (*s ^ wrap); s++; } return result; } static void umnetlink_setproto(char *args,char *proto,char *flags) { char *str, *token, *saveptr; int i,val=1; if (args[0] == '+' || (args[0] == '-' && args[1] == 0)) { for (i=0; i 0 && family < AF_MAXMAX) proto[family]=val; else printk("umnetlink: unknown protocol \"%s\"\n",token); } else printk("umnetlink: unknown protocol \"%s\"\n",token); break; } } } int umnetlink_init (char *source, char *mountpoint, unsigned long flags, char *args, struct umnet *nethandle) { if (source != NULL) { struct umnetlink *umnl=calloc(1,sizeof(struct umnetlink)); umnl->source=strdup(source); umnl->mountpoint=strdup(mountpoint); umnet_setprivatedata(nethandle,umnl); if (args) umnetlink_setproto(args,umnl->proto,&(umnl->flags)); else { int i; for (i=0;iproto[i]=1; } return 0; } else return -1; } int umnetlink_fini (struct umnet *nethandle){ struct umnetlink *umnl=umnet_getprivatedata(nethandle); free(umnl->source); free(umnl->mountpoint); free(umnl); return 0; } int um_mod_event_subscribe(void (* cb)(), void *arg, int fd, int how); struct umnet_operations umnet_ops={ .msocket=umnetlink_msocket, .bind=bind, .connect=connect, .listen=listen, .accept=accept, .getsockname=getsockname, .getpeername=getpeername, .send=send, .sendto=sendto, .recvfrom=recvfrom, .sendmsg=sendmsg, .recvmsg=recvmsg, .getsockopt=getsockopt, .setsockopt=setsockopt, .read=read, .write=write, .ioctl=umnetlink_ioctl, .close=close, .ioctlparms=umnetlink_ioctlparms, .init=umnetlink_init, .fini=umnetlink_fini, .event_subscribe=um_mod_event_subscribe }; umview-0.8.2/umnet_modules/Makefile.am0000644000175000017500000000014611753517211017031 0ustar renzorenzoinclude $(top_srcdir)/modules-common.mk mod_LTLIBRARIES = umnetnull.la umnetcurrent.la umnetlink.la umview-0.8.2/umnet_modules/umnetcurrent.c0000644000175000017500000000674711753517211017711 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMNETNATIVE: Virtual Native Network * Copyright (C) 2008 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "umnet.h" static int umnetnative_ioctlparms(int fd, int req, struct umnet *nethandle) { switch (req) { case FIONREAD: return sizeof(int) | IOCTL_W; case FIONBIO: return sizeof(int) | IOCTL_R; case SIOCGIFCONF: return sizeof(struct ifconf) | IOCTL_R | IOCTL_W; case SIOCGSTAMP: return sizeof(struct timeval) | IOCTL_W; case SIOCGIFTXQLEN: return sizeof(struct ifreq) | IOCTL_R | IOCTL_W; case SIOCGIFFLAGS: case SIOCGIFADDR: case SIOCGIFDSTADDR: case SIOCGIFBRDADDR: case SIOCGIFNETMASK: case SIOCGIFMETRIC: case SIOCGIFMEM: case SIOCGIFMTU: case SIOCGIFHWADDR: case SIOCGIFINDEX: return sizeof(struct ifreq) | IOCTL_R | IOCTL_W; case SIOCSIFFLAGS: case SIOCSIFADDR: case SIOCSIFDSTADDR: case SIOCSIFBRDADDR: case SIOCSIFNETMASK: case SIOCSIFMETRIC: case SIOCSIFMEM: case SIOCSIFMTU: case SIOCSIFHWADDR: return sizeof(struct ifreq) | IOCTL_R; default: return 0; } } int umnetnative_msocket (int domain, int type, int protocol, struct umnet *nethandle){ return msocket(NULL,domain, type, protocol); } int umnetnative_init (char *source, char *mountpoint, unsigned long flags, char *args, struct umnet *nethandle) { return 0; } int umnetnative_fini (struct umnet *nethandle){ return 0; } int um_mod_event_subscribe(void (* cb)(), void *arg, int fd, int how); static int umnetnative_ioctl(int d, int request, void *arg) { if (request == SIOCGIFCONF) { int rv; void *save; struct ifconf *ifc=(struct ifconf *)arg; save=ifc->ifc_buf; ioctl(d,request,arg); ifc->ifc_buf=malloc(ifc->ifc_len); um_mod_umoven((long) save,ifc->ifc_len,ifc->ifc_buf); rv=ioctl(d,request,arg); if (rv>=0) um_mod_ustoren((long) save,ifc->ifc_len,ifc->ifc_buf); free(ifc->ifc_buf); ifc->ifc_buf=save; return rv; } return ioctl(d,request,arg); } struct umnet_operations umnet_ops={ .msocket=umnetnative_msocket, .bind=bind, .connect=connect, .listen=listen, .accept=accept, .getsockname=getsockname, .getpeername=getpeername, .send=send, .sendto=sendto, .recvfrom=recvfrom, .sendmsg=sendmsg, .recvmsg=recvmsg, .getsockopt=getsockopt, .setsockopt=setsockopt, .read=read, .write=write, .ioctl=umnetnative_ioctl, .close=close, .fcntl=(void *)fcntl, .ioctlparms=umnetnative_ioctlparms, .init=umnetnative_init, .fini=umnetnative_fini, .event_subscribe=um_mod_event_subscribe }; umview-0.8.2/m4/0000755000175000017500000000000011753517351012441 5ustar renzorenzoumview-0.8.2/m4/lt~obsolete.m40000644000175000017500000001375611753517317015273 0ustar renzorenzo# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) umview-0.8.2/m4/ltversion.m40000644000175000017500000000126211753517317014733 0ustar renzorenzo# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) umview-0.8.2/m4/ltsugar.m40000644000175000017500000001042411753517317014367 0ustar renzorenzo# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) umview-0.8.2/m4/ltoptions.m40000644000175000017500000003007311753517317014743 0ustar renzorenzo# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) umview-0.8.2/m4/libtool.m40000644000175000017500000106043411753517317014361 0ustar renzorenzo# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS umview-0.8.2/umdev/0000755000175000017500000000000011753517351013241 5ustar renzorenzoumview-0.8.2/umdev/Makefile.in0000644000175000017500000004342711753517330015315 0ustar renzorenzo# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/modules-common.mk subdir = umdev ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moddir)" LTLIBRARIES = $(mod_LTLIBRARIES) umdev_la_LIBADD = umdev_la_SOURCES = umdev.c umdev_la_OBJECTS = umdev.lo umdev_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(umdev_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = umdev.c DIST_SOURCES = umdev.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB20_CFLAGS = @GLIB20_CFLAGS@ GLIB20_LIBS = @GLIB20_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = ../um_lib/libumlib.la LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DEBUGLEVEL = 3 moddir = $(pkglibdir)/modules CBASEFLAGS = CDEBUGFLAGS = -g3 -ggdb3 CPPBASEFLAGS = -I../include -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CPPDEBUGFLAGS = -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) @ENABLE_DEBUG_FALSE@CFULLFLAGS = $(CBASEFLAGS) @ENABLE_DEBUG_TRUE@CFULLFLAGS = $(CBASEFLAGS) $(CDEBUGFLAGS) @ENABLE_DEBUG_FALSE@CPPFULLFLAGS = $(CPPBASEFLAGS) @ENABLE_DEBUG_TRUE@CPPFULLFLAGS = $(CPPBASEFLAGS) $(CPPDEBUGFLAGS) AM_CFLAGS = $(CFULLFLAGS) AM_CPPFLAGS = $(CPPFULLFLAGS) AM_LDFLAGS = -module -avoid-version -export-dynamic AM_LIBTOOLFLAGS = --tag=disable-static #DEVELFLAGS=-D__UMDEV_DEBUG__ mod_LTLIBRARIES = umdev.la umdev_la_LDFLAGS = $(AM_LDFLAGS) -lpthread all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/modules-common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign umdev/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign umdev/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/modules-common.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-modLTLIBRARIES: $(mod_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(moddir)" || $(MKDIR_P) "$(DESTDIR)$(moddir)" @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moddir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moddir)"; \ } uninstall-modLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moddir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moddir)/$$f"; \ done clean-modLTLIBRARIES: -test -z "$(mod_LTLIBRARIES)" || rm -f $(mod_LTLIBRARIES) @list='$(mod_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done umdev.la: $(umdev_la_OBJECTS) $(umdev_la_DEPENDENCIES) $(EXTRA_umdev_la_DEPENDENCIES) $(umdev_la_LINK) -rpath $(moddir) $(umdev_la_OBJECTS) $(umdev_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umdev.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(moddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-modLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-modLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-modLTLIBRARIES .MAKE: install-am install-data-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-modLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-modLTLIBRARIES install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-modLTLIBRARIES @ENABLE_DEBUG_TRUE@release: clean @ENABLE_DEBUG_TRUE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS)' @ENABLE_DEBUG_TRUE@debug: all @ENABLE_DEBUG_FALSE@release: all @ENABLE_DEBUG_FALSE@debug: clean @ENABLE_DEBUG_FALSE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS) $(CDEBUGFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS) $(CPPDEBUGFLAGS)' install-data-hook: cd "$(DESTDIR)/$(moddir)" && rm -f $(mod_LTLIBRARIES) debug release: all # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: umview-0.8.2/umdev/umdev.c0000644000175000017500000005313011753517211014522 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMDEV: Virtual Device in Userspace * Copyright (C) 2006 Renzo Davoli * from an idea of Andrea Gasparini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: umdev.c 969 2011-08-03 13:44:08Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "module.h" #include "libummod.h" #include "umdev.h" //static pthread_mutex_t devicetab_mutex = PTHREAD_MUTEX_INITIALIZER; /* Enable umdev own debug output */ //#define __UMDEV_DEBUG__ 1 /* it is better to enable it from makefile */ #ifndef __UMDEV_DEBUG_LEVEL__ #define __UMDEV_DEBUG_LEVEL__ 0 #endif #ifdef __UMDEV_DEBUG__ #define PRINTDEBUG(level,args...) printdebug(level, __FILE__, __LINE__, __func__, args) #else #define PRINTDEBUG(level,args...) #endif static struct service s; VIEWOS_SERVICE(s) struct umdev { char *path; void *dlhandle; struct timestamp tst; dev_t dev; mode_t mode; uid_t uid; gid_t gid; int nsubdev; struct umdev_operations *devops; int inuse; unsigned long flags; struct ht_elem *devht; void *private_data; }; struct fileinfo { char type; dev_t device; uint64_t fh; int count; /* number of processes that opened the file */ loff_t pos; /* file offset */ struct umdev *umdev; }; #ifdef __UMDEV_DEBUG__ static void printdebug(int level, const char *file, const int line, const char *func, const char *fmt, ...) { va_list ap; if (level >= __UMDEV_DEBUG_LEVEL__) { va_start(ap, fmt); #ifdef _PTHREAD_H printk( "[%d:%lu] dev %s:%d %s(): ", getpid(), pthread_self(), file, line, func); #else printk( "[%d] dev %s:%d %s(): ", getpid(), file, line, func); #endif vprintk(fmt, ap); printk( "\n"); va_end(ap); } } #endif static int umdev_confirm(int type, void *arg, int arglen, struct ht_elem *ht) { char *path=arg; struct umdev *fc=ht_get_private_data(ht); char *suffix=path+strlen(fc->path); //printk("umdev_confirm path %s suffix %s\n",path,suffix); int sub=atoi(suffix); if (sub <= fc->nsubdev) return 1; else return 0; } static int umdev_confirm_dev(int type, void *arg, int arglen, struct ht_elem *ht) { dev_t *dev=arg; struct umdev *fc=ht_get_private_data(ht); if (major(fc->dev) == major(*dev) && (minor(fc->dev) == -1 || (minor(fc->dev) <= minor(*dev) && minor(fc->dev)+fc->nsubdev >= minor(*dev)))) return 1; else return 0; } static inline int mode2char(mode_t mode) { if (S_ISCHR(mode)) return 'c'; else if (S_ISBLK(mode)) return 'b'; else return ' '; } static int set_dev(dev_t *dev, struct umdev *umdev,char *path) { mode_t mode; struct stat64 buf; *dev=0; if (stat64(path,&buf) >= 0 && (S_ISCHR(buf.st_mode) || S_ISBLK(buf.st_mode))) { *dev=buf.st_rdev; } else { if (strlen(path) > strlen(umdev->path)) *dev=makedev(major(umdev->dev),minor(umdev->dev)+atoi(path+strlen(umdev->path))); else *dev= umdev->dev; } mode= umdev->mode; //printk("SET_DEV %s %x %d %d\n",path,mode,major(*dev),minor(*dev)); return mode2char(mode); } #define MAXARGS 256 static void debugfun(char *s,struct umdev *fc) { #ifdef DEBUGUMDEVARGS printk("DEBUG\n"); #endif fc->flags |= UMDEV_DEBUG; } static void charfun(char *s,struct umdev *fc) { fc->mode=(fc->mode & ~S_IFMT) | S_IFCHR; #ifdef DEBUGUMDEVARGS printk("CHAR %o\n",fc->mode); #endif } static void blockfun(char *s,struct umdev *fc) { fc->mode=(fc->mode & ~S_IFMT) | S_IFBLK; #ifdef DEBUGUMDEVARGS printk("BLK %o\n",fc->mode); #endif } static void majorfun(char *s,struct umdev *fc) { int majx,minx; #ifdef DEBUGUMDEVARGS printk("MAJ %s\n",s); #endif majx=atoi(s); minx=minor(fc->dev); fc->dev=makedev(majx,minx); } static void minorfun(char *s,struct umdev *fc) { int majx,minx; #ifdef DEBUGUMDEVARGS printk("MIN %s\n",s); #endif majx=major(fc->dev); if (strcmp(s,"any")==0) minx = -1; else minx=atoi(s); fc->dev=makedev(majx,minx); } static void plusnum(char *s,struct umdev *fc) { #ifdef DEBUGUMDEVARGS printk("PLUSNUM %s\n",s); #endif fc->nsubdev=atoi(s); } static void modefun(char *s,struct umdev *fc) { int mode; sscanf(s,"%o",&mode); fc->mode=(fc->mode & S_IFMT) | (mode & 0777); #ifdef DEBUGUMDEVARGS printk("MODE %o %o\n",mode,fc->mode); #endif } static void uidfun(char *s,struct umdev *fc) { #ifdef DEBUGUMDEVARGS printk("UID %s\n",s); #endif fc->uid=atoi(s); } static void gidfun(char *s,struct umdev *fc) { #ifdef DEBUGUMDEVARGS printk("GID %s\n",s); #endif fc->gid=atoi(s); } void devargs(char *opts, struct devargitem *devargtab, int devargsize, void *arg) { char *sepopts[MAXARGS]; int nsepopts=0; int i; char *optcopy=strdup(opts); char *s=optcopy; char quote=0,olds; #ifdef DEBUGUMDEVARGS printk("devargs opts %s\n",s); #endif /* PHASE 1: tokenize options */ for (quote=0,s=opts,olds=*s;olds != 0 && nsepopts < MAXARGS;s++) { sepopts[nsepopts++]=s; while (*s != 0 && (*s != ',' || quote != 0)) { if (*s=='\\' && *(s+1)!=0) s+=2; if (*s=='\'' || *s=='\"') { if (*s == quote) quote=0; else if (quote==0) quote=*s; } s++; } olds=*s;*s=0; } #ifdef DEBUGUMDEVARGS for (i=0;i"); if(dlhandle == NULL || (umdev_ops=dlsym(dlhandle,"umdev_ops")) == NULL) { printk("%s\n",dlerror()); if(dlhandle != NULL) dlclose(dlhandle); errno=ENODEV; return -1; } else { struct umdev *new = (struct umdev *) malloc(sizeof(struct umdev)); struct stat64 *s64; assert(new); s64=um_mod_getpathstat(); new->path = strdup(target); new->mode = S_IFCHR | 0600; new->uid = getuid(); new->gid = getgid(); new->dev = 0; if (s64) { new->dev = s64->st_rdev; if (S_ISCHR(s64->st_mode) | S_ISBLK (s64->st_mode)) new->mode = (s64->st_mode & S_IFMT) | 0600; } new->dlhandle = dlhandle; new->devops = umdev_ops; new->nsubdev = 0; new->inuse = 0; new->flags = 0; new->private_data = NULL; if(data) { char *datacopy=strdup(data); devargs(datacopy, umdevargtab, UMDEVARGTABSIZE, new); free(datacopy); } if (umdev_ops->init) { if (umdev_ops->init(mode2char(new->mode),new->dev,source, mountflags,data?data:"", new) < 0) { free(new->path); free(new); errno=EINVAL; return -1; } } ht_tab_pathadd(CHECKPATH,source,target,filesystemtype,mountflags,data,&s,1,umdev_confirm,new); new->devht=NULL; if (new->dev) { if (S_ISCHR(new->mode)) new->devht=ht_tab_add(CHECKCHRDEVICE,NULL,0,&s,umdev_confirm_dev,new); else if (S_ISBLK(new->mode)) new->devht=ht_tab_add(CHECKBLKDEVICE,NULL,0,&s,umdev_confirm_dev,new); } return 0; } } static void umdev_umount_internal(struct umdev *fc,int flags) { char *target=fc->path; ht_tab_invalidate(um_mod_get_hte()); if (fc->devht) ht_tab_invalidate(fc->devht); if (fc->flags & UMDEV_DEBUG) printk("UMOUNT => path:%s flag:%d\n",target, flags); if (fc->devops->fini) fc->devops->fini(mode2char(fc->mode),fc->dev,fc); free(fc->path); dlclose(fc->dlhandle); free(fc); } static long umdev_umount2(char *target, int flags) { struct umdev *fc; fc = um_mod_get_private_data(); if (fc == NULL) { errno=EINVAL; return -1; } else if (fc->inuse){ /* TODO FORCE flag */ errno=EBUSY; return -1; } else { struct ht_elem *devht=fc->devht; umdev_umount_internal(fc,flags); ht_tab_del(um_mod_get_hte()); if (devht) ht_tab_del(devht); return 0; } } static void umdev_destructor(int type,struct ht_elem *mp) { switch (type) { case CHECKPATH: um_mod_set_hte(mp); umdev_umount_internal(um_mod_get_private_data(), MNT_FORCE); } } static long umdev_ioctlparms(int fd,int req) { struct fileinfo *ft=getfiletab(fd); if (ft->umdev->devops->ioctlparms) { struct dev_info di; di.fh = ft->fh; di.flags = ft->umdev->flags; di.devhandle=ft->umdev; return ft->umdev->devops->ioctlparms( ft->type, ft->device, req, &di); } else return 0; } static long umdev_open(char *path, int flags, mode_t mode) { struct umdev *fc = um_mod_get_private_data(); struct dev_info di; int fd = addfiletab(sizeof(struct fileinfo)); struct fileinfo *ft=getfiletab(fd); int rv; assert(fc!=NULL); #ifdef __UMDEV_DEBUG__ PRINTDEBUG(10,"FLAGOPEN path:%s \nFLAGS:0x%x MODE:%d\n",path,flags,mode); if(flags & O_CREAT) PRINTDEBUG(10, "O_CREAT\n"); if(flags & O_TRUNC) PRINTDEBUG(10, "O_TRUNC\n"); if(flags & O_RDONLY) PRINTDEBUG(10, "O_RDONLY:\n"); if(flags & O_APPEND) PRINTDEBUG(10, "O_APPEND\n"); if(flags & O_WRONLY) PRINTDEBUG(10, "O_WRONLY\n"); if(flags & O_RDWR) PRINTDEBUG(10, "O_RDWR\n"); if(flags & O_ASYNC) PRINTDEBUG(10, "O_ASYNC\n"); if(flags & O_DIRECT) PRINTDEBUG(10, "O_DIRECT\n"); if(flags & O_DIRECTORY) PRINTDEBUG(10, "O_DIRECTORY\n"); if(flags & O_EXCL) PRINTDEBUG(10, "O_EXCL\n"); if(flags & O_LARGEFILE) PRINTDEBUG(10, "O_LARGEFILE\n"); if(flags & O_DIRECT) PRINTDEBUG(10, "O_NOATIME\n"); if(flags & O_DIRECTORY) PRINTDEBUG(10, "O_NOCTTY\n"); if(flags & O_EXCL) PRINTDEBUG(10, "O_NOCTTY\n"); if(flags & O_NOFOLLOW) PRINTDEBUG(10, "O_NOFOLLOW\n"); if(flags & (O_NONBLOCK | O_NDELAY)) PRINTDEBUG(10, "O_NONBLOCK o O_NDELAY\n"); if(flags & O_SYNC) PRINTDEBUG(10, "SYNC\n"); #endif ft->count = 0; ft->pos = 0; //ft->size = buf.st_size; /* SIZE OF device? */ di.flags = flags & ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); di.fh = 0; di.devhandle=fc; ft->type=set_dev(&ft->device,fc,path); ft->umdev=fc; if (fc->devops->open) rv = fc->devops->open(ft->type, ft->device, &di); else rv=0; ft->fh=di.fh; if (rv < 0) { if (fc->flags & UMDEV_DEBUG) printk("OPEN[%d: %c(%d,%d)] ERROR => path:%s flags:0x%x\n", fd, ft->type, major(ft->device), minor(ft->device), path, flags); delfiletab(fd); errno = -rv; return -1; } else { ft->count += 1; if (fc->flags & UMDEV_DEBUG) printk("OPEN[%d: %c(%d:%d)] => path:%s flags:0x%x\n", fd, ft->type, major(ft->device), minor(ft->device), path, flags); fc->inuse++; return fd; } } static long umdev_close(int fd) { int rv; struct fileinfo *ft=getfiletab(fd); struct dev_info di; di.fh = ft->fh; di.flags = ft->umdev->flags; di.devhandle=ft->umdev; if (ft->umdev->flags & UMDEV_DEBUG) printk("CLOSE[%d %c(%d:%d)] %p\n",fd, ft->type, major(ft->device), minor(ft->device),ft); ft->count--; PRINTDEBUG(10,"->CLOSE %c(%d:%d) %d\n", ft->type, major(ft->device), minor(ft->device), ft->count); if (ft->count == 0) { ft->umdev->inuse--; if (ft->umdev->devops->release) rv=ft->umdev->devops->release(ft->type, ft->device, &di); else rv=0; if (ft->umdev->flags & UMDEV_DEBUG) printk("RELEASE[%d %c(%d:%d)] => flags:0x%x rv=%d\n", fd, ft->type, major(ft->device), minor(ft->device), ft->umdev->flags,rv); delfiletab(fd); } if (rv<0) { errno= -rv; return -1; } else { return rv; } } static long umdev_read(int fd, void *buf, size_t count) { int rv; struct fileinfo *ft=getfiletab(fd); struct dev_info di; di.fh = ft->fh; di.flags = 0; di.devhandle=ft->umdev; if (ft->umdev->devops->read) rv = ft->umdev->devops->read( ft->type, ft->device, buf, count, ft->pos, &di); else rv= -EINVAL; if (ft->umdev->flags & UMDEV_DEBUG) printk("READ[%d %c(%d:%d)] => count:%u\n", fd, ft->type, major(ft->device), minor(ft->device), count); if (rv<0) { errno= -rv; return -1; } else { ft->pos += rv; return rv; } } static long umdev_write(int fd, void *buf, size_t count) { int rv; struct fileinfo *ft=getfiletab(fd); struct dev_info di; di.fh = ft->fh; di.flags = 0; di.devhandle=ft->umdev; if(ft->umdev->devops->write) { rv = ft->umdev->devops->write( ft->type, ft->device, buf, count, ft->pos, &di); } else rv= -EINVAL; if (ft->umdev->flags & UMDEV_DEBUG) printk("WRITE[%d %c(%d:%d)] => count:0x%x\n", fd, ft->type, major(ft->device), minor(ft->device), count); PRINTDEBUG(10,"WRITE rv:%d\n",rv); if (rv<0) { errno= -rv; return -1; } else { ft->pos += rv; return rv; } } static inline int common_stat64(struct umdev *fc, char type, dev_t device, struct stat64 *buf64) { int rv; assert(fc != NULL); memset(buf64, 0, sizeof(struct stat64)); if(fc->devops->getattr) rv = fc->devops->getattr(type, device,buf64,fc); else { memset(buf64,0,sizeof(struct stat64)); buf64->st_mode=fc->mode; buf64->st_rdev=device; buf64->st_uid=fc->uid; buf64->st_gid=fc->gid; rv=0; } if (fc->flags & UMDEV_DEBUG) printk("stat->GETATTR %c(%d:%d) => status: %s\n", type, major(device), minor(device), rv ? "Error" : "Success"); if (rv<0) { errno= -rv; return -1; } else return rv; } static long umdev_lstat64(char *path, struct stat64 *buf64) { dev_t device; int type; struct umdev *umdev=um_mod_get_private_data(); type=set_dev(&device,umdev,path); return common_stat64(umdev,type,device,buf64); } static long umdev_access(char *path, int mode) { struct umdev *fc=um_mod_get_private_data(); int rv; dev_t device; int type; type=set_dev(&device,fc,path); assert(fc!=NULL); if (fc->flags & UMDEV_DEBUG) printk("ACCESS %c(%d,%d) => path:%s mode:%s%s%s%s\n", type, major(device), minor(device), path, (mode & R_OK) ? "R_OK": "", (mode & W_OK) ? "W_OK": "", (mode & X_OK) ? "X_OK": "", (mode & F_OK) ? "F_OK": ""); if (fc->devops->access) rv= fc->devops->access(type, device, mode, fc); else rv=0; if (rv < 0) { errno = -rv; return -1; } else { errno = 0; return 0; } } /* static long umdev_mknod(const char *path, mode_t mode, dev_t dev) { struct device_context *fc = um_mod_get_private_data(); int rv; assert(fc != NULL); device_set_context(fc); if (fc->device->flags & UMDEV_DEBUG) printk("MKNOD => path:%s\n",path); rv = fc->device->fops.mknod( path, mode, dev); if (rv < 0) { errno = -rv; return -1; } return rv; } */ static long umdev_chmod(char *path, int mode) { int rv; struct umdev *umdev; dev_t device; int type; umdev=um_mod_get_private_data(); assert(umdev != NULL); type=set_dev(&device,umdev,path); if (umdev->flags & UMDEV_DEBUG) printk("CHMOD => path:%s\n",path); if (umdev->devops->chmod) rv= umdev->devops->chmod(type,device,mode,umdev); else { umdev->mode=(umdev->mode & S_IFMT) | mode; rv=0; } if (rv < 0) { errno = -rv; return -1; } return rv; } static long umdev_lchown(char *path, uid_t owner, gid_t group) { int rv; struct umdev *umdev; dev_t device; int type; umdev=um_mod_get_private_data(); assert(umdev != NULL); type=set_dev(&device,umdev,path); if (umdev->devops->chown) rv= umdev->devops->chown(type,device,owner,group,umdev); else { umdev->uid=owner; umdev->gid=group; rv=0; } if (rv < 0) { errno = -rv; return -1; } else return rv; } static long umdev_fsync(int fd) { int rv; struct fileinfo *ft=getfiletab(fd); struct dev_info di; di.fh = ft->fh; di.flags = 0; di.devhandle=ft->umdev; if (ft->umdev->devops->fsync) rv = ft->umdev->devops->fsync( ft->type, ft->device, &di); else rv= 0; if (ft->umdev->flags & UMDEV_DEBUG) printk("FSYNC[%d %c(%d:%d)] rv=%d\n", fd, ft->type, major(ft->device), minor(ft->device), rv); if (rv<0) { errno= -rv; return -1; } else { return rv; } } static loff_t umdev_x_lseek(int fd, off_t offset, int whence) { struct fileinfo *ft=getfiletab(fd); if (ft->umdev->devops->lseek) { loff_t rv; struct dev_info di; di.fh = ft->fh; di.flags = 0; di.devhandle=ft->umdev; rv=ft->umdev->devops->lseek( ft->type, ft->device, offset, whence, ft->pos, &di); if (ft->umdev->flags & UMDEV_DEBUG) printk("SEEK[%d %c(%d:%d)] OFF %lld WHENCE %d -> %lld\n", fd, ft->type, major(ft->device), minor(ft->device), offset,whence, rv); if (rv<0) { errno= -rv; return -1; } else { ft->pos=rv; return rv; } } else { errno = ENOSYS; return -1; } } static ssize_t umdev_pread64(int fd, void *buf, size_t count, long long offset) { ssize_t rv; rv=umdev_x_lseek(fd,(off_t) offset,SEEK_SET); if (rv >= 0) rv=umdev_read(fd,buf,count); return rv; } static ssize_t umdev_pwrite64(int fd, void *buf, size_t count, long long offset) { ssize_t rv; rv=umdev_x_lseek(fd,(off_t) offset,SEEK_SET); if (rv >= 0) rv=umdev_write(fd,buf,count); return rv; } static long umdev_lseek(int fd, int offset, int whence) { return umdev_x_lseek(fd, offset, whence); } static long umdev__llseek(unsigned int fd, unsigned long offset_high, unsigned long offset_low, loff_t *result, unsigned int whence) { PRINTDEBUG(10,"umdev__llseek %d %d %d %d\n",fd,offset_high,offset_low,whence); if (result == NULL) { errno = EFAULT; return -1; } else { loff_t rv; loff_t offset=((loff_t)offset_high)<<32 | offset_low; rv=umdev_x_lseek(fd,offset,whence); if (rv >= 0) { *result=rv; return 0; } else { errno = -rv; return -1; } } } static long umdev_ioctl(int fd, int req, void *arg) { int rv; struct fileinfo *ft=getfiletab(fd); if (ft->umdev->devops->ioctl) { struct dev_info di; di.fh = ft->fh; di.flags = 0; di.devhandle=ft->umdev; rv = ft->umdev->devops->ioctl( ft->type, ft->device, req, arg, &di); } else rv= -EINVAL; if (ft->umdev->flags & UMDEV_DEBUG) printk("IOCTL[%d %c(%d:%d)] => req:%x\n", fd, ft->type, major(ft->device), minor(ft->device), req); if (rv<0) { errno= -rv; return -1; } else return rv; } #if 0 static void contextclose(struct umdev *fc) { umdev_umount2(fc->path,MNT_FORCE); } #endif static long umdev_event_subscribe(void (* cb)(), void *arg, int fd, int how) { int rv=1; struct fileinfo *ft=getfiletab(fd); if (ft->umdev->devops->event_subscribe) { struct dev_info di; di.fh = ft->fh; di.flags = 0; di.devhandle=ft->umdev; rv = ft->umdev->devops->event_subscribe( ft->type, ft->device, cb, arg, how, &di); } if (rv<0) { errno= -rv; return -1; } else return rv; } void umdev_setprivatedata(struct umdev *devhandle, void *privatedata) { if(devhandle) devhandle->private_data=privatedata; } void *umdev_getprivatedata(struct umdev *devhandle) { if(devhandle) return devhandle->private_data; else return NULL; } void umdev_setnsubdev(struct umdev *devhandle, int nsubdev) { if(devhandle) devhandle->nsubdev=nsubdev; } int umdev_getnsubdev(struct umdev *devhandle) { if(devhandle) return devhandle->nsubdev; else return -1; } dev_t umdev_getbasedev(struct umdev *devhandle) { if(devhandle) return devhandle->dev; else return 0; } void umdev_setmode(struct umdev *devhandle, mode_t mode) { if(devhandle) devhandle->mode=mode; } mode_t umdev_getmode(struct umdev *devhandle) { if(devhandle) return devhandle->mode; else return 0; } static void __attribute__ ((constructor)) init (void) { printk(KERN_NOTICE "umdev init\n"); s.name="umdev"; s.description="virtual devices"; s.destructor=umdev_destructor; s.ioctlparms=umdev_ioctlparms; //pthread_key_create(&context_key,NULL); s.syscall=(sysfun *)calloc(scmap_scmapsize,sizeof(sysfun)); s.socket=(sysfun *)calloc(scmap_sockmapsize,sizeof(sysfun)); SERVICESYSCALL(s, mount, umdev_mount); SERVICESYSCALL(s, umount2, umdev_umount2); SERVICESYSCALL(s, open, umdev_open); SERVICESYSCALL(s, read, umdev_read); SERVICESYSCALL(s, write, umdev_write); SERVICESYSCALL(s, close, umdev_close); #if !defined(__x86_64__) SERVICESYSCALL(s, lstat64, umdev_lstat64); #else SERVICESYSCALL(s, lstat, umdev_lstat64); #endif SERVICESYSCALL(s, access, umdev_access); SERVICESYSCALL(s, lseek, umdev_lseek); #if ! defined(__x86_64__) SERVICESYSCALL(s, _llseek, umdev__llseek); #endif //SERVICESYSCALL(s, mknod, umdev_mknod); SERVICESYSCALL(s, lchown, umdev_lchown); SERVICESYSCALL(s, chmod, umdev_chmod); SERVICESYSCALL(s, fsync, umdev_fsync); //SERVICESYSCALL(s, _newselect, umdev_select); SERVICESYSCALL(s, ioctl, umdev_ioctl); SERVICESYSCALL(s, pread64, umdev_pread64); SERVICESYSCALL(s, pwrite64, umdev_pwrite64); s.event_subscribe=umdev_event_subscribe; } static void __attribute__ ((destructor)) fini (void) { free(s.syscall); free(s.socket); printk(KERN_NOTICE "umdev fini\n"); } umview-0.8.2/umdev/Makefile.am0000644000175000017500000000021711753517211015270 0ustar renzorenzoinclude $(top_srcdir)/modules-common.mk #DEVELFLAGS=-D__UMDEV_DEBUG__ mod_LTLIBRARIES = umdev.la umdev_la_LDFLAGS = $(AM_LDFLAGS) -lpthread umview-0.8.2/umdevmbr/0000755000175000017500000000000011753517351013742 5ustar renzorenzoumview-0.8.2/umdevmbr/Makefile.in0000644000175000017500000004502611753517330016013 0ustar renzorenzo# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/modules-common.mk subdir = umdevmbr ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moddir)" LTLIBRARIES = $(mod_LTLIBRARIES) umdevmbr_la_LIBADD = am_umdevmbr_la_OBJECTS = umdevmbr.lo mbr.lo umdevmbr_la_OBJECTS = $(am_umdevmbr_la_OBJECTS) umdevramdisk_la_LIBADD = umdevramdisk_la_SOURCES = umdevramdisk.c umdevramdisk_la_OBJECTS = umdevramdisk.lo umdevvd_la_LIBADD = umdevvd_la_SOURCES = umdevvd.c umdevvd_la_OBJECTS = umdevvd.lo DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(umdevmbr_la_SOURCES) umdevramdisk.c umdevvd.c DIST_SOURCES = $(umdevmbr_la_SOURCES) umdevramdisk.c umdevvd.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB20_CFLAGS = @GLIB20_CFLAGS@ GLIB20_LIBS = @GLIB20_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = ../um_lib/libumlib.la LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DEBUGLEVEL = 3 moddir = $(pkglibdir)/modules CBASEFLAGS = CDEBUGFLAGS = -g3 -ggdb3 CPPBASEFLAGS = -I../include -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CPPDEBUGFLAGS = -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) @ENABLE_DEBUG_FALSE@CFULLFLAGS = $(CBASEFLAGS) @ENABLE_DEBUG_TRUE@CFULLFLAGS = $(CBASEFLAGS) $(CDEBUGFLAGS) @ENABLE_DEBUG_FALSE@CPPFULLFLAGS = $(CPPBASEFLAGS) @ENABLE_DEBUG_TRUE@CPPFULLFLAGS = $(CPPBASEFLAGS) $(CPPDEBUGFLAGS) AM_CFLAGS = $(CFULLFLAGS) AM_CPPFLAGS = $(CPPFULLFLAGS) AM_LDFLAGS = -module -avoid-version -export-dynamic AM_LIBTOOLFLAGS = --tag=disable-static mod_LTLIBRARIES = umdevmbr.la umdevramdisk.la umdevvd.la umdevmbr_la_SOURCES = umdevmbr.c mbr.c mbr.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/modules-common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign umdevmbr/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign umdevmbr/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/modules-common.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-modLTLIBRARIES: $(mod_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(moddir)" || $(MKDIR_P) "$(DESTDIR)$(moddir)" @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moddir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moddir)"; \ } uninstall-modLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moddir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moddir)/$$f"; \ done clean-modLTLIBRARIES: -test -z "$(mod_LTLIBRARIES)" || rm -f $(mod_LTLIBRARIES) @list='$(mod_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done umdevmbr.la: $(umdevmbr_la_OBJECTS) $(umdevmbr_la_DEPENDENCIES) $(EXTRA_umdevmbr_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(umdevmbr_la_OBJECTS) $(umdevmbr_la_LIBADD) $(LIBS) umdevramdisk.la: $(umdevramdisk_la_OBJECTS) $(umdevramdisk_la_DEPENDENCIES) $(EXTRA_umdevramdisk_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(umdevramdisk_la_OBJECTS) $(umdevramdisk_la_LIBADD) $(LIBS) umdevvd.la: $(umdevvd_la_OBJECTS) $(umdevvd_la_DEPENDENCIES) $(EXTRA_umdevvd_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(umdevvd_la_OBJECTS) $(umdevvd_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umdevmbr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umdevramdisk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umdevvd.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(moddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-modLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-modLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-modLTLIBRARIES .MAKE: install-am install-data-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-modLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-modLTLIBRARIES install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-modLTLIBRARIES @ENABLE_DEBUG_TRUE@release: clean @ENABLE_DEBUG_TRUE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS)' @ENABLE_DEBUG_TRUE@debug: all @ENABLE_DEBUG_FALSE@release: all @ENABLE_DEBUG_FALSE@debug: clean @ENABLE_DEBUG_FALSE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS) $(CDEBUGFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS) $(CPPDEBUGFLAGS)' install-data-hook: cd "$(DESTDIR)/$(moddir)" && rm -f $(mod_LTLIBRARIES) debug release: all # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: umview-0.8.2/umdevmbr/mbr.c0000644000175000017500000001163611753517211014670 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * MBR: Library to read MBR and Extended MBR * Copyright (C) 2006 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include "mbr.h" #define IDE_HEADER_OFFSET 446 static char mbrsignature[2]={0x55,0xAA}; struct mbr_header { char code[IDE_HEADER_OFFSET]; struct mbrpart { unsigned char flags; unsigned char chs_begin[3]; unsigned char type; unsigned char chs_end[3]; unsigned char lba_begin[4]; unsigned char lba_noblocks[4]; } mbrpart[4]; unsigned char signature[2]; }; #define LE32_INT(X) (((X)[0])+(((X)[1])<<8)+(((X)[2])<<16)+(((X)[3])<<24)) static void maxgeom(struct hd_geometry *geom, const unsigned char *chs) { unsigned char s,h; unsigned short c; h=chs[0]; s=chs[1] & 0x3f; c=chs[2] + ((chs[1] & 0xc0) << 2); if ((h+1) > geom->heads) geom->heads = h+1; if (s > geom->sectors) geom->sectors = s; if (c > geom->cylinders) geom->cylinders = c; } static void mbr_read(struct mbr *mbr) { struct mbr_header mbr_header; unsigned int ext_part_base=0; pread64(mbr->fd, &mbr_header, sizeof(mbr_header), (off_t) 0); if (memcmp(mbr_header.signature,mbrsignature,2) != 0) { fprintf(stderr,"bad signature in MBR %x %x\n", mbr_header.signature[0],mbr_header.signature[1]); } else { /* MBR is okay. Read MBR */ int i; unsigned int offset=0; memset(&(mbr->geometry),0,sizeof(struct hd_geometry)); for (i=0;i<4;i++) { if(mbr_header.mbrpart[i].type != 0) { struct partition *new=mbr->part[i]=malloc(sizeof(struct partition)); maxgeom(&(mbr->geometry),mbr_header.mbrpart[i].chs_end); new->flags=mbr_header.mbrpart[i].flags; new->type=mbr_header.mbrpart[i].type; new->LBAbegin=LE32_INT(mbr_header.mbrpart[i].lba_begin); new->LBAnoblocks=LE32_INT(mbr_header.mbrpart[i].lba_noblocks); if(mbr_header.mbrpart[i].type == 5) {/* extended partition*/ if (ext_part_base==0) ext_part_base=new->LBAbegin; else fprintf(stderr,"There are more than one extended partitions against the specifications\n"); } } } if (mbr->geometry.heads == 0) mbr->geometry.heads = 255; if (mbr->geometry.sectors == 0) mbr->geometry.sectors = 63; mbr->geometry.cylinders = (mbr->size >> IDE_BLOCKSIZE_LOG) / (mbr->geometry.heads * mbr->geometry.sectors); /* Read the chain of logical partitions inside the extended partition */ while (ext_part_base > 0) { off_t base=((off_t)(ext_part_base+offset)) << IDE_BLOCKSIZE_LOG; pread64(mbr->fd, &mbr_header, sizeof(mbr_header), base); if (memcmp(mbr_header.signature,mbrsignature,2) != 0) { fprintf(stderr,"bad signature in block %lld=%x %x\n", base, mbr_header.signature[0],mbr_header.signature[1]); ext_part_base=0; } else { if(mbr_header.mbrpart[0].type != 0) { struct partition *new=mbr->part[i]=malloc(sizeof(struct partition)); new->flags=mbr_header.mbrpart[0].flags; new->type=mbr_header.mbrpart[0].type; new->LBAbegin=LE32_INT(mbr_header.mbrpart[0].lba_begin)+ext_part_base+offset; new->LBAnoblocks=LE32_INT(mbr_header.mbrpart[0].lba_noblocks); i++; } if(mbr_header.mbrpart[1].type == 5) offset=LE32_INT(mbr_header.mbrpart[1].lba_begin); else ext_part_base=0; } } } } void mbr_printpt(struct mbr *mbr) { int i; for(i=0;ipart[i]) { fprintf(stderr,"PART %-2d F%02x T%02x B=%10d S=%10d\n",i, mbr->part[i]->flags,mbr->part[i]->type,mbr->part[i]->LBAbegin,mbr->part[i]->LBAnoblocks); } } } void mbr_reread(struct mbr *mbr) { int i; for(i=0;ipart[i]) { free(mbr->part[i]); mbr->part[i]=0; } } mbr_read(mbr); } struct mbr *mbr_open(int fd) { off_t size=lseek(fd,0,SEEK_END); if (size < 0) { /* maybe it is a device */ long long lsize=-1; if (ioctl(fd,BLKGETSIZE64,&lsize) >= 0) size=lsize; } if (size > 0) { struct mbr *mbr=calloc(1,sizeof(struct mbr)); mbr->fd=fd; mbr->size=size; mbr_read(mbr); return mbr; } else { return NULL; } } void mbr_close(struct mbr *mbr) { close(mbr->fd); free(mbr); } umview-0.8.2/umdevmbr/umdevmbr.c0000644000175000017500000001505711753517211015732 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMDEVMBR: Virtual Device to access Disk Images * (using the standard IBM-PC partition scheme based on MBR/Extended MBR) * * Copyright (C) 2006 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include "umdev.h" #include #include #include #include #include #include #include "mbr.h" //char readonly=0; static int hdmbr_open(char type, dev_t device, struct dev_info *di) { struct mbr *mbr=umdev_getprivatedata(di->devhandle); int partno=minor(device)-minor(umdev_getbasedev(di->devhandle)); if (partno==0 || mbr->part[partno-1] != NULL) return 0; else return -ENODEV; } static int hdmbr_read(char type, dev_t device, char *buf, size_t len, loff_t pos, struct dev_info *di) { struct mbr *mbr=umdev_getprivatedata(di->devhandle); int partno=minor(device)-minor(umdev_getbasedev(di->devhandle)); int rv; if (partno==0) /* partno==0, the disk as a whole */ { rv=pread64(mbr->fd,buf,len,pos); return (rv<0)?-errno:rv; } else { /* access a partition */ struct partition *partition=mbr->part[partno-1]; if (partition) { if ((pos >> IDE_BLOCKSIZE_LOG) <= partition->LBAnoblocks) { pos += ((off_t) partition->LBAbegin) << IDE_BLOCKSIZE_LOG; rv=pread64(mbr->fd,buf,len,pos); return (rv<0)?-errno:rv; } else return 0; } else return -ENODEV; } } static int hdmbr_write(char type, dev_t device, const char *buf, size_t len, loff_t pos, struct dev_info *di) { struct mbr *mbr=umdev_getprivatedata(di->devhandle); int partno=minor(device)-minor(umdev_getbasedev(di->devhandle)); int rv; if (partno==0) /* partno==0, the disk as a whole */ { rv=pwrite64(mbr->fd,buf,len,pos); return (rv<0)?-errno:rv; } else { /* access a partition */ struct partition *partition=mbr->part[partno-1]; if (partition) { if ((pos >> IDE_BLOCKSIZE_LOG) <= partition->LBAnoblocks) { pos += ((off_t) partition->LBAbegin) << IDE_BLOCKSIZE_LOG; rv=pwrite64(mbr->fd,buf,len,pos); return (rv<0)?-errno:rv; } else return -EINVAL; } else return -ENODEV; } } static int hdmbr_release(char type, dev_t device, struct dev_info *di) { return 0; } static loff_t hdmbr_lseek(char type, dev_t device, loff_t offset, int whence, loff_t pos, struct dev_info *di) { loff_t rv; switch (whence) { case SEEK_SET: rv=offset; break; case SEEK_CUR: rv=pos+offset; break; case SEEK_END: { struct mbr *mbr=umdev_getprivatedata(di->devhandle); int partno=minor(device)-minor(umdev_getbasedev(di->devhandle)); if (partno==0) rv=mbr->size + offset; else { /* access a partition */ struct partition *partition=mbr->part[partno-1]; if (partition) rv=((partition->LBAnoblocks)<< IDE_BLOCKSIZE_LOG) +offset; else return -ENODEV; } } break; } if (rv<0) rv=0; return rv; } static int hdmbr_init(char type, dev_t device, char *path, unsigned long flags, char *args, struct umdev *devhandle) { int fd=open(path,O_RDWR); if (fd < 0) return -1; else { struct mbr *mbr=mbr_open(fd); if (mbr != NULL) { mode_t mode=umdev_getmode(devhandle); mode = (mode & ~S_IFMT) | S_IFBLK; umdev_setmode(devhandle, mode); umdev_setprivatedata(devhandle,mbr); umdev_setnsubdev(devhandle, IDE_MAXPART); return 0; } else return -1; } } static int hdmbr_fini(char type, dev_t device, struct umdev *devhandle) { struct mbr *mbr=umdev_getprivatedata(devhandle); mbr_close(mbr); return 0; } static int hdmbr_ioctl(char type, dev_t device, int req, void * arg, struct dev_info *di) { struct mbr *mbr=umdev_getprivatedata(di->devhandle); switch (req) { /*case BLKROSET: if (*(int *)arg != 0) readonly=1; break; case BLKROGET: *(int *)arg = readonly; break;*/ case BLKSSZGET: *(int *)arg = IDE_BLOCKSIZE; break; case BLKRRPART: mbr_reread(mbr); break; case BLKGETSIZE: { int partno=minor(device)-minor(umdev_getbasedev(di->devhandle)); if (partno==0) *(int *)arg = (mbr->size >> IDE_BLOCKSIZE_LOG); else { /* access a partition */ struct partition *partition=mbr->part[partno-1]; if (partition) *(int *)arg = (partition->LBAnoblocks) << IDE_BLOCKSIZE_LOG; else return -ENODEV; } } break; case BLKGETSIZE64: { int partno=minor(device)-minor(umdev_getbasedev(di->devhandle)); if (partno==0) *(long long *)arg = mbr->size; else { /* access a partition */ struct partition *partition=mbr->part[partno-1]; if (partition) *(long long *)arg = (partition->LBAnoblocks) << IDE_BLOCKSIZE_LOG; else return -ENODEV; } } break; case HDIO_GETGEO: { struct hd_geometry *hdg = arg; *hdg=mbr->geometry; } break; default: return -EINVAL; } return 0; } static int hdmbr_ioctl_params(char type, dev_t device, int req, struct dev_info *di) { switch (req) { /*case BLKROSET: return (sizeof(int) | IOCTL_R); case BLKROGET: return (sizeof(int) | IOCTL_W);*/ case BLKSSZGET: return (sizeof(int) | IOCTL_W); case BLKRRPART: return 0; case BLKGETSIZE: return (sizeof(int) | IOCTL_W); case BLKGETSIZE64: return (sizeof(long long) | IOCTL_W); case HDIO_GETGEO: return (sizeof(struct hd_geometry) | IOCTL_W); default: return 0; } } struct umdev_operations umdev_ops={ .open=hdmbr_open, .read=hdmbr_read, .write=hdmbr_write, .release=hdmbr_release, .lseek=hdmbr_lseek, .init=hdmbr_init, .fini=hdmbr_fini, .ioctl=hdmbr_ioctl, .ioctlparms=hdmbr_ioctl_params, }; umview-0.8.2/umdevmbr/mbr.h0000644000175000017500000000261411753517211014671 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * MBR: Library to read MBR and Extended MBR * Copyright (C) 2006 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #define IDE_MAXPART 63 #define IDE_BLOCKSIZE 512 #define IDE_BLOCKSIZE_LOG 9 struct partition { int flags; char type; unsigned int LBAbegin; unsigned int LBAnoblocks; }; struct mbr { int fd; off_t size; struct hd_geometry geometry; struct partition *part[IDE_MAXPART]; }; void mbr_printpt(struct mbr *mbr); void mbr_reread(struct mbr *mbr); struct mbr *mbr_open(int fd); void mbr_close(struct mbr *mbr); umview-0.8.2/umdevmbr/Makefile.am0000644000175000017500000000022111753517211015764 0ustar renzorenzoinclude $(top_srcdir)/modules-common.mk mod_LTLIBRARIES = umdevmbr.la umdevramdisk.la umdevvd.la umdevmbr_la_SOURCES = umdevmbr.c mbr.c mbr.h umview-0.8.2/umdevmbr/umdevvd.c0000644000175000017500000002351411753517211015560 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMDEVVD: Virtual device for VDI, VMDK, VHD disks. * (It requires the VBoxDD library at run time). * * Copyright (C) 2010 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include "umdev.h" #include #include #include "module.h" #define STD_SECTORSIZE 512 #define STD_SECTORSIZE_OFFSET_MASK 0x1ff #ifdef __GNUC__ #define UNUSED __attribute__ ((unused)) #else #define UNUSED #endif #define RT_BIT(bit) (1UL << (bit)) #define VD_OPEN_FLAGS_NORMAL 0 #define VD_OPEN_FLAGS_READONLY RT_BIT(0) typedef struct PDMMEDIAGEOMETRY { uint32_t cCylinders; uint32_t cHeads; uint32_t cSectors; } PDMMEDIAGEOMETRY; typedef int (* intfun)(); typedef uint64_t (* uint64_tfun)(); static int VBoxDD_count; static void *VBoxDD_handle; static intfun pVDFlush; static intfun pVDRead; static intfun pVDWrite; static uint64_tfun pVDGetSize; static intfun pVDCreate; static intfun pVDOpen; static intfun pVDClose; static intfun pVDGetLCHSGeometry; struct vddisk { void *hdDisk; unsigned long flags; loff_t size; }; static int load_VBoxDD() { if (VBoxDD_count == 0) { VBoxDD_handle=dlopen("VBoxDD.so",RTLD_LAZY); if (VBoxDD_handle == NULL) { VBoxDD_handle=dlopen("/usr/lib/virtualbox/VBoxDD.so",RTLD_LAZY); if (VBoxDD_handle == NULL) { printk("VBoxDD library: not found\n"); return -ENOENT; } } pVDFlush=dlsym(VBoxDD_handle,"VDFlush"); pVDRead=dlsym(VBoxDD_handle,"VDRead"); pVDWrite=dlsym(VBoxDD_handle,"VDWrite"); pVDGetSize=dlsym(VBoxDD_handle,"VDGetSize"); pVDCreate=dlsym(VBoxDD_handle,"VDCreate"); pVDOpen=dlsym(VBoxDD_handle,"VDOpen"); pVDClose=dlsym(VBoxDD_handle,"VDClose"); pVDGetLCHSGeometry=dlsym(VBoxDD_handle,"VDGetLCHSGeometry"); /*printk("%p %p %p %p %p %p %p %p \n", pVDFlush, pVDRead, pVDWrite, pVDGetSize, pVDCreate, pVDOpen, pVDClose, pVDGetLCHSGeometry);*/ } VBoxDD_count++; return 0; } static void unload_VBoxDD() { VBoxDD_count--; if (VBoxDD_count == 0) { dlclose(VBoxDD_handle); VBoxDD_handle=NULL; } } static int vd_open(char type, dev_t device, struct dev_info *di) { return 0; } static int vd_release(char type, dev_t device, struct dev_info *di) { struct vddisk *vddisk = umdev_getprivatedata(di->devhandle); if (vddisk) pVDFlush(vddisk->hdDisk); return 0; } static inline int aligned_read(void *disk,loff_t pos, char *buf, size_t len) { if ((pos & STD_SECTORSIZE_OFFSET_MASK)==0 && (len & STD_SECTORSIZE_OFFSET_MASK)==0) { int ret = pVDRead(disk,pos,buf,len); return (ret >= 0) ? (signed) len : -EIO; } else { int rv; char tbuf[STD_SECTORSIZE]; size_t toff,tlen,llen=len; toff=pos & STD_SECTORSIZE_OFFSET_MASK; if (toff) { rv=pVDRead(disk,pos - toff,tbuf,STD_SECTORSIZE); if (rv<0) return -EIO; tlen=STD_SECTORSIZE-toff; if (len 0) { rv=pVDRead(disk,pos,tbuf,STD_SECTORSIZE); if (rv<0) return -EIO; memcpy(buf,tbuf,llen); } return len; } } static int vd_read(char type, dev_t device, char *buf, size_t len, loff_t pos, struct dev_info *di) { struct vddisk *vddisk = umdev_getprivatedata(di->devhandle); if (vddisk) { loff_t size=vddisk->size; if (pos > size) pos=size; if (pos+len > size) len=size-pos; if (len > 0) return aligned_read(vddisk->hdDisk,pos,buf,len); else return 0; } else return -ENODEV; } static inline int aligned_write(void *disk,loff_t pos, const char *buf, size_t len) { if ((pos & STD_SECTORSIZE_OFFSET_MASK)==0 && (len & STD_SECTORSIZE_OFFSET_MASK)==0) { int ret = pVDWrite(disk,pos,buf,len); return (ret >= 0) ? (signed) len : -EIO; } else { int rv; char tbuf[STD_SECTORSIZE]; size_t toff,tlen,llen=len; toff=pos & STD_SECTORSIZE_OFFSET_MASK; if (toff) { rv=pVDRead(disk,pos - toff,tbuf,STD_SECTORSIZE); if (rv<0) return -EIO; tlen=STD_SECTORSIZE-toff; if (len 0) { rv=pVDRead(disk,pos,tbuf,STD_SECTORSIZE); if (rv<0) return -EIO; memcpy(tbuf,buf,llen); rv=pVDWrite(disk,pos,tbuf,STD_SECTORSIZE); if (rv<0) return -EIO; } return len; } } static int vd_write(char type, dev_t device, const char *buf, size_t len, loff_t pos, struct dev_info *di) { struct vddisk *vddisk = umdev_getprivatedata(di->devhandle); if (vddisk) { loff_t size=vddisk->size; if (vddisk->flags & MS_RDONLY) return -EACCES; else { if (pos > size) pos=size; if (pos+len > size) len=size-pos; if (len > 0) return aligned_write(vddisk->hdDisk,pos,buf,len); else return 0; } } else return -ENODEV; } static loff_t vd_lseek(char type, dev_t device, loff_t offset, int whence, loff_t pos, struct dev_info *di) { struct vddisk *vddisk = umdev_getprivatedata(di->devhandle); if (vddisk) { loff_t size=vddisk->size; loff_t rv; switch (whence) { case SEEK_SET: rv=offset; break; case SEEK_CUR: rv=pos+offset; break; case SEEK_END: rv=size+offset; break; } if (rv<0) rv=0; if (rv>size) rv=size; return rv; } else return -ENODEV; } // detects type of virtual image int detectDiskType (char **disktype, char *filename) { char buf[8]; int fd = open (filename, O_RDONLY); read (fd, buf, sizeof (buf)); if (strncmp (buf, "conectix", 8) == 0) *disktype = "VHD"; else if (strncmp (buf, "VMDK", 4) == 0) *disktype = "VMDK"; else if (strncmp (buf, "KDMV", 4) == 0) *disktype = "VMDK"; else if (strncmp (buf, "<<<", 3) == 0) *disktype = "VDI"; else { printk("cannot autodetect disk type\n"); close(fd); return -ENODEV; } printk ("disktype is %s\n", *disktype); close(fd); return 0; } static int vd_init(char type, dev_t device, char *path, unsigned long flags, char *args,struct umdev *devhandle) { struct vddisk *vddisk; char *diskType = "auto"; if (load_VBoxDD() != 0) return -ENODEV; vddisk=calloc(1,sizeof (struct vddisk)); if (vddisk==NULL) return -ENOMEM; vddisk->flags=flags; if (pVDCreate(NULL, &vddisk->hdDisk) < 0) { printk("invalid initialisation of VD interface\n"); goto enodev; } if (detectDiskType (&diskType, path) < 0) goto enodev; if (pVDOpen(vddisk->hdDisk,diskType, path, (flags & MS_RDONLY)?VD_OPEN_FLAGS_READONLY:VD_OPEN_FLAGS_NORMAL, NULL) < 0) { printk("opening vbox image failed\n"); goto enodev; } vddisk->size=pVDGetSize(vddisk->hdDisk, 0); mode_t mode=umdev_getmode(devhandle); mode = (mode & ~S_IFMT) | S_IFBLK; umdev_setmode(devhandle, mode); umdev_setprivatedata(devhandle,vddisk); return 0; enodev: free(vddisk); return -ENODEV; } static int vd_fini(char type, dev_t device, struct umdev *devhandle) { struct vddisk *vddisk = umdev_getprivatedata(devhandle); if (vddisk) { pVDClose(vddisk->hdDisk,0); free(vddisk); unload_VBoxDD(); } return 0; } static int vd_ioctl(char type, dev_t device, int req, void * arg, struct dev_info *di) { struct vddisk *vddisk = umdev_getprivatedata(di->devhandle); if (vddisk) { switch (req) { case BLKROGET: *(int *)arg = ((vddisk->flags & MS_RDONLY) != 0); break; case BLKSSZGET: *(int *)arg = STD_SECTORSIZE; break; case BLKRRPART: break; case BLKGETSIZE: *(int *)arg = vddisk->size / STD_SECTORSIZE; break; case BLKGETSIZE64: *(long long *)arg = vddisk->size; break; case HDIO_GETGEO: { struct hd_geometry *hdg = arg; PDMMEDIAGEOMETRY vdgeom; pVDGetLCHSGeometry(vddisk->hdDisk,0,&vdgeom); /*char*/hdg->heads=vdgeom.cHeads; /*char*/hdg->sectors=vdgeom.cSectors; /*short*/hdg->cylinders=vdgeom.cCylinders; hdg->start=0; } break; default: return -EINVAL; } return 0; } else return -ENODEV; } static int vd_ioctl_params(char type, dev_t device, int req, struct dev_info *di) { switch (req) { case BLKROSET: return (sizeof(int) | IOCTL_R); case BLKROGET: return (sizeof(int) | IOCTL_W); case BLKSSZGET: return (sizeof(int) | IOCTL_W); case BLKRRPART: return 0; case BLKGETSIZE: return (sizeof(int) | IOCTL_W); case BLKGETSIZE64: return (sizeof(long long) | IOCTL_W); case HDIO_GETGEO: return (sizeof(struct hd_geometry) | IOCTL_W); default: return 0; } } struct umdev_operations umdev_ops={ .open=vd_open, .read=vd_read, .write=vd_write, .release=vd_release, .lseek=vd_lseek, .init=vd_init, .ioctl=vd_ioctl, .ioctlparms=vd_ioctl_params, .fini=vd_fini, }; umview-0.8.2/umdevmbr/umdevramdisk.c0000644000175000017500000001317211753517211016600 0ustar renzorenzo#include #include #include "umdev.h" #include "stdlib.h" #include #include #include #include #define STD_SIZE 64*1024 #define STD_SECTORSIZE 512 #define READONLY 1 #define MBR 2 struct ramdisk { char *diskdata; char flags; unsigned long long rd_size; struct hd_geometry rd_geom; }; static int rd_open(char type, dev_t device, struct dev_info *di) { return 0; } static int rd_read(char type, dev_t device, char *buf, size_t len, loff_t pos, struct dev_info *di) { struct ramdisk *ramdisk = umdev_getprivatedata(di->devhandle); if (ramdisk) { loff_t size=ramdisk->rd_size*STD_SECTORSIZE; size_t rlen; if (pos > size) pos=size; if (pos+len <= size) rlen=len; else rlen=size-pos; memcpy(buf,ramdisk->diskdata+pos,rlen); return rlen; } else return -ENODEV; } static int rd_write(char type, dev_t device, const char *buf, size_t len, loff_t pos, struct dev_info *di) { struct ramdisk *ramdisk = umdev_getprivatedata(di->devhandle); if (ramdisk) { if (ramdisk->flags & READONLY) return -EACCES; else { loff_t size=ramdisk->rd_size*STD_SECTORSIZE; size_t rlen; if (pos > size) pos=size; if (pos+len <= size) rlen=len; else rlen=size-pos; memcpy(ramdisk->diskdata+pos,buf,rlen); return rlen; } } else return -ENODEV; } static int rd_release(char type, dev_t device, struct dev_info *di) { return 0; } static loff_t rd_lseek(char type, dev_t device, loff_t offset, int whence, loff_t pos, struct dev_info *di) { struct ramdisk *ramdisk = umdev_getprivatedata(di->devhandle); if (ramdisk) { loff_t size=ramdisk->rd_size*STD_SECTORSIZE; loff_t rv; switch (whence) { case SEEK_SET: rv=offset; break; case SEEK_CUR: rv=pos+offset; break; case SEEK_END: rv=size+offset; break; } if (rv<0) rv=0; if (rv>size) rv=size; return rv; } else return -ENODEV; } static void rd_setmbr(char *s,struct ramdisk *rd) { rd->flags |= MBR; } static void rd_setsize(char *s,struct ramdisk *rd) { if (s) { int len=strlen(s); long long size=atoi(s); switch (s[len-1]) { case 'k': case 'K': size *= 1024 / STD_SECTORSIZE; break; case 'm': case 'M': size *= 1024 * 1024 / STD_SECTORSIZE; break; case 'g': case 'G': size *= 1024 * 1024 * 1024 / STD_SECTORSIZE; break; } rd->rd_size=size; } } static struct devargitem umdevargtab[] = { {"size=", rd_setsize}, {"mbr", rd_setmbr}, }; #define UMDEVARGTABSIZE sizeof(umdevargtab)/sizeof(struct devargitem) static int rd_init(char type, dev_t device, char *path, unsigned long flags, char *args,struct umdev *devhandle) { struct ramdisk *ramdisk=calloc(1,sizeof (struct ramdisk)); if(args) devargs(args, umdevargtab, UMDEVARGTABSIZE, ramdisk); if (ramdisk) { if (ramdisk->rd_size == 0) ramdisk->rd_size=STD_SIZE; ramdisk->rd_geom.start=0; if (ramdisk->rd_size == (unsigned int) ramdisk->rd_size) { ramdisk->rd_geom.heads=16; ramdisk->rd_geom.sectors=16; ramdisk->rd_geom.cylinders=(ramdisk->rd_size+(ramdisk->rd_geom.heads*ramdisk->rd_geom.sectors)-1)/(ramdisk->rd_geom.heads*ramdisk->rd_geom.sectors); } else { ramdisk->rd_geom.heads=128; ramdisk->rd_geom.sectors=128; ramdisk->rd_geom.cylinders=(ramdisk->rd_size+(ramdisk->rd_geom.heads*ramdisk->rd_geom.sectors)-1)/(ramdisk->rd_geom.heads*ramdisk->rd_geom.sectors); } ramdisk->rd_size=ramdisk->rd_geom.heads*ramdisk->rd_geom.sectors*ramdisk->rd_geom.cylinders; if (!ramdisk->diskdata) { ramdisk->diskdata=malloc(ramdisk->rd_size * STD_SECTORSIZE); if (!ramdisk->diskdata) { free(ramdisk); return -ENOMEM; } } mode_t mode=umdev_getmode(devhandle); mode = (mode & ~S_IFMT) | S_IFBLK; umdev_setmode(devhandle, mode); umdev_setprivatedata(devhandle,ramdisk); return 0; } else return -ENODEV; } static int rd_fini(char type, dev_t device, struct umdev *devhandle) { struct ramdisk *ramdisk = umdev_getprivatedata(devhandle); if (ramdisk) { free(ramdisk->diskdata); free(ramdisk); } return 0; } static int rd_ioctl(char type, dev_t device, int req, void * arg, struct dev_info *di) { struct ramdisk *ramdisk = umdev_getprivatedata(di->devhandle); if (ramdisk) { switch (req) { case BLKROSET: if (*(int *)arg != 0) ramdisk->flags |= READONLY; break; case BLKROGET: *(int *)arg = ((ramdisk->flags & READONLY) != 0); break; case BLKSSZGET: *(int *)arg = STD_SECTORSIZE; break; case BLKRRPART: break; case BLKGETSIZE: *(int *)arg = ramdisk->rd_size * ((ramdisk->flags & MBR)?1:STD_SECTORSIZE); break; case BLKGETSIZE64: *(long long *)arg = ramdisk->rd_size * STD_SECTORSIZE; //printk("BLKGETSIZE64 %lld\n",*(long long *)arg); break; case HDIO_GETGEO: { struct hd_geometry *hdg = arg; *hdg=ramdisk->rd_geom; } break; default: return -EINVAL; } return 0; } else return -ENODEV; } static int rd_ioctl_params(char type, dev_t device, int req, struct dev_info *di) { switch (req) { case BLKROSET: return (sizeof(int) | IOCTL_R); case BLKROGET: return (sizeof(int) | IOCTL_W); case BLKSSZGET: return (sizeof(int) | IOCTL_W); case BLKRRPART: return 0; case BLKGETSIZE: return (sizeof(int) | IOCTL_W); case BLKGETSIZE64: return (sizeof(long long) | IOCTL_W); case HDIO_GETGEO: return (sizeof(struct hd_geometry) | IOCTL_W); default: return 0; } } struct umdev_operations umdev_ops={ .open=rd_open, .read=rd_read, .write=rd_write, .release=rd_release, .lseek=rd_lseek, .init=rd_init, .ioctl=rd_ioctl, .ioctlparms=rd_ioctl_params, .fini=rd_fini, }; umview-0.8.2/umbinfmt/0000755000175000017500000000000011753517351013742 5ustar renzorenzoumview-0.8.2/umbinfmt/Makefile.in0000644000175000017500000004353111753517327016020 0ustar renzorenzo# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/modules-common.mk subdir = umbinfmt ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moddir)" LTLIBRARIES = $(mod_LTLIBRARIES) umbinfmt_la_LIBADD = umbinfmt_la_SOURCES = umbinfmt.c umbinfmt_la_OBJECTS = umbinfmt.lo umbinfmt_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(umbinfmt_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = umbinfmt.c DIST_SOURCES = umbinfmt.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB20_CFLAGS = @GLIB20_CFLAGS@ GLIB20_LIBS = @GLIB20_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = ../um_lib/libumlib.la LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DEBUGLEVEL = 3 moddir = $(pkglibdir)/modules CBASEFLAGS = CDEBUGFLAGS = -g3 -ggdb3 CPPBASEFLAGS = -I../include -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CPPDEBUGFLAGS = -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) @ENABLE_DEBUG_FALSE@CFULLFLAGS = $(CBASEFLAGS) @ENABLE_DEBUG_TRUE@CFULLFLAGS = $(CBASEFLAGS) $(CDEBUGFLAGS) @ENABLE_DEBUG_FALSE@CPPFULLFLAGS = $(CPPBASEFLAGS) @ENABLE_DEBUG_TRUE@CPPFULLFLAGS = $(CPPBASEFLAGS) $(CPPDEBUGFLAGS) AM_CFLAGS = $(CFULLFLAGS) AM_CPPFLAGS = $(CPPFULLFLAGS) AM_LDFLAGS = -module -avoid-version -export-dynamic AM_LIBTOOLFLAGS = --tag=disable-static #DEVELFLAGS=-D__UMDEV_DEBUG__ mod_LTLIBRARIES = umbinfmt.la umbinfmt_la_LDFLAGS = $(AM_LDFLAGS) -lpthread all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/modules-common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign umbinfmt/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign umbinfmt/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/modules-common.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-modLTLIBRARIES: $(mod_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(moddir)" || $(MKDIR_P) "$(DESTDIR)$(moddir)" @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moddir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moddir)"; \ } uninstall-modLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moddir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moddir)/$$f"; \ done clean-modLTLIBRARIES: -test -z "$(mod_LTLIBRARIES)" || rm -f $(mod_LTLIBRARIES) @list='$(mod_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done umbinfmt.la: $(umbinfmt_la_OBJECTS) $(umbinfmt_la_DEPENDENCIES) $(EXTRA_umbinfmt_la_DEPENDENCIES) $(umbinfmt_la_LINK) -rpath $(moddir) $(umbinfmt_la_OBJECTS) $(umbinfmt_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umbinfmt.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(moddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-modLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-modLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-modLTLIBRARIES .MAKE: install-am install-data-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-modLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-modLTLIBRARIES install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-modLTLIBRARIES @ENABLE_DEBUG_TRUE@release: clean @ENABLE_DEBUG_TRUE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS)' @ENABLE_DEBUG_TRUE@debug: all @ENABLE_DEBUG_FALSE@release: all @ENABLE_DEBUG_FALSE@debug: clean @ENABLE_DEBUG_FALSE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS) $(CDEBUGFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS) $(CPPDEBUGFLAGS)' install-data-hook: cd "$(DESTDIR)/$(moddir)" && rm -f $(mod_LTLIBRARIES) debug release: all # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: umview-0.8.2/umbinfmt/umbinfmt.c0000644000175000017500000005247711753517211015741 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMBINFMT: Virtual BinFMT * Copyright (C) 2006 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: umbinfmt.c 971 2011-08-03 14:38:28Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "module.h" #include "libummod.h" //#include "umbinfmt.h" /* Enable umbinfmt own debug output */ //#define __UMBINFMT_DEBUG__ 1 /* it is better to enable it from makefile */ #ifndef __UMBINFMT_DEBUG_LEVEL__ #define __UMBINFMT_DEBUG_LEVEL__ 0 #endif #ifdef __UMBINFMT_DEBUG__ #define PRINTDEBUG(level,args...) printdebug(level, __FILE__, __LINE__, __func__, args) #else #define PRINTDEBUG(level,args...) #endif /* internal real system call insulated for nesting */ #define syscall_stat64 stat64 #define syscall_getuid getuid #define syscall_getgid getgid static struct service s; VIEWOS_SERVICE(s) struct binfileinfo { struct umregister *reg; struct umbinfmt *bfmount; int flags; int pos; int len; char *contents; }; struct umregister { char *name; unsigned char enabled; char type; unsigned char offset; unsigned char len; char *flags; char *magic; char *mask; char *interpreter; struct umregister *next; }; static char rootdir[]="/"; static char registerfile[]="register"; static char statusfile[]="status"; #define UBM_IS_ROOT(X) ((X) == ((struct umregister *)rootdir)) #define UBM_IS_REGISTER(X) ((X) == ((struct umregister *)registerfile)) #define UBM_IS_STATUS(X) ((X) == ((struct umregister *)statusfile)) #define UMBINFMT_DEBUG 1 struct umbinfmt { char *path; unsigned char enabled; char flags; int inuse; struct umregister *head; struct ht_elem *binfmt_ht; }; struct umbinfmt_dirent64 { __ino64_t d_ino; __off64_t d_off; unsigned short d_reclen; unsigned char d_type; char d_name[0]; }; #ifdef __UMBINFMT_DEBUG__ static void printdebug(int level, const char *file, const int line, const char *func, const char *fmt, ...) { va_list ap; if (level >= __UMBINFMT_DEBUG_LEVEL__) { va_start(ap, fmt); #ifdef _PTHREAD_H printk("[%d:%lu] dev %s:%d %s(): ", getpid(), pthread_self(), file, line, func); #else printk("[%d] dev %s:%d %s(): ", getpid(), file, line, func); #endif vprintk(fmt, ap); printk("\n"); va_end(ap); } } #endif static int searchbinfmt(struct umbinfmt *fc,struct binfmt_req *req) { char *buf=req->buf; if (fc->enabled) { struct umregister *scan=fc->head; while (scan != NULL && req->interp==NULL) { if (scan->enabled) { if (scan->type == 'E') { int suffixpos=strlen(req->path)-scan->len; if (suffixpos>0 && strcmp(req->path+suffixpos,scan->magic)==0) { req->interp=scan->interpreter; req->flags=(strchr(scan->flags,'P') != NULL)?BINFMT_KEEP_ARG0:0; } } else if (scan->type == 'M') { int i,j,diff; /*for (i=scan->offset,j=0,diff=0;i<128 && jlen && diff==0;i++,j++) printk("%02x %02x %02x %2x\n",buf[i],scan->magic[j],scan->mask[j], (buf[i] ^ scan->magic[j]) & scan->mask[j]);*/ for (i=scan->offset,j=0,diff=0;i<128 && jlen && diff==0;i++,j++) diff=(buf[i] ^ scan->magic[j]) & scan->mask[j]; if (diff==0) { req->interp=scan->interpreter; req->flags=(strchr(scan->flags,'P') != NULL)?BINFMT_KEEP_ARG0:0; } } } scan=scan->next; } } //printk("searchbinfmt %s %s\n",req->path,req->interp); if (req->interp!=NULL) return 1; else return 0; } #if 0 #define MAXARGS 256 static void debugfun(char *s,struct umbinfmt *fc) { #ifdef DEBUGUMBINFMTARGS printf("DEBUG\n"); #endif fc->flags |= UMBINFMT_DEBUG; } void devargs(char *opts, struct devargitem *devargtab, int devargsize, void *arg) { char *sepopts[MAXARGS]; int nsepopts=0; int i; char *optcopy=strdup(opts); char *s=optcopy; char quote=0,olds; #ifdef DEBUGUMBINFMTARGS printf("devargs opts %s\n",s); #endif /* PHASE 1: tokenize options */ for (quote=0,s=opts,olds=*s;olds != 0 && nsepopts < MAXARGS;s++) { sepopts[nsepopts++]=s; while (*s != 0 && (*s != ',' || quote != 0)) { if (*s=='\\' && *(s+1)!=0) s+=2; if (*s=='\'' || *s=='\"') { if (*s == quote) quote=0; else if (quote==0) quote=*s; } s++; } olds=*s;*s=0; } #ifdef DEBUGUMBINFMTARGS for (i=0;inext; free(this->name); free(this->flags); free(this->magic); free(this->mask); free(this->interpreter); free(this); return next; } else return delete_reg(head->next,this); } static struct umregister *delete_allreg(struct umregister *head) { if (head == NULL) return NULL; else { delete_allreg(head->next); free(head->name); free(head->flags); free(head->magic); free(head->mask); free(head->interpreter); free(head); return NULL; } } static int checkbinfmt(int type, void *arg, int arglen, struct ht_elem *ht) { struct binfmt_req *req=arg; void *private_data=ht_get_private_data(ht); if (private_data) return searchbinfmt(private_data,req); else return 0; } static long umbinfmt_mount(char *source, char *target, char *filesystemtype, unsigned long mountflags, void *data) { struct umbinfmt *new = (struct umbinfmt *) malloc(sizeof(struct umbinfmt)); assert(new); new->path = strdup(target); new->flags=(data && strcmp((char*)data,"debug")==0)?UMBINFMT_DEBUG:0; new->inuse=0; new->enabled=1; new->head=NULL; if (strcmp(source,"none")==0 || strcmp(source,"/")==0) new->binfmt_ht=ht_tab_add(CHECKBINFMT,NULL,0,&s,checkbinfmt,new); else new->binfmt_ht=ht_tab_add(CHECKBINFMT,source,strlen(source),&s,checkbinfmt,new); ht_tab_pathadd(CHECKPATH,source,target,filesystemtype,mountflags,data,&s,0,NULL,new); return 0; } static void umbinfmt_umount_internal(struct umbinfmt *fc, int flags) { struct umbinfmt *fc_norace=fc; char *target=fc->path; if (fc_norace->flags & UMBINFMT_DEBUG) printk("UMOUNT => path:%s flag:%d\n",target, flags); ht_tab_invalidate(fc->binfmt_ht); ht_tab_invalidate(um_mod_get_hte()); delete_allreg(fc->head); free(fc_norace->path); free(fc_norace); } static long umbinfmt_umount2(char *target, int flags) { struct umbinfmt *fc=um_mod_get_private_data(); if (fc == NULL) { errno=EINVAL; return -1; } else if (fc->inuse > 0) { errno=EBUSY; return -1; } else { struct ht_elem *binfmt_ht=fc->binfmt_ht; umbinfmt_umount_internal(fc,flags); ht_tab_del(binfmt_ht); ht_tab_del(um_mod_get_hte()); return 0; } } #if 0 #define TRUE 1 #define FALSE 0 static int alwaysfalse() { return FALSE; } #endif static char *unwrap(struct umbinfmt *fc,char *path) { char *reduced=path+strlen(fc->path); if (*reduced == 0) return("/"); else return(reduced); } static struct umregister *searchfile(char *path,struct umbinfmt *fc) { char *unpath=unwrap(fc,path); if (strcmp(unpath,rootdir)==0) return (struct umregister *)rootdir; else if (strcmp(unpath+1,registerfile)==0) return (struct umregister *)registerfile; else if (strcmp(unpath+1,statusfile)==0) return (struct umregister *)statusfile; else { struct umregister *scan=fc->head; while (scan != NULL && strcmp(unpath+1,scan->name) != 0) scan=scan->next; return scan; } } #define SIZEOFPUREDIRENT (sizeof(struct umbinfmt_dirent64)) static char *add_dirent(char *start, char *name, char *base) { struct umbinfmt_dirent64 *de=(struct umbinfmt_dirent64 *)start; de->d_ino=2; de->d_reclen=SIZEOFPUREDIRENT+strlen(name)+1; de->d_off=(start-base)+de->d_reclen; de->d_type=0; strcpy(de->d_name,name); return start+de->d_reclen; } static char *create_dirent(struct umbinfmt *fc, int *len) { int totlen=0; struct umregister *scan=fc->head; char *contents,*scont; totlen+=SIZEOFPUREDIRENT+2; /* . */ totlen+=SIZEOFPUREDIRENT+3; /* .. */ totlen+=SIZEOFPUREDIRENT+7; /* status */ totlen+=SIZEOFPUREDIRENT+9; /* register */ while (scan != NULL) { totlen+=SIZEOFPUREDIRENT+strlen(scan->name)+1; scan=scan->next; } contents=scont=malloc(totlen); assert(contents); scont=add_dirent(scont,".",contents); scont=add_dirent(scont,"..",contents); scont=add_dirent(scont,"status",contents); scont=add_dirent(scont,"register",contents); scan=fc->head; while (scan != NULL) { scont=add_dirent(scont,scan->name,contents); scan=scan->next; } *len=totlen; return contents; } #define dec2hex(X) (((X)<10)?(X)+'0':(X)+'a'-10) static char *hexstring(char *src,char *hex,int len) { register int i; for (i=0;i> 4); hex[2*i+1]=dec2hex(src[i] & 0xf); } hex[2*i]=0; return hex; } static char *createcontents(int fd,struct umbinfmt *fc,int *len) { struct binfileinfo *ft=getfiletab(fd); struct umregister *reg=ft->reg; assert (reg); if (UBM_IS_ROOT(reg)) { return create_dirent(fc,len); } else if (UBM_IS_STATUS(reg)) { char *rv; if (fc->enabled) rv= strdup("enabled"); else rv= strdup("disabled"); *len=strlen(rv); return rv; } else { char *rv; char magic[257]; char mask[257]; asprintf(&rv,"%sabled\n" "interpreter %s\n" "flags: %s\n" "offset %d\n" "magic %s\n" "mask %s\n", (reg->enabled)?"en":"dis", reg->interpreter, reg->flags, reg->offset, hexstring(reg->magic,magic,reg->len), hexstring(reg->mask,mask,reg->len)); *len=strlen(rv); return rv; } } static long umbinfmt_open(char *path, int flags, mode_t mode) { struct umbinfmt *fc = um_mod_get_private_data(); int fd; int rv; assert(fc!=NULL); struct umregister *file=searchfile(path,fc); if (file == NULL) rv=-ENOENT; else if ((UBM_IS_REGISTER(file) && (flags & O_WRONLY)== 0) || (flags & O_RDWR) || (UBM_IS_ROOT(file) && !(flags & O_DIRECTORY) && (flags & O_WRONLY))) rv=-EINVAL; else { fd = addfiletab(sizeof(struct binfileinfo)); struct binfileinfo *ft=getfiletab(fd); assert(fd>=0); #ifdef __UMBINFMT_DEBUG__ PRINTDEBUG(10,"FLAGOPEN path:%s \nFLAGS:0x%x MODE:%d\n",path,flags,mode); if(flags & O_CREAT) PRINTDEBUG(10, "O_CREAT\n"); if(flags & O_TRUNC) PRINTDEBUG(10, "O_TRUNC\n"); if(flags & O_RDONLY) PRINTDEBUG(10, "O_RDONLY:\n"); if(flags & O_APPEND) PRINTDEBUG(10, "O_APPEND\n"); if(flags & O_WRONLY) PRINTDEBUG(10, "O_WRONLY\n"); if(flags & O_RDWR) PRINTDEBUG(10, "O_RDWR\n"); if(flags & O_ASYNC) PRINTDEBUG(10, "O_ASYNC\n"); if(flags & O_DIRECT) PRINTDEBUG(10, "O_DIRECT\n"); if(flags & O_DIRECTORY) PRINTDEBUG(10, "O_DIRECTORY\n"); if(flags & O_EXCL) PRINTDEBUG(10, "O_EXCL\n"); if(flags & O_LARGEFILE) PRINTDEBUG(10, "O_LARGEFILE\n"); if(flags & O_DIRECT) PRINTDEBUG(10, "O_NOATIME\n"); if(flags & O_DIRECTORY) PRINTDEBUG(10, "O_NOCTTY\n"); if(flags & O_EXCL) PRINTDEBUG(10, "O_NOCTTY\n"); if(flags & O_NOFOLLOW) PRINTDEBUG(10, "O_NOFOLLOW\n"); if(flags & (O_NONBLOCK | O_NDELAY)) PRINTDEBUG(10, "O_NONBLOCK o O_NDELAY\n"); if(flags & O_SYNC) PRINTDEBUG(10, "SYNC\n"); #endif ft->reg = file; ft->bfmount = fc; ft->flags = flags & ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); ft->pos = 0; if (!(flags & O_WRONLY)) { ft->contents = createcontents(fd,fc,&(ft->len)); } else { ft->len = 0; ft->contents = NULL; } fc->inuse++; rv=0; } if (rv < 0) { if (fc->flags & UMBINFMT_DEBUG) printk("OPEN[%d] ERROR => path:%s flags:0x%x\n", fd, path, flags); errno = -rv; return -1; } else { if (fc->flags & UMBINFMT_DEBUG) printk("OPEN[%d] => path:%s flags:0x%x\n", fd, path, flags); return fd; } } static long umbinfmt_close(int fd) { struct binfileinfo *ft=getfiletab(fd); if (ft->bfmount->flags & UMBINFMT_DEBUG) printk("CLOSE[%d]\n",fd); if (ft->contents != NULL) free(ft->contents); ft->bfmount->inuse--; if (UBM_IS_STATUS(ft->reg)) { if (ft->bfmount->enabled == 0xff) ft->bfmount->head=delete_allreg(ft->bfmount->head); } else { if (ft->reg->enabled == 0xff) ft->bfmount->head=delete_reg(ft->bfmount->head,ft->reg); } delfiletab(fd); return 0; } static int count_dents64(void *buf, int count, int max) { struct umbinfmt_dirent64 *d64=(struct umbinfmt_dirent64 *)buf; if (count == 0 || count < d64->d_reclen || max == 0) return 0; else { void *next=(void *)(((char *)buf) + d64->d_reclen); return count_dents64(next,count - d64->d_reclen,max - d64->d_reclen) + d64->d_reclen; } } static long umbinfmt_getdents64(int fd, void *buf, size_t count){ struct binfileinfo *ft=getfiletab(fd); if (! UBM_IS_ROOT(ft->reg)) { errno=ENOTDIR; return -1; } else { char *tail=(ft->contents)+ft->pos; int rv=count_dents64(tail,count,ft->len-ft->pos); memcpy(buf,(ft->contents)+ft->pos,rv); if (rv<0) { errno= -rv; return -1; } else { ft->pos += rv; return rv; } } } static long umbinfmt_read(int fd, void *buf, size_t count) { int rv; struct binfileinfo *ft=getfiletab(fd); if (UBM_IS_ROOT(ft->reg)) { errno=EISDIR; return -1; } else { rv = count; if (rv > ft->len - ft->pos) rv= ft->len - ft->pos; strncpy(buf,(ft->contents)+ft->pos,rv); if (rv<0) { errno= -rv; return -1; } else { ft->pos += rv; return rv; } } } static char *toknext(char *str,char sep) { while(*str && *str != sep && *str != '\n') str++; if (*str) *(str++)=0; return str; } #define F_NAME 0 #define F_TYPE 1 #define F_OFFSET 2 #define F_MAGIC 3 #define F_MASK 4 #define F_INTERPRETER 5 #define F_FLAGS 6 static char *dechex(char *src,unsigned char *len) { char buf[128]; char *rv; int i; if (*len > 0) for (i=0;i < *len;i++) buf[i]=0xff; i=0; while (*src != 0 && i<128) { if(src[0] == '\\' && src[1] == 'x' && src[2] != 0 && src[3] != 0) { unsigned int v; src +=2; sscanf(src,"%2x",&v); buf[i++]=v; src+=2; } else { buf[i++]=*src; src++; } } if (*len == 0) *len=i; else buf[*len]=0; rv=malloc(*len); assert(rv); memcpy(rv,buf,*len); return rv; } static void ubm_register(struct umbinfmt *fc,char *buf, size_t count) { char regstr[256]; if (count > 0 && buf) { char sep=*buf;; char *scan=regstr; char *fields[7]; int i; if (count > 255) count=255; strncpy(regstr,buf+1,count-1); regstr[count-1]=0; for (i=0;i<7;i++) { fields[i]=scan; scan=toknext(scan,sep); } if (fields[F_NAME][0] != 0 && fields[F_MAGIC][0] != 0 && fields[F_INTERPRETER][0] != 0 && (fields[F_TYPE][0] == 'M' || fields[F_TYPE][0] == 'E')) { struct umregister *new=malloc(sizeof (struct umregister)); new->name=strdup(fields[F_NAME]); new->enabled=1; new->flags=strdup(fields[F_FLAGS]); new->type=fields[F_TYPE][0]; new->offset=(atoi(fields[F_OFFSET])); new->interpreter=strdup(fields[F_INTERPRETER]); new->len=0; new->magic=dechex(fields[F_MAGIC],&(new->len)); new->mask=dechex(fields[F_MASK],&(new->len)); new->next=fc->head; fc->head=new; } } } static long umbinfmt_write(int fd, void *buf, size_t count) { int rv=count; struct binfileinfo *ft=getfiletab(fd); char *cbuf=buf; if (UBM_IS_REGISTER(ft->reg)) { if (ft->pos == 0) ubm_register(ft->bfmount,buf,count); } else if (UBM_IS_STATUS(ft->reg)) { if (count >= 1) { if (*cbuf=='1') ft->bfmount->enabled = 1; else if (*cbuf=='0') ft->bfmount->enabled = 0; if (count >= 2 && cbuf[0]=='-' && cbuf[1]=='1') ft->bfmount->enabled = 0xff; } } else { if (count >= 1) { if (*cbuf=='1') ft->reg->enabled = 1; else if (*cbuf=='0') ft->reg->enabled = 0; if (count >= 2 && cbuf[0]=='-' && cbuf[1]=='1') ft->reg->enabled = 0xff; } } if (rv<0) { errno= -rv; return -1; } else { ft->pos += rv; return rv; } } static inline int common_stat64(struct umbinfmt *fc,struct umregister *reg, struct stat64 *buf64) { int rv; if (reg == NULL) { errno=ENOENT; return -1; } memset(buf64, 0, sizeof(struct stat64)); buf64->st_nlink=1; if (UBM_IS_ROOT(reg)) buf64->st_mode=S_IFDIR | 0755; else if (UBM_IS_REGISTER(reg)) buf64->st_mode=S_IFREG | 0200; else if (UBM_IS_STATUS(reg)) buf64->st_mode=S_IFREG | 0644; else buf64->st_mode=S_IFREG | 0644; rv=0; if (fc->flags & UMBINFMT_DEBUG) printk("stat->GETATTR => status: %s\n", rv ? "Error" : "Success"); return rv; } static long umbinfmt_lstat64(char *path, struct stat64 *buf64) { struct umbinfmt *umbinfmt=um_mod_get_private_data(); struct umregister *reg=searchfile(path,umbinfmt); return common_stat64(umbinfmt,reg,buf64); } static long umbinfmt_access(char *path, int mode) { struct umbinfmt *fc=um_mod_get_private_data(); struct umregister *reg=searchfile(path,fc); int rv; assert(fc!=NULL); if (fc->flags & UMBINFMT_DEBUG) printk("ACCESS => path:%s mode:%s%s%s%s\n", path, (mode & R_OK) ? "R_OK": "", (mode & W_OK) ? "W_OK": "", (mode & X_OK) ? "X_OK": "", (mode & F_OK) ? "F_OK": ""); if (UBM_IS_ROOT(reg)) rv= !(mode & W_OK); /* it is forbidden to create new file by hand*/ else if (UBM_IS_REGISTER(reg)) rv=(!(mode & R_OK) && !(mode & X_OK)); /* only WRITE on register */ else rv=(!(mode & X_OK)); if (rv) return 0; else { errno=EACCES; return -1; } #if 0 if (UBM_IS_ROOT(reg)) return(!(mode & W_OK)); else if (UBM_IS_REGISTER(reg)) return(!(mode & R_OK) && !(mode & X_OK)); else return(!(mode & X_OK)); #endif } static loff_t umbinfmt_x_lseek(int fd, off_t offset, int whence) { struct binfileinfo *ft=getfiletab(fd); switch (whence) { case SEEK_SET: ft->pos=offset; break; case SEEK_CUR: ft->pos+=offset; break; case SEEK_END: ft->pos=ft->len+offset; break; } if (ft->pos<0) ft->pos=0; if (ft->pos > ft->len) ft->pos=ft->len; return ft->pos; } static long umbinfmt_lseek(int fd, int offset, int whence) { return umbinfmt_x_lseek(fd, offset, whence); } static long umbinfmt__llseek(unsigned int fd, unsigned long offset_high, unsigned long offset_low, loff_t *result, unsigned int whence) { PRINTDEBUG(10,"umbinfmt__llseek %d %d %d %d\n",fd,offset_high,offset_low,whence); if (result == NULL) { errno = EFAULT; return -1; } else { loff_t rv; loff_t offset=((loff_t)offset_high)<<32 | offset_low; rv=umbinfmt_x_lseek(fd,offset,whence); if (rv >= 0) { *result=rv; return 0; } else { errno = -rv; return -1; } } } #if 0 static void contextclose(struct umbinfmt *fc) { umbinfmt_umount2(fc->path,MNT_FORCE); } #endif static long umbinfmt_event_subscribe(void (* cb)(), void *arg, int fd, int how) { return 1; } #if 0 static epoch_t umbinfmt_check(int type, void *arg) { if (type == CHECKBINMFT) { struct binfmt_req *req=arg; if (strcmp(req->path,"/tmp/f1/bin/ls")==0 || strcmp(req->path,"/tmp/ls")==0) { req->interp="/usr/local/bin/qemu-i386"; return get_epoch()-1; } else return 0; } else return 0; } #endif static long umbinfmt_fcntl64() { return 0; } static void umbinfmt_destructor(int type,struct ht_elem *mp) { switch (type) { case CHECKPATH: um_mod_set_hte(mp); umbinfmt_umount_internal(um_mod_get_private_data(), MNT_FORCE); } } static void __attribute__ ((constructor)) init (void) { printk(KERN_NOTICE "umbinfmt init\n"); s.name="umbinfmt"; s.description="virtual binfmt_misc"; s.destructor=umbinfmt_destructor; s.syscall=(sysfun *)calloc(scmap_scmapsize,sizeof(sysfun)); s.socket=(sysfun *)calloc(scmap_sockmapsize,sizeof(sysfun)); SERVICESYSCALL(s, mount, umbinfmt_mount); SERVICESYSCALL(s, umount2, umbinfmt_umount2); SERVICESYSCALL(s, open, umbinfmt_open); SERVICESYSCALL(s, read, umbinfmt_read); SERVICESYSCALL(s, write, umbinfmt_write); SERVICESYSCALL(s, close, umbinfmt_close); #if !defined(__x86_64__) SERVICESYSCALL(s, lstat64, umbinfmt_lstat64); #else SERVICESYSCALL(s, lstat, umbinfmt_lstat64); #endif SERVICESYSCALL(s, access, umbinfmt_access); SERVICESYSCALL(s, lseek, umbinfmt_lseek); #if ! defined(__x86_64__) SERVICESYSCALL(s, _llseek, umbinfmt__llseek); #endif SERVICESYSCALL(s, getdents64, umbinfmt_getdents64); SERVICESYSCALL(s, fcntl, umbinfmt_fcntl64); s.event_subscribe=umbinfmt_event_subscribe; } static void __attribute__ ((destructor)) fini (void) { free(s.syscall); free(s.socket); printk(KERN_NOTICE "umbinfmt fini\n"); } umview-0.8.2/umbinfmt/Makefile.am0000644000175000017500000000022711753517211015772 0ustar renzorenzoinclude $(top_srcdir)/modules-common.mk #DEVELFLAGS=-D__UMDEV_DEBUG__ mod_LTLIBRARIES = umbinfmt.la umbinfmt_la_LDFLAGS = $(AM_LDFLAGS) -lpthread umview-0.8.2/include/0000755000175000017500000000000011753517351013544 5ustar renzorenzoumview-0.8.2/include/Makefile.in0000644000175000017500000003461011753517327015620 0ustar renzorenzo# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = include DIST_COMMON = $(dist_noinst_SCRIPTS) $(dist_pkginclude_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SCRIPTS = $(dist_noinst_SCRIPTS) SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(dist_pkginclude_HEADERS) $(nodist_noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/umview ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB20_CFLAGS = @GLIB20_CFLAGS@ GLIB20_LIBS = @GLIB20_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ nodist_noinst_HEADERS = syscallnames.h nrsyscalls.h dist_pkginclude_HEADERS = \ gdebug.h \ libummod.h \ module.h \ um_lib.h \ msocket.h \ ummisc.h \ umnet.h \ umdev.h dist_noinst_SCRIPTS = \ syscallnames.sh BUILT_SOURCES = syscallnames.h nrsyscalls.h CLEANFILES = syscallnames.h nrsyscalls.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-dist_pkgincludeHEADERS: $(dist_pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(dist_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-dist_pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(dist_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(SCRIPTS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dist_pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_pkgincludeHEADERS .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dist_pkgincludeHEADERS install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-dist_pkgincludeHEADERS syscallnames.h: syscallnames.sh ./syscallnames.sh nrsyscalls.h: syscallnames.h debug release: all # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: umview-0.8.2/include/gdebug.h0000644000175000017500000000570511753517211015154 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * gdebug.h: debugging functions (headers) * * Copyright 2005 Ludovico Gardenghi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: gdebug.h 282 2007-01-18 12:33:03Z garden $ * */ #ifndef _GDEBUG_H #define _GDEBUG_H #include #include #ifdef DEBUG # define GDEBUG_ENABLED #endif #define GDEBUG_OFILE (gdebug_ofile?gdebug_ofile:stderr) extern FILE* gdebug_ofile; void gdebug_set_ofile(char* new_ofile); void fgmsg(FILE *ofile, const char *fmt, ...); #ifdef GDEBUG_ENABLED # ifndef GDEBUG_LEVEL # error "Debug enabled but GDEBUG_LEVEL undefined." # endif # define FGDEBUG(ofile, level, args...) fgdebug(ofile, GDEBUG_LEVEL, level, __FILE__, __LINE__, __func__, args) # define GDEBUG(level, args...) FGDEBUG(GDEBUG_OFILE, level, args) # define GPERROR(level, prefix) GDEBUG(level, "%s: %s", prefix, strerror(errno)) # define FGHEXDUMP(ofile, level, text, len) fghexdump(ofile, GDEBUG_LEVEL, level, __FILE__, __LINE__, __func__, text, len) # define GHEXDUMP(level, text, len) FGHEXDUMP(GDEBUG_OFILE, level, text, len) # define GBACKTRACE(level, maxdepth) FGBACKTRACE(gdebug_ofile?gdebug_ofile:stderr, level, maxdepth) # define FGBACKTRACE(ofile, level, maxdepth) fgbacktrace(ofile, GDEBUG_LEVEL, level, __FILE__, __LINE__, __func__, maxdepth) # define FGERROR(ofile, args...) fgdebug(ofile, -1, -1, __FILE__, __LINE__, __func__, args) # define GERROR(args...) FGERROR(GDEBUG_OFILE, args) # define GMESSAGE(args...) FGERROR(GDEBUG_OFILE, args) void fgdebug(FILE *ofile, int gdebug_level, int level, const char *file, const int line, const char *func, const char *fmt, ...); void fghexdump(FILE *ofile, int gdebug_level, int level, const char *file, const int line, const char *func, char *text, int len); void fgbacktrace(FILE *ofile, int gdebug_level, int level, const char *file, const int line, const char *func, int maxdepth); #else # define FGDEBUG(ofile, level, args...) # define GDEBUG(level, args...) # define GPERROR(level, prefix) # define FGHEXDUMP(ofile, level, text, len) # define GHEXDUMP(level, text, len) # define GBACKTRACE(level, maxdepth) # define FGERROR(ofile, args...) fgmsg(ofile, args) # define GERROR(args...) FGERROR(GDEBUG_OFILE, args) # define GMESSAGE(args...) FGERROR(GDEBUG_OFILE, args) #endif #endif umview-0.8.2/include/ummisc.h0000644000175000017500000000272211753517211015210 0ustar renzorenzo/* * UMMISC: Virtual Miscellanea in Userspace * (virtualization of pid/uid/gid/time/uname....) * Copyright (C) 2006 Renzo Davoli * * This program can be distributed under the terms of the GNU GPLv2. * See the file COPYING.LIB. */ #ifndef _UMMISC_H_ #define _UMMISC_H_ #include #include #include #define IOCTLLENMASK 0x07ffffff #define IOCTL_R 0x10000000 #define IOCTL_W 0x20000000 #define MISCFILESIZE 4096 #define UMMISC_DEBUG (1 << 29) typedef void (* voidfun)(void *arg); struct ummisc; #define UMMISC_GET 1 #define UMMISC_PUT 0 struct fsentry { char *name; struct fsentry *subdir; loff_t (*getputfun)(int op,char *value,int size,struct ummisc *mh,int tag,char *path); int tag; }; struct ummisc_operations { struct fsentry root; void (*init) (char *path, unsigned long flags, char *args,struct ummisc *mh); void (*fini) (struct ummisc *mh); }; /* MOUNT ARG MGMT */ struct miscargitem { char *arg; void (*fun)(); }; void miscargs(char *opts, struct miscargitem *miscargtab, int miscargsize, void *arg); struct ummisc *searchmisc_sc(int scno); void *misc_getdl(struct ummisc *mh); void ummisc_setprivatedata(struct ummisc *mischandle,void *privatedata); void *ummisc_getprivatedata(struct ummisc *mischandle); //void ummisc_setmode(struct ummisc *mischandle, mode_t mode); //mode_t ummisc_getmode(struct ummisc *mischandle); #endif /* _UMMISC_H_ */ umview-0.8.2/include/umdev.h0000644000175000017500000000461211753517211015033 0ustar renzorenzo/* * UMDEV: Virtual Device in Userspace * Copyright (C) 2006 Renzo Davoli * * This program can be distributed under the terms of the GNU GPLv2. * See the file COPYING.LIB. */ #ifndef _UMDEV_H_ #define _UMDEV_H_ #include #include #include #define IOCTLLENMASK 0x07ffffff #define IOCTL_R 0x10000000 #define IOCTL_W 0x20000000 #define UMDEV_DEBUG (1 << 29) typedef void (* voidfun)(void *arg); struct umdev; struct dev_info { /* Open flags, available in open and release */ int flags; /* File handle. It usually set up in open and then * available for all other operations */ uint64_t fh; /* devhandle for management */ struct umdev *devhandle; }; struct umdev_operations { int (*getattr) (char, dev_t, struct stat64 *, struct umdev *devhandle); int (*fgetattr) (char, dev_t, struct stat64 *, struct dev_info *); int (*chmod) (char, dev_t, mode_t, struct umdev *devhandle); int (*chown) (char, dev_t, uid_t, gid_t, struct umdev *devhandle); int (*open) (char, dev_t, struct dev_info *); int (*read) (char, dev_t, char *, size_t, loff_t, struct dev_info *); int (*write) (char, dev_t, const char *, size_t, loff_t, struct dev_info *); loff_t (*lseek) (char, dev_t, loff_t, int, loff_t, struct dev_info *); int (*fsync) (char, dev_t, struct dev_info *); int (*ioctl) (char, dev_t, int, void *, struct dev_info *); int (*release) (char, dev_t, struct dev_info *); int (*access) (char, dev_t, int, struct umdev *devhandle); int (*event_subscribe) (char, dev_t, voidfun cb, void *arg, int how, struct dev_info *); int (*ioctlparms) (char, dev_t, int arg, struct dev_info *); int (*init) (char, dev_t, char *path, unsigned long flags, char *args, struct umdev *devhandle); int (*fini) (char, dev_t, struct umdev *devhandle); }; /* MOUNT ARG MGMT */ struct devargitem { char *arg; void (*fun)(); }; void devargs(char *opts, struct devargitem *devargtab, int devargsize, void *arg); void umdev_setprivatedata(struct umdev *devhandle, void *privatedata); void *umdev_getprivatedata(struct umdev *devhandle); void umdev_setnsubdev(struct umdev *devhandle, int nsubdev); int umdev_getnsubdev(struct umdev *devhandle); void umdev_setmode(struct umdev *devhandle, mode_t mode); mode_t umdev_getmode(struct umdev *devhandle); dev_t umdev_getbasedev(struct umdev *devhandle); #endif /* _UMDEV_H_ */ umview-0.8.2/include/syscallnames.sh0000755000175000017500000000771011753517211016601 0ustar renzorenzo#!/bin/bash -e # This is part of um-ViewOS # The user-mode implementation of OSVIEW -- A Process with a View # # syscallnames.sh: extracts correspondence syscall number - syscall name # # Copyright 2005 Ludovico Gardenghi # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # # $Id: syscallnames.sh 1009 2011-10-24 19:44:13Z rd235 $ # #set -x tmpfile=`mktemp /tmp/scnXXXXXX` tmpoutfile=`mktemp /tmp/scnXXXXXX` tmpsfile=`mktemp /tmp/scnXXXXXX` tmpsoutfile=`mktemp /tmp/scnXXXXXX` # First step: obtain the total number of system calls ### cat > $tmpfile << _END_ ### #include ### #include ### ### int main(void) ### { ### printf("%d\n", NR_syscalls); ### return 0; ### } ### _END_ ### ### gcc -xc -o "$tmpoutfile" "$tmpfile" ### syscalls=$($tmpoutfile) ### # Second step: read system calls names cat > $tmpfile << _END_ #include #include int main(void) { _END_ echo "#include " | cpp -dN | egrep "^#[[:blank:]]*define[[:blank:]]+__NR_" | tr -s " " " " | cut -d" " -f2 | sed 's/__NR_//g' | sort | uniq | while read do cat >> $tmpfile << _END_ #ifdef __NR_$REPLY printf("%d\t%s\n", __NR_$REPLY, "$REPLY"); #endif _END_ done cat >> $tmpfile << _END_ return 0; } _END_ cat > $tmpsfile << _END_ #include #include int main(void) { _END_ echo "#include " | cpp -dN | egrep "^#[[:blank:]]*define[[:blank:]]+SYS_" | tr -s " " " " | cut -d" " -f2 | sed 's/SYS_//g' | sort | uniq | while read do cat >> $tmpsfile << _END_ #ifdef SYS_$REPLY printf("%d\t%s\n", SYS_$REPLY, "$REPLY"); #endif _END_ done cat >> $tmpsfile << _END_ return 0; } _END_ gcc -xc -o "$tmpoutfile" "$tmpfile" gcc -xc -o "$tmpsoutfile" "$tmpsfile" lastscno=-1 cat > syscallnames.h << _END_ #ifndef _SYSCALLNAMES_H #define _SYSCALLNAMES_H #include static const char *syscallnames[] = { _END_ $tmpoutfile | sort -n | uniq | ( while read scno scname do if [[ $scno == $lastscno ]] then # Two system calls with the same number continue fi if [[ $scno -gt $(($lastscno + 1)) ]] then for i in `seq $(($lastscno+1)) $(($scno-1))` do echo " /* $i */ \"UNKNOWN($i)\"," done fi echo " /* $scno */ \"$scname\"," lastscno=$scno done >> syscallnames.h scsize=$(($lastscno + 1)) cat >> syscallnames.h << _END_ }; static const int syscallnames_size = $scsize; #define SYSCALLNAME(n) (((n) < syscallnames_size) ? syscallnames[(n)] : "OUTOFBOUNDS") #ifdef __NR_socketcall static const char *sockcallnames[] = { _END_ lastscno=-1 $tmpsoutfile | sort -n | uniq | ( while read scno scname do if [[ $scno == $lastscno ]] then # Two system calls with the same number continue fi if [[ $scno -gt $(($lastscno + 1)) ]] then for i in `seq $(($lastscno+1)) $(($scno-1))` do echo " /* $i */ \"UNKNOWN($i)\"," done fi echo " /* $scno */ \"$scname\"," lastscno=$scno done >> syscallnames.h socksize=$(($lastscno + 1)) cat >> syscallnames.h << _END_ }; static const int sockcallnames_size = $socksize; #define SOCKCALLNAME(n) (((n) < sockcallnames_size) ? sockcallnames[(n)] : "OUTOFBOUNDS") #endif #endif _END_ cat > nrsyscalls.h << _END_ #ifndef _NRSYSCALLS_H #define _NRSYSCALLS_H #include #define _UM_NR_syscalls $scsize #ifdef __NR_socketcall #define _UM_NR_sockcalls $socksize #endif #endif _END_ ) ) rm -f "$tmpfile" "$tmpoutfile" "$tmpsfile" "$tmpsoutfile" umview-0.8.2/include/Makefile.am0000644000175000017500000000067611753517211015604 0ustar renzorenzonodist_noinst_HEADERS = syscallnames.h nrsyscalls.h pkgincludedir = $(includedir)/umview dist_pkginclude_HEADERS = \ gdebug.h \ libummod.h \ module.h \ um_lib.h \ msocket.h \ ummisc.h \ umnet.h \ umdev.h dist_noinst_SCRIPTS = \ syscallnames.sh BUILT_SOURCES = syscallnames.h nrsyscalls.h CLEANFILES = syscallnames.h nrsyscalls.h syscallnames.h: syscallnames.sh ./syscallnames.sh nrsyscalls.h: syscallnames.h debug release: all umview-0.8.2/include/gd64helper.h0000644000175000017500000000275011753517211015660 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * Helper for getdents64 * * Copyright 2007 Ludovico Gardenghi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: gd64helper.h 648 2009-04-22 22:50:01Z rd235 $ * */ #ifndef _GD64HELPER_H #define _GD64HELPER_H #include #include #include "libummod.h" typedef struct _dirdata dirdata; enum ddmode { DDFULL, DDFAST }; dirdata *dirdata_new(enum ddmode mode); int dirdata_lseek(dirdata *dd, int fd, unsigned long long offset, loff_t *result, unsigned int whence); int dirdata_getdents64(dirdata *dd, unsigned int fd, struct dirent64 *dirp, unsigned int count); void dirdata_transform_remove(dirdata *dd, char *d_name); void dirdata_transform_add(dirdata *dd, long d_ino, char *d_name, int replace); void dirdata_free(dirdata *dd); #endif umview-0.8.2/include/linux_dirent.h0000644000175000017500000000127111753517211016415 0ustar renzorenzo#ifndef _LINUX_DIRENT_H #define _LINUX_DIRENT_H struct dirent { long d_ino; __kernel_off_t d_off; unsigned short d_reclen; char d_name[256]; /* We must not include limits.h! */ }; struct dirent64 { __u64 d_ino; __s64 d_off; unsigned short d_reclen; unsigned char d_type; char d_name[256]; }; enum { DT_UNKNOWN = 0, # define DT_UNKNOWN DT_UNKNOWN DT_FIFO = 1, # define DT_FIFO DT_FIFO DT_CHR = 2, # define DT_CHR DT_CHR DT_DIR = 4, # define DT_DIR DT_DIR DT_BLK = 6, # define DT_BLK DT_BLK DT_REG = 8, # define DT_REG DT_REG DT_LNK = 10, # define DT_LNK DT_LNK DT_SOCK = 12, # define DT_SOCK DT_SOCK DT_WHT = 14 # define DT_WHT DT_WHT }; #endif umview-0.8.2/include/module.h0000644000175000017500000002751611753517211015210 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: module.h 968 2011-08-03 10:16:26Z rd235 $ * */ #ifndef _UM_VIEW_MODULE_H #define _UM_VIEW_MODULE_H #include #include #include #include //#include /* VIRTUAL SYSCALLS */ #define VIRSYS_UMSERVICE 1 #define VIRSYS_MSOCKET 2 #define __NR_msocket VIRSYS_MSOCKET struct ht_elem; extern int _umview_version; typedef long (*sysfun)(); typedef long long epoch_t; struct treepoch; struct timestamp { epoch_t epoch; struct treepoch *treepoch; }; extern epoch_t tst_matchingepoch(struct timestamp *service_tst); extern struct timestamp tst_timestamp(); extern epoch_t get_epoch(); extern epoch_t um_setepoch(epoch_t epoch); typedef epoch_t (*epochfun)(); typedef unsigned long c_set; extern int msocket (char *path, int domain, int type, int protocol); #define MC_USER 1 #define MC_CORECTLCLASS(x) ((x) << 1) #define MC_CORECTLOPT(x) ((x) << 6) #define MC_USERCTL(ctl) (MC_USER | (ctl << 1)) /* To be tested. Bits are fun! */ #define MC_ISUSER(x) ((x) & MC_USER) #define MC_USERCTL_CTL(x) (((x) >> 1)) #define MC_PROC MC_CORECTLCLASS(0) #define MC_MODULE MC_CORECTLCLASS(1) #define MC_MOUNT MC_CORECTLCLASS(2) #define MC_ADD MC_CORECTLOPT(0) #define MC_REM MC_CORECTLOPT(1) #define MCH_SET(c, set) *(set) |= (1 << c) #define MCH_CLR(c, set) *(set) &= ~(1 << c) #define MCH_ISSET(c, set) (*(set) & (1 << c)) #define MCH_ZERO(set) *(set) = 0; #define CHECKMODULE 0 #define CHECKPATH 1 #define CHECKSOCKET 2 #define CHECKCHRDEVICE 3 #define CHECKBLKDEVICE 4 #define CHECKSC 5 #define CHECKBINFMT 6 #define CHECKFSALIAS 7 // for IOCTL mgmt #define CHECKIOCTLPARMS 0x40000000 #define IOCTLLENMASK 0x07ffffff #define IOCTL_R 0x10000000 #define IOCTL_W 0x20000000 struct ioctl_len_req { int fd; int req; }; #define BINFMT_MODULE_ALLOC 1 #define BINFMT_KEEP_ARG0 2 struct binfmt_req { char *path; char *interp; char *extraarg; char *buf; int flags; }; struct service { /* short name of the module */ char *name; /* description */ char *description; /* handle to service data. It is used by um_service.c to store * dynamic lib handle (see dlopen (3))*/ void *dlhandle; /* destructor for ht_elem's defined by this module */ void (*destructor)(int type, struct ht_elem *hte); /* Generic notification/callback function. The first parameter identifies * the type of command. The lower 5 bits identify the class, the remaining * ones identify the command. * * Valid classes: * * MC_PROC (process birth/dead) * MC_MODULE (module insertion/removal) * MC_MOUNT (mount/umount) * * Valid commands: * * MC_ADD * MC_REM * * Parameters 2 to n depend on the command type. * * MC_MODULE | MC_ADD: * * * MC_MODULE | MC_REM: * * * MC_PROC | MC_ADD: int umpid, int pumpid, int numprocs * numprocs is the current max number of processes: service implementation can use it * to realloc their internal structures. UMPID is an internal id, *not* * the pid! id is in the range 0,...,numprocs-1 it is never reassigned during * the life of a process, can be used as an index for internal data * pumpid is the similar id for the parent process, -1 if it does not exist * * MC_PROC | MC_REM: int umpid * is the garbage collection function for the data that addproc may have created * * MC_MOUNT | MC_ADD: * * MC_MOUNT | MC_REM: * */ long (*ctl)(int, char *, va_list); /* Mask of ctl classes for which the module want synthetized * notifications. For example, at module loading time, it may want one * ctl(MC_PROC | MC_ADD) for each currently running process. * (hs stands for history set) */ c_set ctlhs; /* * (int fd, void *req) * returns: the length of the field bit_or IOCTL_R/IOCTL_W if the parameter is input/output */ sysfun ioctlparms; /* proactive management of select/poll system call. The module provides this function * to activate a callback when an event occurs. * it has the followin args: * (void (* cb)(), void *arg, int fd, int events) * cb: the callback function (if NULL, it means that a previous registration for callback * must be deleted). * arg: argument passed to the callback function * fd: fd (i.e. sfd, the fd as seen by the service module) * events: as defined in poll(2) */ sysfun event_subscribe; /* the syscall table, the arguments are the same of the "real world" syscalls,*/ sysfun *syscall; /* the socket call table, the arguments are the same of the "real world" syscalls,*/ sysfun *socket; /* the virtual call table, the arguments are the same of the "real world" syscalls,*/ sysfun *virsc; }; /* * #define ESCNO_SOCKET is defined 0x4000 or 0x0 * depending on the presence of the single socketcall system call * or one syscall for each socket call*/ #define ESCNO_VIRSC 0x8000 #define ESCNO_MASK 0x3fff #define ESCNO_MAP 0xC000 extern int _lwip_version; extern int scmap_scmapsize; extern int scmap_sockmapsize; extern int scmap_virscmapsize; extern int um_mod_getpid(void); //extern void *um_mod_get_private_data(void); extern void um_mod_set_private_data(void *private_data); extern void um_mod_set_hte(struct ht_elem *hte); extern struct ht_elem *um_mod_get_hte(void); extern int um_mod_umoven(long addr, int len, void *_laddr); extern int um_mod_umovestr(long addr, int len, void *_laddr); extern int um_mod_ustoren(long addr, int len, void *_laddr); extern int um_mod_ustorestr(long addr, int len, void *_laddr); extern int um_mod_getsyscallno(void); extern int um_mod_getumpid(void); extern long* um_mod_getargs(void); extern struct stat64 *um_mod_getpathstat(void); extern char *um_mod_getpath(void); extern int um_mod_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); extern int um_mod_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); extern int um_mod_setresuid(uid_t ruid, uid_t euid, uid_t suid); extern int um_mod_setresgid(gid_t rgid, gid_t egid, gid_t sgid); extern int um_mod_getfs_uid_gid(uid_t *fsuid, gid_t *fsgid); extern int um_mod_setfs_uid_gid(uid_t fsuid, gid_t fsgid); extern int um_mod_getsyscalltype(int escno); extern int um_mod_event_subscribe(void (* cb)(), void *arg, int fd, int how); extern int um_mod_nrsyscalls(void); extern int uscno(int scno); extern void service_userctl(unsigned long type, struct service *sender, char *recipient, ...); extern void *openmodule(const char *modname, int flag); #define KERN_EMERG "<0>" /* system is unusable */ #define KERN_ALERT "<1>" /* action must be taken immediately */ #define KERN_CRIT "<2>" /* critical conditions */ #define KERN_ERR "<3>" /* error conditions */ #define KERN_WARNING "<4>" /* warning conditions */ #define KERN_NOTICE "<5>" /* normal but significant condition */ #define KERN_INFO "<6>" /* informational */ #define KERN_DEBUG "<7>" /* debug-level messages */ extern int printk(const char *fmt, ...); extern int vprintk(const char *fmt, va_list ap); #define __NR_doesnotexist -1 #if defined(__x86_64__) #define __NR_socketcall __NR_doesnotexist #define __NR__newselect __NR_doesnotexist #define __NR_umount __NR_doesnotexist #define __NR_stat64 __NR_stat #define __NR_lstat64 __NR_lstat #define __NR_fstat64 __NR_fstat #define __NR_statfs64 __NR_statfs #define __NR_fstatfs64 __NR_fstatfs //#define __NR_chown32 __NR_chown //#define __NR_lchown32 __NR_lchown //#define __NR_fchown32 __NR_fchown #define __NR_fcntl64 __NR_fcntl #define __NR__llseek __NR_doesnotexist #define __NR_send __NR_doesnotexist #define __NR_recv __NR_doesnotexist #endif #if (__NR_socketcall != __NR_doesnotexist) #define __NR_socket SYS_SOCKET #define __NR_bind SYS_BIND #define __NR_connect SYS_CONNECT #define __NR_listen SYS_LISTEN #define __NR_accept SYS_ACCEPT #define __NR_getsockname SYS_GETSOCKNAME #define __NR_getpeername SYS_GETPEERNAME #define __NR_socketpair SYS_SOCKETPAIR #define __NR_send SYS_SEND #define __NR_recv SYS_RECV #define __NR_sendto SYS_SENDTO #define __NR_recvfrom SYS_RECVFROM #define __NR_shutdown SYS_SHUTDOWN #define __NR_setsockopt SYS_SETSOCKOPT #define __NR_getsockopt SYS_GETSOCKOPT #define __NR_sendmsg SYS_SENDMSG #define __NR_recvmsg SYS_RECVMSG #define ESCNO_SOCKET 0x40000000 #else #define ESCNO_SOCKET 0x00000000 #endif #define __NR_msocket VIRSYS_MSOCKET #define INTERNAL_MAKE_NAME(a, b) a ## b #define MAKE_NAME(a, b) INTERNAL_MAKE_NAME(a, b) /* GEN stands for "generic" */ #define GENSERVICESYSCALL(s, scno, sfun, type) ((s).syscall[uscno(MAKE_NAME(__NR_, scno))] = (type) (sfun)) #define GETSERVICESYSCALL(s, scno) ((s).syscall[uscno(MAKE_NAME(__NR_, scno))]) #if (__NR_socketcall == __NR_doesnotexist) # define GENSERVICESOCKET(s, scno, sfun, type) ((s).syscall[uscno(MAKE_NAME(__NR_, scno))] = (type) (sfun)) # define GETSERVICESOCKET(s, scno) ((s).syscall[uscno(MAKE_NAME(__NR_, scno))]) #else # define GENSERVICESOCKET(s, scno, sfun, type) ((s).socket[MAKE_NAME(__NR_, scno)] = (type) (sfun)) # define GETSERVICESOCKET(s, scno) ((s).socket[MAKE_NAME(__NR_, scno)]) #endif #define SERVICESYSCALL(s, scno, sfun) GENSERVICESYSCALL(s, scno, sfun, sysfun) #define SERVICESOCKET(s, scno, sfun) GENSERVICESOCKET(s, scno, sfun, sysfun) #define SERVICEVIRSYSCALL(s, scno, sfun) ((s).virsc[MAKE_NAME(__NR_, scno)] = (sysfun) (sfun)) #define VIEWOS_SERVICE(s) \ extern __typeof__ (s) viewos_service __attribute__ ((alias (#s))); /* modules can define check functions to test for exceptions */ typedef int (* confirmfun_t)(int type, void *arg, int arglen, struct ht_elem *ht); #define NEGATIVE_MOUNT ((confirmfun_t) 1) #ifndef MS_KERNMOUNT #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ #endif #define MS_GHOST MS_KERNMOUNT /* ghost mount */ /* add a path to the hashtable (this creates an entry for the mounttab) */ struct ht_elem *ht_tab_pathadd(unsigned char type, const char *source, const char *path, const char *fstype, unsigned long mountflags, const char *flags, struct service *service, unsigned char trailingnumbers, confirmfun_t confirmfun, void *private_data); /* add a generic element to the hashtable */ struct ht_elem *ht_tab_add(unsigned char type,void *obj,int objlen, struct service *service, confirmfun_t confirmfun, void *private_data); void ht_tab_invalidate(struct ht_elem *hte); int ht_tab_del(struct ht_elem *mp); void ht_tab_getmtab(FILE *f); /*void forall_ht_tab_service_do(unsigned char type, struct service *service, void (*fun)(struct ht_elem *ht, void *arg), void *arg); void forall_ht_tab_tst_do(unsigned char type, void (*fun)(struct ht_elem *ht, void *arg), void *arg); void forall_ht_tab_del_invalid(unsigned char type);*/ void *ht_get_private_data(struct ht_elem *hte); struct ht_elem *ht_search(int type, void *arg, int objlen, struct service *service); void ht_renew(struct ht_elem *hte); static inline void *um_mod_get_private_data(void){ return ht_get_private_data(um_mod_get_hte()); } /* filetab management */ int addfiletab(int size); void delfiletab(int i); void *getfiletab(int i); #endif umview-0.8.2/include/msocket.h0000644000175000017500000000325611753517211015363 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * library header for msocket * * Copyright 2008 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_lib.h 403 2007-10-10 19:39:58Z rd235 $ * */ #ifndef _MSOCKET_H #define _MSOCKET_H #include #include #include #include #define VIRSYS_MSOCKET 2 #ifdef OLDVIRSC static inline long msocket(char *path, int domain, int type, int protocol) { struct __sysctl_args scarg; long args[6]={(long) path,domain,type,protocol,0,0}; scarg.name=NULL; scarg.nlen=VIRSYS_MSOCKET; scarg.oldval=NULL; scarg.oldlenp=NULL; scarg.newval=args; scarg.newlen=4; return syscall(__NR__sysctl,&scarg); } #else static inline long msocket(char *path, int domain, int type, int protocol) { long args[6]={(long) path,domain,type,protocol,0,0}; return syscall(__NR_pivot_root,NULL,4,VIRSYS_MSOCKET,args); } #endif #define S_IFSTACK 0160000 #define SOCK_DEFAULT 0 #endif umview-0.8.2/include/um_lib.h0000644000175000017500000000476111753517211015167 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * library header for user level access to um-ViewOS service mgmt * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: um_lib.h 913 2011-01-06 17:46:23Z rd235 $ * */ #ifndef _UM_LIB_H #define _UM_LIB_H #include #include #include typedef unsigned long viewid_t; #define VIRUMSERVICE 1 #define ADD_SERVICE 0 #define DEL_SERVICE 1 #define LIST_SERVICE 3 #define NAME_SERVICE 4 #define RECURSIVE_VIEWOS 0x100 #define VIEWOS_GETINFO 0x101 #define VIEWOS_SETVIEWNAME 0x102 #define VIEWOS_KILLALL 0x103 #define VIEWOS_ATTACH 0x104 #define VIEWOS_FSALIAS 0x105 extern long (*virnsyscall)(); #define virsyscall0(virscno,a1) virnsyscall(virscno,0,0,0,0,0,0,0); #define virsyscall1(virscno,a1) virnsyscall(virscno,1,(a1),0,0,0,0,0); #define virsyscall2(virscno,a1,a2) virnsyscall(virscno,2,(a1),(a2),0,0,0,0); #define virsyscall3(virscno,a1,a2,a3) virnsyscall(virscno,3,(a1),(a2),(a3),0,0,0); #define virsyscall4(virscno,a1,a2,a3,a4) virnsyscall(virscno,4,(a1),(a2),(a3),(a4),0,0); #define virsyscall5(virscno,a1,a2,a3,a4,a5) virnsyscall(virscno,5,(a1),(a2),(a3),(a4),(a5),0); #define virsyscall6(virscno,a1,a2,a3,a4,a5,a6) virnsyscall(virscno,5,(a1),(a2),(a3),(a4),(a5),(a6)); struct viewinfo { struct utsname uname; pid_t serverid; viewid_t viewid; char viewname[_UTSNAME_LENGTH]; }; int um_check_viewos(void); int um_add_service(char *path,int permament); int um_del_service(char *name); int um_list_service(char *buf, int len); int um_name_service(char *name, char *buf, int len); int um_view_getinfo(struct viewinfo *info); int um_setviewname(char *name); int um_killall(int signo); int um_attach(int pid); int um_fsalias(char *alias,char *filesystemname); #endif umview-0.8.2/include/libummod.h0000644000175000017500000000624411753517211015526 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: libummod.h 649 2009-04-23 05:44:01Z rd235 $ * * */ #ifndef _LIBUMMOD_H #define _LIBUMMOD_H #include #include #include #include #include #include int getdents(unsigned int fd, struct dirent *dirp, unsigned int count); int getdents64(unsigned int fd, struct dirent64 *dirp, unsigned int count); #if !defined(__x86_64__) int fcntl32(int fd, int cmd, long arg); #else #define fcntl32 fcntl #endif int fcntl64(int fd, int cmd, long arg); int _llseek(unsigned int fd, unsigned long offset_high, unsigned long offset_low, loff_t *result, unsigned int whence); #ifdef __NR_chown32 #undef __NR_chown #define __NR_chown __NR_chown32 #endif #ifdef __NR_lchown32 #undef __NR_lchown #define __NR_lchown __NR_lchown32 #endif #ifdef __NR_fchown32 #undef __NR_fchown #define __NR_fchown __NR_fchown32 #endif #ifdef __NR_getuid32 #undef __NR_getuid #define __NR_getuid __NR_getuid32 #endif #ifdef __NR_getgid32 #undef __NR_getgid #define __NR_getgid __NR_getgid32 #endif #ifdef __NR_geteuid32 #undef __NR_geteuid #define __NR_geteuid __NR_geteuid32 #endif #ifdef __NR_setreuid32 #undef __NR_setreuid #define __NR_setreuid __NR_setreuid32 #endif #ifdef __NR_setregid32 #undef __NR_setregid #define __NR_setregid __NR_setregid32 #endif #ifdef __NR_getgroups32 #undef __NR_getgroups #define __NR_getgroups __NR_getgroups32 #endif #ifdef __NR_getresuid32 #undef __NR_getresuid #define __NR_getresuid __NR_getresuid32 #endif #ifdef __NR_getresgid32 #undef __NR_getresgid #define __NR_getresgid __NR_getresgid32 #endif #ifdef __NR_setresuid32 #undef __NR_setresuid #define __NR_setresuid __NR_setresuid32 #endif #ifdef __NR_setresgid32 #undef __NR_setresgid #define __NR_setresgid __NR_setresgid32 #endif #ifdef __NR_setuid32 #undef __NR_setuid #define __NR_setuid __NR_setuid32 #endif #ifdef __NR_setgid32 #undef __NR_setgid #define __NR_setgid __NR_setgid32 #endif #ifdef __NR_setfsuid32 #undef __NR_setfsuid #define __NR_setfsuid __NR_setfsuid32 #endif #ifdef __NR_setfsuid32 #undef __NR_setfsuid #define __NR_setfsuid __NR_setfsuid32 #endif #ifdef __NR_getegid32 #undef __NR_getegid #define __NR_getegid __NR_getegid32 #endif #ifdef __NR_setfsgid32 #undef __NR_setfsgid #define __NR_setfsgid __NR_setfsgid32 #endif /*#if defined(__x86_64__) #define __NR__newselect __NR_select #endif */ #endif umview-0.8.2/include/umnet.h0000644000175000017500000000555611753517211015053 0ustar renzorenzo/* * UMNET: (MULTI) Virtual Stack management * Copyright (C) 2008 Renzo Davoli * * This program can be distributed under the terms of the GNU GPLv2. * See the file COPYING.LIB. */ #ifndef _UMNET_H_ #define _UMNET_H_ #include #include #include #include #include #define AF_MAXMAX (AF_MAX + 2) #define IOCTLLENMASK 0x07ffffff #define IOCTL_R 0x10000000 #define IOCTL_W 0x20000000 #define UMNET_DEBUG (1 << 29) typedef void (* voidfun)(void *arg); struct umnet; #if 0 struct net_info { /* File handle. It usually set up in msocket and then * available for all other operations */ uint64_t fh; /* nethandle for management */ struct umnet *nethandle; }; #endif struct umnet_operations { //int (*getattr) (struct stat64 *, struct umnet *nethandle); //int (*fgetattr) (struct stat64 *, struct net_info *); //int (*chmod) (mode_t, struct umnet *nethandle); //int (*chown) (uid_t, gid_t, struct umnet *nethandle); //int (*access) (int, struct umnet *nethandle); //int (*open) (char, net_t, struct net_info *); int (*msocket) (int, int, int, struct umnet *); int (*bind) (int, const struct sockaddr *, socklen_t); int (*connect) (int, const struct sockaddr *, socklen_t); int (*listen) (int, int); int (*accept) (int, struct sockaddr *, socklen_t *); int (*getsockname) (int, struct sockaddr *, socklen_t *); int (*getpeername) (int, struct sockaddr *, socklen_t *); ssize_t (*send) (int, const void *, size_t, int) ; ssize_t (*recv) (int, const void *, size_t, int); ssize_t (*sendto) (int, const void *, size_t, int, const struct sockaddr *, socklen_t); ssize_t (*recvfrom) (int, void *, size_t, int, struct sockaddr *, socklen_t *); ssize_t (*recvmsg)(int, struct msghdr *, int); ssize_t (*sendmsg)(int, const struct msghdr *, int); int (*setsockopt) (int, int, int, const void *, socklen_t); int (*getsockopt) (int, int, int, void *, socklen_t *); ssize_t (*read) (int, void *, size_t); ssize_t (*write) (int, const void *, size_t); int (*ioctl) (int, int, void *); int (*close) (int); int (*fcntl) (int, int, long); int (*supported_domain) (int); int (*event_subscribe) (voidfun cb, void *arg, int fd, int how); int (*ioctlparms) (int, int req, struct umnet *nethandle); int (*init) (char *source, char *mountpoint, unsigned long flags, char *args, struct umnet *nethandle); int (*fini) (struct umnet *nethandle); }; /* MOUNT ARG MGMT */ struct netargitem { char *arg; void (*fun)(); }; void netargs(char *opts, struct netargitem *netargtab, int netargsize, void *arg); void umnet_setprivatedata(struct umnet *nethandle, void *privatedata); void *umnet_getprivatedata(struct umnet *nethandle); #if 0 void umnet_setmode(struct umnet *nethandle, mode_t mode); mode_t umnet_getmode(struct umnet *nethandle); #endif #endif /* _UMNET_H_ */ umview-0.8.2/ummisc_modules/0000755000175000017500000000000011753517351015146 5ustar renzorenzoumview-0.8.2/ummisc_modules/Makefile.in0000644000175000017500000004441711753517330017222 0ustar renzorenzo# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/modules-common.mk subdir = ummisc_modules ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moddir)" LTLIBRARIES = $(mod_LTLIBRARIES) ummisctime_la_LIBADD = ummisctime_la_SOURCES = ummisctime.c ummisctime_la_OBJECTS = ummisctime.lo ummisctime_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(ummisctime_la_LDFLAGS) $(LDFLAGS) -o $@ ummiscuname_la_LIBADD = ummiscuname_la_SOURCES = ummiscuname.c ummiscuname_la_OBJECTS = ummiscuname.lo DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = ummisctime.c ummiscuname.c DIST_SOURCES = ummisctime.c ummiscuname.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB20_CFLAGS = @GLIB20_CFLAGS@ GLIB20_LIBS = @GLIB20_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = ../um_lib/libumlib.la LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DEBUGLEVEL = 3 moddir = $(pkglibdir)/modules CBASEFLAGS = CDEBUGFLAGS = -g3 -ggdb3 CPPBASEFLAGS = -I../include -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CPPDEBUGFLAGS = -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) @ENABLE_DEBUG_FALSE@CFULLFLAGS = $(CBASEFLAGS) @ENABLE_DEBUG_TRUE@CFULLFLAGS = $(CBASEFLAGS) $(CDEBUGFLAGS) @ENABLE_DEBUG_FALSE@CPPFULLFLAGS = $(CPPBASEFLAGS) @ENABLE_DEBUG_TRUE@CPPFULLFLAGS = $(CPPBASEFLAGS) $(CPPDEBUGFLAGS) AM_CFLAGS = $(CFULLFLAGS) AM_CPPFLAGS = $(CPPFULLFLAGS) AM_LDFLAGS = -module -avoid-version -export-dynamic AM_LIBTOOLFLAGS = --tag=disable-static mod_LTLIBRARIES = ummisctime.la ummiscuname.la ummisctime_la_LDFLAGS = $(AM_LDFLAGS) -lrt all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/modules-common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ummisc_modules/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ummisc_modules/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/modules-common.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-modLTLIBRARIES: $(mod_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(moddir)" || $(MKDIR_P) "$(DESTDIR)$(moddir)" @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moddir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moddir)"; \ } uninstall-modLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moddir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moddir)/$$f"; \ done clean-modLTLIBRARIES: -test -z "$(mod_LTLIBRARIES)" || rm -f $(mod_LTLIBRARIES) @list='$(mod_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done ummisctime.la: $(ummisctime_la_OBJECTS) $(ummisctime_la_DEPENDENCIES) $(EXTRA_ummisctime_la_DEPENDENCIES) $(ummisctime_la_LINK) -rpath $(moddir) $(ummisctime_la_OBJECTS) $(ummisctime_la_LIBADD) $(LIBS) ummiscuname.la: $(ummiscuname_la_OBJECTS) $(ummiscuname_la_DEPENDENCIES) $(EXTRA_ummiscuname_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(ummiscuname_la_OBJECTS) $(ummiscuname_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ummisctime.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ummiscuname.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(moddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-modLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-modLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-modLTLIBRARIES .MAKE: install-am install-data-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-modLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-modLTLIBRARIES install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-modLTLIBRARIES @ENABLE_DEBUG_TRUE@release: clean @ENABLE_DEBUG_TRUE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS)' @ENABLE_DEBUG_TRUE@debug: all @ENABLE_DEBUG_FALSE@release: all @ENABLE_DEBUG_FALSE@debug: clean @ENABLE_DEBUG_FALSE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS) $(CDEBUGFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS) $(CPPDEBUGFLAGS)' install-data-hook: cd "$(DESTDIR)/$(moddir)" && rm -f $(mod_LTLIBRARIES) debug release: all # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: umview-0.8.2/ummisc_modules/ummiscuname.c0000644000175000017500000000712611753517211017636 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMMISCUNAME: Virtual System Identification (Uname) * Copyright (C) 2007 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include "ummisc.h" loff_t gp_uname(int op,char *value,int size,struct ummisc *mh,int tag,char *path); void ummisc_uname_init(char *path, unsigned long flags, char *args,struct ummisc *mh); void ummisc_uname_fini(struct ummisc *mh); #define GP_SYSNAME 1 #define GP_NODENAME 2 #define GP_RELEASE 3 #define GP_VERSION 4 #define GP_MACHINE 5 #define GP_DOMAIN 6 struct fsentry fseroot[] = { {"sysname",NULL,gp_uname,GP_SYSNAME}, {"nodename",NULL,gp_uname,GP_NODENAME}, {"release",NULL,gp_uname,GP_RELEASE}, {"version",NULL,gp_uname,GP_VERSION}, {"machine",NULL,gp_uname,GP_MACHINE}, {"domainname",NULL,gp_uname,GP_DOMAIN}, {NULL,NULL,NULL,0}}; struct ummisc_operations ummisc_ops = { {"root", fseroot, NULL, 0}, ummisc_uname_init, ummisc_uname_fini }; int misc_uname(struct utsname *buf, struct ummisc *mh) { //printk("DEBUG, misc_uname\n"); memcpy(buf,ummisc_getprivatedata(mh),sizeof(struct utsname)); return 0; } int misc_sethostname(const char *name, size_t len, struct ummisc *mh) { struct utsname *buf=ummisc_getprivatedata(mh); char *field=buf->nodename; memset(field,0,_UTSNAME_SYSNAME_LENGTH); if (len>_UTSNAME_SYSNAME_LENGTH) len=_UTSNAME_SYSNAME_LENGTH; strncpy(field,name,len); return 0; } int misc_setdomainname(const char *name, size_t len, struct ummisc *mh) { struct utsname *buf=ummisc_getprivatedata(mh); char *field=buf->domainname; memset(field,0,_UTSNAME_SYSNAME_LENGTH); if (len>_UTSNAME_SYSNAME_LENGTH) len=_UTSNAME_SYSNAME_LENGTH; strncpy(field,name,len); return 0; } loff_t gp_uname(int op,char *value,int size,struct ummisc *mh,int tag, char *path) { struct utsname *buf=ummisc_getprivatedata(mh); char *field; switch (tag) { case GP_SYSNAME: field=buf->sysname; break; case GP_NODENAME: field=buf->nodename; break; case GP_RELEASE: field=buf->release; break; case GP_VERSION: field=buf->version; break; case GP_MACHINE: field=buf->machine; break; case GP_DOMAIN: field=buf->domainname; break; } if (op==UMMISC_GET) { snprintf(value,MISCFILESIZE,"%s\n",field); return strlen(field); } else { char *nl; value[size]=0; memset(field,0,_UTSNAME_SYSNAME_LENGTH); if ((nl=strchr(value,'\n')) != NULL) *nl=0; strncpy(field,value,_UTSNAME_SYSNAME_LENGTH); return size; } } void ummisc_uname_init(char *path, unsigned long flags, char *args, struct ummisc *mh) { struct utsname *buf; buf=malloc(sizeof(struct utsname)); assert(buf); uname(buf); ummisc_setprivatedata(mh,buf); //printk("ummisc_uname_init \n"); } void ummisc_uname_fini(struct ummisc *mh) { struct utsname *buf=ummisc_getprivatedata(mh); free(buf); //printk("ummisc_uname_fini \n"); } umview-0.8.2/ummisc_modules/Makefile.am0000644000175000017500000000020511753517211017172 0ustar renzorenzoinclude $(top_srcdir)/modules-common.mk mod_LTLIBRARIES = ummisctime.la ummiscuname.la ummisctime_la_LDFLAGS = $(AM_LDFLAGS) -lrt umview-0.8.2/ummisc_modules/ummisctime.c0000644000175000017500000001201311753517211017456 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMMISCTIME: Virtual Time Abstraction * Copyright (C) 2007 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include "ummisc.h" struct umtimeinfo { long double offset; double freq; }; static loff_t gp_time(int op,char *value,int size,struct ummisc *mh,int tag,char *path); static void ummisc_time_init(char *path, unsigned long flags, char *args,struct ummisc *mh); static void ummisc_time_fini(struct ummisc *mh); #define GP_OFFSET 1 #define GP_FREQ 2 struct fsentry fseroot[] = { {"offset",NULL,gp_time,GP_OFFSET}, {"frequency",NULL,gp_time,GP_FREQ}, {NULL,NULL,NULL,0}}; struct ummisc_operations ummisc_ops = { {"root", fseroot, NULL, 0}, ummisc_time_init, ummisc_time_fini }; static long double umtime(struct umtimeinfo *umt) { struct timespec ts; long double now; clock_gettime(CLOCK_REALTIME,&ts); now=ts.tv_sec + ((long double) ts.tv_nsec) / 1000000000; //printk("umtime now %Lf\n",now); now=now*umt->freq+umt->offset; //printk("umtime umnow %Lf\n",now); return now; } static void umsettime(struct umtimeinfo *umt,long double newnow) { struct timespec ts; long double now; clock_gettime(CLOCK_REALTIME,&ts); now=ts.tv_sec + ((long double) ts.tv_nsec) / 1000000000; now=now*umt->freq+umt->offset; umt->offset += newnow - now; } static void setnewfreq(struct umtimeinfo *umt,long double newfreq) { struct timespec ts; long double now; long double oldtime; long double newuncorrected; clock_gettime(CLOCK_REALTIME,&ts); now=ts.tv_sec + ((long double) ts.tv_nsec) / 1000000000; oldtime=now*umt->freq+umt->offset; newuncorrected=now*newfreq+umt->offset; //printk("setnewfreq %Lf %Lf %Lf %Lf\n", //newfreq,now,oldtime,newuncorrected); umt->offset += (oldtime-newuncorrected); umt->freq=newfreq; } int misc_gettimeofday(struct timeval *tv, struct timezone *tz, struct ummisc *mh) { struct umtimeinfo *buf=ummisc_getprivatedata(mh); long double now=umtime(buf); if (tv) { tv->tv_sec = (time_t) now; tv->tv_usec = (time_t) ((now - tv->tv_sec) * 1000000); } return 0; } int misc_settimeofday(const struct timeval *tv , const struct timezone *tz, struct ummisc *mh) { struct umtimeinfo *buf=ummisc_getprivatedata(mh); long double newnow; if (tv) { newnow = tv->tv_sec + ((long double) tv->tv_usec) / 1000000; umsettime(buf,newnow); } return 0; } int misc_clock_getres(clockid_t clk_id, struct timespec *res, struct ummisc *mh) { return clock_getres(clk_id,res); } int misc_clock_gettime(clockid_t clk_id, struct timespec *tp, struct ummisc *mh) { if (clk_id == CLOCK_REALTIME) { struct umtimeinfo *buf=ummisc_getprivatedata(mh); long double now=umtime(buf); if (tp) { tp->tv_sec = (time_t) now; tp->tv_nsec = (time_t) ((now - tp->tv_sec) * 1000000000); } return 0; } else return clock_gettime(clk_id,tp); } int misc_clock_settime(clockid_t clk_id, const struct timespec *tp, struct ummisc *mh) { if (clk_id == CLOCK_REALTIME) { struct umtimeinfo *buf=ummisc_getprivatedata(mh); long double newnow; if (tp) { newnow = tp->tv_sec + ((long double) tp->tv_nsec) / 1000000000; umsettime(buf,newnow); } return 0; } else return clock_settime(clk_id,tp); } static loff_t gp_time(int op,char *value,int size,struct ummisc *mh,int tag, char *path) { struct umtimeinfo *buf=ummisc_getprivatedata(mh); loff_t rv=0; switch (tag) { case GP_OFFSET: if (op==UMMISC_GET) { snprintf(value,size,"%Lf\n",buf->offset); rv=strlen(value); } else { rv=size; value[size]=0; sscanf(value,"%Lf",&buf->offset); } break; case GP_FREQ: if (op==UMMISC_GET) { snprintf(value,size,"%15.10lf\n",buf->freq); rv=strlen(value); } else { long double newfreq; rv=size; value[size]=0; sscanf(value,"%Lf",&newfreq); setnewfreq(buf,newfreq); } break; } return rv; } static void ummisc_time_init(char *path, unsigned long flags, char *args, struct ummisc *mh) { struct umtimeinfo *buf; buf=calloc(1,sizeof(struct umtimeinfo)); assert(buf); buf->freq=1; ummisc_setprivatedata(mh,buf); //printk("ummisc_time_init \n"); } static void ummisc_time_fini(struct ummisc *mh) { struct umtimeinfo *buf=ummisc_getprivatedata(mh); free(buf); //printk("ummisc_time_fini \n"); } umview-0.8.2/umdevtap/0000755000175000017500000000000011753517351013746 5ustar renzorenzoumview-0.8.2/umdevtap/Makefile.in0000644000175000017500000004347211753517330016022 0ustar renzorenzo# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/modules-common.mk subdir = umdevtap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moddir)" LTLIBRARIES = $(mod_LTLIBRARIES) umdevtap_la_LIBADD = umdevtap_la_SOURCES = umdevtap.c umdevtap_la_OBJECTS = umdevtap.lo umdevtap_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(umdevtap_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = umdevtap.c DIST_SOURCES = umdevtap.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB20_CFLAGS = @GLIB20_CFLAGS@ GLIB20_LIBS = @GLIB20_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = ../um_lib/libumlib.la LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DEBUGLEVEL = 3 moddir = $(pkglibdir)/modules CBASEFLAGS = CDEBUGFLAGS = -g3 -ggdb3 CPPBASEFLAGS = -I../include -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CPPDEBUGFLAGS = -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) @ENABLE_DEBUG_FALSE@CFULLFLAGS = $(CBASEFLAGS) @ENABLE_DEBUG_TRUE@CFULLFLAGS = $(CBASEFLAGS) $(CDEBUGFLAGS) @ENABLE_DEBUG_FALSE@CPPFULLFLAGS = $(CPPBASEFLAGS) @ENABLE_DEBUG_TRUE@CPPFULLFLAGS = $(CPPBASEFLAGS) $(CPPDEBUGFLAGS) AM_CFLAGS = $(CFULLFLAGS) AM_CPPFLAGS = $(CPPFULLFLAGS) AM_LDFLAGS = -module -avoid-version -export-dynamic AM_LIBTOOLFLAGS = --tag=disable-static mod_LTLIBRARIES = umdevtap.la umdevtap_la_LDFLAGS = $(AM_LDFLAGS) -lvdeplug all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/modules-common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign umdevtap/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign umdevtap/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/modules-common.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-modLTLIBRARIES: $(mod_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(moddir)" || $(MKDIR_P) "$(DESTDIR)$(moddir)" @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moddir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moddir)"; \ } uninstall-modLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moddir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moddir)/$$f"; \ done clean-modLTLIBRARIES: -test -z "$(mod_LTLIBRARIES)" || rm -f $(mod_LTLIBRARIES) @list='$(mod_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done umdevtap.la: $(umdevtap_la_OBJECTS) $(umdevtap_la_DEPENDENCIES) $(EXTRA_umdevtap_la_DEPENDENCIES) $(umdevtap_la_LINK) -rpath $(moddir) $(umdevtap_la_OBJECTS) $(umdevtap_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umdevtap.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(moddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-modLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-modLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-modLTLIBRARIES .MAKE: install-am install-data-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-modLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-modLTLIBRARIES install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-modLTLIBRARIES @ENABLE_DEBUG_TRUE@release: clean @ENABLE_DEBUG_TRUE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS)' @ENABLE_DEBUG_TRUE@debug: all @ENABLE_DEBUG_FALSE@release: all @ENABLE_DEBUG_FALSE@debug: clean @ENABLE_DEBUG_FALSE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS) $(CDEBUGFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS) $(CPPDEBUGFLAGS)' install-data-hook: cd "$(DESTDIR)/$(moddir)" && rm -f $(mod_LTLIBRARIES) debug release: all # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: umview-0.8.2/umdevtap/umdevtap.c0000644000175000017500000001101111753517211015724 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMDEVMBR: Virtual Device to access Disk Images * (using the standard IBM-PC partition scheme based on MBR/Extended MBR) * * Copyright (C) 2006 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include struct umtap { VDECONN *conn; char *name; }; static int umtap_open(char type, dev_t device, struct dev_info *di) { struct umtap *umtap=malloc(sizeof(struct umtap)); umtap->conn=NULL; umtap->name=NULL; di->fh=(uint64_t)((long) umtap); return 0; } static int umtap_read(char type, dev_t device, char *buf, size_t len, loff_t pos, struct dev_info *di) { struct umtap *umtap=(struct umtap *)((long) di->fh); if (umtap->conn) { return vde_recv(umtap->conn,buf,len,0); } else return -ENOTCONN; } static int umtap_write(char type, dev_t device, const char *buf, size_t len, loff_t pos, struct dev_info *di) { struct umtap *umtap=(struct umtap *)((long) di->fh); if (umtap->conn) { return vde_send(umtap->conn,buf,len,0); } else return -ENOTCONN; } static int umtap_release(char type, dev_t device, struct dev_info *di) { struct umtap *umtap=(struct umtap *)((long) di->fh); if (umtap->conn) { vde_close(umtap->conn); return 0; } else return -ENOTCONN; } static int umtap_init(char type, dev_t device, char *path, unsigned long flags, char *args, struct umdev *devhandle) { /* TODO parse args */ umdev_setprivatedata(devhandle,strdup(path)); return 0; } static int umtap_fini(char type, dev_t device, struct umdev *devhandle) { char *path=umdev_getprivatedata(devhandle); free(path); return 0; } static int umtap_ioctl(char type, dev_t device, int req, void * arg, struct dev_info *di) { char *path=umdev_getprivatedata(di->devhandle); struct umtap *umtap=(struct umtap *)((long) di->fh); static int tapcount; switch (req) { case TUNSETIFF: { struct ifreq *ifr=arg; if (umtap->conn != NULL) return -EADDRINUSE; if (ifr->ifr_flags & IFF_TAP) { char name[IFNAMSIZ+1]; char comment[80+IFNAMSIZ+1]; if (ifr->ifr_name[0] == 0) sprintf(name,"tap%d",tapcount++); else strncpy(name,ifr->ifr_name,IFNAMSIZ); name[IFNAMSIZ]=0; snprintf(comment,80+IFNAMSIZ,"umdevtap PID:%d %s",um_mod_getpid(),name); umtap->conn=vde_open(path,comment,NULL); if (umtap->conn) umtap->name=strdup(name); } else return -EINVAL; } break; default: return -EINVAL; } return 0; } static int umtap_ioctl_params(char type, dev_t device, int req, struct dev_info *di) { switch (req) { /*case BLKROSET: return (sizeof(int) | IOCTL_R); case BLKROGET: return (sizeof(int) | IOCTL_W);*/ case TUNSETIFF: return (sizeof(struct ifreq) | IOCTL_W | IOCTL_R); default: return 0; } } static int umtap_event_subscribe(char type, dev_t device, voidfun cb, void *arg, int how, struct dev_info *di) { struct umtap *umtap=(struct umtap *)((long) di->fh); if (umtap->conn) { int rv=um_mod_event_subscribe(cb,arg,vde_datafd(umtap->conn),how); /* if (cb) { if (rv == 0) rv=um_event_subscribe(cb,arg,vde_datafd(umtap->conn),POLLIN|POLLERR); return rv; } else { if (rv == 0) rv=um_event_subscribe(cb,arg,vde_datafd(umtap->conn),POLLIN|POLLERR); else um_event_subscribe(cb,arg,vde_datafd(umtap->conn),POLLIN|POLLERR); }*/ return rv; } else return 1; } struct umdev_operations umdev_ops={ .open=umtap_open, .read=umtap_read, .write=umtap_write, .release=umtap_release, .init=umtap_init, .fini=umtap_fini, .ioctl=umtap_ioctl, .ioctlparms=umtap_ioctl_params, .event_subscribe=umtap_event_subscribe, }; umview-0.8.2/umdevtap/Makefile.am0000644000175000017500000000016711753517211016001 0ustar renzorenzoinclude $(top_srcdir)/modules-common.mk mod_LTLIBRARIES = umdevtap.la umdevtap_la_LDFLAGS = $(AM_LDFLAGS) -lvdeplug umview-0.8.2/umpyew/0000755000175000017500000000000011753517351013447 5ustar renzorenzoumview-0.8.2/umpyew/umpyew-testmodule.py0000644000175000017500000001374111753517211017533 0ustar renzorenzo# This is part of UMView # The user-mode implementation of View-OS: A Process with a View # # Sample (useless) Python module to be used with the umpyew UMView module. # # $ umview -p umpyew,umpyew-testmodule command # # Copyright 2008 Ludovico Gardenghi, University of Bologna, Italy # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. import os # The module 'umpyew' must be included in order to have access to the # following methods: # # - tstTimestamp # - tstMatchingEpoch # # More method will be provided (ideally the final umpyew module will provide # all the public functions from module.h) import umpyew # This list can contain zero or more of the following: # 'proc', 'module', 'mount' and corresponds to the ctlhs. modCtlHistorySet = ['proc']; # If you have any initalization, put it here. def modInit(): print "Init!" global ts ts = umpyew.tstTimestamp() # The same for finalization. def modFini(): print "Fini!" # This is the same as the ctl function of regular C modules. At present only # the standard commands are supported (i.e. not the custom ones). def modCtl(cls, cmd, cmdArgs): print "class:", cls, "command:", cmd, "args:", cmdArgs # Just an example if cls == 'proc': if cmd == 'add': print "New process with id %d" % cmdArgs[0] elif cmd == 'rem': print "Process with id %d removed" % cmdArgs[0] return 0 # This is the standard check function that returns 0 or an epoch. kw # contains only one key. Its name is one of 'path', 'socket', 'fstype', 'sc' # (system call number) and 'binfmt'. Its value is as in regular C modules. def modCheckFun(*arg, **kw): print kw if kw.has_key('path'): rv = umpyew.tstMatchingEpoch(ts) print "returning", rv return rv # Just examples elif kw.has_key('socket'): pass elif kw.has_key('fstype'): pass elif kw.has_key('sc'): pass elif kw.has_key('binfmt'): pass print "returning 0" return 0 # These functions are called from the umpyew module with the positional # parameters corresponding to the parameters of the C system calls (except for # pointers to structures to be filled, that are not passed) and with two # dictionary parameters: 'cname' which contains the system call name and # 'pyname' which contains the name used to call the Python method (e.g. # 'sysOpen'). # The return value of the system call management functions must be a tuple # with no less than 2 items. The minimal return value is composed by (retval, # errno). Additional items can be inserted for returning additional data (as # in stat or readlink syscalls). # Setting a sysSomething to None is equivalent to calling # SERVICESYSCALL(s, something, something) # i.e the real system call will be called without accessing Python methods. # This function manages system calls that does not need to return additional # data. It works only for those syscalls whose C prototype matches the # corrresponding one in Pyton os module as for parameters type and order. # If you want to see how to change the arguments before calling, take a look # at the unreal.py module. def sysGeneric(*arg, **kw): print "Calling system call", kw['cname'], "with parameters", arg try: rv = getattr(os, kw['cname'])(*arg) if rv == None: # syscalls like os.mkdir, os.rmdir, os.unlink, os.chmod, os.close... # return None on success and raise an exception in case of error. return (0, 0) elif type(rv) == bool: # syscalls like os.access return True or False. Since True means # success, and for UNIX syscalls succes is 0, we must negate the # value (True is represented as 1 and False as 0). return (not rv, 0) else: # syscalls like os.open return an integer (e.g. a file descriptor) # in case of success. return (rv, 0) except OSError, (errno, strerror): return (-1, errno) sysOpen = sysRmdir = sysUnlink = sysAccess = sysMkdir = sysChmod = \ sysClose = sysLink = sysSymlink = sysLseek = sysUtime = sysUtimes = \ sysGeneric # The following system calls can't be managed directly by a generic function # because they must return some complex structure, so they have their specific # functions. # manages stat64, lstat64, fstat64 # As the original C system call provides more than one parameter (i.e. it # includes the buffer where the result must be stored), we must call the # Python function passing only the first parameter (arg[0]). def sysStats(*arg, **kw): print "Calling system call", kw['cname'], "with parameters", arg try: os.stat_float_times(False) return (0, 0, getattr(os, kw['cname'].rstrip('64'))(arg[0])) except OSError, (errno, strerror): return (-1, errno) sysStat64 = sysLstat64 = sysFstat64 = sysStats def sysStatfs64(path, **kw): print "Calling system call", kw['cname'], "with parameters", path try: return (0, 0, os.statvfs(path)) except OSError, (errno, strerror): return (-1, errno) def sysReadlink(path, bufsiz, **kw): print "Calling system call", kw['cname'], "with parameters", path, bufsiz try: tmplink = os.readlink(path) return (min(bufsiz, len(tmplink)), 0, tmplink[0:bufsiz]) except OSError, (errno, strerror): return (-1, errno) def sysRead(fd, count, **kw): print "Calling system call", kw['cname'], "with parameters", fd, count try: rv = os.read(fd, count); return (len(rv), 0, rv) except OSError, (errno, strerror): return (-1, errno) def sysWrite(fd, buf, count, **kw): print "Calling system call", kw['cname'], "with parameters", fd, buf, count try: return (os.write(fd, buf), 0) except OSError, (errno, strerror): return (-1, errno) umview-0.8.2/umpyew/umpyew.c0000644000175000017500000005466011753517211015147 0ustar renzorenzo/* This is part of UMView * The user-mode implementation of View-OS: A Process with a View * * Bindings for writing Python modules for *MView * * $ umview -p umpyew,modulename command * * PYTHONPATH, if unset, will be set to the current working directory. * * Copyright 2008 Ludovico Gardenghi, University of Bologna, Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ /* ***** IMPORTANT NOTICE ***************************************************** * Please note: these bindings are still PARTIAL! Take a look to the list of * PYTHON_SYSCALLS invocations in the _um_mod_init function if you want to * know which system calls are currently supported. * Also, the support for upcalls is limited. The list of supported upcalls is * in the array named pEmbMethods. More will follow. * Finally, there is no support for custom ctl commands yet. **************************************************************************** */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "module.h" #include "libummod.h" #include "gdebug.h" struct pService { PyObject *ctl; PyObject *checkfun; PyObject **syscall; PyObject **socket; }; static struct service s; static struct pService ps; static PyObject *pModule; /* Used for calling PyCall with empty arg */ static PyObject *pEmptyTuple; #define PYCHKERR {GMESSAGE("testing..."); if (PyErr_Occurred()) PyErr_Print();} #define PYTHON_SYSCALL(cname, pyname) \ { \ if (PyObject_HasAttrString(pModule, #pyname)) \ { \ pTmpFunc = PyObject_GetAttrString(pModule, #pyname); \ if (pTmpFunc && PyCallable_Check(pTmpFunc)) \ { \ pTmpObj = PyTuple_New(2); \ PyTuple_SET_ITEM(pTmpObj, 0, pTmpFunc); \ pTmpDict = PyDict_New(); \ PyDict_SetItemString(pTmpDict, "cname", PyString_FromString(#cname)); \ PyDict_SetItemString(pTmpDict, "pyname", PyString_FromString(#pyname)); \ PyTuple_SET_ITEM(pTmpObj, 1, pTmpDict); \ GDEBUG(3, "found function for system call %s, adding", #cname); \ GENSERVICESYSCALL(ps, cname, pTmpObj, PyObject*); \ SERVICESYSCALL(s, cname, umpyew_##cname); \ } \ else if (pTmpFunc == Py_None) \ { \ GDEBUG(3, "system call %s is mapped to itself", #cname); \ SERVICESYSCALL(s, cname, cname); \ } \ else \ GERROR("python object %s is not Callable!", #pyname); \ } \ } #define PYIN(type, cname, argc) \ PyObject *pRetVal; \ long retval; \ PyObject *pFunc = PyTuple_GetItem(GETSERVICE##type(ps, cname), 0); \ PyObject *pKw = PyTuple_GetItem(GETSERVICE##type(ps, cname), 1); \ PyObject *pArg = PyTuple_New(argc); #define PYCALL \ { \ GDEBUG(3, "calling python..."); \ pRetVal = PyObject_Call(pFunc, pArg, pKw); \ GDEBUG(3, "returned from python"); \ if (pRetVal) \ { \ retval = PyInt_AsLong(PyTuple_GetItem(pRetVal, 0)); \ errno = PyInt_AsLong(PyTuple_GetItem(pRetVal, 1)); \ GDEBUG(3, "(retval, errno) == (%d, %d)", retval, errno); \ } \ else \ { \ GDEBUG(3, "retval is null?"); \ PyErr_Print(); \ retval = -1; \ errno = ENOSYS; \ } \ } #define PYOUT \ { \ Py_DECREF(pArg); \ if (pRetVal) \ { \ Py_DECREF(pRetVal); \ } \ } #define PYINSYS(cname, argc) PYIN(SYSCALL, cname, argc) #define PYINSOCK(cname, argc) PYIN(SOCKET, cname, argc) #define PYARG(argnum, argval) \ PyTuple_SET_ITEM(pArg, argnum, argval) /* * Exported functions (Python side). They must be kept update depending on the * evolution of the struct timestamp. */ static PyObject *umpyew_tst_matchingepoch(PyObject *self, PyObject *args) { PyObject *obj; struct timestamp *ts; PyArg_ParseTuple(args, "O", &obj); ts = PyCObject_AsVoidPtr(obj); return PyLong_FromLongLong(tst_matchingepoch(ts)); } static PyObject *umpyew_tst_timestamp(PyObject *self, PyObject *args) { struct timestamp *ts = malloc(sizeof(struct timestamp)); *ts = tst_timestamp(); return PyCObject_FromVoidPtr(ts, free); } static PyMethodDef pEmbMethods[] = { {"tstMatchingEpoch", umpyew_tst_matchingepoch, METH_VARARGS, "Fare clic qui per inserire una descrizione."}, {"tstTimestamp", umpyew_tst_timestamp, METH_VARARGS, "Return a new (opaque) timestamp object/"}, {NULL, NULL, 0, NULL}, }; /* * Begin of system calls definitions (bindings) */ static long umpyew_open(char *path, int flags, mode_t mode) { PYINSYS(open, 3); PYARG(0, PyString_FromString(path)); PYARG(1, PyInt_FromLong(flags)); PYARG(2, PyInt_FromLong(mode)); PYCALL; PYOUT; return retval; } static long umpyew_close(int fd) { PYINSYS(close, 1); PYARG(0, PyInt_FromLong(fd)); PYCALL; PYOUT; return retval; } static long umpyew_access(char *path, int mode) { PYINSYS(access, 2); PYARG(0, PyString_FromString(path)); PYARG(1, PyInt_FromLong(mode)); PYCALL; PYOUT; return retval; } static long umpyew_mkdir(char *path, int mode) { PYINSYS(mkdir, 2); PYARG(0, PyString_FromString(path)); PYARG(1, PyInt_FromLong(mode)); PYCALL; PYOUT; return retval; } static long umpyew_rmdir(char *path) { PYINSYS(rmdir, 1); PYARG(0, PyString_FromString(path)); PYCALL; PYOUT; return retval; } static long umpyew_chmod(char *path, int mode) { PYINSYS(chmod, 2); PYARG(0, PyString_FromString(path)); PYARG(1, PyInt_FromLong(mode)); PYCALL; PYOUT; return retval; } static long umpyew_chown(char *path, uid_t owner, gid_t group) { PYINSYS(chown, 3); PYARG(0, PyString_FromString(path)); PYARG(1, PyInt_FromLong(owner)); PYARG(2, PyInt_FromLong(group)); PYCALL; PYOUT; return retval; } static long umpyew_lchown(char *path, uid_t owner, gid_t group) { PYINSYS(lchown, 3); PYARG(0, PyString_FromString(path)); PYARG(1, PyInt_FromLong(owner)); PYARG(2, PyInt_FromLong(group)); PYCALL; PYOUT; return retval; } static long umpyew_unlink(char *path) { PYINSYS(unlink, 1); PYARG(0, PyString_FromString(path)); PYCALL; PYOUT; return retval; } static long umpyew_link(char *oldpath, char *newpath) { PYINSYS(link, 2); PYARG(0, PyString_FromString(oldpath)); PYARG(1, PyString_FromString(newpath)); PYCALL; PYOUT; return retval; } static long umpyew_symlink(char *oldpath, char *newpath) { PYINSYS(symlink, 2); PYARG(0, PyString_FromString(oldpath)); PYARG(1, PyString_FromString(newpath)); PYCALL; PYOUT; return retval; } #define PY_COPYSTATFIELD(field) \ { \ if ((pStatField = PyObject_GetAttrString(pStatObj, #field))) \ buf->field = PyInt_AsLong(pStatField); \ else \ buf->field = 0; \ } #define UMPYEW_STATFUNC(name, fptype, fpname, fppycmd) \ static long umpyew_##name(fptype fpname, struct stat64 *buf) \ { \ PyObject *pStatObj; \ PyObject *pStatField; \ \ PYINSYS(name, 1); \ PYARG(0, fppycmd(fpname)); \ \ PYCALL; \ \ if (retval == 0) \ { \ pStatObj = PyTuple_GetItem(pRetVal, 2); \ GDEBUG(3, "%p", pStatObj); \ PY_COPYSTATFIELD(st_dev); \ PY_COPYSTATFIELD(st_ino); \ PY_COPYSTATFIELD(st_mode); \ PY_COPYSTATFIELD(st_nlink); \ PY_COPYSTATFIELD(st_uid); \ PY_COPYSTATFIELD(st_gid); \ PY_COPYSTATFIELD(st_rdev); \ PY_COPYSTATFIELD(st_size); \ PY_COPYSTATFIELD(st_blksize); \ PY_COPYSTATFIELD(st_blocks); \ PY_COPYSTATFIELD(st_atime); \ PY_COPYSTATFIELD(st_mtime); \ PY_COPYSTATFIELD(st_ctime); \ GDEBUG(3, "ino: %d", buf->st_ino); \ } \ \ GDEBUG(3, "returning %d", retval); \ PYOUT; \ return retval; \ } UMPYEW_STATFUNC(stat64, char*, path, PyString_FromString); UMPYEW_STATFUNC(lstat64, char*, path, PyString_FromString); UMPYEW_STATFUNC(fstat64, int, fd, PyInt_FromLong); #define UMPYEW_STATFSFUNC(name, fptype, fpname, fppycmd) \ static long umpyew_##name(fptype fpname, struct statfs64 *buf) \ { \ PyObject *pStatObj; \ PyObject *pStatField; \ \ PYINSYS(name, 1); \ PYARG(0, fppycmd(fpname)); \ \ PYCALL; \ \ if (retval == 0) \ { \ pStatObj = PyTuple_GetItem(pRetVal, 2); \ PY_COPYSTATFIELD(f_type); \ PY_COPYSTATFIELD(f_bsize); \ PY_COPYSTATFIELD(f_blocks); \ PY_COPYSTATFIELD(f_bfree); \ PY_COPYSTATFIELD(f_bavail); \ PY_COPYSTATFIELD(f_files); \ PY_COPYSTATFIELD(f_ffree); \ /* f_namelen is called f_namemax in the posix.stat_result class */ \ if ((pStatField = PyDict_GetItemString(pStatObj, "f_namemax"))) \ buf->f_namelen = PyInt_AsLong(pStatField); \ \ /* f_fsid seems to be a struct with a 'int __val[2]' inside. So we \ * expect a tuple with the two values. */ \ \ if ((pStatField = PyDict_GetItemString(pStatObj, "f_fsid"))) \ { \ buf->f_fsid.__val[0] = PyInt_AsLong(PyTuple_GetItem(pStatField, 0)); \ buf->f_fsid.__val[1] = PyInt_AsLong(PyTuple_GetItem(pStatField, 1)); \ } \ /* statvfs returns also frsize, favail, flag and namemax (instead of \ * namelen), but does not return type. Could they be unified? Mind \ * that python has os.statvfs but not os.statfs. */ \ } \ \ PYOUT; \ return retval; \ } \ UMPYEW_STATFSFUNC(statfs64, char*, path, PyString_FromString); UMPYEW_STATFSFUNC(fstatfs64, int, fd, PyInt_FromLong); static long umpyew_readlink(char *path, char *buf, size_t bufsiz) { PYINSYS(readlink, 2); PYARG(0, PyString_FromString(path)); PYARG(1, PyInt_FromLong(bufsiz)); PYCALL; if (retval >= 0) { strncpy(buf, PyString_AsString(PyTuple_GetItem(pRetVal, 2)), bufsiz); PYOUT; if (buf[bufsiz-1]) return bufsiz; else return strlen(buf); } PYOUT; return retval; } static long umpyew_lseek(int fd, int offset, int whence) { PYINSYS(lseek, 3); PYARG(0, PyInt_FromLong(fd)); PYARG(1, PyInt_FromLong(offset)); PYARG(2, PyInt_FromLong(whence)); PYCALL; PYOUT; return retval; } static long umpyew_utime(char *path, struct utimbuf *buf) { PYINSYS(utime, 2); PYARG(0, PyString_FromString(path)); if (buf) PYARG(1, PyTuple_Pack(2, PyInt_FromLong(buf->actime), PyInt_FromLong(buf->modtime))); else PYARG(1, Py_None); PYCALL; PYOUT; return retval; } static long umpyew_utimes(char *path, struct timeval tv[2]) { PYINSYS(utime, 2); PYARG(0, PyString_FromString(path)); if (tv) PYARG(1, PyTuple_Pack(2, (tv[0].tv_usec) ? (PyFloat_FromDouble(tv[0].tv_sec + (double)tv[0].tv_usec / 1000000.0)): (PyInt_FromLong(tv[0].tv_sec)), (tv[1].tv_usec) ? (PyFloat_FromDouble(tv[1].tv_sec + (double)tv[1].tv_usec / 1000000.0)): (PyInt_FromLong(tv[1].tv_sec)))); else PYARG(1, Py_None); PYCALL; PYOUT; return retval; } static long umpyew_read(int fd, void *buf, size_t count) { PYINSYS(read, 2); PYARG(0, PyInt_FromLong(fd)); PYARG(1, PyInt_FromLong(count)); PYCALL; if (retval >= 0) memcpy(buf, PyString_AsString(PyTuple_GetItem(pRetVal, 2)), retval); PYOUT; return retval; } static long umpyew_write(int fd, const void *buf, size_t count) { PYINSYS(write, 3); PYARG(0, PyInt_FromLong(fd)); PYARG(1, PyString_FromStringAndSize(buf, count)); PYARG(2, PyInt_FromLong(count)); PYCALL; PYOUT; return retval; } static ssize_t umpyew_pread64(int fd, void *buf, size_t count, long long offset) { PYINSYS(pread64, 3); PYARG(0, PyInt_FromLong(fd)); PYARG(1, PyInt_FromLong(count)); PYARG(2, PyLong_FromLongLong(offset)); PYCALL; if (retval >= 0) memcpy(buf, PyString_AsString(PyTuple_GetItem(pRetVal, 2)), retval); PYOUT; return retval; } static ssize_t umpyew_pwrite64(int fd, const void *buf, size_t count, long long offset) { PYINSYS(pwrite64, 4); PYARG(0, PyInt_FromLong(fd)); PYARG(1, PyString_FromStringAndSize(buf, count)); PYARG(2, PyInt_FromLong(count)); PYARG(3, PyLong_FromLongLong(offset)); PYCALL; PYOUT; return retval; } /* * End of system calls definitions. */ /* This is used if modCtl or modCheckFun are not defined */ static long umpyew_alwayszero() { return 0; } static epoch_t checkfun(int type, void *arg) { PyObject *pKw = PyDict_New(); PyObject *pArg; PyObject *pRetVal; epoch_t retval = -1; struct binfmt_req *bf; switch(type) { case CHECKPATH: pArg = PyString_FromString((char*)arg); PyDict_SetItemString(pKw, "path", pArg); break; case CHECKSOCKET: pArg = PyInt_FromLong((long)arg); PyDict_SetItemString(pKw, "socket", pArg); break; case CHECKFSTYPE: pArg = PyString_FromString((char*)arg); PyDict_SetItemString(pKw, "fstype", pArg); break; case CHECKSC: pArg = PyInt_FromLong(*((long*)arg)); PyDict_SetItemString(pKw, "sc", pArg); break; case CHECKBINFMT: bf = (struct binfmt_req*) arg; pArg = PyTuple_New(3); if (bf->path) PyTuple_SET_ITEM(pArg, 0, PyString_FromString(bf->path)); if (bf->interp) PyTuple_SET_ITEM(pArg, 1, PyString_FromString(bf->interp)); PyTuple_SET_ITEM(pArg, 2, PyInt_FromLong(bf->flags)); PyDict_SetItemString(pKw, "binfmt", pArg); break; default: GERROR("Unknown check type %d", type); retval = 0; break; } if (!retval) { Py_DECREF(pKw); return retval; } pRetVal = PyObject_Call(ps.checkfun, pEmptyTuple, pKw); if (!pRetVal) { PyErr_Print(); return 0; } retval = PyInt_AsLong(pRetVal); Py_DECREF(pArg); Py_DECREF(pKw); Py_DECREF(pRetVal); return retval; } static long ctl(int type, va_list ap) { long retval; PyObject *pArg, *pCmdArgs, *pRetVal; pArg = PyTuple_New(3); switch(type) { case MC_PROC | MC_ADD: PyTuple_SET_ITEM(pArg, 0, PyString_FromString("proc")); PyTuple_SET_ITEM(pArg, 1, PyString_FromString("add")); pCmdArgs = PyTuple_New(3); /* The tuple is (id, ppid, max) */ PyTuple_SET_ITEM(pCmdArgs, 0, PyInt_FromLong(va_arg(ap, long))); PyTuple_SET_ITEM(pCmdArgs, 1, PyInt_FromLong(va_arg(ap, long))); PyTuple_SET_ITEM(pCmdArgs, 2, PyInt_FromLong(va_arg(ap, long))); break; case MC_PROC | MC_REM: PyTuple_SET_ITEM(pArg, 0, PyString_FromString("proc")); PyTuple_SET_ITEM(pArg, 1, PyString_FromString("rem")); pCmdArgs = PyTuple_New(1); /* The tuple is (id) */ PyTuple_SET_ITEM(pCmdArgs, 0, PyInt_FromLong(va_arg(ap, long))); break; case MC_MODULE | MC_ADD: PyTuple_SET_ITEM(pArg, 0, PyString_FromString("module")); PyTuple_SET_ITEM(pArg, 1, PyString_FromString("add")); pCmdArgs = PyTuple_New(1); /* The tuple is (code) */ PyTuple_SET_ITEM(pCmdArgs, 0, PyInt_FromLong(va_arg(ap, long))); break; case MC_MODULE | MC_REM: PyTuple_SET_ITEM(pArg, 0, PyString_FromString("module")); PyTuple_SET_ITEM(pArg, 1, PyString_FromString("rem")); pCmdArgs = PyTuple_New(1); /* The tuple is (code) */ PyTuple_SET_ITEM(pCmdArgs, 0, PyInt_FromLong(va_arg(ap, long))); break; default: Py_DECREF(pArg); return -1; } PyTuple_SET_ITEM(pArg, 2, pCmdArgs); pRetVal = PyObject_CallObject(ps.ctl, pArg); Py_DECREF(pCmdArgs); Py_DECREF(pArg); retval = PyInt_AsLong(pRetVal); Py_DECREF(pRetVal); return retval; } static void __attribute__ ((constructor)) init (void) {} void _um_mod_init(char *initargs) { const char *name; char *tmphs, *cwd; int i; PyObject *pName, *pTmpObj, *pTmpFunc, *pTmpDict; GMESSAGE("umpyew init"); if (!strlen(initargs)) { GERROR("You must specify the Python module name."); return; } name = initargs; s.name="Prototypal Python bindings for *MView"; s.code=0x07; s.syscall=(sysfun *)calloc(scmap_scmapsize,sizeof(sysfun)); s.socket=(sysfun *)calloc(scmap_sockmapsize,sizeof(sysfun)); Py_Initialize(); Py_InitModule("umpyew", pEmbMethods); pEmptyTuple = PyTuple_New(0); pName = PyString_FromString(name); cwd = getcwd(NULL, 0); if (cwd) { setenv("PYTHONPATH", cwd, 0); free(cwd); } pModule = PyImport_Import(pName); Py_DECREF(pName); if (!pModule) { GERROR("Error loading Python module %s.\nIt has been searched for in the following path:\n%s", name, getenv("PYTHONPATH")); PyErr_Print(); return; } /* * Add ctl */ if ((ps.ctl = PyObject_GetAttrString(pModule, "modCtl")) && PyCallable_Check(ps.ctl)) s.ctl = ctl; else { GDEBUG(2, "function modCheckFun not defined in module %s", name); s.ctl = umpyew_alwayszero; Py_XDECREF(ps.ctl); } /* * Add checkfun */ if ((ps.checkfun = PyObject_GetAttrString(pModule, "modCheckFun")) && PyCallable_Check(ps.checkfun)) s.checkfun = checkfun; else { GDEBUG("2, function modCheckFun not defined in module %s", name); /* This makes the module almost useless, but we respect its author's will. */ s.checkfun = (epoch_t(*)())umpyew_alwayszero; Py_XDECREF(ps.checkfun); } /* * Add ctlhs */ MCH_ZERO(&(s.ctlhs)); pTmpObj = PyObject_GetAttrString(pModule, "modCtlHistorySet"); if (pTmpObj && PyList_Check(pTmpObj)) for (i = 0; i < PyList_Size(pTmpObj); i++) if ((tmphs = PyString_AsString(PyList_GET_ITEM(pTmpObj, i)))) { if (!strcmp(tmphs, "proc")) MCH_SET(MC_PROC, &(s.ctlhs)); else if (!strcmp(tmphs, "module")) MCH_SET(MC_MODULE, &(s.ctlhs)); else if (!strcmp(tmphs, "mount")) MCH_SET(MC_MOUNT, &(s.ctlhs)); } Py_XDECREF(pTmpObj); /* * Call modInit, if present */ pTmpObj = PyObject_GetAttrString(pModule, "modInit"); if (pTmpObj && PyCallable_Check(pTmpObj)) PyObject_CallObject(pTmpObj, pEmptyTuple); Py_XDECREF(pTmpObj); /* * Add system calls */ ps.syscall = calloc(scmap_scmapsize, sizeof(PyObject*)); PYTHON_SYSCALL(open, sysOpen); PYTHON_SYSCALL(close, sysClose); PYTHON_SYSCALL(access, sysAccess); PYTHON_SYSCALL(mkdir, sysMkdir); PYTHON_SYSCALL(rmdir, sysRmdir); PYTHON_SYSCALL(chmod, sysChmod); PYTHON_SYSCALL(chown, sysChown); PYTHON_SYSCALL(lchown, sysLchown); PYTHON_SYSCALL(unlink, sysUnlink); PYTHON_SYSCALL(link, sysLink); PYTHON_SYSCALL(symlink, sysSymlink); PYTHON_SYSCALL(stat64, sysStat64); PYTHON_SYSCALL(lstat64, sysLstat64); PYTHON_SYSCALL(fstat64, sysFstat64); PYTHON_SYSCALL(statfs64, sysStatfs64); PYTHON_SYSCALL(fstatfs64, sysStatfs64); PYTHON_SYSCALL(readlink, sysReadlink); PYTHON_SYSCALL(lseek, sysLseek); PYTHON_SYSCALL(utime, sysUtime); PYTHON_SYSCALL(utimes, sysUtimes) PYTHON_SYSCALL(read, sysRead); PYTHON_SYSCALL(write, sysWrite); PYTHON_SYSCALL(pread64, sysPread64); PYTHON_SYSCALL(pwrite64, sysPwrite64); add_service(&s); } static void __attribute__ ((destructor)) fini (void) { GBACKTRACE(5,20); PyObject *pTmpObj = PyObject_GetAttrString(pModule, "modFini"); if (pTmpObj && PyCallable_Check(pTmpObj)) PyObject_CallObject(pTmpObj, pEmptyTuple); Py_XDECREF(pTmpObj); free(s.syscall); free(s.socket); /* Finalizing will destroy everything, no need for DECREFs (I think) */ PyErr_Clear(); Py_Finalize(); GMESSAGE("umpyew fini"); } /* * Development stuff, don't look! */ #if 0 #if 0 SERVICESYSCALL(s, getdents, getdents64); #endif SERVICESYSCALL(s, getdents64, getdents64); #if !defined(__x86_64__) SERVICESYSCALL(s, fcntl, fcntl32); SERVICESYSCALL(s, fcntl64, fcntl64); SERVICESYSCALL(s, _llseek, _llseek); #else SERVICESYSCALL(s, fcntl, fcntl); #endif SERVICESYSCALL(s, fchown, fchown); SERVICESYSCALL(s, fchmod, fchmod); SERVICESYSCALL(s, fsync, fsync); SERVICESYSCALL(s, fdatasync, fdatasync); SERVICESYSCALL(s, _newselect, select); #endif #if 0 static struct cpymap_s cpymap_syscall[] = { { "execve", "sysExecve" }, { "chdir", "sysChdir" }, { "fchdir", "sysFchdir" }, { "getcwd", "sysGetcwd" }, { "select", "sysSelect" }, { "poll", "sysPoll" }, { "_newselect", "sys_newselect" }, { "pselect6", "sysPselect6" }, { "ppoll", "sysPpoll" }, { "umask", "sysUmask" }, { "chroot", "sysChroot" }, { "dup", "sysDup" }, { "dup2", "sysDup2" }, { "mount", "sysMount" }, { "umount2", "sysUmount2" }, { "ioctl", "sysIoctl" }, { "fchown", "sysFchown" }, { "chown32", "sysChown32" }, { "lchown32", "sysLchown32" }, { "fchown32", "sysFchown32" }, { "fchmod", "sysFchmod" }, { "getxattr", "sysGetxattr" }, { "lgetxattr", "sysLgetxattr" }, { "fgetxattr", "sysFgetxattr" }, { "readlink", "sysReadlink" }, { "getdents64", "sysGetdents64" }, { "fcntl", "sysFcntl" }, { "fcntl64", "sysFcntl64" }, { "lseek", "sysLseek" }, { "_llseek", "sys_llseek" }, { "rename", "sysRename" }, { "fsync", "sysFsync" }, { "fdatasync", "sysFdatasync" }, { "truncate64", "sysTruncate64" }, { "ftruncate64", "sysFtruncate64" }, #ifdef _UM_MMAP { "mmap", "sysMmap" }, { "mmap2", "sysMmap2" }, { "munmap", "sysMunmap" }, { "mremap", "sysMremap" }, #endif { "gettimeofday", "sysGettimeofday" }, { "settimeofday", "sysSettimeofday" }, { "adjtimex", "sysAdjtimex" }, { "clock_gettime", "sysClock_gettime" }, { "clock_settime", "sysClock_settime" }, { "clock_getres", "sysClock_getres" }, { "uname", "sysUname" }, { "gethostname", "sysGethostname" }, { "sethostname", "sysSethostname" }, { "getdomainname", "sysGetdomainname" }, { "setdomainname", "sysSetdomainname" }, { "getuid", "sysGetuid" }, { "setuid", "sysSetuid" }, { "geteuid", "sysGeteuid" }, { "setfsuid", "sysSetfsuid" }, { "setreuid", "sysSetreuid" }, { "getresuid", "sysGetresuid" }, { "setresuid", "sysSetresuid" }, { "getgid", "sysGetgid" }, { "setgid", "sysSetgid" }, { "getegid", "sysGetegid" }, { "setfsgid", "sysSetfsgid" }, { "setregid", "sysSetregid" }, { "getresgid", "sysGetresgid" }, { "setresgid", "sysSetresgid" }, { "nice", "sysNice" }, { "getpriority", "sysGetpriority" }, { "setpriority", "sysSetpriority" }, { "getpid", "sysGetpid" }, { "getppid", "sysGetppid" }, { "getpgid", "sysGetpgid" }, { "setpgid", "sysSetpgid" }, { "getsid", "sysGetsid" }, { "setsid", "sysSetsid" }, #if 0 { "sysctl", "sysSysctl" }, { "ptrace", "sysPtrace" }, #endif { "kill", "sysKill" }, #if (__NR_socketcall != __NR_doesnotexist) }; static struct cpymap_s cpymap_socket[] = { { "doesnotexist", "sysDoesnotexist" }, { "socket", "sysSocket" }, #else { "socket", "sysSocket" }, #endif { "bind", "sysBind" }, { "connect", "sysConnect" }, { "listen", "sysListen" }, { "accept", "sysAccept" }, { "getsockname", "sysGetsockname" }, { "getpeername", "sysGetpeername" }, { "socketpair", "sysSocketpair" }, { "send", "sysSend" }, { "recv", "sysRecv" }, { "sendto", "sysSendto" }, { "recvfrom", "sysRecvfrom" }, { "shutdown", "sysShutdown" }, { "setsockopt", "sysSetsockopt" }, { "getsockopt", "sysGetsockopt" }, { "sendmsg", "sysSendmsg" }, { "recvmsg", "sysRecvmsg" }, #if (__NR_socketcall != __NR_doesnotexist) { "msocket", "sysMsocket" }, #endif }; #endif umview-0.8.2/umpyew/Makefile.am0000644000175000017500000000022211753517211015472 0ustar renzorenzoinclude $(top_srcdir)/modules-common.mk mod_LTLIBRARIES = umpyew.la umpyew_la_CFLAGS = $(PYTHON_CFLAGS) -Wall umpyew_la_LIBADD = $(PYTHON_LIBS) umview-0.8.2/umpyew/unreal.py0000644000175000017500000000554011753517211015306 0ustar renzorenzo# This is part of UMView # The user-mode implementation of View-OS: A Process with a View # # Sample Python module that mimics the unreal testmodule # # Copyright 2008 Ludovico Gardenghi, University of Bologna, Italy # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. import os import umpyew def modInit(): global t1, t2 t1 = umpyew.tstTimestamp() t2 = umpyew.tstTimestamp() def modCheckFun(*arg, **kw): if kw.has_key('path') and kw['path'][0:7] == '/unreal': e = umpyew.tstMatchingEpoch(t2) if e == 0: return umpyew.tstMatchingEpoch(t1) return e return 0 def unwrap(path): if type(path) == str: return path[0] + path[8:] else: return path ############################ # System calls definitions # ############################ # These functions can be safely mapped to the corresponding real syscalls. sysRead = sysWrite = sysClose = sysFstat64 = sysLseek = None def sysGenericPath(path, *arg, **kw): try: rv = getattr(os, kw['cname'])(unwrap(path), *arg) if rv == None: return (0, 0) elif type(rv) == bool: # syscalls like os.access() return True or False. Since True means # success, and for UNIX syscalls succes is 0, we must negate the # value (True is represented as 1 and False as 0). return (not rv, 0) else: return (rv, 0) except OSError, (errno, strerror): return (-1, errno) sysOpen = sysRmdir = sysUnlink = sysAccess = sysMkdir = sysChmod = sysUtime = sysUtimes = sysGenericPath # Manages also symlink() def sysLink(oldpath, newpath, **kw): try: if kw['cname'] == 'symlink': os.symlink(oldpath, unwrap(newpath)) else: # link os.link(unwrap(oldpath), unwrap(newpath)) return (0, 0) except OSError, (errno, strerror): return (-1, errno) sysSymlink = sysLink # manages stat64, lstat64() def sysStats(path, **kw): try: os.stat_float_times(False) return (0, 0, getattr(os, kw['cname'].rstrip('64'))(unwrap(path))) except OSError, (errno, strerror): return (-1, errno) sysStat64 = sysLstat64 = sysStats def sysStatfs64(**kw): try: return (0, 0, os.statvfs(unwrap(path))) except OSError, (errno, strerror): return (-1, errno) def sysReadlink(path, bufsiz, **kw): try: tmplink = os.readlink(unwrap(path)) return (min(bufsiz, len(tmplink)), 0, tmplink[0:bufsiz]) except OSError, (errno, strerror): return (-1, errno) umview-0.8.2/um_testmodule/0000755000175000017500000000000011753517351015007 5ustar renzorenzoumview-0.8.2/um_testmodule/Makefile.in0000644000175000017500000004663511753517327017075 0ustar renzorenzo# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/modules-common.mk subdir = um_testmodule ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moddir)" LTLIBRARIES = $(mod_LTLIBRARIES) real_la_LIBADD = real_la_SOURCES = real.c real_la_OBJECTS = real.lo sockettest_la_LIBADD = sockettest_la_SOURCES = sockettest.c sockettest_la_OBJECTS = sockettest.lo sockip_la_LIBADD = sockip_la_SOURCES = sockip.c sockip_la_OBJECTS = sockip.lo testmodul2_la_LIBADD = testmodul2_la_SOURCES = testmodul2.c testmodul2_la_OBJECTS = testmodul2.lo testmodule_la_LIBADD = testmodule_la_SOURCES = testmodule.c testmodule_la_OBJECTS = testmodule.lo unreal_la_LIBADD = unreal_la_SOURCES = unreal.c unreal_la_OBJECTS = unreal.lo DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = real.c sockettest.c sockip.c testmodul2.c testmodule.c \ unreal.c DIST_SOURCES = real.c sockettest.c sockip.c testmodul2.c testmodule.c \ unreal.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB20_CFLAGS = @GLIB20_CFLAGS@ GLIB20_LIBS = @GLIB20_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = ../um_lib/libumlib.la LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DEBUGLEVEL = 3 moddir = $(pkglibdir)/modules CBASEFLAGS = CDEBUGFLAGS = -g3 -ggdb3 CPPBASEFLAGS = -I../include -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CPPDEBUGFLAGS = -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) @ENABLE_DEBUG_FALSE@CFULLFLAGS = $(CBASEFLAGS) @ENABLE_DEBUG_TRUE@CFULLFLAGS = $(CBASEFLAGS) $(CDEBUGFLAGS) @ENABLE_DEBUG_FALSE@CPPFULLFLAGS = $(CPPBASEFLAGS) @ENABLE_DEBUG_TRUE@CPPFULLFLAGS = $(CPPBASEFLAGS) $(CPPDEBUGFLAGS) AM_CFLAGS = $(CFULLFLAGS) AM_CPPFLAGS = $(CPPFULLFLAGS) AM_LDFLAGS = -module -avoid-version -export-dynamic AM_LIBTOOLFLAGS = --tag=disable-static mod_LTLIBRARIES = testmodule.la testmodul2.la unreal.la real.la sockettest.la sockip.la all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/modules-common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign um_testmodule/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign um_testmodule/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/modules-common.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-modLTLIBRARIES: $(mod_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(moddir)" || $(MKDIR_P) "$(DESTDIR)$(moddir)" @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moddir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moddir)"; \ } uninstall-modLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moddir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moddir)/$$f"; \ done clean-modLTLIBRARIES: -test -z "$(mod_LTLIBRARIES)" || rm -f $(mod_LTLIBRARIES) @list='$(mod_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done real.la: $(real_la_OBJECTS) $(real_la_DEPENDENCIES) $(EXTRA_real_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(real_la_OBJECTS) $(real_la_LIBADD) $(LIBS) sockettest.la: $(sockettest_la_OBJECTS) $(sockettest_la_DEPENDENCIES) $(EXTRA_sockettest_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(sockettest_la_OBJECTS) $(sockettest_la_LIBADD) $(LIBS) sockip.la: $(sockip_la_OBJECTS) $(sockip_la_DEPENDENCIES) $(EXTRA_sockip_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(sockip_la_OBJECTS) $(sockip_la_LIBADD) $(LIBS) testmodul2.la: $(testmodul2_la_OBJECTS) $(testmodul2_la_DEPENDENCIES) $(EXTRA_testmodul2_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(testmodul2_la_OBJECTS) $(testmodul2_la_LIBADD) $(LIBS) testmodule.la: $(testmodule_la_OBJECTS) $(testmodule_la_DEPENDENCIES) $(EXTRA_testmodule_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(testmodule_la_OBJECTS) $(testmodule_la_LIBADD) $(LIBS) unreal.la: $(unreal_la_OBJECTS) $(unreal_la_DEPENDENCIES) $(EXTRA_unreal_la_DEPENDENCIES) $(LINK) -rpath $(moddir) $(unreal_la_OBJECTS) $(unreal_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/real.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockettest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockip.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmodul2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmodule.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unreal.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(moddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-modLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-modLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-modLTLIBRARIES .MAKE: install-am install-data-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-modLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-modLTLIBRARIES install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-modLTLIBRARIES @ENABLE_DEBUG_TRUE@release: clean @ENABLE_DEBUG_TRUE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS)' @ENABLE_DEBUG_TRUE@debug: all @ENABLE_DEBUG_FALSE@release: all @ENABLE_DEBUG_FALSE@debug: clean @ENABLE_DEBUG_FALSE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS) $(CDEBUGFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS) $(CPPDEBUGFLAGS)' install-data-hook: cd "$(DESTDIR)/$(moddir)" && rm -f $(mod_LTLIBRARIES) debug release: all # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: umview-0.8.2/um_testmodule/testmodul2.c0000644000175000017500000000246211753517212017255 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: testmodul2.c 1003 2011-09-06 10:32:34Z rd235 $ * */ #include #include #include "module.h" #include "gdebug.h" static struct service s; VIEWOS_SERVICE(s) static void __attribute__ ((constructor)) init (void) { printk(KERN_NOTICE "testmodul2 init\n"); s.name="test2"; s.description="Test Module 2"; s.syscall=NULL; s.socket=NULL; } static void __attribute__ ((destructor)) fini (void) { printk(KERN_NOTICE "testmodul2 fini\n"); } umview-0.8.2/um_testmodule/real.c0000644000175000017500000000663011753517212016077 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * example of um-ViewOS module: * Identity module. * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: real.c 1003 2011-09-06 10:32:34Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include "module.h" #include "libummod.h" #include "gdebug.h" // int read(), write(), close(); static struct service s; VIEWOS_SERVICE(s) static long addproc(int id, int max) { GDEBUG(3, "new process id %d pid %d max %d",id,um_mod_getpid(),max); return 0; } static long delproc(int id) { GDEBUG(3, "terminated process id %d pid %d",id,um_mod_getpid()); return 0; } static long addmodule(char *sender) { GDEBUG(3, "new module loaded. %s", sender); return 0; } static long delmodule(char *sender) { GDEBUG(3, "module %s removed", sender); return 0; } static long ctl(int type, char *sender, va_list ap) { int id, /*ppid,*/ max; switch(type) { case MC_PROC | MC_ADD: id = va_arg(ap, int); /*ppid = */ va_arg(ap, int); max = va_arg(ap, int); return addproc(id, max); case MC_PROC | MC_REM: id = va_arg(ap, int); return delproc(id); case MC_MODULE | MC_ADD: return addmodule(sender); case MC_MODULE | MC_REM: return delmodule(sender); default: return -1; } } void *viewos_init(char *args) { return ht_tab_pathadd(CHECKPATH,"/","/","real",0,"",&s,0,NULL,NULL); } void viewos_fini(void *data) { struct ht_elem *proc_ht=data; ht_tab_del(proc_ht); } static void __attribute__ ((constructor)) init (void) { printk(KERN_NOTICE "real init\n"); s.name="real"; s.description="Identity (server side)"; s.ctl = ctl; MCH_ZERO(&(s.ctlhs)); MCH_SET(MC_PROC, &(s.ctlhs)); MCH_SET(MC_MODULE, &(s.ctlhs)); s.syscall=(sysfun *)calloc(scmap_scmapsize,sizeof(sysfun)); s.socket=(sysfun *)calloc(scmap_sockmapsize,sizeof(sysfun)); SERVICESYSCALL(s, open, (sysfun)open); SERVICESYSCALL(s, read, read); SERVICESYSCALL(s, write, write); SERVICESYSCALL(s, close, close); #if !defined(__x86_64__) //SERVICESYSCALL(s, stat64, stat64); SERVICESYSCALL(s, lstat64, lstat64); #else SERVICESYSCALL(s, lstat, lstat); #endif SERVICESYSCALL(s, readlink, readlink); SERVICESYSCALL(s, getdents64, getdents64); SERVICESYSCALL(s, access, access); #ifdef __NR_fcntl64 SERVICESYSCALL(s, fcntl, fcntl64); #else SERVICESYSCALL(s, fcntl, fcntl); #endif #if !defined(__x86_64__) SERVICESYSCALL(s, _llseek, _llseek); #endif } static void __attribute__ ((destructor)) fini (void) { free(s.syscall); free(s.socket); printk(KERN_NOTICE "real fini\n"); } umview-0.8.2/um_testmodule/testmodule.c0000644000175000017500000000602411753517212017336 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: testmodule.c 1003 2011-09-06 10:32:34Z rd235 $ * */ #include #include #include #include #include "module.h" #include "gdebug.h" static struct service s; VIEWOS_SERVICE(s) static long addproc(int id, int ppid, int max) { fprintf(stderr, "testmodule add proc %d %d %d\n", id, ppid, max); GDEBUG(3, "new process id %d pid %d max %d",id,um_mod_getpid(),max); return 0; } static long delproc(int id) { fprintf(stderr, "testmodule del proc %d\n", id); GDEBUG(3, "terminated process id %d pid %d",id,um_mod_getpid()); return 0; } static long addmodule(char *sender) { fprintf(stderr, "testmodule add module %s\n", sender); GDEBUG(3, "new module loaded. %s", sender); return 0; } static long delmodule(char *sender) { fprintf(stderr, "testmodule del module %s\n", sender); GDEBUG(3, "module %s removed", sender); return 0; } static long ctl(int type, char *sender, va_list ap) { int id, ppid, max; char* arg; if (type & MC_USER) { GDEBUG(3, "received user ctl. sender sercode: 0x%02x, ctl: %d\n", MC_USERCTL_SERCODE(type), MC_USERCTL_CTL(type)); switch (MC_USERCTL_CTL(type)) { case 42: arg = va_arg(ap, char*); printk(KERN_NOTICE "service %s is managing open(\"%s\", ...)", sender, arg); return 0; default: return -1; } } else switch(type) { case MC_PROC | MC_ADD: id = va_arg(ap, int); ppid = va_arg(ap, int); max = va_arg(ap, int); return addproc(id, ppid, max); case MC_PROC | MC_REM: id = va_arg(ap, int); return delproc(id); case MC_MODULE | MC_ADD: return addmodule(sender); case MC_MODULE | MC_REM: return delmodule(sender); default: return -1; } } static void __attribute__ ((constructor)) init (void) { printk(KERN_NOTICE "testmodule init\n"); s.name="test"; s.description="Test Module"; s.syscall=(sysfun *)calloc(scmap_scmapsize,sizeof(sysfun)); s.socket=(sysfun *)calloc(scmap_sockmapsize,sizeof(sysfun)); s.ctl = ctl; MCH_ZERO(&s.ctlhs); MCH_SET(MC_PROC, &s.ctlhs); MCH_SET(MC_MODULE, &s.ctlhs); } static void __attribute__ ((destructor)) fini (void) { free(s.syscall); free(s.socket); printk(KERN_NOTICE "testmodule fini\n"); } umview-0.8.2/um_testmodule/unreal.c0000644000175000017500000001612411753517212016441 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * example of um-ViewOS module: * remap of /unreal onto the real FS * /unreal/XXXX is mapped to XXXX in th real FS * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: unreal.c 1003 2011-09-06 10:32:34Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include "module.h" #include "libummod.h" #include "gdebug.h" // int read(), write(), close(); static struct service s; VIEWOS_SERVICE(s) static long addproc(int id, int max) { fprintf(stderr, "add proc %d %d\n", id, max); GDEBUG(3, "new process id %d pid %d max %d",id,um_mod_getpid(),max); return 0; } static long delproc(int id) { fprintf(stderr, "del proc %d\n", id); GDEBUG(3, "terminated process id %d pid %d",id,um_mod_getpid()); return 0; } static long addmodule(char *sender) { fprintf(stderr, "add module %s\n", sender); GDEBUG(3, "new module loaded. %s", sender); return 0; } static long delmodule(char *sender) { fprintf(stderr, "del module %s\n", sender); GDEBUG(3, "module %s removed", sender); return 0; } static long ctl(int type, char *sender, va_list ap) { int id, /*ppid,*/ max; switch(type) { case MC_PROC | MC_ADD: id = va_arg(ap, int); /*ppid =*/ va_arg(ap, int); max = va_arg(ap, int); return addproc(id, max); case MC_PROC | MC_REM: id = va_arg(ap, int); return delproc(id); case MC_MODULE | MC_ADD: return addmodule(sender); case MC_MODULE | MC_REM: return delmodule(sender); default: return -1; } } static char *unwrap(char *path) { char *s; s=&(path[7]); if (*s == 0) s = "/"; return (s); } static long unreal_open(char *pathname, int flags, mode_t mode) { /* send the file name to every module except myself (just for testing) */ service_userctl(42, &s, NULL, pathname); /* send the file name to module TEST (i.e. testmodule) */ // service_userctl(42, &s, "TEST", pathname); return open(unwrap(pathname),flags,mode); } static long unreal_statfs64(char *pathname, struct statfs64 *buf) { return statfs64(unwrap(pathname),buf); } /*static long unreal_stat64(char *pathname, struct stat64 *buf) { return stat64(unwrap(pathname),buf); }*/ static long unreal_lstat64(char *pathname, struct stat64 *buf) { return lstat64(unwrap(pathname),buf); } static long unreal_readlink(char *path, char *buf, size_t bufsiz) { return readlink(unwrap(path),buf,bufsiz); } static long unreal_access(char *path, int mode) { return access(unwrap(path),mode); } static long unreal_mkdir(char *path, int mode) { return mkdir(unwrap(path),mode); } static long unreal_rmdir(char *path) { return rmdir(unwrap(path)); } static long unreal_chmod(char *path, int mode) { return chmod(unwrap(path),mode); } /*static long unreal_chown(char *path, uid_t owner, gid_t group) { return chown(unwrap(path),owner,group); }*/ static long unreal_lchown(char *path, uid_t owner, gid_t group) { return lchown(unwrap(path),owner,group); } static long unreal_unlink(char *path) { return unlink(unwrap(path)); } static long unreal_link(char *oldpath, char *newpath) { return link(unwrap(oldpath),unwrap(newpath)); } static long unreal_symlink(char *oldpath, char *newpath) { return symlink(oldpath,unwrap(newpath)); } #if 0 static long unreal_utime(char *filename, struct utimbuf *buf) { return utime(unwrap(filename),buf); } #endif static long unreal_utimes(char *filename, struct timeval tv[2]) { return utimes(unwrap(filename),tv); } static ssize_t unreal_pread(int fd, void *buf, size_t count, long long offset) { off_t off=offset; return pread(fd,buf,count,off); } static ssize_t unreal_pwrite(int fd, const void *buf, size_t count, long long offset) { off_t off=offset; return pwrite(fd,buf,count,off); } static long unreal_lseek(int fildes, int offset, int whence) { return (int) lseek64(fildes, (off_t) offset, whence); } struct twohte { struct ht_elem *ht1,*ht2; }; void *viewos_init(char *args) { struct twohte *two=malloc(sizeof(struct twohte)); two->ht1=ht_tab_pathadd(CHECKPATH,"/","/unreal","unreal",0,"",&s,0,NULL,NULL); two->ht2=ht_tab_pathadd(CHECKPATH,"/","/unreal","unreal",0,"",&s,0,NULL,NULL); return two; } void viewos_fini(void *data) { struct twohte *two=data; ht_tab_del(two->ht2); ht_tab_del(two->ht1); free(two); } static void __attribute__ ((constructor)) init (void) { printk(KERN_NOTICE "unreal init\n"); s.name="unreal"; s.description="/unreal Mapping to FS (server side)"; s.syscall=(sysfun *)calloc(scmap_scmapsize,sizeof(sysfun)); s.socket=(sysfun *)calloc(scmap_sockmapsize,sizeof(sysfun)); s.ctl = ctl; MCH_ZERO(&(s.ctlhs)); MCH_SET(MC_PROC, &(s.ctlhs)); MCH_SET(MC_MODULE, &(s.ctlhs)); SERVICESYSCALL(s, open, unreal_open); SERVICESYSCALL(s, read, read); SERVICESYSCALL(s, write, write); SERVICESYSCALL(s, close, close); #if !defined(__x86_64__) //SERVICESYSCALL(s, stat64, unreal_stat64); SERVICESYSCALL(s, lstat64, unreal_lstat64); #else //SERVICESYSCALL(s, stat, unreal_stat64); SERVICESYSCALL(s, lstat, unreal_lstat64); #endif SERVICESYSCALL(s, readlink, unreal_readlink); SERVICESYSCALL(s, getdents64, getdents64); SERVICESYSCALL(s, access, unreal_access); #ifdef __NR_fcntl64 SERVICESYSCALL(s, fcntl, fcntl64); #else SERVICESYSCALL(s, fcntl, fcntl); #endif #if !defined(__x86_64__) SERVICESYSCALL(s, _llseek, _llseek); #endif SERVICESYSCALL(s, lseek, unreal_lseek); SERVICESYSCALL(s, mkdir, unreal_mkdir); SERVICESYSCALL(s, rmdir, unreal_rmdir); //SERVICESYSCALL(s, chown, unreal_chown); SERVICESYSCALL(s, lchown, unreal_lchown); SERVICESYSCALL(s, chmod, unreal_chmod); SERVICESYSCALL(s, unlink, unreal_unlink); SERVICESYSCALL(s, fsync, fsync); SERVICESYSCALL(s, fdatasync, fdatasync); SERVICESYSCALL(s, _newselect, select); SERVICESYSCALL(s, link, unreal_link); SERVICESYSCALL(s, symlink, unreal_symlink); SERVICESYSCALL(s, pread64, unreal_pread); SERVICESYSCALL(s, pwrite64, unreal_pwrite); //SERVICESYSCALL(s, utime, unreal_utime); SERVICESYSCALL(s, utimes, unreal_utimes); #if !defined(__x86_64__) SERVICESYSCALL(s, statfs64, unreal_statfs64); #else SERVICESYSCALL(s, statfs, unreal_statfs64); #endif } static void __attribute__ ((destructor)) fini (void) { GBACKTRACE(5,20); free(s.syscall); free(s.socket); printk(KERN_NOTICE "unreal fini\n"); } umview-0.8.2/um_testmodule/Makefile.am0000644000175000017500000000020211753517212017031 0ustar renzorenzoinclude $(top_srcdir)/modules-common.mk mod_LTLIBRARIES = testmodule.la testmodul2.la unreal.la real.la sockettest.la sockip.la umview-0.8.2/um_testmodule/sockettest.c0000644000175000017500000001037411753517212017344 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * example of um-ViewOS module * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: sockettest.c 1005 2011-09-08 15:11:23Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include "module.h" #include "libummod.h" #include "gdebug.h" #include #include #include #include // int read(), write(), close(); static struct service s; VIEWOS_SERVICE(s) static long ioctlparms(int fd,int req) { switch (req) { case FIONREAD: return sizeof(int) | IOCTL_W; case FIONBIO: return sizeof(int) | IOCTL_R; case SIOCGIFCONF: return sizeof(struct ifconf) | IOCTL_R | IOCTL_W; case SIOCGSTAMP: return sizeof(struct timeval) | IOCTL_W; case SIOCGIFTXQLEN: return sizeof(struct ifreq) | IOCTL_R | IOCTL_W; case SIOCGIFFLAGS: case SIOCGIFADDR: case SIOCGIFDSTADDR: case SIOCGIFBRDADDR: case SIOCGIFNETMASK: case SIOCGIFMETRIC: case SIOCGIFMEM: case SIOCGIFMTU: case SIOCGIFHWADDR: return sizeof(struct ifreq) | IOCTL_R | IOCTL_W; case SIOCSIFFLAGS: case SIOCSIFADDR: case SIOCSIFDSTADDR: case SIOCSIFBRDADDR: case SIOCSIFNETMASK: case SIOCSIFMETRIC: case SIOCSIFMEM: case SIOCSIFMTU: case SIOCSIFHWADDR: case SIOCGIFINDEX: return sizeof(struct ifreq) | IOCTL_R; default: return 0; } } static int sockioctl(int d, int request, void *arg) { if (request == SIOCGIFCONF) { int rv; void *save; struct ifconf *ifc=(struct ifconf *)arg; save=ifc->ifc_buf; ioctl(d,request,arg); ifc->ifc_buf=malloc(ifc->ifc_len); um_mod_umoven((long) save,ifc->ifc_len,ifc->ifc_buf); rv=ioctl(d,request,arg); if (rv>=0) um_mod_ustoren((long) save,ifc->ifc_len,ifc->ifc_buf); free(ifc->ifc_buf); ifc->ifc_buf=save; return rv; } return ioctl(d,request,arg); } void *viewos_init(char *args) { return ht_tab_add(CHECKSOCKET,NULL,0,&s,NULL,NULL); } void viewos_fini(void *data) { struct ht_elem *proc_ht=data; ht_tab_del(proc_ht); } static void __attribute__ ((constructor)) init (void) { printk(KERN_NOTICE "sockettest init\n"); s.name="sockettest"; s.description="socket syscalls are executed server side"; s.ioctlparms=ioctlparms; s.syscall=(sysfun *)calloc(scmap_scmapsize,sizeof(sysfun)); s.socket=(sysfun *)calloc(scmap_sockmapsize,sizeof(sysfun)); SERVICESOCKET(s, socket, socket); SERVICESOCKET(s, bind, bind); SERVICESOCKET(s, connect, connect); SERVICESOCKET(s, listen, listen); SERVICESOCKET(s, accept, accept); SERVICESOCKET(s, getsockname, getsockname); SERVICESOCKET(s, getpeername, getpeername); SERVICESOCKET(s, send, send); SERVICESOCKET(s, recv, recv); SERVICESOCKET(s, sendto, sendto); SERVICESOCKET(s, recvfrom, recvfrom); SERVICESOCKET(s, shutdown, shutdown); SERVICESOCKET(s, setsockopt, setsockopt); SERVICESOCKET(s, getsockopt, getsockopt); SERVICESOCKET(s, sendmsg, sendmsg); SERVICESOCKET(s, recvmsg, recvmsg); SERVICESYSCALL(s, read, read); SERVICESYSCALL(s, write, write); SERVICESYSCALL(s, close, close); #ifdef __NR_fcntl64 SERVICESYSCALL(s, fcntl, fcntl64); #else SERVICESYSCALL(s, fcntl, fcntl); #endif SERVICESYSCALL(s, ioctl, sockioctl); s.event_subscribe=um_mod_event_subscribe; } static void __attribute__ ((destructor)) fini (void) { free(s.syscall); free(s.socket); printk(KERN_NOTICE "sockettest fini\n"); } umview-0.8.2/um_testmodule/sockip.c0000644000175000017500000001206211753517212016440 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * example of um-ViewOS module * * Copyright 2005 Renzo Davoli University of Bologna - Italy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: sockip.c 1003 2011-09-06 10:32:34Z rd235 $ * */ #include #include #include #include #include #include #include #include #include #include #include #include #include "module.h" #include "libummod.h" #include "gdebug.h" #include #include #include static struct service s; VIEWOS_SERVICE(s) static long ioctlparms(int fd, int req) { switch (req) { case FIONREAD: return sizeof(int) | IOCTL_W; case FIONBIO: return sizeof(int) | IOCTL_R; case SIOCGIFCONF: return sizeof(struct ifconf) | IOCTL_R | IOCTL_W; case SIOCGSTAMP: return sizeof(struct timeval) | IOCTL_W; case SIOCGIFTXQLEN: return sizeof(struct ifreq) | IOCTL_R | IOCTL_W; case SIOCGIFFLAGS: case SIOCGIFADDR: case SIOCGIFDSTADDR: case SIOCGIFBRDADDR: case SIOCGIFNETMASK: case SIOCGIFMETRIC: case SIOCGIFMEM: case SIOCGIFMTU: case SIOCGIFHWADDR: return sizeof(struct ifreq) | IOCTL_R | IOCTL_W; case SIOCSIFFLAGS: case SIOCSIFADDR: case SIOCSIFDSTADDR: case SIOCSIFBRDADDR: case SIOCSIFNETMASK: case SIOCSIFMETRIC: case SIOCSIFMEM: case SIOCSIFMTU: case SIOCSIFHWADDR: case SIOCGIFINDEX: return sizeof(struct ifreq) | IOCTL_R; default: return 0; } } // int read(), write(), close(); /* static int myread(int fd, char *buf, int size) { printk("READ %d %d\n ",fd,size); int rv=read(fd,buf,size); int i; for (i=0;i %d\n",domain,type,protocol,rv); return rv; } */ static int sockioctl(int d, int request, void *arg) { if (request == SIOCGIFCONF) { int rv; void *save; struct ifconf *ifc=(struct ifconf *)arg; save=ifc->ifc_buf; ioctl(d,request,arg); ifc->ifc_buf=malloc(ifc->ifc_len); um_mod_umoven((long) save,ifc->ifc_len,ifc->ifc_buf); rv=ioctl(d,request,arg); if (rv>=0) um_mod_ustoren((long) save,ifc->ifc_len,ifc->ifc_buf); free(ifc->ifc_buf); ifc->ifc_buf=save; return rv; } return ioctl(d,request,arg); } static long sock_event_subscribe(void (* cb)(), void *arg, int fd, int how) { return um_mod_event_subscribe(cb,arg,fd,how); } void *viewos_init(char *args) { int socktype=AF_INET; return ht_tab_add(CHECKSOCKET,&socktype,sizeof(int),&s,NULL,NULL); } void viewos_fini(void *data) { struct ht_elem *proc_ht=data; ht_tab_del(proc_ht); } static void __attribute__ ((constructor)) init (void) { printk(KERN_NOTICE "sockettest init\n"); s.name="sockip"; s.description="socket syscall (AF_INET) are executed server side"; s.ioctlparms=ioctlparms; s.syscall=(sysfun *)calloc(scmap_scmapsize,sizeof(sysfun)); s.socket=(sysfun *)calloc(scmap_sockmapsize,sizeof(sysfun)); SERVICESOCKET(s, socket, socket); //SERVICESOCKET(s, socket, mysocket); SERVICESOCKET(s, bind, bind); SERVICESOCKET(s, connect, connect); SERVICESOCKET(s, listen, listen); SERVICESOCKET(s, accept, accept); SERVICESOCKET(s, getsockname, getsockname); SERVICESOCKET(s, getpeername, getpeername); SERVICESOCKET(s, send, send); SERVICESOCKET(s, recv, recv); SERVICESOCKET(s, sendto, sendto); SERVICESOCKET(s, recvfrom, recvfrom); SERVICESOCKET(s, shutdown, shutdown); SERVICESOCKET(s, setsockopt, setsockopt); SERVICESOCKET(s, getsockopt, getsockopt); SERVICESOCKET(s, sendmsg, sendmsg); SERVICESOCKET(s, recvmsg, recvmsg); //SERVICESYSCALL(s, read, myread); //SERVICESYSCALL(s, write, mywrite); SERVICESYSCALL(s, read, read); SERVICESYSCALL(s, write, write); SERVICESYSCALL(s, close, close); #ifdef __NR_fcntl64 SERVICESYSCALL(s, fcntl, fcntl64); #else SERVICESYSCALL(s, fcntl, fcntl); #endif SERVICESYSCALL(s, ioctl, sockioctl); s.event_subscribe=sock_event_subscribe; } static void __attribute__ ((destructor)) fini (void) { free(s.syscall); free(s.socket); printk(KERN_NOTICE "sockettest fini\n"); } umview-0.8.2/umnet/0000755000175000017500000000000011753517351013251 5ustar renzorenzoumview-0.8.2/umnet/Makefile.in0000644000175000017500000004544411753517330015326 0ustar renzorenzo# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/modules-common.mk subdir = umnet ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moddir)" LTLIBRARIES = $(mod_LTLIBRARIES) umnet_la_LIBADD = am_umnet_la_OBJECTS = umnet_la-umnet.lo umnet_la_OBJECTS = $(am_umnet_la_OBJECTS) umnet_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(umnet_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(umnet_la_SOURCES) DIST_SOURCES = $(umnet_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB20_CFLAGS = @GLIB20_CFLAGS@ GLIB20_LIBS = @GLIB20_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = ../um_lib/libumlib.la LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DEBUGLEVEL = 3 moddir = $(pkglibdir)/modules CBASEFLAGS = CDEBUGFLAGS = -g3 -ggdb3 CPPBASEFLAGS = -I../include -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CPPDEBUGFLAGS = -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) @ENABLE_DEBUG_FALSE@CFULLFLAGS = $(CBASEFLAGS) @ENABLE_DEBUG_TRUE@CFULLFLAGS = $(CBASEFLAGS) $(CDEBUGFLAGS) @ENABLE_DEBUG_FALSE@CPPFULLFLAGS = $(CPPBASEFLAGS) @ENABLE_DEBUG_TRUE@CPPFULLFLAGS = $(CPPBASEFLAGS) $(CPPDEBUGFLAGS) AM_CFLAGS = $(CFULLFLAGS) AM_CPPFLAGS = $(CPPFULLFLAGS) AM_LDFLAGS = -module -avoid-version -export-dynamic AM_LIBTOOLFLAGS = --tag=disable-static mod_LTLIBRARIES = umnet.la #dist_man1_MANS = umnet.1viewos umnet_la_SOURCES = umnet.c umnet_la_LDFLAGS = $(AM_LDFLAGS) -lpthread umnet_la_CPPFLAGS = $(AM_CPPFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/modules-common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign umnet/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign umnet/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/modules-common.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-modLTLIBRARIES: $(mod_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(moddir)" || $(MKDIR_P) "$(DESTDIR)$(moddir)" @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moddir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moddir)"; \ } uninstall-modLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moddir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moddir)/$$f"; \ done clean-modLTLIBRARIES: -test -z "$(mod_LTLIBRARIES)" || rm -f $(mod_LTLIBRARIES) @list='$(mod_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done umnet.la: $(umnet_la_OBJECTS) $(umnet_la_DEPENDENCIES) $(EXTRA_umnet_la_DEPENDENCIES) $(umnet_la_LINK) -rpath $(moddir) $(umnet_la_OBJECTS) $(umnet_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umnet_la-umnet.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< umnet_la-umnet.lo: umnet.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umnet_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT umnet_la-umnet.lo -MD -MP -MF $(DEPDIR)/umnet_la-umnet.Tpo -c -o umnet_la-umnet.lo `test -f 'umnet.c' || echo '$(srcdir)/'`umnet.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/umnet_la-umnet.Tpo $(DEPDIR)/umnet_la-umnet.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='umnet.c' object='umnet_la-umnet.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(umnet_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o umnet_la-umnet.lo `test -f 'umnet.c' || echo '$(srcdir)/'`umnet.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(moddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-modLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-modLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-modLTLIBRARIES .MAKE: install-am install-data-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-modLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-modLTLIBRARIES install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-modLTLIBRARIES @ENABLE_DEBUG_TRUE@release: clean @ENABLE_DEBUG_TRUE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS)' @ENABLE_DEBUG_TRUE@debug: all @ENABLE_DEBUG_FALSE@release: all @ENABLE_DEBUG_FALSE@debug: clean @ENABLE_DEBUG_FALSE@ $(MAKE) CFULLFLAGS='$(CBASEFLAGS) $(CDEBUGFLAGS)' CPPFULLFLAGS='$(CPPBASEFLAGS) $(CPPDEBUGFLAGS)' install-data-hook: cd "$(DESTDIR)/$(moddir)" && rm -f $(mod_LTLIBRARIES) debug release: all # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: umview-0.8.2/umnet/Makefile.am0000644000175000017500000000032011753517212015274 0ustar renzorenzoinclude $(top_srcdir)/modules-common.mk mod_LTLIBRARIES = umnet.la #dist_man1_MANS = umnet.1viewos umnet_la_SOURCES = umnet.c umnet_la_LDFLAGS = $(AM_LDFLAGS) -lpthread umnet_la_CPPFLAGS = $(AM_CPPFLAGS) umview-0.8.2/umnet/umnet.c0000644000175000017500000004762211753517212014554 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * UMNET: (Multi) Networking in User Space * Copyright (C) 2008 Renzo Davoli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "module.h" #include "libummod.h" #include "umnet.h" #define S_IFSTACK 0160000 #define SOCK_DEFAULT 0 #define TRUE 1 #define FALSE 0 #define DEFAULT_NET_PATH "/dev/net/default" #ifndef __UMNET_DEBUG_LEVEL__ #define __UMNET_DEBUG_LEVEL__ 0 #endif #ifdef __UMNET_DEBUG__ #define PRINTDEBUG(level,args...) printdebug(level, __FILE__, __LINE__, __func__, args) #else #define PRINTDEBUG(level,args...) #endif static struct service s; VIEWOS_SERVICE(s) struct umnet { char *path; int pathlen; void *dlhandle; struct umnet_operations *netops; unsigned long flags; long mode; uid_t uid; gid_t gid; time_t mounttime; time_t sockettime; void *private_data; struct ht_elem *socket_ht; }; struct fileinfo { int nfd; struct umnet *umnet; }; #if 0 #define WORDLEN sizeof(int *) #define WORDALIGN(X) (((X) + WORDLEN) & ~(WORDLEN-1)) #define SIZEDIRENT64NONAME (sizeof(__u64)+sizeof(__s64)+sizeof(unsigned short)+sizeof(unsigned char)) #endif struct umnetdefault { int count; struct umnet *defstack[AF_MAXMAX]; }; static struct umnetdefault **defnet=NULL; /* TAG for NULLNET */ #define NULLNET ((struct umnet*)defnet) static int defnetsize=0; void *net_getdl(struct umnet *mh) { return mh->dlhandle; } static long umnet_addproc(int id, int ppid, int max) { int size=max+1; if (size > defnetsize) { struct umnetdefault **newdefnet; newdefnet = realloc(defnet,size*sizeof(struct umnetdefault *)); if (newdefnet == NULL) return -1; else { for (;defnetsizecount); defnet[id]->count++; } } return 0; } static long umnet_delproc(int id) { if (defnet[id] != NULL) { //printk("-net %d %p %d\n",id,defnet[id],defnet[id]->count); if (defnet[id]->count <= 0) free(defnet[id]); else defnet[id]->count--; defnet[id]=NULL; } return 0; } static void umnet_delallproc(void) { int i; for(i=0;i 0 && domain < AF_MAXMAX) { //printk("umnet_setdefstack %d %d %p\n",id,domain,defstack); if (defnet[id] == NULL) defnet[id] = calloc(1,sizeof (struct umnetdefault)); if (defnet[id] != NULL) { if (defnet[id]->defstack[domain-1] != defstack) { if (defnet[id]->count > 0) { struct umnetdefault *new=malloc(sizeof (struct umnetdefault)); if (new) { memcpy(new,defnet[id],sizeof (struct umnetdefault)); new->count=0; defnet[id]->count--; defnet[id]=new; } else { errno=EINVAL; return -1; } } defnet[id]->defstack[domain-1] = defstack; } return 0; } else { errno=EINVAL; return -1; } } else { errno=EINVAL; return -1; } } static struct umnet *umnet_getdefstack(int id, int domain) { if (domain > 0 && domain <= AF_MAXMAX && defnet[id] != NULL) { //printk("umnet_getdefstack %d %d\n",id,domain); //printk(" %p %p\n",defnet[id],defnet[id]->defstack[domain-1]); return defnet[id]->defstack[domain-1]; } else { struct ht_elem *hte=ht_search(CHECKPATH,DEFAULT_NET_PATH, strlen(DEFAULT_NET_PATH),&s); if (hte) return ht_get_private_data(hte); else return NULL; } } static long umnet_ctl(int type, char *sender, va_list ap) { int id, ppid, max; switch(type) { case MC_PROC | MC_ADD: id = va_arg(ap, int); ppid = va_arg(ap, int); max = va_arg(ap, int); /*printk("umnet_addproc %d %d %d\n",id,ppid,max);*/ return umnet_addproc(id, ppid, max); case MC_PROC | MC_REM: id = va_arg(ap, int); /*printk("umnet_delproc %d\n",id);*/ return umnet_delproc(id); default: return -1; } } static long umnet_ioctlparms(int fd,int req) { //printk("fd %d arg %d\n",fd,req); struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->ioctlparms) { return ft->umnet->netops->ioctlparms( ft->nfd, req, ft->umnet); } else { return 0; } } static int checksocket(int type, void *arg, int arglen, struct ht_elem *ht) { int *family=arg; struct umnet *mc=umnet_getdefstack(um_mod_getumpid(),*family); //printk("checksocket %d %d %p\n",um_mod_getumpid(),*family,mc); if (mc==NULL) { char *defnetstr=ht_get_private_data(ht); if (defnetstr) return defnetstr[*family]; else return 0; } else { return 1; } } static long umnet_msocket(char *path, int domain, int type, int protocol) { struct umnet *mh; long rv; if (path) mh = um_mod_get_private_data(); else mh = umnet_getdefstack(um_mod_getumpid(),domain); if (mh == NULL) { errno = EAFNOSUPPORT; return -1; } //printk("msocket %s %d %d %d\n",path,domain, type, protocol); if (type == SOCK_DEFAULT) { if (domain == PF_UNSPEC) { for (domain=1; domain<=AF_MAXMAX; domain++) if (!mh->netops->supported_domain || mh->netops->supported_domain(domain)) umnet_setdefstack(um_mod_getumpid(),domain,mh); return 0; } else { return umnet_setdefstack(um_mod_getumpid(),domain,mh); } } else if (mh->netops->msocket) { rv=mh->netops->msocket(domain, type, protocol, mh); if (rv >= 0) { int fd = addfiletab(sizeof(struct fileinfo)); struct fileinfo *ft=getfiletab(fd); ft->nfd = rv; ft->umnet = mh; rv=fd; mh->sockettime=time(NULL); } return rv; } else { errno = EINVAL; return -1; } } static long umnet_bind(int fd, const struct sockaddr *addr, socklen_t addrlen) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->bind) { return ft->umnet->netops->bind( ft->nfd, addr, addrlen); } else { errno = EINVAL; return -1; } } static long umnet_connect(int fd, const struct sockaddr *serv_addr, socklen_t addrlen) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->connect) { return ft->umnet->netops->connect( ft->nfd, serv_addr, addrlen); } else { errno = EINVAL; return -1; } } static long umnet_listen(int fd, int backlog) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->listen) { return ft->umnet->netops->listen( ft->nfd, backlog); } else { errno = EINVAL; return -1; } } static long umnet_accept(int fd, struct sockaddr *addr, socklen_t *addrlen) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->accept) { long rv; rv=ft->umnet->netops->accept( ft->nfd, addr, addrlen); if (rv >= 0) { int fd2 = addfiletab(sizeof(struct fileinfo)); struct fileinfo *ft2=getfiletab(fd2); ft2->nfd = rv; ft2->umnet = ft->umnet; rv=fd2; } return rv; } else { errno = EINVAL; return -1; } } static long umnet_getsockname(int fd, struct sockaddr *name, socklen_t *namelen) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->getsockname) { return ft->umnet->netops->getsockname( ft->nfd, name, namelen); } else { errno = EINVAL; return -1; } } static long umnet_getpeername(int fd, struct sockaddr *name, socklen_t *namelen) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->getpeername) { return ft->umnet->netops->getpeername( ft->nfd, name, namelen); } else { errno = EINVAL; return -1; } } static long umnet_send(int fd, const void *buf, size_t len, int flags) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->send) { return ft->umnet->netops->send( ft->nfd, buf, len, flags); } else { errno = EINVAL; return -1; } } static long umnet_recv(int fd, void *buf, size_t len, int flags) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->recv) { return ft->umnet->netops->recv( ft->nfd, buf, len, flags); } else { errno = EINVAL; return -1; } } static long umnet_sendto(int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->sendto) { return ft->umnet->netops->sendto( ft->nfd, buf, len, flags, to, tolen); } else { errno = EINVAL; return -1; } } static long umnet_recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->recvfrom) { return ft->umnet->netops->recvfrom( ft->nfd, buf, len, flags, from, fromlen); } else { errno = EINVAL; return -1; } } long umnet_sendmsg(int fd, const struct msghdr *msg, int flags) { struct fileinfo *ft=getfiletab(fd); if (ft->umnet->netops->sendmsg) return(ft->umnet->netops->sendmsg(ft->nfd,msg,flags)); else return umnet_sendto(ft->nfd,msg->msg_iov->iov_base,msg->msg_iov->iov_len,flags, msg->msg_name,msg->msg_namelen); } long umnet_recvmsg(int fd, struct msghdr *msg, int flags) { struct fileinfo *ft=getfiletab(fd); if (ft->umnet->netops->recvmsg) return(ft->umnet->netops->recvmsg(ft->nfd, msg, flags)); else { msg->msg_controllen=0; return umnet_recvfrom(ft->nfd,msg->msg_iov->iov_base,msg->msg_iov->iov_len,flags, msg->msg_name,&msg->msg_namelen); } } static long umnet_getsockopt(int fd, int level, int optname, void *optval, socklen_t *optlen) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->getsockopt) { return ft->umnet->netops->getsockopt( ft->nfd, level, optname, optval, optlen); } else { errno = EINVAL; return -1; } } static long umnet_setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->setsockopt) { return ft->umnet->netops->setsockopt( ft->nfd, level, optname, optval, optlen); } else { errno = EINVAL; return -1; } } static long umnet_read(int fd, void *buf, size_t count) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->read) { return ft->umnet->netops->read( ft->nfd, buf, count); } else { errno = EINVAL; return -1; } } static long umnet_write(int fd, const void *buf, size_t count) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->write) { return ft->umnet->netops->write( ft->nfd, buf, count); } else { errno = EINVAL; return -1; } } static long umnet_close(int fd) { long rv; struct fileinfo *ft=getfiletab(fd); if(ft->nfd>=0 && ft->umnet->netops->close) { rv=ft->umnet->netops->close( ft->nfd); if (rv >=0) { delfiletab(fd); } return rv; } else { errno = EINVAL; return -1; } } static long umnet_ioctl(int fd, int req, void *arg) { struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->ioctl) { return ft->umnet->netops->ioctl(ft->nfd, req, arg); } else { errno = EINVAL; return -1; } } static void setstat64(struct stat64 *buf64, struct umnet *um) { memset(buf64,0,sizeof(struct stat64)); buf64->st_mode=um->mode; buf64->st_uid=um->uid; buf64->st_gid=um->gid; buf64->st_mtime=buf64->st_ctime=um->mounttime; buf64->st_atime=um->sockettime; } static long umnet_lstat64(char *path, struct stat64 *buf64) { struct umnet *mh = um_mod_get_private_data(); assert(mh); //printk("stat64 %s %p\n",path,fse); setstat64(buf64,mh); return 0; } /* TODO management of fcntl */ static long umnet_fcntl64(int fd, int cmd, int arg) { //printk("umnet_fcntl64 %d %x\n",cmd,arg); struct fileinfo *ft=getfiletab(fd); if(ft->umnet->netops->fcntl) { return ft->umnet->netops->fcntl( ft->nfd, cmd, arg); } else { errno = EINVAL; return -1; } //errno=0; //return 0; } #if 0 static long umnet_fsync(int fd, int cmd, void *arg) { //printk("umnet_fsync\n"); errno=0; return 0; } #endif static long umnet_access(char *path, int mode) { struct umnet *mh = um_mod_get_private_data(); assert(mh); return 0; } static long umnet_chmod(char *path, int mode) { struct umnet *mh = um_mod_get_private_data(); mh->mode=mode; return 0; } static long umnet_lchown(char *path, uid_t owner, gid_t group) { struct umnet *mh = um_mod_get_private_data(); if (owner != -1) mh->uid=owner; if (group != -1) mh->gid=group; return 0; } static long umnet_mount(char *source, char *target, char *filesystemtype, unsigned long mountflags, void *data) { void *dlhandle = openmodule(filesystemtype, RTLD_NOW); struct umnet_operations *netops; PRINTDEBUG(10, "MOUNT %s %s %s %x %s\n",source,target,filesystemtype, mountflags, (data!=NULL)?data:""); if(dlhandle == NULL || (netops=dlsym(dlhandle,"umnet_ops")) == NULL) { printk("%s\n",dlerror()); if(dlhandle != NULL) dlclose(dlhandle); errno=ENODEV; return -1; } else { struct umnet *new = (struct umnet *) malloc(sizeof(struct umnet)); /*struct stat64 *s64;*/ assert(new); /*s64=um_mod_getpathstat();*/ /* uncomment to check something on stat data */ new->path = strdup(target); new->pathlen = strlen(target); new->dlhandle=dlhandle; new->netops=netops; new->private_data = NULL; new->mode=S_IFSTACK|0777; new->mounttime=new->sockettime=time(NULL); new->uid=0; new->gid=0; new->flags=mountflags; if (new->netops->init) new->netops->init(source,new->path,mountflags,data,new); new->socket_ht=ht_tab_add(CHECKSOCKET,NULL,0,&s,checksocket,NULL); ht_tab_pathadd(CHECKPATH,source,target,filesystemtype,mountflags,data,&s,0,NULL,new); return 0; } } static void umnet_umount_internal(struct umnet *mh, int flags) { ht_tab_invalidate(mh->socket_ht); ht_tab_invalidate(um_mod_get_hte()); if (mh->netops->fini) mh->netops->fini(mh); free(mh->path); free(mh); } static long umnet_umount2(char *target, int flags) { struct umnet *mh = um_mod_get_private_data(); if (mh == NULL) { errno=EINVAL; return -1; } else { struct ht_elem *socket_ht=mh->socket_ht; umnet_umount_internal(mh,flags); ht_tab_del(socket_ht); ht_tab_del(um_mod_get_hte()); return 0; } } static void umnet_destructor(int type,struct ht_elem *mp) { switch (type) { case CHECKPATH: um_mod_set_hte(mp); umnet_umount_internal(um_mod_get_private_data(), MNT_FORCE); } } void umnet_setprivatedata(struct umnet *nethandle, void *privatedata) { if(nethandle) nethandle->private_data=privatedata; } void *umnet_getprivatedata(struct umnet *nethandle) { if(nethandle) return nethandle->private_data; else return NULL; } static long umnet_event_subscribe(void (* cb)(), void *arg, int fd, int how) { struct fileinfo *ft=getfiletab(fd); //printk("umnet_event_subscribe %d %d\n",fd,how); if (ft->umnet->netops->event_subscribe) { return ft->umnet->netops->event_subscribe( cb, arg, ft->nfd, how); } else { errno = 1; return -1; } } #define PF_ALL PF_MAXMAX+1 #define PF_ALLIP PF_MAXMAX+2 static uint32_t hash4(char *s) { uint32_t result=0; uint32_t wrap=0; while (*s) { wrap = result >> 24; result <<= 8; result |= (*s ^ wrap); s++; } return result; } static void defnet_update (char *defnetstr, char plusminus, int family) { if (family > 0 && family < AF_MAXMAX) { switch (plusminus) { case '+' : defnetstr[family]=0; break; case '-' : defnetstr[family]=1; break; } } } void *viewos_init(char *args) { char *defnetstr = NULL; if (args && *args) { char *str, *token, *saveptr; char plusminus='-'; int i; defnetstr = calloc(1,AF_MAXMAX); if (args[0] == '+' || (args[0] == '-' && args[1] == 0)) { for (i=0; i 0 && family < AF_MAXMAX) defnet_update(defnetstr,plusminus,family); else printk("umnet: unknown protocol \"%s\"\n",token); } else printk("umnet: unknown protocol \"%s\"\n",token); break; } } } return ht_tab_add(CHECKSOCKET,NULL,0,&s,checksocket,defnetstr); } void viewos_fini(void *arg) { struct ht_elem *socket_ht=arg; struct umnetdefault *defnetstr=ht_get_private_data(socket_ht); if (defnetstr != NULL) free(defnetstr); ht_tab_invalidate(socket_ht); ht_tab_del(socket_ht); } static void __attribute__ ((constructor)) init (void) { printk(KERN_NOTICE "umnet init\n"); s.name="umnet"; s.description="virtual (multi-stack) networking"; s.destructor=umnet_destructor; s.ioctlparms=umnet_ioctlparms; s.syscall=(sysfun *)calloc(scmap_scmapsize,sizeof(sysfun)); s.socket=(sysfun *)calloc(scmap_sockmapsize,sizeof(sysfun)); s.virsc=(sysfun *)calloc(scmap_virscmapsize,sizeof(sysfun)); s.ctl = umnet_ctl; MCH_ZERO(&(s.ctlhs)); MCH_SET(MC_PROC, &(s.ctlhs)); SERVICESYSCALL(s, mount, umnet_mount); SERVICESYSCALL(s, umount2, umnet_umount2); SERVICEVIRSYSCALL(s, msocket, umnet_msocket); SERVICESOCKET(s, bind, umnet_bind); SERVICESOCKET(s, connect, umnet_connect); SERVICESOCKET(s, listen, umnet_listen); SERVICESOCKET(s, accept, umnet_accept); SERVICESOCKET(s, getsockname, umnet_getsockname); SERVICESOCKET(s, getpeername, umnet_getpeername); SERVICESOCKET(s, send, umnet_send); SERVICESOCKET(s, recv, umnet_recv); SERVICESOCKET(s, sendto, umnet_sendto); SERVICESOCKET(s, recvfrom, umnet_recvfrom); SERVICESOCKET(s, sendmsg, umnet_sendmsg); SERVICESOCKET(s, recvmsg, umnet_recvmsg); SERVICESOCKET(s, getsockopt, umnet_getsockopt); SERVICESOCKET(s, setsockopt, umnet_setsockopt); SERVICESYSCALL(s, read, umnet_read); SERVICESYSCALL(s, write, umnet_write); SERVICESYSCALL(s, close, umnet_close); SERVICESYSCALL(s, lstat64, umnet_lstat64); SERVICESYSCALL(s, fcntl, umnet_fcntl64); SERVICESYSCALL(s, access, umnet_access); SERVICESYSCALL(s, chmod, umnet_chmod); SERVICESYSCALL(s, lchown, umnet_lchown); SERVICESYSCALL(s, ioctl, umnet_ioctl); s.event_subscribe=umnet_event_subscribe; } static void __attribute__ ((destructor)) fini (void) { free(s.syscall); free(s.socket); free(s.virsc); umnet_delallproc(); printk(KERN_NOTICE "umnet fini\n"); } umview-0.8.2/um_rsc/0000755000175000017500000000000011753517351013411 5ustar renzorenzoumview-0.8.2/um_rsc/module/0000755000175000017500000000000011753517351014676 5ustar renzorenzoumview-0.8.2/um_rsc/module/utils.c0000644000175000017500000000735211753517212016205 0ustar renzorenzo/* * This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * utils.c: utility functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include "gdebug.h" #include "utils.h" int write_n_bytes(int fd, void *buffer, int nbytes) { int n, nwritten; char *buf = buffer; int total_bytes = nbytes; assert(fd >= 0); /* assert(buf != NULL); */ /* If the buffer is null, I return nbytes. * In this way, if the caller has made a mistake passing me a empty buffer, * It doesn't recevie an error. */ if(buf == NULL) return nbytes; assert(nbytes >= 0); nwritten = 0; while(nbytes > 0) { n = write(fd, buf, nbytes); if( (n == -1) || (n == 0) ) { if(n == -1) { GERROR("write error: '%s'", strerror(errno)); } break; } /* assert(n > 0); */ nwritten += n; nbytes -= n; buf += n; } GDEBUG(1, "[fd = %d; buf = %p (len = %d bytes)] written %d/%d bytes.", fd, buffer, total_bytes, nwritten, total_bytes); return nwritten; } int read_n_bytes(int fd, void *buffer, int nbytes) { int n, nread; void *buf = buffer; int total_bytes = nbytes; assert(fd >= 0); assert(buf != NULL); assert(nbytes >= 0); nread = 0; while(nbytes > 0) { n = read(fd, buf, nbytes); if( (n == -1) || (n == 0) ) { if(n == -1) { GERROR("read error: '%s'", strerror(errno)); } if(n == 0 || (n == -1 && errno != EINTR)) { break; } n = 0; /* break; */ } /* assert(n > 0); */ nread += n; nbytes -= n; buf += n; } GDEBUG(1, "[fd = %d; buf = %p (len = %d bytes)] read %d/%d bytes.", fd, buffer, total_bytes, nread, total_bytes); return nread; } int rwv_n_bytes(rwv_fun fun, int fd, struct iovec *vector, size_t count, int nbytes) { int i, n, nrw; struct iovec *v, *v_orig; int original_count = count; int total_bytes; assert(fd >= 0); assert(vector != NULL); assert(count > 0); /* I copy the vector, because I've to work on it */ v = calloc(count, sizeof(struct iovec)); assert(v != NULL); v_orig = v; int total = 0; for(i = 0; i < count; i ++) { v[i].iov_base = vector[i].iov_base; v[i].iov_len = vector[i].iov_len; total += v[i].iov_len; } total_bytes = nbytes; nrw = 0; while(nbytes > 0) { n = fun(fd, v, count); if( (n == -1) || (n == 0) ) { if(n == -1) { GERROR("function error: '%s'", strerror(errno)); } if(n == 0 || (n == -1 && errno != EINTR)) { break; } n = 0; } nrw += n; nbytes -= n; /* I've read/write all */ if(nrw == total_bytes) break; for(i = 0; i < count; i++) { if(v[i].iov_len <= n) n -= v[i].iov_len; else break; } v[i].iov_base = v[i].iov_base + n; v[i].iov_len -= n; v += i; count -= i; } GDEBUG(1, "[fd = %d; vector = %p; count = %d] read/write %d/%d bytes.", fd, vector, original_count, nrw, total_bytes); free(v_orig); return nrw; } umview-0.8.2/um_rsc/module/utils.h0000644000175000017500000000266111753517212016210 0ustar renzorenzo/* * This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * utils.h: utility functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __UTILS_HEADER__ #define __UTILS_HEADER__ #include int write_n_bytes(int fd, void *buffer, int nbytes); int read_n_bytes(int fd, void *buffer, int nbytes); typedef int (*rwv_fun )(int filedes, const struct iovec *vector, size_t count); int rwv_n_bytes(rwv_fun fun, int fd, struct iovec *vector, size_t count, int nbytes); #define readv_n_bytes(fd, vector, count, nbytes) rwv_n_bytes((rwv_fun)readv, fd, vector, count, nbytes) #define writev_n_bytes(fd, vector, count, nbytes) rwv_n_bytes((rwv_fun)writev, fd, vector, count, nbytes) #endif /* __UTILS_HEADER__ */ umview-0.8.2/um_rsc/module/parse_args.c0000644000175000017500000001134411753517212017167 0ustar renzorenzo/* * This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * parse_args.c: parse module arguments functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include "parse_args.h" #include "gdebug.h" /* Local Functions */ enum err_return_value { OPT_ERR_OK = 0, OPT_ERR_ARG_ZERO_LENGTH, OPT_ERR_ARG_NEEDED, OPT_ERR_ARG_POINTLESS, OPT_ERR_OPT_NOT_FOUND, OPT_ERR_LAST = OPT_ERR_OPT_NOT_FOUND }; static char *err2str[] = { NULL, "the argument has zero length", "the option needs an argument", "the option doesn't need an argument", "option not found" }; /* The function parse the single option, saving it value, if present, in ->var. * On success return 0, otherwise an error OPT_ERR_* defined in the header. */ static int rsc_parse_single_opt(char *str, int len, struct rsc_option opt[], int opt_len) { int i; char *c; char *name = str; int name_len = 0; char *arg = NULL; if ( (c = strchr(str, '=')) != NULL ) { /* "str" contains an option with '=' */ name_len = len - strlen(c); arg = c + 1; } else { /* "str" contains an option without arguments */ name_len = len; arg = NULL; } GDEBUG(2, "rsc_parse_opt: Name = '%s', name len = %d, arg = '%s'\n", name, name_len, arg); /* Now I have to search the right option */ for(i = 0; i < opt_len; i++) { if(strncmp(name, opt[i].name, name_len) == 0) { /* Found the option */ GDEBUG(2, "rsc_parse_opt: Option '%s' found in '%s'\n", opt[i].name, name); /* This option need an argument but there isn't */ if( opt[i].has_arg == 1 && arg == NULL ) return OPT_ERR_ARG_NEEDED; /* This option doesn't need an argument but there is */ if( opt[i].has_arg == 0 && arg != NULL ) return OPT_ERR_ARG_POINTLESS; /* Parse the argument, if there is */ if (opt[i].has_arg == 1 ) { int arg_len = strlen(arg); /* If the argument has zero length, return */ if(arg_len == 0) return OPT_ERR_ARG_ZERO_LENGTH; /* The '+1' in the length of the string in malloc() or bxzero() is ofr * the final '\0'. */ *(opt[i].var) = (char *) malloc( ( arg_len + 1) * sizeof(char) ); bzero(*(opt[i].var), arg_len + 1); strncpy(*(opt[i].var), arg, arg_len); } else { *(opt[i].var) = OPT_PRESENT; } GDEBUG(2, "rsc_parse_opt: Option name = '%s', option argument = '%s' (len = %d, addr = %p)\n", opt[i].name, *(opt[i].var), strlen(*(opt[i].var)), opt[i].var); /* I found the option, I can exit. */ break; } } /* No option foun with name 'name' */ if ( i == opt_len ) return OPT_ERR_OPT_NOT_FOUND; return OPT_ERR_OK; } /* Global Functions */ /* Parse all the arguments in "init_args". * If there is an error a number != 0 is returned.*/ int rsc_parse_opt(char *init_args, struct rsc_option opt[], int opt_len) { int len_str, i, ret; int first; char *str; len_str = strlen(init_args); GDEBUG(2, "rsc_parse_opt: Initargs: \"%s\" (len = %d), opt_len = %d\n", init_args, len_str, opt_len); /* If there is no arguments (len_str == 0), I return */ if(len_str == 0) return OPT_ERR_OK; /* I split the string into the different options, ten I parse * each option. */ for(first = i = 0; i < len_str; i++) { if( (init_args[i] == ',') || (i == len_str - 1) ) { /* End of an option OR last option. I parse it */ int len = (i == len_str - 1 ) ? (i - first + 1) : (i - first); int dim = len * sizeof(char) + 1; /* I create a string of the single option ... */ str = (char *) malloc( dim ); bzero(str, dim); strncpy(str, init_args + first, len); /* ... and I parse it. */ ret = rsc_parse_single_opt(str, len, opt, opt_len); free(str); /* If an error occurs, return */ if( ret != 0) return ret; first = i + 1; } } return OPT_ERR_OK; } char *rsc_parse_to_string(int err) { if( err >= OPT_ERR_OK && err <= OPT_ERR_LAST ) return err2str[err]; else return NULL; } umview-0.8.2/um_rsc/module/um_rsc.c0000644000175000017500000002421411753517212016331 0ustar renzorenzo/* * This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * um_rsc.c: UMView Remote System Call module * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include #include "gdebug.h" #include "module.h" #include "parse_args.h" #include "utils.h" #include "rsc_client.h" #include "handshake.h" #define SERVER_ADDR "127.0.0.1" #define SERVER_PORT "8050" #define SERVER_PORT_EVENT_SUB "8051" static struct service s; static int event_sub_fd; static struct reg_cbs *reg_cbs; static int create_fd(char *server_name, char *port_number) { struct addrinfo hint, *res; int fd, ret; GDEBUG(1, "Server name = %s, port number = %s\n", server_name, port_number); /* I get the info about "server_name" */ bzero(&hint, sizeof(hint)); hint.ai_socktype = SOCK_STREAM; if( (ret = getaddrinfo(server_name, port_number, &hint, &res)) != 0) { GERROR("Getaddrinfo() error: %s\n", gai_strerror(ret)); return -1; } /* I connect the client */ if( (fd = socket(res->ai_family, res->ai_socktype, 0)) == -1 ) { GERROR("Socket() error: %s\n", strerror(errno)); return -1; } if( connect(fd, res->ai_addr, res->ai_addrlen) != 0 ) { GERROR("Connect() error: %s\n", strerror(errno)); return -1; } #ifdef GDEBUG_ENABLED { char str_addr[INET6_ADDRSTRLEN]; void *src; int port; if(res->ai_family == AF_INET) { src = &( (struct sockaddr_in *)(res->ai_addr) )->sin_addr; port = ( (struct sockaddr_in *)(res->ai_addr) )->sin_port; } else { src = &( (struct sockaddr_in6 *)(res->ai_addr) )->sin6_addr; port = ( (struct sockaddr_in6 *)(res->ai_addr) )->sin6_port; } GDEBUG(1, "Connected to < %s, %d >", inet_ntop(res->ai_family, src, str_addr, INET6_ADDRSTRLEN), ntohs(port)); } #endif freeaddrinfo(res); return fd; } static int init_client(char *server_name, char *port_number, char *event_sub_port_number) { int fd, nwrite, nread; struct handshake req, resp; enum arch my_arch, server_arch; /* I'm connecting to server */ fd = create_fd(server_name, port_number); if(fd == -1) { GERROR("I cannot connect to the server\n"); return -1; } /* I'm connecting to server's event subscribe port */ event_sub_fd = create_fd(server_name, event_sub_port_number); if(event_sub_fd == -1) { GERROR("I cannot connect to the event subscribe service\n"); return -1; } /* I get my architecture and I send it to the server */ if((my_arch = aconv_get_host_arch()) == ACONV_ARCH_ERROR) { GERROR("I cannot get my architecture\n"); return -1; } GDEBUG(1, "My architecture is %s (%d)\n", aconv_arch2str(my_arch), my_arch); req.arch = htonl(my_arch); GDEBUG(1, "req.arch = %d\n", req.arch); nwrite = write_n_bytes(fd, &req, sizeof(req)); if(nwrite != sizeof(req)) { GERROR("I cannot send my architecture to the server.\n"); return -1; } nread = read_n_bytes(fd, &resp, sizeof(resp)); if(nread != sizeof(resp)) { GERROR("I cannot read the server architecture.\n"); return -1; } server_arch = ntohl(resp.arch); GDEBUG(1, "Server architecture is %s\n", aconv_arch2str(server_arch)); if(rscc_init(fd, event_sub_fd, ®_cbs, my_arch, server_arch) == -1) { GERROR("I cannot initialize the RSC module.\n"); return -1; } return fd; } static epoch_t rsc_checkfun(int type, void *arg) { if( type == CHECKSOCKET) { return 1; } else if(type == CHECKPATH) { char *path = arg; /* I don't manage the /lib /usr/lib directories, in this way the program use the shared * library of the UMView host. I don't manage the /bin and /usr/bin directories * in this way I can execute local program and not remote ones. */ /* printf("path = '%s' is for us? %d\n", path, (strncmp(path, "/lib", 4) != 0 && strncmp(path, "/bin", 4) != 0)); */ return (strncmp(path, "/lib", 4) != 0 && strncmp(path, "/bin", 4) != 0); } else if(type == CHECKIOCTLPARMS) { return rscc_check_ioctl_request(((struct ioctl_len_req *)arg)->req); } else { /* GDEBUG(1, "rsc_path: it's not for us!\n"); */ return 0; } } static long rsc_event_subscribe(void (* cb)(), void *arg, int fd, int how) { int ret; ret = rscc_es_send_req(reg_cbs, event_sub_fd, fd, how, cb, arg); if(ret == -1) { GDEBUG(1, "Error adding fd = %d; how = %d; cb = %p; arg = %p\n", fd, how, cb, arg); return -1; } GDEBUG(1, "rsc_event_subscribe: added fd = %d, how = %d, cb = %p, arg = %p\n", fd, how, cb, arg); return ret; } void _um_mod_init(char *initargs) { char *server_addr; char *server_port; char *event_sub_server_port; int opt_len; int ret; struct rsc_option opt[] = { {"sa", 1, &server_addr}, {"sp", 1, &server_port}, {"essp", 1, &event_sub_server_port} }; /* Parsing of the initialization arguments */ server_addr = SERVER_ADDR; server_port = SERVER_PORT; event_sub_server_port = SERVER_PORT_EVENT_SUB; opt_len = sizeof(opt) / sizeof(struct rsc_option); if( (ret = rsc_parse_opt(initargs, opt, opt_len)) != 0 ) { /* Some problems occurred during the parsing of the init args */ GERROR("Bad initialization arguments: %s\n", rsc_parse_to_string(ret)); return; } /* Connection to the server */ if( init_client(server_addr, server_port, event_sub_server_port) < 0) { GERROR("Connect_to_server() error\n"); return; } /* If the control reaches here, the connection was successful and * I can start to fill the struct service. */ s.name = "Remote System Call"; s.code = 0xF9; s.checkfun = rsc_checkfun; s.event_subscribe = rsc_event_subscribe; s.syscall = (sysfun *) calloc(scmap_scmapsize, sizeof(sysfun)); s.socket = (sysfun *) calloc(scmap_sockmapsize, sizeof(sysfun)); SERVICESYSCALL(s, fcntl, rscc_fcntl); SERVICESYSCALL(s, fcntl64, rscc_fcntl); SERVICESYSCALL(s, ioctl, rscc_ioctl); SERVICESYSCALL(s, access, rscc_access); SERVICESYSCALL(s, adjtimex, rscc_adjtimex); SERVICESYSCALL(s, chdir, rscc_chdir); SERVICESYSCALL(s, chmod, rscc_chmod); SERVICESYSCALL(s, chown, rscc_chown); SERVICESYSCALL(s, clock_getres, rscc_clock_getres); SERVICESYSCALL(s, clock_gettime, rscc_clock_gettime); SERVICESYSCALL(s, clock_settime, rscc_clock_settime); SERVICESYSCALL(s, close, rscc_close); SERVICESYSCALL(s, dup, rscc_dup); SERVICESYSCALL(s, dup2, rscc_dup2); SERVICESYSCALL(s, fchdir, rscc_fchdir); SERVICESYSCALL(s, fchmod, rscc_fchmod); SERVICESYSCALL(s, fchown, rscc_fchown); SERVICESYSCALL(s, fdatasync, rscc_fdatasync); SERVICESYSCALL(s, fgetxattr, rscc_fgetxattr); SERVICESYSCALL(s, fsync, rscc_fsync); SERVICESYSCALL(s, getdents64, rscc_getdents64); SERVICESYSCALL(s, gettimeofday, rscc_gettimeofday); SERVICESYSCALL(s, getxattr, rscc_getxattr); SERVICESYSCALL(s, lchown, rscc_lchown); SERVICESYSCALL(s, lgetxattr, rscc_lgetxattr); SERVICESYSCALL(s, link, rscc_link); SERVICESYSCALL(s, lseek, rscc_lseek); SERVICESYSCALL(s, lstat64, rscc_lstat64); SERVICESYSCALL(s, mkdir, rscc_mkdir); SERVICESYSCALL(s, mount, rscc_mount); SERVICESYSCALL(s, open, rscc_open); SERVICESYSCALL(s, pread64, rscc_pread64); SERVICESYSCALL(s, pwrite64, rscc_pwrite64); SERVICESYSCALL(s, read, rscc_read); SERVICESYSCALL(s, readlink, rscc_readlink); SERVICESYSCALL(s, rename, rscc_rename); SERVICESYSCALL(s, rmdir, rscc_rmdir); SERVICESYSCALL(s, setdomainname, rscc_setdomainname); SERVICESYSCALL(s, sethostname, rscc_sethostname); SERVICESYSCALL(s, settimeofday, rscc_settimeofday); SERVICESYSCALL(s, stat64, rscc_stat64); SERVICESYSCALL(s, symlink, rscc_symlink); SERVICESYSCALL(s, umount2, rscc_umount2); SERVICESYSCALL(s, uname, rscc_uname); SERVICESYSCALL(s, unlink, rscc_unlink); SERVICESYSCALL(s, utime, rscc_utime); SERVICESYSCALL(s, utimes, rscc_utimes); SERVICESYSCALL(s, write, rscc_write); SERVICESOCKET(s, accept, rscc_accept); SERVICESOCKET(s, bind, rscc_bind); SERVICESOCKET(s, connect, rscc_connect); SERVICESOCKET(s, getpeername, rscc_getpeername); SERVICESOCKET(s, getsockname, rscc_getsockname); SERVICESOCKET(s, getsockopt, rscc_getsockopt); SERVICESOCKET(s, listen, rscc_listen); SERVICESOCKET(s, recvfrom, rscc_recvfrom); SERVICESOCKET(s, sendto, rscc_sendto); SERVICESOCKET(s, setsockopt, rscc_setsockopt); SERVICESOCKET(s, shutdown, rscc_shutdown); SERVICESOCKET(s, socket, rscc_socket); #if defined __x86_64__ #elif defined __powerpc__ #else SERVICESYSCALL(s, chown32, rscc_chown32); SERVICESYSCALL(s, lchown32, rscc_lchown32); SERVICESYSCALL(s, fchown32, rscc_fchown32); #endif #if defined __x86_64__ SERVICESYSCALL(s, fstat, rscc_fstat64); SERVICESYSCALL(s, fstatfs, rscc_fstatfs64); SERVICESYSCALL(s, ftruncate, rscc_ftruncate64); SERVICESYSCALL(s, truncate, rscc_truncate64); SERVICESYSCALL(s, statfs, rscc_statfs64); #else SERVICESYSCALL(s, statfs64, rscc_statfs64); SERVICESYSCALL(s, fstat64, rscc_fstat64); SERVICESYSCALL(s, fstatfs64, rscc_fstatfs64); SERVICESYSCALL(s, ftruncate64, rscc_ftruncate64); SERVICESYSCALL(s, truncate64, rscc_truncate64); SERVICESYSCALL(s, _llseek, rscc__llseek); SERVICESOCKET(s, recv, rscc_recv); SERVICESOCKET(s, send, rscc_send); #endif add_service(&s); } static void __attribute__ ((constructor)) init (void) { GDEBUG(1, "RSC Init\n"); } static void __attribute__ ((destructor)) fini (void) { GDEBUG(1, "RSC Fini\n"); } umview-0.8.2/um_rsc/module/handshake.h0000644000175000017500000000203511753517212016771 0ustar renzorenzo/* * This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * handshake.h: client and server handshake message format * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __HANDSHAKE_HEADER__ #define __HANDSHAKE_HEADER__ #include "aconv.h" struct handshake { enum arch arch; }; #endif /* __HANDSHAKE_HEADER__ */ umview-0.8.2/um_rsc/module/parse_args.h0000644000175000017500000000320411753517212017170 0ustar renzorenzo/* * This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * parse_args.h: parse module arguments functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __PARSE_ARG_HEADDER__ #define __PARSE_ARG_HEADDER__ #define OPT_PRESENT "1" struct rsc_option { char *name; /* The name of the option */ int has_arg; /* It's equal to 1 if the option as an argument, 0 otherwise */ char **var; /* If ->as_arg it's equal to 1, the variable store the value of the argument. Otherwise if ->as_arg it's equal to 0, ->var it's equal to the string OPT_PRESENT if the option it's present in the list of option to parse, otherwsie it's left unchanged. */ }; /* Return value */ char *rsc_parse_to_string(int err); int rsc_parse_opt(char *init_args, struct rsc_option opt[], int opt_len); #endif /* __PARSE_ARG_HEADDER__ */ umview-0.8.2/um_rsc/module/Makefile0000644000175000017500000000325111753517212016333 0ustar renzorenzo# # This is part of um-ViewOS # The user-mode implementation of OSVIEW -- A Process with a View # # Makefile: UMView RSC module makefile # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # CC = gcc RELEASE = true DEBUGLEVEL = 2 C_DEBUG_FLAGS = -O0 -g -ggdb -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) C_BASE_FLAGS = -fPIC -Wall -I ../librsc/include/ -I ../../include/ CFLAGS = $(C_BASE_FLAGS) RSC_LIB = ../librsc/librsc.a sources = parse_args.c um_rsc.c utils.c um_rsc_so_prereq = $(sources:.c=.o) ${RSC_LIB} .PHONY: all clean um_rsc.so ifeq ($(RELEASE), true) CFLAGS += -O3 all: um_rsc.so else CFLAGS += -O0 $(C_DEBUG_FLAGS) all: um_rsc.so clean_lib: make -C ../librsc/ clean .PHNOY: tags tags: ctags-exuberant -R ../../ endif um_rsc.so: $(um_rsc_so_prereq) $(CC) -shared -o $@ $^ ${RSC_LIB}: make -C ../librsc/ all %.d: %.c set -e; $(CC) -MM $(CFLAGS) $< \ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ [ -s $@ ] || rm -f $@ include $(sources:.c=.d) clean: rm -fr um_rsc.so $(sources:.c=.o) $(sources:.c=.d) tags umview-0.8.2/um_rsc/server/0000755000175000017500000000000011753517351014717 5ustar renzorenzoumview-0.8.2/um_rsc/server/pollfd_info.h0000644000175000017500000000503711753517212017364 0ustar renzorenzo/* * This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * pollfd_info.h: Data structure used to trace server's clients * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __POLLFD_INFO_HEADER__ #define __POLLFD_INFO_HEADER__ #include #include "aconv.h" enum client_state { WAITING_ARCH = 1, SENDING_ARCH, CONN_READING_HDR, CONN_READING_BODY, CONN_SENDING_RESP }; enum client_type { REQ_RESP = 1, EVENT_SUB, SUBSCRIBED_FD }; struct buffer { struct msg *first; struct msg *last; }; struct msg { void *data; /* the pointer to data */ unsigned int n; /* number of byte of data into the buffer */ unsigned int tot; /* total number of bytes to read/write */ struct msg *next; }; struct client { int fd; enum arch arch; enum client_type type; enum client_state state; struct buffer *rbuf; /* reading buffer */ struct buffer *wbuf; /* writing buffer */ int esfd_index; }; #define POLLFD_INITIAL_SIZE 10 struct pollfd_info { struct pollfd *pollfd; /* The number of used entries into 'pollfd' and 'clients' */ int nfds; /* The size of 'pollfd' and 'clients'*/ int size; /* The i-th file descriptor in 'pollfd' belongs to the i-th client * in 'clients' */ struct client **clients; }; struct pollfd_info *pollfd_init(); void pollfd_add(struct pollfd_info *p, int fd, short events, struct client *c); void pollfd_del(struct pollfd_info *p, int i); void pollfd_compact(struct pollfd_info *p); struct msg *buff_enq(struct buffer *b, void *data, int tot); void *buff_deq(struct buffer *b); struct client *create_client(int fd, enum client_type type, enum client_state state); #ifdef GDEBUG_ENABLED # define PRINT_POLLFDINFO(p) print_pollfd_info(p) void print_pollfd_info(struct pollfd_info *p); #else # define PRINT_POLLFDINFO(p) #endif #endif /* __POLLFD_INFO_HEADER__ */ umview-0.8.2/um_rsc/server/handshake.h0000644000175000017500000000203511753517212017012 0ustar renzorenzo/* * This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * handshake.h: client and server handshake message format * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __HANDSHAKE_HEADER__ #define __HANDSHAKE_HEADER__ #include "aconv.h" struct handshake { enum arch arch; }; #endif /* __HANDSHAKE_HEADER__ */ umview-0.8.2/um_rsc/server/pollfd_info.c0000644000175000017500000001665611753517212017370 0ustar renzorenzo/* * This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * pollfd_info.c: Data structure used to trace server's clients * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include "pollfd_info.h" #include "aconv.h" /**************************************************************/ /* Client elements */ /**************************************************************/ #ifdef GDEBUG_ENABLED static char *client_state_str[] = { "waiting architecture", "sending architecture", "connected: reading header", "connected: reading body", "connected: sending response", "connected: sending ack" }; static char *client_type_str[] = { "request response", "event subscribe", "registered fd" }; #endif struct msg *buff_enq(struct buffer *b, void *data, int tot) { struct msg *m; m = calloc(1, sizeof(struct msg)); if(m == NULL) return m; m->data = data; m->tot = tot; if(b->first == NULL) b->first = b->last = m; else { b->last->next = m; b->last = m; } return m; } /* Free the first buffer in 'bs' and returns its data */ void *buff_deq(struct buffer *b) { void *data; struct msg *m; if(b->first == NULL) return NULL; data = b->first->data; /* Is las element? */ m = b->first; if(b->first->next == NULL) { b->first = b->last = NULL; } else { b->first = b->first->next; } free(m); return data; } static void free_msg(struct msg *m) { free(m->data); free(m); } /* Free client c and all the messages into the 2 buffers */ static void free_client(struct client *c){ struct msg *m, *next; if(c->rbuf != NULL) { m = c->rbuf->first; while(m) { next = m->next; free_msg(m); m = next; } } if(c->wbuf != NULL) { m = c->wbuf->first; while(m) { next = m->next; free_msg(m); m = next; } } free(c->rbuf); free(c->wbuf); free(c); } struct client *create_client(int fd, enum client_type type, enum client_state state) { struct client *client; client = calloc (1, sizeof(struct client)); if(client == NULL) return NULL; client->rbuf = calloc(1, sizeof(struct buffer)); client->wbuf = calloc(1, sizeof(struct buffer)); if(client->rbuf == NULL) { free(client); return NULL; } if(client->wbuf == NULL) { free(client->rbuf); free(client); return NULL; } client->fd = fd; client->type = type; client->arch = ACONV_ARCH_ERROR; client->state = state; return client; } /**************************************************************/ /* Pollfd management */ /**************************************************************/ static void init_empty_entry(struct pollfd_info *p, int i) { p->pollfd[i].fd = -1; p->pollfd[i].events = 0; p->pollfd[i].revents = 0; p->clients[i] = NULL; } struct pollfd_info *pollfd_init() { int i; struct pollfd_info *p; p = calloc(1, sizeof(struct pollfd_info)); if(p == NULL) return NULL; p->pollfd = calloc(POLLFD_INITIAL_SIZE, sizeof(struct pollfd)); if(p->pollfd == NULL) { free(p); return NULL; } p->clients = calloc(POLLFD_INITIAL_SIZE, sizeof(struct client *)); if(p->pollfd == NULL) { free(p->pollfd); free(p); return NULL; } p->nfds = 0; p->size = POLLFD_INITIAL_SIZE; for(i = 0; i < p->size; i++) { init_empty_entry(p, i); } return p; } void pollfd_add(struct pollfd_info *p, int fd, short events, struct client *c) { int empty_i = -1; /* I have to enlarge the array */ if(p->nfds >= p->size) { int i; p->size += POLLFD_INITIAL_SIZE; p->pollfd = realloc(p->pollfd, p->size * sizeof(struct pollfd)); p->clients = realloc(p->clients, p->size * sizeof(struct client *)); assert(p->pollfd != NULL && p->clients != NULL); /* I init the new entries created */ for(i = p->nfds; i < p->size; i++) { init_empty_entry(p, i); } empty_i = p->nfds; } else { int i; for(i = 0; i < p->size; i++) if(p->pollfd[i].fd == -1) { empty_i = i; break; } } p->pollfd[empty_i].fd = fd; p->pollfd[empty_i].events = events; p->pollfd[empty_i].revents = 0; p->clients[empty_i] = c; p->nfds += 1; } void pollfd_del(struct pollfd_info *p, int i) { if(i < 0 || i >= p->size) return; free_client(p->clients[i]); init_empty_entry(p, i); p->nfds -= 1; } void pollfd_compact(struct pollfd_info *p) { int i, j; for(i = 0, j = 0; i < p->size; i++) { if(p->pollfd[i].fd == -1) { continue; } else { if(j < i) { p->pollfd[j] = p->pollfd[i]; p->clients[j] = p->clients[i]; init_empty_entry(p, i); } j++; } } } #ifdef GDEBUG_ENABLED static char *client_state_2_str(enum client_state state) { return client_state_str[state - 1]; } static char *client_type_2_str(enum client_type type) { return client_type_str[type - 1]; } static void print_buffer(struct buffer *b, char *name) { struct msg *m; fprintf(stderr, "\t\t%s (first = %p; last = %p):\n", name, b->first, b->last); m = b->first; while(m) { fprintf(stderr, "\t\t\t- (%p): data = %p (%d/%d bytes), next = %p\n", m, m->data, m->n, m->tot, m->next); m = m->next; } } static void print_client(struct client *client) { if(client == NULL) fprintf(stderr, "NO_CLIENT"); else { fprintf(stderr, "(%p): ", client); switch(client->type) { case REQ_RESP: fprintf(stderr, "FD = '%d'; TYPE = '%s'; ARCH = '%s'; STATE = '%s'\n", client->fd, client_type_2_str(client->type), aconv_arch2str(client->arch), client_state_2_str(client->state)); print_buffer(client->rbuf, "Read buffer"); print_buffer(client->wbuf, "Write buffer"); break; case EVENT_SUB: fprintf(stderr, "FD = '%d'; TYPE = '%s'; STATE = '%s''\n", client->fd, client_type_2_str(client->type), client_state_2_str(client->state)); print_buffer(client->rbuf, "Read buffer"); print_buffer(client->wbuf, "Write buffer"); break; default: fprintf(stderr, "DATA_FD = '%d'; TYPE = '%s'; EVENT SUB FD INDEX = %d", client->fd, client_type_2_str(client->type), client->esfd_index); break; } } } void print_pollfd_info(struct pollfd_info *p) { int i; fprintf(stderr, "Pollfd info: nfds = %d, size = %d:\n", p->nfds, p->size); for(i = 0; i < p->size; i++) { fprintf(stderr, "\t%d", i); if(p->pollfd[i].fd != -1) fprintf(stderr, ". (FD = %.2d, E = %hX): ", p->pollfd[i].fd, p->pollfd[i].events); else fprintf(stderr, ". "); print_client(p->clients[i]); fprintf(stderr, "\n"); } } #endif umview-0.8.2/um_rsc/server/Makefile0000644000175000017500000000325011753517212016353 0ustar renzorenzo# # This is part of um-ViewOS # The user-mode implementation of OSVIEW -- A Process with a View # # Makefile: UMView RSC server makefile # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # CC = gcc RELEASE = true DEBUGLEVEL = 2 C_DEBUG_FLAGS = -O0 -g -ggdb -DGDEBUG_ENABLED -DGDEBUG_LEVEL=$(DEBUGLEVEL) C_BASE_FLAGS = -O0 -g -ggdb -Wall -I ../librsc/include/ -I ../../include/ -I ../../ CFLAGS = $(C_BASE_FLAGS) RSC_LIB = ../librsc/librsc.a sources = rsc_server.c gdebug.c pollfd_info.c .PHONY: all clean rsc_server ifeq ($(RELEASE), true) CFLAGS += -O3 all: rsc_server else CFLAGS += -O0 $(C_DEBUG_FLAGS) all: rsc_server clean_lib: make -C ../librsc/ clean .PHNOY: tags tags: ctags-exuberant -R ../../ endif rsc_server: $(sources:.c=.o) ${RSC_LIB} $(CC) -o $@ $^ -ldl -lpthread ${RSC_LIB}: make -C ../librsc/ %.d: %.c set -e; $(CC) -MM $(CFLAGS) $< \ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ [ -s $@ ] || rm -f $@ include $(sources:.c=.d) clean: rm -fr *.so rsc_server $(sources:.c=.o) $(sources:.c=.d) tags umview-0.8.2/um_rsc/server/gdebug.c0000644000175000017500000001206411753517212016317 0ustar renzorenzo/* This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * gdebug.c: debugging functions * * Copyright 2005 Ludovico Gardenghi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * $Id: gdebug.c 358 2007-06-05 10:38:02Z gendag $ * */ #include #include #include #include #include #include #include #include #include //#include "defs.h" #include "gdebug.h" #ifdef MULTI_THREAD #include #endif FILE *gdebug_ofile = NULL; #define BACKTRACE_INITIAL_SIZE 10 static void *libc_handle; static int (*libc_fprintf)(FILE *stream, const char *format, ...); static int (*libc_vfprintf)(FILE *stream, const char *format, va_list ap); static FILE *(*libc_fopen)(const char *path, const char *mode); static int (*libc_getpid)(void); static void **backtrace_array = NULL; static int backtrace_array_size = 0; void gdebug_set_ofile(char* new_ofile) { gdebug_ofile = libc_fopen(new_ofile, "w"); if (!gdebug_ofile) libc_fprintf(stderr, "gdebug: can't open log file %s: %s. Using stderr.\n", new_ofile, strerror(errno)); } void fgdebug(FILE *ofile, int gdebug_level, int level, const char *file, const int line, const char *func, const char *fmt, ...) { va_list ap; if (gdebug_level >= level) { va_start(ap, fmt); #ifdef _PTHREAD_H libc_fprintf(ofile, "[%d:%lu] %s:%d %s(): ", libc_getpid(), pthread_self(), file, line, func); #else libc_fprintf(ofile, "[%d] %s:%d %s(): ", libc_getpid(), file, line, func); #endif libc_vfprintf(ofile, fmt, ap); libc_fprintf(ofile, "\n"); va_end(ap); } } void fgmsg(FILE *ofile, const char *fmt, ...) { va_list ap; va_start(ap, fmt); libc_vfprintf(ofile, fmt, ap); libc_fprintf(ofile, "\n"); va_end(ap); } void fghexdump(FILE *ofile, int gdebug_level, int level, const char *file, const int line, const char *func, char* text, int len) { int i; if (gdebug_level >= level) { #ifdef _PTHREAD_H libc_fprintf(ofile, "[%d:%lu] %s:%d %s(): [%d] ", libc_getpid(), pthread_self(), file, line, func, len); #else libc_fprintf(ofile, "[%d] %s:%d %s(): [%d] ", libc_getpid(), file, line, func, len); #endif for (i = 0; i < len; i++) { if ((i != 0) && ((i % 4) == 0)) libc_fprintf(ofile, " "); libc_fprintf(ofile, "%02x", (unsigned char)text[i]); } libc_fprintf(ofile, "\n"); } } void fgbacktrace(FILE *ofile, int gdebug_level, int level, const char *file, const int line, const char *func, int maxdepth) { int i; int btdepth; char **btstrings; /* The first entry is always ignored (it's the call to fgbacktrace), the * user wants maxdepth entries so we must add 1 */ maxdepth++; if (gdebug_level >= level) { if (maxdepth > backtrace_array_size) { backtrace_array_size = maxdepth; backtrace_array = realloc(backtrace_array, sizeof(void*) * backtrace_array_size); } btdepth = backtrace(backtrace_array, maxdepth); btstrings = backtrace_symbols(backtrace_array, btdepth); if (!btstrings) { fgdebug(ofile, gdebug_level, level, file, line, func, "can't obtain backtrace"); return; } /* 1 and not 0 (0 is fgbacktrace and it's not interesting) */ for (i = 1; i < btdepth; i++) fgdebug(ofile, gdebug_level, level, file, line, func, "BT: #%d %s", i-1, btstrings[i]); } } static void __attribute__ ((constructor)) init() { libc_handle = dlopen("libc.so.6", RTLD_LAZY); if (!libc_handle) { fprintf(stderr, "dlopen: %s", dlerror()); fprintf(stderr, "dlopen in gdebug failed, reverting to original fprintf/vfprintf/fopen\n"); libc_fprintf = fprintf; libc_vfprintf = vfprintf; libc_fopen = fopen; libc_getpid = getpid; } else { libc_fprintf = dlsym(libc_handle, "fprintf"); libc_vfprintf = dlsym(libc_handle, "vfprintf"); libc_fopen = dlsym(libc_handle, "fopen"); libc_getpid = dlsym(libc_handle,"getpid"); if (!libc_fprintf || !libc_vfprintf || !libc_fopen || !libc_getpid) { fprintf(stderr, "dlsym: %s", dlerror()); fprintf(stderr, "dlsym in gdebug failed, reverting to original fprintf/vfprintf/fopen\n"); libc_fprintf = fprintf; libc_vfprintf = vfprintf; libc_fopen = fopen; libc_getpid = getpid; } } backtrace_array = malloc(sizeof(void*) * BACKTRACE_INITIAL_SIZE); backtrace_array_size = BACKTRACE_INITIAL_SIZE; } static void __attribute__ ((destructor)) fini() { dlclose(libc_handle); if (backtrace_array) free(backtrace_array); backtrace_array = NULL; backtrace_array_size = 0; } umview-0.8.2/um_rsc/server/rsc_server.c0000644000175000017500000007163711753517212017252 0ustar renzorenzo/* * This is part of um-ViewOS * The user-mode implementation of OSVIEW -- A Process with a View * * rsc_server.c: UMView Remote System Call module's server * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #define __USE_LARGEFILE64 #include #include #include #include #include #include #include #include #include #include #include "gdebug.h" #include "rsc_server.h" #include "handshake.h" #include "pollfd_info.h" /* For ioctl requests */ #include #include #include #include #include #include #include /**********************/ /*####################################################################*/ /*# Constants #*/ /*####################################################################*/ #define SERVER_ADDR "0.0.0.0" #define SERVER_PORT "8050" #define SERVER_PORT_EVENT_SUB "8051" #define MAX_CONNECTIONS 5 /*####################################################################*/ /*# Global Variables #*/ /*####################################################################*/ static enum arch my_arch; static struct pollfd_info *pfdinfo; /*####################################################################*/ /*# Local Functions #*/ /*####################################################################*/ /*******************/ /* Other Functions */ /*******************/ static void print_addr_port(int fd) { struct sockaddr_in info4; struct sockaddr_in6 info6; struct sockaddr *info; void *addr; u_int16_t *port; u_int16_t family; socklen_t info_len; char str_addr[INET6_ADDRSTRLEN]; /* I get the family (AF_INET, AF_INET6, ...) of the socket */ info = malloc(sizeof(struct sockaddr)); info_len = sizeof(struct sockaddr); if( getsockname(fd, info, &info_len) != 0 ) fprintf(stderr, "getsockname() error: %s\n", strerror(errno)); family = info->sa_family; free(info); /* Now that I have the family, I set the fields for * the query based on the family type */ if(family == AF_INET) { bzero(&info4, sizeof(info4)); info_len = sizeof(info4); info = (struct sockaddr *)(&info4); addr = &(info4.sin_addr); port = &(info4.sin_port); } else if(family == AF_INET6) { bzero(&info6, sizeof(info6)); info_len = sizeof(info6); info = (struct sockaddr *)(&info6); addr = &(info6.sin6_addr); port = &(info6.sin6_port); } else { /* If the family isn't AF_INET or AF_INET6 I clear the variables, * in this way the functions that will use them, will genereate * an error*/ info_len = 0; info = addr = port = NULL; } /* I get the info ...*/ if( getsockname(fd, info, &info_len) != 0 ) fprintf(stderr, "getsockname() error: %s\n", strerror(errno)); /* ... and I print them. */ if( inet_ntop(family, addr, str_addr, INET6_ADDRSTRLEN ) == NULL ) fprintf(stderr, "inet_ntop() error: %s\n", strerror(errno)); GDEBUG(1, "<%s, %d>", str_addr, ntohs(*port)); } static int create_listening_fd(char *server_addr, char *server_port) { struct addrinfo hint, *res; int fd, ret, on; bzero(&hint, sizeof(hint)); hint.ai_socktype = SOCK_STREAM; if( (ret = getaddrinfo(server_addr, server_port, &hint, &res)) != 0) { fprintf(stderr, "I cannot getaddrinfo(): %s\n", gai_strerror(ret)); return -1; } /* Creation of the listening socket */ if ((fd = socket(res->ai_family, res->ai_socktype, 0)) == -1 ) { fprintf(stderr, "I cannot create the listen socket: %s\n", strerror(errno)); return -1; } /* Setting the "reuse address" option */ on = 1; setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); /* Binding */ if (bind(fd, res->ai_addr, res->ai_addrlen) != 0 ) { fprintf(stderr, "I cannot bind the listen socket: %s\n", strerror(errno)); return -1; } /* Listening */ if(listen(fd, MAX_CONNECTIONS) == -1) { fprintf(stderr, "I cannot accept the connections: %s\n", strerror(errno)); return -1; } GDEBUG(1, "Server listening on "); print_addr_port(fd); GDEBUG(1, " (fd = %d).\n", fd); freeaddrinfo(res); return fd; } static void init_ioctl_register_request(void) { /* asm/sockios.h */ rscs_ioctl_register_request(FIOSETOWN, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(SIOCSPGRP, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(FIOGETOWN, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(SIOCGPGRP, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(SIOCATMARK, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(SIOCGSTAMP, IOCTL_W, sizeof(struct timeval)); /* asm/termios.h */ /* asm/ioctls.h */ /* linux/serial.h */ rscs_ioctl_register_request(TCGETS, IOCTL_W, sizeof(struct termios)); rscs_ioctl_register_request(TCSETS, IOCTL_R, sizeof(const struct termios)); rscs_ioctl_register_request(TCSETSW, IOCTL_R, sizeof(const struct termios)); rscs_ioctl_register_request(TCSETSF, IOCTL_R, sizeof(const struct termios)); rscs_ioctl_register_request(TCGETA, IOCTL_W, sizeof(struct termio)); rscs_ioctl_register_request(TCSETA, IOCTL_R, sizeof(const struct termio)); rscs_ioctl_register_request(TCSETAW, IOCTL_R, sizeof(const struct termio)); rscs_ioctl_register_request(TCSETAF, IOCTL_R, sizeof(const struct termio)); rscs_ioctl_register_request(TCSBRK, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TCXONC, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TCFLSH, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TIOCSCTTY, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TIOCGPGRP, IOCTL_W, sizeof(pid_t)); rscs_ioctl_register_request(TIOCSPGRP, IOCTL_R, sizeof(const pid_t)); rscs_ioctl_register_request(TIOCOUTQ, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TIOCSTI, IOCTL_R, sizeof(const char)); rscs_ioctl_register_request(TIOCGWINSZ, IOCTL_W, sizeof(struct winsize)); rscs_ioctl_register_request(TIOCSWINSZ, IOCTL_R, sizeof(const struct winsize)); rscs_ioctl_register_request(TIOCMGET, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TIOCMBIS, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(TIOCMBIC, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(TIOCMSET, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(TIOCGSOFTCAR, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TIOCSSOFTCAR, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(FIONREAD, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TIOCINQ, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TIOCGSERIAL, IOCTL_W, sizeof(struct serial_struct)); rscs_ioctl_register_request(TIOCSSERIAL, IOCTL_R, sizeof(const struct serial_struct)); rscs_ioctl_register_request(TIOCPKT, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(FIONBIO, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(TIOCSETD, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(TIOCGETD, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TCSBRKP, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(FIOASYNC, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(TIOCSERGWILD, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TIOCSERSWILD, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(TIOCGLCKTRMIOS, IOCTL_W, sizeof(struct termios)); rscs_ioctl_register_request(TIOCSLCKTRMIOS, IOCTL_R, sizeof(const struct termios)); rscs_ioctl_register_request(TIOCSERGETLSR, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(TIOCSERGETMULTI, IOCTL_W, sizeof(struct serial_multiport_struct)); rscs_ioctl_register_request(TIOCSERSETMULTI, IOCTL_R, sizeof(const struct serial_multiport_struct)); /* linux/fd.h */ rscs_ioctl_register_request(FDSETPRM, IOCTL_R, sizeof(const struct floppy_struct)); rscs_ioctl_register_request(FDDEFPRM, IOCTL_R, sizeof(const struct floppy_struct)); rscs_ioctl_register_request(FDGETPRM, IOCTL_W, sizeof(struct floppy_struct)); rscs_ioctl_register_request(FDFMTTRK, IOCTL_R, sizeof(const struct format_descr)); rscs_ioctl_register_request(FDSETEMSGTRESH, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(FDSETMAXERRS, IOCTL_R, sizeof(const struct floppy_max_errors)); rscs_ioctl_register_request(FDGETMAXERRS, IOCTL_W, sizeof(struct floppy_max_errors)); rscs_ioctl_register_request(FDGETDRVTYP, IOCTL_W, 16); rscs_ioctl_register_request(FDSETDRVPRM, IOCTL_R, sizeof(const struct floppy_drive_params)); rscs_ioctl_register_request(FDGETDRVPRM, IOCTL_W, sizeof(struct floppy_drive_params)); rscs_ioctl_register_request(FDGETDRVSTAT, IOCTL_W, sizeof(struct floppy_drive_struct)); rscs_ioctl_register_request(FDPOLLDRVSTAT, IOCTL_W, sizeof(struct floppy_drive_struct)); rscs_ioctl_register_request(FDRESET, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(FDGETFDCSTAT, IOCTL_W, sizeof(struct floppy_fdc_state)); rscs_ioctl_register_request(FDWERRORGET, IOCTL_W, sizeof(struct floppy_write_errors)); /* linux/fs.h */ rscs_ioctl_register_request(BLKROSET, IOCTL_R, sizeof(const int)); rscs_ioctl_register_request(BLKROGET, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(BLKGETSIZE, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(BLKRASET, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(BLKRAGET, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(FIBMAP, IOCTL_RW, sizeof(int)); rscs_ioctl_register_request(FIGETBSZ, IOCTL_W, sizeof(int)); /* linux/hdreg.h */ rscs_ioctl_register_request(HDIO_GETGEO, IOCTL_W, sizeof(struct hd_geometry)); rscs_ioctl_register_request(HDIO_GET_UNMASKINTR, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(HDIO_GET_MULTCOUNT, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(HDIO_GET_IDENTITY, IOCTL_W, sizeof(struct hd_driveid)); rscs_ioctl_register_request(HDIO_GET_KEEPSETTINGS, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(HDIO_GET_NOWERR, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(HDIO_GET_DMA, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(HDIO_DRIVE_CMD, IOCTL_RW, sizeof(int)); rscs_ioctl_register_request(HDIO_SET_MULTCOUNT, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(HDIO_SET_UNMASKINTR, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(HDIO_SET_KEEPSETTINGS, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(HDIO_SET_NOWERR, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(HDIO_SET_DMA, IOCTL_W, sizeof(int)); } static int set_non_blocking(int fd) { int flags; if((flags = fcntl(fd, F_GETFL)) == -1) return 0; flags |= O_NONBLOCK; if((flags = fcntl(fd, F_SETFL, flags)) == -1) return 0; return 1; } static int init(char *server_addr, char *server_port, char *event_sub_server_port, int *listen_fd, int *event_sub_fd) { int ret; *listen_fd = create_listening_fd(server_addr, server_port); if(*listen_fd == -1) { fprintf(stderr, "I cannot create the listening socket\n"); return -1; } if(set_non_blocking(*listen_fd) == 0) return -1; *event_sub_fd = create_listening_fd(server_addr, event_sub_server_port); if(*event_sub_fd == -1) { fprintf(stderr, "I cannot create the event subscribe listening socket\n"); return -1; } if(set_non_blocking(*event_sub_fd) == 0) return -1; /* I get my architecture */ if( (my_arch = aconv_get_host_arch()) == ACONV_ARCH_ERROR ) { fprintf(stderr, "I cannot get my architecture\n"); return -1; } /* I init the librsc module */ ret = rscs_init(my_arch); if(ret == -1) { fprintf(stderr, "I cannot initialize the RSC module\n"); return -1; } GDEBUG(1, "My architecture is %s\n", aconv_arch2str(my_arch)); /* I set the list of ioctl request I support AFTER the initialization * of the rsc_module (otherwise segfault)*/ init_ioctl_register_request(); /* I Init the pollfd structure */ if((pfdinfo = pollfd_init()) == NULL) { fprintf(stderr, "I cannot init the pollfd structure\n"); return -1; } return 0; } /* Close the connection of the i-th fd */ static void close_connection(struct pollfd_info *p, int i) { GDEBUG(1, "Connection closed: fd = %d", p->pollfd[i].fd); close(p->pollfd[i].fd); pollfd_del(p, i); /* compact pfdinfo */ PRINT_POLLFDINFO(p); } static void main_loop(int listen_fd, int event_sub_fd) { int i, nready; int new_fd; int deleted_entry; struct sockaddr_in client_addr; socklen_t client_len; pollfd_add(pfdinfo, listen_fd, POLLIN, NULL); pollfd_add(pfdinfo, event_sub_fd, POLLIN, NULL); /* Main loop */ while(1) { deleted_entry = 0; GDEBUG(1, "Before poll():"); PRINT_POLLFDINFO(pfdinfo); /* Poll */ nready = poll(pfdinfo->pollfd, pfdinfo->nfds, -1); /* There is an error? */ if(nready == -1) { fprintf(stderr, "poll() error: %s; I continue.\n", strerror(errno)); continue; } for(i = 0; i < pfdinfo->nfds; i++) { if(pfdinfo->pollfd[i].revents == 0) continue; GDEBUG(1, "fd = %d is ready for event 0x%X\n", pfdinfo->pollfd[i].fd, pfdinfo->pollfd[i].revents); /* If there is an error, I close the connection */ if( pfdinfo->pollfd[i].revents & POLLERR || pfdinfo->pollfd[i].revents & POLLHUP || pfdinfo->pollfd[i].revents & POLLNVAL) { /* printf("Error, getchar():\n"); getchar(); */ close_connection(pfdinfo, i); deleted_entry = 1; if(--nready < 0) break; continue; } /*********************************************/ /* New Connection/Event Subscribe management */ /*********************************************/ if((pfdinfo->pollfd[i].fd == listen_fd || pfdinfo->pollfd[i].fd == event_sub_fd) && pfdinfo->pollfd[i].revents & POLLIN) { enum client_type type; int size; enum client_state state; if(pfdinfo->pollfd[i].fd == listen_fd) { type = REQ_RESP; size = sizeof(struct handshake); state = WAITING_ARCH; } else { type = EVENT_SUB; size = sizeof(struct rsc_es_hdr); state = CONN_READING_HDR; } bzero(&client_addr, sizeof(client_addr)); client_len = sizeof(client_addr); /* I accept the new connection */ new_fd = accept(pfdinfo->pollfd[i].fd, (struct sockaddr *)&client_addr, &client_len); if(new_fd == -1) { fprintf(stderr, "Accept() error: %s\n", strerror(errno)); } else { /* I create the new client structure */ struct client *new_client; void *data; new_client = create_client(new_fd, type, state); data = malloc(sizeof(struct handshake)); if(data == NULL) { close(new_fd); if(--nready < 0) break; continue; } if(new_client == NULL || data == NULL) { fprintf(stderr, "I cannot create a new client struct for fd %d\n", new_fd); if(new_client == NULL) free(new_client); if(data == NULL); free(data); close(new_fd); } else { buff_enq(new_client->rbuf, data, size); GDEBUG(1, "Accepting new connection from "); print_addr_port(new_client->fd); GDEBUG(1, " (fd = %d).\n", new_client->fd); pollfd_add(pfdinfo, new_client->fd, POLLIN, new_client); } } if(--nready <= 0) break; /*************************************************************************/ /* Management of descriptors ready to read of type REQ_RESP or EVENT_SUB */ /*************************************************************************/ } else if(pfdinfo->clients[i]->type == REQ_RESP || pfdinfo->clients[i]->type == EVENT_SUB) { struct client *client = pfdinfo->clients[i]; /***********************************************/ /* POLLIN */ /***********************************************/ if(pfdinfo->pollfd[i].revents & POLLIN) { void *buf; int size, nread; /* If there are data to read, but the read buffer is empty * I create a new message */ if(client->rbuf->first == NULL) { int size = 0; void *data; if(pfdinfo->clients[i]->type == REQ_RESP && pfdinfo->clients[i]->state == CONN_READING_HDR) size = sizeof(struct req_header); else if(pfdinfo->clients[i]->type == EVENT_SUB && pfdinfo->clients[i]->state == CONN_READING_HDR) size = sizeof(struct rsc_es_hdr); if(size != 0) { data = malloc(size); if(data == NULL) { close_connection(pfdinfo, i); deleted_entry = 1; if(--nready < 0) break; continue; } buff_enq(client->rbuf, data, size); } } GDEBUG(1, "There are data ready do be read for fd %d", pfdinfo->pollfd[i].fd); /* I read the data from the first message */ buf = client->rbuf->first->data + client->rbuf->first->n; size = client->rbuf->first->tot - client->rbuf->first->n; nread = read(client->fd, buf, size); if(nread <= 0 ) { /* If there is an error or the connection was close, * I close the connection from my side */ close_connection(pfdinfo, i); deleted_entry = 1; if(--nready <= 0) break; continue; } else { client->rbuf->first->n += nread; } /* If I've read all the data, I remove the buffer from client->rbuf * and I process the data */ if(client->rbuf->first->n == client->rbuf->first->tot) { void *read_data = buff_deq(client->rbuf); if(pfdinfo->clients[i]->type == REQ_RESP) { if(client->state == WAITING_ARCH) { /* I read the architecture of the client */ struct handshake *client_arch, *server_arch; client_arch = (struct handshake *)read_data; client->arch = ntohl(client_arch->arch); GDEBUG(1, "Client (%d) architecture is %s\n", client->fd, aconv_arch2str(client->arch)); free(read_data); /* Now I can send my architecture */ client->state = SENDING_ARCH; server_arch = calloc(1, sizeof(struct handshake)); if(server_arch == NULL) { close_connection(pfdinfo, i); deleted_entry = 1; if(--nready < 0) break; continue; } server_arch->arch = htonl(my_arch); buff_enq(client->wbuf, server_arch, sizeof(struct handshake)); pfdinfo->pollfd[i].events |= POLLOUT; client->state = SENDING_ARCH; }else if(client->state == CONN_READING_HDR) { struct req_header *req_hd; struct msg *m; int req_size; void *new_data; /* I've read all the request header, now I've to read all the request body */ client->state = CONN_READING_BODY; req_hd = (struct req_header *)read_data; req_size = rsc_req_msg_size(req_hd); new_data = realloc(read_data, req_size); if(new_data == NULL) { close_connection(pfdinfo, i); deleted_entry = 1; if(--nready < 0) break; continue; } m = buff_enq(client->rbuf, new_data, req_size); /* I've already read the req_header, so I need to update m->n field */ m->n = sizeof(struct req_header); }else if(client->state == CONN_READING_BODY) { /* Now I've read all the request and I can pass it to RSC function */ struct iovec *resp; resp = rscs_manage_request(client->arch, read_data); /* If there is an error, I close the connection */ if(resp == NULL) { close_connection(pfdinfo, i); deleted_entry = 1; if(--nready < 0) break; continue; } buff_enq(client->wbuf, resp[0].iov_base, resp[0].iov_len); pfdinfo->pollfd[i].events |= POLLOUT; client->state = CONN_SENDING_RESP; free(read_data); } } else { /* type == EVENT_SUB */ if(client->state == CONN_READING_HDR) { struct rsc_es_hdr *hdr; int size; void *new_data; struct msg *m; hdr = (struct rsc_es_hdr *)read_data; size = rsc_es_msg_size(hdr->type); if(size == -1) { close_connection(pfdinfo, i); deleted_entry = 1; if(--nready < 0) break; continue; } new_data = realloc(read_data, size); if(new_data == NULL) { close_connection(pfdinfo, i); deleted_entry = 1; if(--nready < 0) break; continue; } m = buff_enq(client->rbuf, new_data, size); m->n = sizeof(struct rsc_es_hdr); client->state = CONN_READING_BODY; } else if(client->state == CONN_READING_BODY) { struct rsc_es_ack *ack; ack = rscs_es_manage_msg(client->fd, read_data); free(read_data); /* I take the appropriate action based on ack->response field. * If the response is ACK_FD_REG I've to insert the fd into the * pollfd set. If the response is ACK_FD_DEREG_NOT_READY or ACK_FD_READY, * I remove the fd from the pollfd. */ if(ack->response == ACK_FD_REG) { struct client *c; /* Into the client structure I insert the stream fd and not the * fd to subscribe, In this way I can know where to send data */ c = create_client(client->fd, SUBSCRIBED_FD, CONN_SENDING_RESP); if(c == NULL) { close_connection(pfdinfo, i); deleted_entry = 1; if(--nready < 0) break; continue; } c->esfd_index = i; pollfd_add(pfdinfo, ntohl(ack->fd), ntohl(ack->how), c); } else if(ack->response == ACK_FD_DEREG_NOT_READY || ack->response == ACK_FD_DEREG_READY) { int j; for(j = 0; j < pfdinfo->size; j++) if( pfdinfo->pollfd[j].fd != -1 && pfdinfo->clients[j] != NULL && pfdinfo->clients[j]->type == SUBSCRIBED_FD && pfdinfo->clients[j]->fd == client->fd && pfdinfo->pollfd[j].fd == ntohl(ack->fd) && pfdinfo->pollfd[j].events == ntohl(ack->how)) break; if(j < pfdinfo->size) pollfd_del(pfdinfo, j); } GDEBUG(1, "After rscem_manage_msg:"); PRINT_POLLFDINFO(pfdinfo); /* Now I can send ack back */ buff_enq(client->wbuf, ack, sizeof(struct rsc_es_ack)); pfdinfo->pollfd[i].events |= POLLOUT; /* It's not an error, I don't need to keep trace of the sending state */ client->state = CONN_READING_HDR; } } } /***********************************************/ /* POLLOUT */ /***********************************************/ } else if(pfdinfo->pollfd[i].revents & POLLOUT) { void *buf; int size, nwrite; /* If write buffer is empty, I remove the POLLOUT event and I continue */ if(client->wbuf->first == NULL) { pfdinfo->pollfd[i].events &= (~POLLOUT); if(--nready <= 0) break; continue; } GDEBUG(1, "There are data ready do be written for fd %d", pfdinfo->pollfd[i].fd); buf = client->wbuf->first->data + client->wbuf->first->n; size = client->wbuf->first->tot - client->wbuf->first->n; nwrite = write(client->fd, buf, size); if(nwrite < 0) { close_connection(pfdinfo, i); deleted_entry = 1; if(--nready < 0) break; continue; } else { client->wbuf->first->n += nwrite; } if(client->wbuf->first->n == client->wbuf->first->tot) { /* I remove the message from the buffer and I free it */ void *data = buff_deq(client->wbuf); free(data); /* If it's a request/response fd and I've sent an arch or response message, * I change my state to reading header */ if( pfdinfo->clients[i]->type == REQ_RESP && ( client->state == SENDING_ARCH || client->state == CONN_SENDING_RESP) ) client->state = CONN_READING_HDR; /* if client->type is EVENT_SUB there is nothing to do: I need only * to continue to send the buffered data */ } } if(--nready <= 0) break; /*******************************************/ /* An event subscribed fd is waken up */ /*******************************************/ /* The event is occurred, I send back a response I didn't it before */ }else if(pfdinfo->clients[i]->type == SUBSCRIBED_FD) { struct rsc_es_resp *resp; int esfd_index = pfdinfo->clients[i]->esfd_index; resp = rscs_es_event_occurred(pfdinfo->pollfd[esfd_index].fd, pfdinfo->pollfd[i].fd, pfdinfo->pollfd[i].revents); if(resp != NULL) { buff_enq(pfdinfo->clients[esfd_index]->wbuf, resp, sizeof(struct rsc_es_resp)); pfdinfo->pollfd[esfd_index].events |= POLLOUT; } if(--nready <= 0) break; } } /* for(i = 0; i < nready; i++) */ /* If I've deleted a pfdinfo, I compact it */ if(deleted_entry) pollfd_compact(pfdinfo); } /* while(1) */ } static void usage(char *s, int exit_code) { fprintf(stderr, "Usage: %s [OPTIONS]\n" "OPTIONS are:\n" "\t-h, --help print this help message.\n" "\t-a ADDRESS, --address ADDRESS bind the server to ADDRESS.\n" "\t-p PORT, --port PORT set the port for syscall execution.\n" "\t-e PORT, --es_port PORT set the port for event subscription.\n", basename(s)); exit(exit_code); } /*####################################################################*/ /*# Main Function #*/ /*####################################################################*/ int main (int argc, char *argv[]) { int listen_fd, event_sub_fd; int c; char *server_addr, *server_port, *event_sub_server_port; /* I parse the command-line arguments */ server_addr = SERVER_ADDR; server_port = SERVER_PORT; event_sub_server_port = SERVER_PORT_EVENT_SUB; while(1) { int option_index = 0; static struct option long_option[] = { {"address", 1, NULL, 'a'}, {"port", 1, NULL, 'p'}, {"es_port", 1, NULL, 'e'}, {"help", 0, NULL, 'h'} }; c = getopt_long(argc, argv, "a:p:e:h", long_option, &option_index); if(c == -1) break; switch(c) { case 'h': usage(argv[0], 0); break; case 'a': server_addr = optarg; break; case 'p': server_port= optarg; break; case 'e': event_sub_server_port = optarg; break; default: usage(argv[0], -1); break; } } GDEBUG(1, "Server : <%s, %s>\n", server_addr, server_port); /* I initialize the server */ if(init(server_addr, server_port, event_sub_server_port, &listen_fd, &event_sub_fd) < 0) { fprintf(stderr, "Error during the initialization of the server.\n"); exit(-1); } /* Main loop */ main_loop(listen_fd, event_sub_fd); return 0; } /**/ umview-0.8.2/um_rsc/librsc_templates/0000755000175000017500000000000011753517351016745 5ustar renzorenzoumview-0.8.2/um_rsc/librsc_templates/input/0000755000175000017500000000000011753517351020104 5ustar renzorenzoumview-0.8.2/um_rsc/librsc_templates/input/unistd_files/0000755000175000017500000000000011753517351022574 5ustar renzorenzoumview-0.8.2/um_rsc/librsc_templates/input/unistd_files/unistd_x86.h0000644000175000017500000003063011753517212024756 0ustar renzorenzo#ifndef _ASM_I386_UNISTD_H_ #define _ASM_I386_UNISTD_H_ /* * This file contains the system call numbers. */ #define __NR_restart_syscall 0 #define __NR_exit 1 #define __NR_fork 2 #define __NR_read 3 #define __NR_write 4 #define __NR_open 5 #define __NR_close 6 #define __NR_waitpid 7 #define __NR_creat 8 #define __NR_link 9 #define __NR_unlink 10 #define __NR_execve 11 #define __NR_chdir 12 #define __NR_time 13 #define __NR_mknod 14 #define __NR_chmod 15 #define __NR_lchown 16 #define __NR_break 17 #define __NR_oldstat 18 #define __NR_lseek 19 #define __NR_getpid 20 #define __NR_mount 21 #define __NR_umount 22 #define __NR_setuid 23 #define __NR_getuid 24 #define __NR_stime 25 #define __NR_ptrace 26 #define __NR_alarm 27 #define __NR_oldfstat 28 #define __NR_pause 29 #define __NR_utime 30 #define __NR_stty 31 #define __NR_gtty 32 #define __NR_access 33 #define __NR_nice 34 #define __NR_ftime 35 #define __NR_sync 36 #define __NR_kill 37 #define __NR_rename 38 #define __NR_mkdir 39 #define __NR_rmdir 40 #define __NR_dup 41 #define __NR_pipe 42 #define __NR_times 43 #define __NR_prof 44 #define __NR_brk 45 #define __NR_setgid 46 #define __NR_getgid 47 #define __NR_signal 48 #define __NR_geteuid 49 #define __NR_getegid 50 #define __NR_acct 51 #define __NR_umount2 52 #define __NR_lock 53 #define __NR_ioctl 54 #define __NR_fcntl 55 #define __NR_mpx 56 #define __NR_setpgid 57 #define __NR_ulimit 58 #define __NR_oldolduname 59 #define __NR_umask 60 #define __NR_chroot 61 #define __NR_ustat 62 #define __NR_dup2 63 #define __NR_getppid 64 #define __NR_getpgrp 65 #define __NR_setsid 66 #define __NR_sigaction 67 #define __NR_sgetmask 68 #define __NR_ssetmask 69 #define __NR_setreuid 70 #define __NR_setregid 71 #define __NR_sigsuspend 72 #define __NR_sigpending 73 #define __NR_sethostname 74 #define __NR_setrlimit 75 #define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ #define __NR_getrusage 77 #define __NR_gettimeofday 78 #define __NR_settimeofday 79 #define __NR_getgroups 80 #define __NR_setgroups 81 #define __NR_select 82 #define __NR_symlink 83 #define __NR_oldlstat 84 #define __NR_readlink 85 #define __NR_uselib 86 #define __NR_swapon 87 #define __NR_reboot 88 #define __NR_readdir 89 #define __NR_mmap 90 #define __NR_munmap 91 #define __NR_truncate 92 #define __NR_ftruncate 93 #define __NR_fchmod 94 #define __NR_fchown 95 #define __NR_getpriority 96 #define __NR_setpriority 97 #define __NR_profil 98 #define __NR_statfs 99 #define __NR_fstatfs 100 #define __NR_ioperm 101 #define __NR_socketcall 102 #define __NR_syslog 103 #define __NR_setitimer 104 #define __NR_getitimer 105 #define __NR_stat 106 #define __NR_lstat 107 #define __NR_fstat 108 #define __NR_olduname 109 #define __NR_iopl 110 #define __NR_vhangup 111 #define __NR_idle 112 #define __NR_vm86old 113 #define __NR_wait4 114 #define __NR_swapoff 115 #define __NR_sysinfo 116 #define __NR_ipc 117 #define __NR_fsync 118 #define __NR_sigreturn 119 #define __NR_clone 120 #define __NR_setdomainname 121 #define __NR_uname 122 #define __NR_modify_ldt 123 #define __NR_adjtimex 124 #define __NR_mprotect 125 #define __NR_sigprocmask 126 #define __NR_create_module 127 #define __NR_init_module 128 #define __NR_delete_module 129 #define __NR_get_kernel_syms 130 #define __NR_quotactl 131 #define __NR_getpgid 132 #define __NR_fchdir 133 #define __NR_bdflush 134 #define __NR_sysfs 135 #define __NR_personality 136 #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ #define __NR_setfsuid 138 #define __NR_setfsgid 139 #define __NR__llseek 140 #define __NR_getdents 141 #define __NR__newselect 142 #define __NR_flock 143 #define __NR_msync 144 #define __NR_readv 145 #define __NR_writev 146 #define __NR_getsid 147 #define __NR_fdatasync 148 #define __NR__sysctl 149 #define __NR_mlock 150 #define __NR_munlock 151 #define __NR_mlockall 152 #define __NR_munlockall 153 #define __NR_sched_setparam 154 #define __NR_sched_getparam 155 #define __NR_sched_setscheduler 156 #define __NR_sched_getscheduler 157 #define __NR_sched_yield 158 #define __NR_sched_get_priority_max 159 #define __NR_sched_get_priority_min 160 #define __NR_sched_rr_get_interval 161 #define __NR_nanosleep 162 #define __NR_mremap 163 #define __NR_setresuid 164 #define __NR_getresuid 165 #define __NR_vm86 166 #define __NR_query_module 167 #define __NR_poll 168 #define __NR_nfsservctl 169 #define __NR_setresgid 170 #define __NR_getresgid 171 #define __NR_prctl 172 #define __NR_rt_sigreturn 173 #define __NR_rt_sigaction 174 #define __NR_rt_sigprocmask 175 #define __NR_rt_sigpending 176 #define __NR_rt_sigtimedwait 177 #define __NR_rt_sigqueueinfo 178 #define __NR_rt_sigsuspend 179 #define __NR_pread64 180 #define __NR_pwrite64 181 #define __NR_chown 182 #define __NR_getcwd 183 #define __NR_capget 184 #define __NR_capset 185 #define __NR_sigaltstack 186 #define __NR_sendfile 187 #define __NR_getpmsg 188 /* some people actually want streams */ #define __NR_putpmsg 189 /* some people actually want streams */ #define __NR_vfork 190 #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ #define __NR_mmap2 192 #define __NR_truncate64 193 #define __NR_ftruncate64 194 #define __NR_stat64 195 #define __NR_lstat64 196 #define __NR_fstat64 197 #define __NR_lchown32 198 #define __NR_getuid32 199 #define __NR_getgid32 200 #define __NR_geteuid32 201 #define __NR_getegid32 202 #define __NR_setreuid32 203 #define __NR_setregid32 204 #define __NR_getgroups32 205 #define __NR_setgroups32 206 #define __NR_fchown32 207 #define __NR_setresuid32 208 #define __NR_getresuid32 209 #define __NR_setresgid32 210 #define __NR_getresgid32 211 #define __NR_chown32 212 #define __NR_setuid32 213 #define __NR_setgid32 214 #define __NR_setfsuid32 215 #define __NR_setfsgid32 216 #define __NR_pivot_root 217 #define __NR_mincore 218 #define __NR_madvise 219 #define __NR_madvise1 219 /* delete when C lib stub is removed */ #define __NR_getdents64 220 #define __NR_fcntl64 221 /* 223 is unused */ #define __NR_gettid 224 #define __NR_readahead 225 #define __NR_setxattr 226 #define __NR_lsetxattr 227 #define __NR_fsetxattr 228 #define __NR_getxattr 229 #define __NR_lgetxattr 230 #define __NR_fgetxattr 231 #define __NR_listxattr 232 #define __NR_llistxattr 233 #define __NR_flistxattr 234 #define __NR_removexattr 235 #define __NR_lremovexattr 236 #define __NR_fremovexattr 237 #define __NR_tkill 238 #define __NR_sendfile64 239 #define __NR_futex 240 #define __NR_sched_setaffinity 241 #define __NR_sched_getaffinity 242 #define __NR_set_thread_area 243 #define __NR_get_thread_area 244 #define __NR_io_setup 245 #define __NR_io_destroy 246 #define __NR_io_getevents 247 #define __NR_io_submit 248 #define __NR_io_cancel 249 #define __NR_fadvise64 250 #define __NR_exit_group 252 #define __NR_lookup_dcookie 253 #define __NR_epoll_create 254 #define __NR_epoll_ctl 255 #define __NR_epoll_wait 256 #define __NR_remap_file_pages 257 #define __NR_set_tid_address 258 #define __NR_timer_create 259 #define __NR_timer_settime (__NR_timer_create+1) #define __NR_timer_gettime (__NR_timer_create+2) #define __NR_timer_getoverrun (__NR_timer_create+3) #define __NR_timer_delete (__NR_timer_create+4) #define __NR_clock_settime (__NR_timer_create+5) #define __NR_clock_gettime (__NR_timer_create+6) #define __NR_clock_getres (__NR_timer_create+7) #define __NR_clock_nanosleep (__NR_timer_create+8) #define __NR_statfs64 268 #define __NR_fstatfs64 269 #define __NR_tgkill 270 #define __NR_utimes 271 #define __NR_fadvise64_64 272 #define __NR_vserver 273 #define __NR_mbind 274 #define __NR_get_mempolicy 275 #define __NR_set_mempolicy 276 #define __NR_mq_open 277 #define __NR_mq_unlink (__NR_mq_open+1) #define __NR_mq_timedsend (__NR_mq_open+2) #define __NR_mq_timedreceive (__NR_mq_open+3) #define __NR_mq_notify (__NR_mq_open+4) #define __NR_mq_getsetattr (__NR_mq_open+5) #define __NR_sys_kexec_load 283 #define __NR_waitid 284 /* #define __NR_sys_setaltroot 285 */ #define __NR_add_key 286 #define __NR_request_key 287 #define __NR_keyctl 288 #define NR_syscalls 289 /* * user-visible error numbers are in the range -1 - -128: see * */ #define __syscall_return(type, res) \ do { \ if ((unsigned long)(res) >= (unsigned long)(-(128 + 1))) { \ errno = -(res); \ res = -1; \ } \ return (type) (res); \ } while (0) /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */ #define _syscall0(type,name) \ type name(void) \ { \ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name)); \ __syscall_return(type,__res); \ } #define _syscall1(type,name,type1,arg1) \ type name(type1 arg1) \ { \ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1))); \ __syscall_return(type,__res); \ } #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1,type2 arg2) \ { \ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ __syscall_return(type,__res); \ } #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) \ { \ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3))); \ __syscall_return(type,__res); \ } #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ { \ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3)),"S" ((long)(arg4))); \ __syscall_return(type,__res); \ } #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ type5,arg5) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ { \ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ __syscall_return(type,__res); \ } #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ type5,arg5,type6,arg6) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ { \ long __res; \ __asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \ : "=a" (__res) \ : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ "0" ((long)(arg6))); \ __syscall_return(type,__res); \ } #ifdef __KERNEL_SYSCALLS__ #include #include #include /* * we need this inline - forking from kernel space will result * in NO COPY ON WRITE (!!!), until an execve is executed. This * is no problem, but for the stack. This is handled by not letting * main() use the stack at all after fork(). Thus, no function * calls - which means inline code for fork too, as otherwise we * would use the stack upon exit from 'fork()'. * * Actually only pause and fork are needed inline, so that there * won't be any messing with the stack from main(), but we define * some others too. */ static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) asmlinkage int sys_modify_ldt(int func, void *ptr, unsigned long bytecount); asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff); asmlinkage int sys_execve(struct pt_regs regs); asmlinkage int sys_clone(struct pt_regs regs); asmlinkage int sys_fork(struct pt_regs regs); asmlinkage int sys_vfork(struct pt_regs regs); asmlinkage int sys_pipe(unsigned long *fildes); asmlinkage int sys_ptrace(long request, long pid, long addr, long data); asmlinkage long sys_iopl(unsigned long unused); struct sigaction; asmlinkage long sys_rt_sigaction(int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize); #endif /* * "Conditional" syscalls * * What we want is __attribute__((weak,alias("sys_ni_syscall"))), * but it doesn't work on all toolchains, so we just do it by hand */ #ifndef cond_syscall #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); #endif #endif /* _ASM_I386_UNISTD_H_ */ umview-0.8.2/um_rsc/librsc_templates/input/unistd_files/unistd_x86_64.h0000644000175000017500000006065111753517212025275 0ustar renzorenzo#ifndef _ASM_X86_64_UNISTD_H_ #define _ASM_X86_64_UNISTD_H_ #ifndef __SYSCALL #define __SYSCALL(a,b) #endif /* * This file contains the system call numbers. * * Note: holes are not allowed. */ /* at least 8 syscall per cacheline */ #define __NR_read 0 __SYSCALL(__NR_read, sys_read) #define __NR_write 1 __SYSCALL(__NR_write, sys_write) #define __NR_open 2 __SYSCALL(__NR_open, sys_open) #define __NR_close 3 __SYSCALL(__NR_close, sys_close) #define __NR_stat 4 __SYSCALL(__NR_stat, sys_newstat) #define __NR_fstat 5 __SYSCALL(__NR_fstat, sys_newfstat) #define __NR_lstat 6 __SYSCALL(__NR_lstat, sys_newlstat) #define __NR_poll 7 __SYSCALL(__NR_poll, sys_poll) #define __NR_lseek 8 __SYSCALL(__NR_lseek, sys_lseek) #define __NR_mmap 9 __SYSCALL(__NR_mmap, sys_mmap) #define __NR_mprotect 10 __SYSCALL(__NR_mprotect, sys_mprotect) #define __NR_munmap 11 __SYSCALL(__NR_munmap, sys_munmap) #define __NR_brk 12 __SYSCALL(__NR_brk, sys_brk) #define __NR_rt_sigaction 13 __SYSCALL(__NR_rt_sigaction, sys_rt_sigaction) #define __NR_rt_sigprocmask 14 __SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask) #define __NR_rt_sigreturn 15 __SYSCALL(__NR_rt_sigreturn, stub_rt_sigreturn) #define __NR_ioctl 16 __SYSCALL(__NR_ioctl, sys_ioctl) #define __NR_pread64 17 __SYSCALL(__NR_pread64, sys_pread64) #define __NR_pwrite64 18 __SYSCALL(__NR_pwrite64, sys_pwrite64) #define __NR_readv 19 __SYSCALL(__NR_readv, sys_readv) #define __NR_writev 20 __SYSCALL(__NR_writev, sys_writev) #define __NR_access 21 __SYSCALL(__NR_access, sys_access) #define __NR_pipe 22 __SYSCALL(__NR_pipe, sys_pipe) #define __NR_select 23 __SYSCALL(__NR_select, sys_select) #define __NR_sched_yield 24 __SYSCALL(__NR_sched_yield, sys_sched_yield) #define __NR_mremap 25 __SYSCALL(__NR_mremap, sys_mremap) #define __NR_msync 26 __SYSCALL(__NR_msync, sys_msync) #define __NR_mincore 27 __SYSCALL(__NR_mincore, sys_mincore) #define __NR_madvise 28 __SYSCALL(__NR_madvise, sys_madvise) #define __NR_shmget 29 __SYSCALL(__NR_shmget, sys_shmget) #define __NR_shmat 30 __SYSCALL(__NR_shmat, wrap_sys_shmat) #define __NR_shmctl 31 __SYSCALL(__NR_shmctl, sys_shmctl) #define __NR_dup 32 __SYSCALL(__NR_dup, sys_dup) #define __NR_dup2 33 __SYSCALL(__NR_dup2, sys_dup2) #define __NR_pause 34 __SYSCALL(__NR_pause, sys_pause) #define __NR_nanosleep 35 __SYSCALL(__NR_nanosleep, sys_nanosleep) #define __NR_getitimer 36 __SYSCALL(__NR_getitimer, sys_getitimer) #define __NR_alarm 37 __SYSCALL(__NR_alarm, sys_alarm) #define __NR_setitimer 38 __SYSCALL(__NR_setitimer, sys_setitimer) #define __NR_getpid 39 __SYSCALL(__NR_getpid, sys_getpid) #define __NR_sendfile 40 __SYSCALL(__NR_sendfile, sys_sendfile64) #define __NR_socket 41 __SYSCALL(__NR_socket, sys_socket) #define __NR_connect 42 __SYSCALL(__NR_connect, sys_connect) #define __NR_accept 43 __SYSCALL(__NR_accept, sys_accept) #define __NR_sendto 44 __SYSCALL(__NR_sendto, sys_sendto) #define __NR_recvfrom 45 __SYSCALL(__NR_recvfrom, sys_recvfrom) #define __NR_sendmsg 46 __SYSCALL(__NR_sendmsg, sys_sendmsg) #define __NR_recvmsg 47 __SYSCALL(__NR_recvmsg, sys_recvmsg) #define __NR_shutdown 48 __SYSCALL(__NR_shutdown, sys_shutdown) #define __NR_bind 49 __SYSCALL(__NR_bind, sys_bind) #define __NR_listen 50 __SYSCALL(__NR_listen, sys_listen) #define __NR_getsockname 51 __SYSCALL(__NR_getsockname, sys_getsockname) #define __NR_getpeername 52 __SYSCALL(__NR_getpeername, sys_getpeername) #define __NR_socketpair 53 __SYSCALL(__NR_socketpair, sys_socketpair) #define __NR_setsockopt 54 __SYSCALL(__NR_setsockopt, sys_setsockopt) #define __NR_getsockopt 55 __SYSCALL(__NR_getsockopt, sys_getsockopt) #define __NR_clone 56 __SYSCALL(__NR_clone, stub_clone) #define __NR_fork 57 __SYSCALL(__NR_fork, stub_fork) #define __NR_vfork 58 __SYSCALL(__NR_vfork, stub_vfork) #define __NR_execve 59 __SYSCALL(__NR_execve, stub_execve) #define __NR_exit 60 __SYSCALL(__NR_exit, sys_exit) #define __NR_wait4 61 __SYSCALL(__NR_wait4, sys_wait4) #define __NR_kill 62 __SYSCALL(__NR_kill, sys_kill) #define __NR_uname 63 __SYSCALL(__NR_uname, sys_uname) #define __NR_semget 64 __SYSCALL(__NR_semget, sys_semget) #define __NR_semop 65 __SYSCALL(__NR_semop, sys_semop) #define __NR_semctl 66 __SYSCALL(__NR_semctl, sys_semctl) #define __NR_shmdt 67 __SYSCALL(__NR_shmdt, sys_shmdt) #define __NR_msgget 68 __SYSCALL(__NR_msgget, sys_msgget) #define __NR_msgsnd 69 __SYSCALL(__NR_msgsnd, sys_msgsnd) #define __NR_msgrcv 70 __SYSCALL(__NR_msgrcv, sys_msgrcv) #define __NR_msgctl 71 __SYSCALL(__NR_msgctl, sys_msgctl) #define __NR_fcntl 72 __SYSCALL(__NR_fcntl, sys_fcntl) #define __NR_flock 73 __SYSCALL(__NR_flock, sys_flock) #define __NR_fsync 74 __SYSCALL(__NR_fsync, sys_fsync) #define __NR_fdatasync 75 __SYSCALL(__NR_fdatasync, sys_fdatasync) #define __NR_truncate 76 __SYSCALL(__NR_truncate, sys_truncate) #define __NR_ftruncate 77 __SYSCALL(__NR_ftruncate, sys_ftruncate) #define __NR_getdents 78 __SYSCALL(__NR_getdents, sys_getdents) #define __NR_getcwd 79 __SYSCALL(__NR_getcwd, sys_getcwd) #define __NR_chdir 80 __SYSCALL(__NR_chdir, sys_chdir) #define __NR_fchdir 81 __SYSCALL(__NR_fchdir, sys_fchdir) #define __NR_rename 82 __SYSCALL(__NR_rename, sys_rename) #define __NR_mkdir 83 __SYSCALL(__NR_mkdir, sys_mkdir) #define __NR_rmdir 84 __SYSCALL(__NR_rmdir, sys_rmdir) #define __NR_creat 85 __SYSCALL(__NR_creat, sys_creat) #define __NR_link 86 __SYSCALL(__NR_link, sys_link) #define __NR_unlink 87 __SYSCALL(__NR_unlink, sys_unlink) #define __NR_symlink 88 __SYSCALL(__NR_symlink, sys_symlink) #define __NR_readlink 89 __SYSCALL(__NR_readlink, sys_readlink) #define __NR_chmod 90 __SYSCALL(__NR_chmod, sys_chmod) #define __NR_fchmod 91 __SYSCALL(__NR_fchmod, sys_fchmod) #define __NR_chown 92 __SYSCALL(__NR_chown, sys_chown) #define __NR_fchown 93 __SYSCALL(__NR_fchown, sys_fchown) #define __NR_lchown 94 __SYSCALL(__NR_lchown, sys_lchown) #define __NR_umask 95 __SYSCALL(__NR_umask, sys_umask) #define __NR_gettimeofday 96 __SYSCALL(__NR_gettimeofday, sys_gettimeofday) #define __NR_getrlimit 97 __SYSCALL(__NR_getrlimit, sys_getrlimit) #define __NR_getrusage 98 __SYSCALL(__NR_getrusage, sys_getrusage) #define __NR_sysinfo 99 __SYSCALL(__NR_sysinfo, sys_sysinfo) #define __NR_times 100 __SYSCALL(__NR_times, sys_times) #define __NR_ptrace 101 __SYSCALL(__NR_ptrace, sys_ptrace) #define __NR_getuid 102 __SYSCALL(__NR_getuid, sys_getuid) #define __NR_syslog 103 __SYSCALL(__NR_syslog, sys_syslog) /* at the very end the stuff that never runs during the benchmarks */ #define __NR_getgid 104 __SYSCALL(__NR_getgid, sys_getgid) #define __NR_setuid 105 __SYSCALL(__NR_setuid, sys_setuid) #define __NR_setgid 106 __SYSCALL(__NR_setgid, sys_setgid) #define __NR_geteuid 107 __SYSCALL(__NR_geteuid, sys_geteuid) #define __NR_getegid 108 __SYSCALL(__NR_getegid, sys_getegid) #define __NR_setpgid 109 __SYSCALL(__NR_setpgid, sys_setpgid) #define __NR_getppid 110 __SYSCALL(__NR_getppid, sys_getppid) #define __NR_getpgrp 111 __SYSCALL(__NR_getpgrp, sys_getpgrp) #define __NR_setsid 112 __SYSCALL(__NR_setsid, sys_setsid) #define __NR_setreuid 113 __SYSCALL(__NR_setreuid, sys_setreuid) #define __NR_setregid 114 __SYSCALL(__NR_setregid, sys_setregid) #define __NR_getgroups 115 __SYSCALL(__NR_getgroups, sys_getgroups) #define __NR_setgroups 116 __SYSCALL(__NR_setgroups, sys_setgroups) #define __NR_setresuid 117 __SYSCALL(__NR_setresuid, sys_setresuid) #define __NR_getresuid 118 __SYSCALL(__NR_getresuid, sys_getresuid) #define __NR_setresgid 119 __SYSCALL(__NR_setresgid, sys_setresgid) #define __NR_getresgid 120 __SYSCALL(__NR_getresgid, sys_getresgid) #define __NR_getpgid 121 __SYSCALL(__NR_getpgid, sys_getpgid) #define __NR_setfsuid 122 __SYSCALL(__NR_setfsuid, sys_setfsuid) #define __NR_setfsgid 123 __SYSCALL(__NR_setfsgid, sys_setfsgid) #define __NR_getsid 124 __SYSCALL(__NR_getsid, sys_getsid) #define __NR_capget 125 __SYSCALL(__NR_capget, sys_capget) #define __NR_capset 126 __SYSCALL(__NR_capset, sys_capset) #define __NR_rt_sigpending 127 __SYSCALL(__NR_rt_sigpending, sys_rt_sigpending) #define __NR_rt_sigtimedwait 128 __SYSCALL(__NR_rt_sigtimedwait, sys_rt_sigtimedwait) #define __NR_rt_sigqueueinfo 129 __SYSCALL(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo) #define __NR_rt_sigsuspend 130 __SYSCALL(__NR_rt_sigsuspend, stub_rt_sigsuspend) #define __NR_sigaltstack 131 __SYSCALL(__NR_sigaltstack, stub_sigaltstack) #define __NR_utime 132 __SYSCALL(__NR_utime, sys_utime) #define __NR_mknod 133 __SYSCALL(__NR_mknod, sys_mknod) /* Only needed for a.out */ #define __NR_uselib 134 __SYSCALL(__NR_uselib, sys_ni_syscall) #define __NR_personality 135 __SYSCALL(__NR_personality, sys_personality) #define __NR_ustat 136 __SYSCALL(__NR_ustat, sys_ustat) #define __NR_statfs 137 __SYSCALL(__NR_statfs, sys_statfs) #define __NR_fstatfs 138 __SYSCALL(__NR_fstatfs, sys_fstatfs) #define __NR_sysfs 139 __SYSCALL(__NR_sysfs, sys_sysfs) #define __NR_getpriority 140 __SYSCALL(__NR_getpriority, sys_getpriority) #define __NR_setpriority 141 __SYSCALL(__NR_setpriority, sys_setpriority) #define __NR_sched_setparam 142 __SYSCALL(__NR_sched_setparam, sys_sched_setparam) #define __NR_sched_getparam 143 __SYSCALL(__NR_sched_getparam, sys_sched_getparam) #define __NR_sched_setscheduler 144 __SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler) #define __NR_sched_getscheduler 145 __SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler) #define __NR_sched_get_priority_max 146 __SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max) #define __NR_sched_get_priority_min 147 __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min) #define __NR_sched_rr_get_interval 148 __SYSCALL(__NR_sched_rr_get_interval, sys_sched_rr_get_interval) #define __NR_mlock 149 __SYSCALL(__NR_mlock, sys_mlock) #define __NR_munlock 150 __SYSCALL(__NR_munlock, sys_munlock) #define __NR_mlockall 151 __SYSCALL(__NR_mlockall, sys_mlockall) #define __NR_munlockall 152 __SYSCALL(__NR_munlockall, sys_munlockall) #define __NR_vhangup 153 __SYSCALL(__NR_vhangup, sys_vhangup) #define __NR_modify_ldt 154 __SYSCALL(__NR_modify_ldt, sys_modify_ldt) #define __NR_pivot_root 155 __SYSCALL(__NR_pivot_root, sys_pivot_root) #define __NR__sysctl 156 __SYSCALL(__NR__sysctl, sys_sysctl) #define __NR_prctl 157 __SYSCALL(__NR_prctl, sys_prctl) #define __NR_arch_prctl 158 __SYSCALL(__NR_arch_prctl, sys_arch_prctl) #define __NR_adjtimex 159 __SYSCALL(__NR_adjtimex, sys_adjtimex) #define __NR_setrlimit 160 __SYSCALL(__NR_setrlimit, sys_setrlimit) #define __NR_chroot 161 __SYSCALL(__NR_chroot, sys_chroot) #define __NR_sync 162 __SYSCALL(__NR_sync, sys_sync) #define __NR_acct 163 __SYSCALL(__NR_acct, sys_acct) #define __NR_settimeofday 164 __SYSCALL(__NR_settimeofday, sys_settimeofday) #define __NR_mount 165 __SYSCALL(__NR_mount, sys_mount) #define __NR_umount2 166 __SYSCALL(__NR_umount2, sys_umount) #define __NR_swapon 167 __SYSCALL(__NR_swapon, sys_swapon) #define __NR_swapoff 168 __SYSCALL(__NR_swapoff, sys_swapoff) #define __NR_reboot 169 __SYSCALL(__NR_reboot, sys_reboot) #define __NR_sethostname 170 __SYSCALL(__NR_sethostname, sys_sethostname) #define __NR_setdomainname 171 __SYSCALL(__NR_setdomainname, sys_setdomainname) #define __NR_iopl 172 __SYSCALL(__NR_iopl, stub_iopl) #define __NR_ioperm 173 __SYSCALL(__NR_ioperm, sys_ioperm) #define __NR_create_module 174 __SYSCALL(__NR_create_module, sys_ni_syscall) #define __NR_init_module 175 __SYSCALL(__NR_init_module, sys_init_module) #define __NR_delete_module 176 __SYSCALL(__NR_delete_module, sys_delete_module) #define __NR_get_kernel_syms 177 __SYSCALL(__NR_get_kernel_syms, sys_ni_syscall) #define __NR_query_module 178 __SYSCALL(__NR_query_module, sys_ni_syscall) #define __NR_quotactl 179 __SYSCALL(__NR_quotactl, sys_quotactl) #define __NR_nfsservctl 180 __SYSCALL(__NR_nfsservctl, sys_nfsservctl) #define __NR_getpmsg 181 /* reserved for LiS/STREAMS */ __SYSCALL(__NR_getpmsg, sys_ni_syscall) #define __NR_putpmsg 182 /* reserved for LiS/STREAMS */ __SYSCALL(__NR_putpmsg, sys_ni_syscall) #define __NR_afs_syscall 183 /* reserved for AFS */ __SYSCALL(__NR_afs_syscall, sys_ni_syscall) #define __NR_tuxcall 184 /* reserved for tux */ __SYSCALL(__NR_tuxcall, sys_ni_syscall) #define __NR_security 185 __SYSCALL(__NR_security, sys_ni_syscall) #define __NR_gettid 186 __SYSCALL(__NR_gettid, sys_gettid) #define __NR_readahead 187 __SYSCALL(__NR_readahead, sys_readahead) #define __NR_setxattr 188 __SYSCALL(__NR_setxattr, sys_setxattr) #define __NR_lsetxattr 189 __SYSCALL(__NR_lsetxattr, sys_lsetxattr) #define __NR_fsetxattr 190 __SYSCALL(__NR_fsetxattr, sys_fsetxattr) #define __NR_getxattr 191 __SYSCALL(__NR_getxattr, sys_getxattr) #define __NR_lgetxattr 192 __SYSCALL(__NR_lgetxattr, sys_lgetxattr) #define __NR_fgetxattr 193 __SYSCALL(__NR_fgetxattr, sys_fgetxattr) #define __NR_listxattr 194 __SYSCALL(__NR_listxattr, sys_listxattr) #define __NR_llistxattr 195 __SYSCALL(__NR_llistxattr, sys_llistxattr) #define __NR_flistxattr 196 __SYSCALL(__NR_flistxattr, sys_flistxattr) #define __NR_removexattr 197 __SYSCALL(__NR_removexattr, sys_removexattr) #define __NR_lremovexattr 198 __SYSCALL(__NR_lremovexattr, sys_lremovexattr) #define __NR_fremovexattr 199 __SYSCALL(__NR_fremovexattr, sys_fremovexattr) #define __NR_tkill 200 __SYSCALL(__NR_tkill, sys_tkill) #define __NR_time 201 __SYSCALL(__NR_time, sys_time64) #define __NR_futex 202 __SYSCALL(__NR_futex, sys_futex) #define __NR_sched_setaffinity 203 __SYSCALL(__NR_sched_setaffinity, sys_sched_setaffinity) #define __NR_sched_getaffinity 204 __SYSCALL(__NR_sched_getaffinity, sys_sched_getaffinity) #define __NR_set_thread_area 205 __SYSCALL(__NR_set_thread_area, sys_ni_syscall) /* use arch_prctl */ #define __NR_io_setup 206 __SYSCALL(__NR_io_setup, sys_io_setup) #define __NR_io_destroy 207 __SYSCALL(__NR_io_destroy, sys_io_destroy) #define __NR_io_getevents 208 __SYSCALL(__NR_io_getevents, sys_io_getevents) #define __NR_io_submit 209 __SYSCALL(__NR_io_submit, sys_io_submit) #define __NR_io_cancel 210 __SYSCALL(__NR_io_cancel, sys_io_cancel) #define __NR_get_thread_area 211 __SYSCALL(__NR_get_thread_area, sys_ni_syscall) /* use arch_prctl */ #define __NR_lookup_dcookie 212 __SYSCALL(__NR_lookup_dcookie, sys_lookup_dcookie) #define __NR_epoll_create 213 __SYSCALL(__NR_epoll_create, sys_epoll_create) #define __NR_epoll_ctl_old 214 __SYSCALL(__NR_epoll_ctl_old, sys_ni_syscall) #define __NR_epoll_wait_old 215 __SYSCALL(__NR_epoll_wait_old, sys_ni_syscall) #define __NR_remap_file_pages 216 __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages) #define __NR_getdents64 217 __SYSCALL(__NR_getdents64, sys_getdents64) #define __NR_set_tid_address 218 __SYSCALL(__NR_set_tid_address, sys_set_tid_address) #define __NR_restart_syscall 219 __SYSCALL(__NR_restart_syscall, sys_restart_syscall) #define __NR_semtimedop 220 __SYSCALL(__NR_semtimedop, sys_semtimedop) #define __NR_fadvise64 221 __SYSCALL(__NR_fadvise64, sys_fadvise64) #define __NR_timer_create 222 __SYSCALL(__NR_timer_create, sys_timer_create) #define __NR_timer_settime 223 __SYSCALL(__NR_timer_settime, sys_timer_settime) #define __NR_timer_gettime 224 __SYSCALL(__NR_timer_gettime, sys_timer_gettime) #define __NR_timer_getoverrun 225 __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun) #define __NR_timer_delete 226 __SYSCALL(__NR_timer_delete, sys_timer_delete) #define __NR_clock_settime 227 __SYSCALL(__NR_clock_settime, sys_clock_settime) #define __NR_clock_gettime 228 __SYSCALL(__NR_clock_gettime, sys_clock_gettime) #define __NR_clock_getres 229 __SYSCALL(__NR_clock_getres, sys_clock_getres) #define __NR_clock_nanosleep 230 __SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep) #define __NR_exit_group 231 __SYSCALL(__NR_exit_group, sys_exit_group) #define __NR_epoll_wait 232 __SYSCALL(__NR_epoll_wait, sys_epoll_wait) #define __NR_epoll_ctl 233 __SYSCALL(__NR_epoll_ctl, sys_epoll_ctl) #define __NR_tgkill 234 __SYSCALL(__NR_tgkill, sys_tgkill) #define __NR_utimes 235 __SYSCALL(__NR_utimes, sys_utimes) #define __NR_vserver 236 __SYSCALL(__NR_vserver, sys_ni_syscall) #define __NR_vserver 236 __SYSCALL(__NR_vserver, sys_ni_syscall) #define __NR_mbind 237 __SYSCALL(__NR_mbind, sys_mbind) #define __NR_set_mempolicy 238 __SYSCALL(__NR_set_mempolicy, sys_set_mempolicy) #define __NR_get_mempolicy 239 __SYSCALL(__NR_get_mempolicy, sys_get_mempolicy) #define __NR_mq_open 240 __SYSCALL(__NR_mq_open, sys_mq_open) #define __NR_mq_unlink 241 __SYSCALL(__NR_mq_unlink, sys_mq_unlink) #define __NR_mq_timedsend 242 __SYSCALL(__NR_mq_timedsend, sys_mq_timedsend) #define __NR_mq_timedreceive 243 __SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive) #define __NR_mq_notify 244 __SYSCALL(__NR_mq_notify, sys_mq_notify) #define __NR_mq_getsetattr 245 __SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr) #define __NR_kexec_load 246 __SYSCALL(__NR_kexec_load, sys_ni_syscall) #define __NR_waitid 247 __SYSCALL(__NR_waitid, sys_waitid) #define __NR_add_key 248 __SYSCALL(__NR_add_key, sys_add_key) #define __NR_request_key 249 __SYSCALL(__NR_request_key, sys_request_key) #define __NR_keyctl 250 __SYSCALL(__NR_keyctl, sys_keyctl) #define __NR_syscall_max __NR_keyctl #ifndef __NO_STUBS /* user-visible error numbers are in the range -1 - -4095 */ #define __syscall_clobber "r11","rcx","memory" #define __syscall_return(type, res) \ do { \ if ((unsigned long)(res) >= (unsigned long)(-127)) { \ errno = -(res); \ res = -1; \ } \ return (type) (res); \ } while (0) #define __syscall "syscall" #define _syscall0(type,name) \ type name(void) \ { \ long __res; \ __asm__ volatile (__syscall \ : "=a" (__res) \ : "0" (__NR_##name) : __syscall_clobber ); \ __syscall_return(type,__res); \ } #define _syscall1(type,name,type1,arg1) \ type name(type1 arg1) \ { \ long __res; \ __asm__ volatile (__syscall \ : "=a" (__res) \ : "0" (__NR_##name),"D" ((long)(arg1)) : __syscall_clobber ); \ __syscall_return(type,__res); \ } #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1,type2 arg2) \ { \ long __res; \ __asm__ volatile (__syscall \ : "=a" (__res) \ : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)) : __syscall_clobber ); \ __syscall_return(type,__res); \ } #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) \ { \ long __res; \ __asm__ volatile (__syscall \ : "=a" (__res) \ : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \ "d" ((long)(arg3)) : __syscall_clobber); \ __syscall_return(type,__res); \ } #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ { \ long __res; \ __asm__ volatile ("movq %5,%%r10 ;" __syscall \ : "=a" (__res) \ : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \ "d" ((long)(arg3)),"g" ((long)(arg4)) : __syscall_clobber,"r10" ); \ __syscall_return(type,__res); \ } #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ type5,arg5) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ { \ long __res; \ __asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " __syscall \ : "=a" (__res) \ : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \ "d" ((long)(arg3)),"g" ((long)(arg4)),"g" ((long)(arg5)) : \ __syscall_clobber,"r8","r10" ); \ __syscall_return(type,__res); \ } #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ type5,arg5,type6,arg6) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ { \ long __res; \ __asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; movq %7,%%r9 ; " __syscall \ : "=a" (__res) \ : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \ "d" ((long)(arg3)), "g" ((long)(arg4)), "g" ((long)(arg5)), \ "g" ((long)(arg6)) : \ __syscall_clobber,"r8","r10","r9" ); \ __syscall_return(type,__res); \ } #endif /* __NO_STUBS */ /* * "Conditional" syscalls * * What we want is __attribute__((weak,alias("sys_ni_syscall"))), * but it doesn't work on all toolchains, so we just do it by hand */ #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); #endif umview-0.8.2/um_rsc/librsc_templates/input/unistd_files/unistd_ppc.h0000644000175000017500000002665711753517212025131 0ustar renzorenzo#ifndef _ASM_PPC_UNISTD_H_ #define _ASM_PPC_UNISTD_H_ /* * This file contains the system call numbers. */ #define __NR_restart_syscall 0 #define __NR_exit 1 #define __NR_fork 2 #define __NR_read 3 #define __NR_write 4 #define __NR_open 5 #define __NR_close 6 #define __NR_waitpid 7 #define __NR_creat 8 #define __NR_link 9 #define __NR_unlink 10 #define __NR_execve 11 #define __NR_chdir 12 #define __NR_time 13 #define __NR_mknod 14 #define __NR_chmod 15 #define __NR_lchown 16 #define __NR_break 17 #define __NR_oldstat 18 #define __NR_lseek 19 #define __NR_getpid 20 #define __NR_mount 21 #define __NR_umount 22 #define __NR_setuid 23 #define __NR_getuid 24 #define __NR_stime 25 #define __NR_ptrace 26 #define __NR_alarm 27 #define __NR_oldfstat 28 #define __NR_pause 29 #define __NR_utime 30 #define __NR_stty 31 #define __NR_gtty 32 #define __NR_access 33 #define __NR_nice 34 #define __NR_ftime 35 #define __NR_sync 36 #define __NR_kill 37 #define __NR_rename 38 #define __NR_mkdir 39 #define __NR_rmdir 40 #define __NR_dup 41 #define __NR_pipe 42 #define __NR_times 43 #define __NR_prof 44 #define __NR_brk 45 #define __NR_setgid 46 #define __NR_getgid 47 #define __NR_signal 48 #define __NR_geteuid 49 #define __NR_getegid 50 #define __NR_acct 51 #define __NR_umount2 52 #define __NR_lock 53 #define __NR_ioctl 54 #define __NR_fcntl 55 #define __NR_mpx 56 #define __NR_setpgid 57 #define __NR_ulimit 58 #define __NR_oldolduname 59 #define __NR_umask 60 #define __NR_chroot 61 #define __NR_ustat 62 #define __NR_dup2 63 #define __NR_getppid 64 #define __NR_getpgrp 65 #define __NR_setsid 66 #define __NR_sigaction 67 #define __NR_sgetmask 68 #define __NR_ssetmask 69 #define __NR_setreuid 70 #define __NR_setregid 71 #define __NR_sigsuspend 72 #define __NR_sigpending 73 #define __NR_sethostname 74 #define __NR_setrlimit 75 #define __NR_getrlimit 76 #define __NR_getrusage 77 #define __NR_gettimeofday 78 #define __NR_settimeofday 79 #define __NR_getgroups 80 #define __NR_setgroups 81 #define __NR_select 82 #define __NR_symlink 83 #define __NR_oldlstat 84 #define __NR_readlink 85 #define __NR_uselib 86 #define __NR_swapon 87 #define __NR_reboot 88 #define __NR_readdir 89 #define __NR_mmap 90 #define __NR_munmap 91 #define __NR_truncate 92 #define __NR_ftruncate 93 #define __NR_fchmod 94 #define __NR_fchown 95 #define __NR_getpriority 96 #define __NR_setpriority 97 #define __NR_profil 98 #define __NR_statfs 99 #define __NR_fstatfs 100 #define __NR_ioperm 101 #define __NR_socketcall 102 #define __NR_syslog 103 #define __NR_setitimer 104 #define __NR_getitimer 105 #define __NR_stat 106 #define __NR_lstat 107 #define __NR_fstat 108 #define __NR_olduname 109 #define __NR_iopl 110 #define __NR_vhangup 111 #define __NR_idle 112 #define __NR_vm86 113 #define __NR_wait4 114 #define __NR_swapoff 115 #define __NR_sysinfo 116 #define __NR_ipc 117 #define __NR_fsync 118 #define __NR_sigreturn 119 #define __NR_clone 120 #define __NR_setdomainname 121 #define __NR_uname 122 #define __NR_modify_ldt 123 #define __NR_adjtimex 124 #define __NR_mprotect 125 #define __NR_sigprocmask 126 #define __NR_create_module 127 #define __NR_init_module 128 #define __NR_delete_module 129 #define __NR_get_kernel_syms 130 #define __NR_quotactl 131 #define __NR_getpgid 132 #define __NR_fchdir 133 #define __NR_bdflush 134 #define __NR_sysfs 135 #define __NR_personality 136 #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ #define __NR_setfsuid 138 #define __NR_setfsgid 139 #define __NR__llseek 140 #define __NR_getdents 141 #define __NR__newselect 142 #define __NR_flock 143 #define __NR_msync 144 #define __NR_readv 145 #define __NR_writev 146 #define __NR_getsid 147 #define __NR_fdatasync 148 #define __NR__sysctl 149 #define __NR_mlock 150 #define __NR_munlock 151 #define __NR_mlockall 152 #define __NR_munlockall 153 #define __NR_sched_setparam 154 #define __NR_sched_getparam 155 #define __NR_sched_setscheduler 156 #define __NR_sched_getscheduler 157 #define __NR_sched_yield 158 #define __NR_sched_get_priority_max 159 #define __NR_sched_get_priority_min 160 #define __NR_sched_rr_get_interval 161 #define __NR_nanosleep 162 #define __NR_mremap 163 #define __NR_setresuid 164 #define __NR_getresuid 165 #define __NR_query_module 166 #define __NR_poll 167 #define __NR_nfsservctl 168 #define __NR_setresgid 169 #define __NR_getresgid 170 #define __NR_prctl 171 #define __NR_rt_sigreturn 172 #define __NR_rt_sigaction 173 #define __NR_rt_sigprocmask 174 #define __NR_rt_sigpending 175 #define __NR_rt_sigtimedwait 176 #define __NR_rt_sigqueueinfo 177 #define __NR_rt_sigsuspend 178 #define __NR_pread64 179 #define __NR_pwrite64 180 #define __NR_chown 181 #define __NR_getcwd 182 #define __NR_capget 183 #define __NR_capset 184 #define __NR_sigaltstack 185 #define __NR_sendfile 186 #define __NR_getpmsg 187 /* some people actually want streams */ #define __NR_putpmsg 188 /* some people actually want streams */ #define __NR_vfork 189 #define __NR_ugetrlimit 190 /* SuS compliant getrlimit */ #define __NR_readahead 191 #define __NR_mmap2 192 #define __NR_truncate64 193 #define __NR_ftruncate64 194 #define __NR_stat64 195 #define __NR_lstat64 196 #define __NR_fstat64 197 #define __NR_pciconfig_read 198 #define __NR_pciconfig_write 199 #define __NR_pciconfig_iobase 200 #define __NR_multiplexer 201 #define __NR_getdents64 202 #define __NR_pivot_root 203 #define __NR_fcntl64 204 #define __NR_madvise 205 #define __NR_mincore 206 #define __NR_gettid 207 #define __NR_tkill 208 #define __NR_setxattr 209 #define __NR_lsetxattr 210 #define __NR_fsetxattr 211 #define __NR_getxattr 212 #define __NR_lgetxattr 213 #define __NR_fgetxattr 214 #define __NR_listxattr 215 #define __NR_llistxattr 216 #define __NR_flistxattr 217 #define __NR_removexattr 218 #define __NR_lremovexattr 219 #define __NR_fremovexattr 220 #define __NR_futex 221 #define __NR_sched_setaffinity 222 #define __NR_sched_getaffinity 223 /* 224 currently unused */ #define __NR_tuxcall 225 #define __NR_sendfile64 226 #define __NR_io_setup 227 #define __NR_io_destroy 228 #define __NR_io_getevents 229 #define __NR_io_submit 230 #define __NR_io_cancel 231 #define __NR_set_tid_address 232 #define __NR_fadvise64 233 #define __NR_exit_group 234 #define __NR_lookup_dcookie 235 #define __NR_epoll_create 236 #define __NR_epoll_ctl 237 #define __NR_epoll_wait 238 #define __NR_remap_file_pages 239 #define __NR_timer_create 240 #define __NR_timer_settime 241 #define __NR_timer_gettime 242 #define __NR_timer_getoverrun 243 #define __NR_timer_delete 244 #define __NR_clock_settime 245 #define __NR_clock_gettime 246 #define __NR_clock_getres 247 #define __NR_clock_nanosleep 248 #define __NR_swapcontext 249 #define __NR_tgkill 250 #define __NR_utimes 251 #define __NR_statfs64 252 #define __NR_fstatfs64 253 #define __NR_fadvise64_64 254 #define __NR_syscalls 255 #define __NR(n) #n /* On powerpc a system call basically clobbers the same registers like a * function call, with the exception of LR (which is needed for the * "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal * an error return status). */ #define __syscall_nr(nr, type, name, args...) \ unsigned long __sc_ret, __sc_err; \ { \ register unsigned long __sc_0 __asm__ ("r0"); \ register unsigned long __sc_3 __asm__ ("r3"); \ register unsigned long __sc_4 __asm__ ("r4"); \ register unsigned long __sc_5 __asm__ ("r5"); \ register unsigned long __sc_6 __asm__ ("r6"); \ register unsigned long __sc_7 __asm__ ("r7"); \ \ __sc_loadargs_##nr(name, args); \ __asm__ __volatile__ \ ("sc \n\t" \ "mfcr %0 " \ : "=&r" (__sc_0), \ "=&r" (__sc_3), "=&r" (__sc_4), \ "=&r" (__sc_5), "=&r" (__sc_6), \ "=&r" (__sc_7) \ : __sc_asm_input_##nr \ : "cr0", "ctr", "memory", \ "r8", "r9", "r10","r11", "r12"); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ if (__sc_err & 0x10000000) \ { \ errno = __sc_ret; \ __sc_ret = -1; \ } \ return (type) __sc_ret #define __sc_loadargs_0(name, dummy...) \ __sc_0 = __NR_##name #define __sc_loadargs_1(name, arg1) \ __sc_loadargs_0(name); \ __sc_3 = (unsigned long) (arg1) #define __sc_loadargs_2(name, arg1, arg2) \ __sc_loadargs_1(name, arg1); \ __sc_4 = (unsigned long) (arg2) #define __sc_loadargs_3(name, arg1, arg2, arg3) \ __sc_loadargs_2(name, arg1, arg2); \ __sc_5 = (unsigned long) (arg3) #define __sc_loadargs_4(name, arg1, arg2, arg3, arg4) \ __sc_loadargs_3(name, arg1, arg2, arg3); \ __sc_6 = (unsigned long) (arg4) #define __sc_loadargs_5(name, arg1, arg2, arg3, arg4, arg5) \ __sc_loadargs_4(name, arg1, arg2, arg3, arg4); \ __sc_7 = (unsigned long) (arg5) #define __sc_asm_input_0 "0" (__sc_0) #define __sc_asm_input_1 __sc_asm_input_0, "1" (__sc_3) #define __sc_asm_input_2 __sc_asm_input_1, "2" (__sc_4) #define __sc_asm_input_3 __sc_asm_input_2, "3" (__sc_5) #define __sc_asm_input_4 __sc_asm_input_3, "4" (__sc_6) #define __sc_asm_input_5 __sc_asm_input_4, "5" (__sc_7) #define _syscall0(type,name) \ type name(void) \ { \ __syscall_nr(0, type, name); \ } #define _syscall1(type,name,type1,arg1) \ type name(type1 arg1) \ { \ __syscall_nr(1, type, name, arg1); \ } #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1, type2 arg2) \ { \ __syscall_nr(2, type, name, arg1, arg2); \ } #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1, type2 arg2, type3 arg3) \ { \ __syscall_nr(3, type, name, arg1, arg2, arg3); \ } #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ { \ __syscall_nr(4, type, name, arg1, arg2, arg3, arg4); \ } #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ { \ __syscall_nr(5, type, name, arg1, arg2, arg3, arg4, arg5); \ } #ifdef __KERNEL__ #define __NR__exit __NR_exit #define NR_syscalls __NR_syscalls /* * Forking from kernel space will result in the child getting a new, * empty kernel stack area. Thus the child cannot access automatic * variables set in the parent unless they are in registers, and the * procedure where the fork was done cannot return to its caller in * the child. */ #ifdef __KERNEL_SYSCALLS__ /* * System call prototypes. */ extern pid_t setsid(void); extern int write(int fd, const char *buf, off_t count); extern int read(int fd, char *buf, off_t count); extern off_t lseek(int fd, off_t offset, int count); extern int dup(int fd); extern int execve(const char *file, char **argv, char **envp); extern int open(const char *file, int flag, int mode); extern int close(int fd); extern pid_t waitpid(pid_t pid, int *wait_stat, int options); #endif /* __KERNEL_SYSCALLS__ */ /* * "Conditional" syscalls * * What we want is __attribute__((weak,alias("sys_ni_syscall"))), * but it doesn't work on all toolchains, so we just do it by hand */ #ifndef cond_syscall #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); #endif #endif /* __KERNEL__ */ #endif /* _ASM_PPC_UNISTD_H_ */ umview-0.8.2/um_rsc/librsc_templates/input/templates/0000755000175000017500000000000011753517351022102 5ustar renzorenzoumview-0.8.2/um_rsc/librsc_templates/input/templates/test_common_code.rb0000644000175000017500000000165211753517212025750 0ustar renzorenzo# # This is part of RSC file generator program # # test_common_code.rb: common ruby code used by different templates # implementing librsc test files # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # def compare_func_name(arg) fun_name = "compare_" if(arg.type.type =~ /void/) fun_name += "mem" elsif(arg.type.type =~ /char */) fun_name += "string" else fun_name += arg.type.type.sub("\*", "").strip.gsub(" ", "_") end return fun_name end umview-0.8.2/um_rsc/librsc_templates/input/templates/common_code.rb0000644000175000017500000001126211753517212024707 0ustar renzorenzo# # This is part of RSC file generator program # # common_code.rb: common ruby code used by different templates # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # This is a file grouping some functions and global variables used by # different templates # It takes in input the argument "arg" and returns the name of the # LibAConv function to use to convert the element. # The function doesn't return all the name of the LibAConv function, # but only the part depending on the specific type of are: # # aconv_() and aconv__size() # # If pointed == true and the type of "arg" is a pointer, # the functions returns the name or the function # that manage the pointed memory, not the pointer it-self. def arg2aconv(arg, pointed = false) raise ArgumentError.new("arg must be a C::Argument, not #{type.class}") if arg.class != C::Argument type = arg.type.type.clone if(pointed) type.sub!(/\*/, ''); type.strip! end if(arg.type.pointer? and not pointed) return "pointer" elsif(arg.type.array? and not pointed) return "array" elsif(arg.type.type =~ /char \*/ or (arg.type.type =~ /void \*/ and arg.type.act_as_a_string?)) return "string" elsif(arg.type.type == "void *") return "bytes" elsif(arg.type.struct?) return type.sub(/ /, '_') elsif(arg.type.type == "unsigned long int") return "u_long" elsif(arg.type.type == "unsigned int") return "u_int" else return type end end # Returns a string aconv_(). # "arg" is the argument, "a1", "a2" the two architectures # and "pointer" is the 4th argument of aconv_() function. def aconv(arg, a1, a2, pointer, pointed = false, prefix = "", arg_postfix = "") typename = arg2aconv(arg, pointed) str = "aconv_#{arg2aconv(arg, pointed)}(" if(not arg.type.pointer? or not arg_postfix.empty?) str += "&" end str += "#{prefix}#{arg.name}#{arg_postfix}, #{a1}, #{a2}, #{pointer}" if(typename == "bytes") if(arg.size_var.type.pointer?) str += ", *(#{prefix}#{arg.size_var.name}#{arg_postfix})" else str += ", #{prefix}#{arg.size_var.name}#{arg_postfix}" end end str += ")" if(typename == "array") str = "aconv_#{typename}(#{arg.name}, #{a1}, #{a2}, #{arg.type.array_size}, #{pointer}, aconv_struct_timeval_size, aconv_struct_timeval)" end return str end # Returns a string aconv__size(). # "arg" is the argument, and "a1", "a2" the two architectures def aconv_size(arg, a1, a2, pointed = false, prefix = "") # If the argument is a write char pointer, I don't use the # aconv_*_size() function, but the arg_size if(pointed and arg.type.type =~ /char \*/ and arg.is_size_a_var?) return "#{prefix}#{arg.size_var.name}" end typename = arg2aconv(arg, pointed) func_name = "aconv_#{typename}_size" str = "#{func_name}(#{a1}, #{a2})" if(typename == "string") str = "#{func_name}(#{prefix}#{arg.name}, #{a1}, #{a2})" elsif(typename == "array") # FIXME: in this way it works because I know that the only array argument is in utimes, # I need to change it for the future. str = "#{func_name}(#{a1}, #{a2}, #{arg.type.array_size}, aconv_struct_timeval_size)" elsif(typename == "bytes") if(arg.size_var.type.pointer?) str = "#{func_name}(*(#{prefix}#{arg.size_var.name}), #{a1}, #{a2})" else str = "#{func_name}(#{prefix}#{arg.size_var.name}, #{a1}, #{a2})" end end return str end # The has table contains as keys the __RSC_* constants of some # system calls that are not defined in all the four architectures. # For each key, the value is an array the architecture constants # where the system call is NOT defined. @@special_syscall = { "__RSC_chown32" => ["__powerpc__", "__x86_64__"], "__RSC_lchown32" => ["__powerpc__", "__x86_64__"], "__RSC_fchown32" => ["__powerpc__", "__x86_64__"], "__RSC__llseek" => ["__x86_64__"], "__RSC_recv" => ["__x86_64__"], "__RSC_send" => ["__x86_64__"] } # It's a list of __NR_* constants of 64bit system calls. # Into x86_64 architecture, these constants are defined without # the trailing "64". @@x86_64_without64 = [ '__NR_fstat64', '__NR_fstatfs64', '__NR_ftruncate64', '__NR_lchown32', '__NR_lstat64', '__NR_recv', '__NR_send', '__NR_stat64', '__NR_statfs64', '__NR_truncate64' ] umview-0.8.2/um_rsc/librsc_templates/input/templates/client_tests.h0000644000175000017500000000504211753517212024750 0ustar renzorenzo<%# This is part of RSC file generator program client_tests.h: template file for the header containing private client side functions to be tested Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/src/include/" %> <% @@filename = "test_rsc_client.h" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: header containing private client side functions to be tested * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __TEST_RSC_CLIENT_HEADER__ #define __TEST_RSC_CLIENT_HEADER__ #ifndef __USE_LARGEFILE64 #define __USE_LARGEFILE64 #endif #include "rsc_client.h" #ifdef RSCDEBUG struct ioctl_cache_el { int request; u_int32_t size_type; struct ioctl_cache_el *prev; struct ioctl_cache_el *next; }; struct ioctl_cache { struct ioctl_cache_el *first; struct ioctl_cache_el *last; int size; int nentry; }; struct ioctl_cache *ioctl_cache; struct ioctl_cache *ioctl_cache_init(int size); void ioctl_cache_add(struct ioctl_cache *cache, int request, u_int32_t size_type); u_int32_t ioctl_cache_search(struct ioctl_cache *cache, int request); u_int16_t fcntl_cmd_type(int cmd); #endif #endif /* __TEST_RSC_CLIENT_HEADER__ */ umview-0.8.2/um_rsc/librsc_templates/input/templates/testing_tools_fill_write_pointers.h0000644000175000017500000000510511753517212031310 0ustar renzorenzo<%# This is part of RSC file generator program testing_tools_write_pointers.h: template file for the header of the functions used during the tests to fill write syscall buffers Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/tests/tools/" %> <% @@filename = "fill_write_pointers.h" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: header of the functions used during the tests * to fill write syscall buffers * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __FILL_WRITE_POINTERS__ #define __FILL_WRITE_POINTERS__ #include #include #include "rsc_client.h" <% headers = [] nr_all.each_umview { |syscall| headers << syscall.headers } headers.flatten!.sort!.uniq!.delete("utime.h") headers.collect!{ |hd| "#include <#{hd}>" } %> <%= headers.join("\n") %> int simple_fill(); <% nr_all.each_umview do |syscall| %> <% if(syscall.has_write_args?) %> int <%=syscall.name%>_fill_write_pointers(<%=syscall.args.join(', ')%>); <% end %> <% end %> int ioctl_fill_write_pointers(int d, int request, void *arg); int fcntl_fill_write_pointers(int16_t cmd_type, int fd, int cmd, struct flock *lock); #endif /* __FILL_WRITE_POINTERS__ */ umview-0.8.2/um_rsc/librsc_templates/input/templates/server.c0000644000175000017500000010403711753517212023555 0ustar renzorenzo<%# This is part of RSC file generator program server.c: template file for server side functions Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/src/" %> <% @@filename = "rsc_server.c" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: server side functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __USE_LARGEFILE64 #define __USE_LARGEFILE64 #endif #include #include #include "debug.h" #include "rsc_server.h" #include "utils.h" #include "aconv.h" #include "rsc_consts.h" #include "generic_list.h" #include "event_sub.h" #include #include #include #include #include #include #include #include #include <% headers = [] nr_all.each_umview { |syscall| headers << syscall.headers } headers.flatten!.sort!.uniq!.delete("utime.h") headers.collect!{ |hd| "#include <#{hd}>" } %> <%= headers.join("\n") %> static enum arch my_arch; static struct list *ioctl_list; /*########################################################################*/ /*## ##*/ /*## REQUEST FUNCTION DECLARATIONS and HANDLER TABLE ##*/ /*## ##*/ /*########################################################################*/ typedef struct sys_resp_header *(*rscs_pre_exec)(void *req, enum arch client_arch); typedef int (*rscs_exec)(void *request); typedef struct iovec *(*rscs_post_exec)(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); /* static void *req_func_recvmsg(void *req); */ <% nr_all.each_umview do |syscall| %> struct sys_resp_header *rscs_pre_<%= syscall.name %>_exec(void *req, enum arch client_arch); int rscs_exec_<%= syscall.name %>(void *request); struct iovec *rscs_post_<%= syscall.name %>_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); <% end %> struct sys_resp_header *rscs_pre_ioctl_exec(void *req, enum arch client_arch); int rscs_exec_ioctl(void *request); struct iovec *rscs_post_ioctl_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fcntl_exec(void *req, enum arch client_arch); int rscs_exec_fcntl(void *request); struct iovec *rscs_post_fcntl_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); /* Handler Tables */ rscs_pre_exec rscs_pre_exec_table[] = { <% nr_create_fun = ["ioctl", "fcntl"] nr_all.each_with_index { |syscall, i| if(syscall.used_by_umview? or nr_create_fun.include?(syscall.name)) %> <%= "/* #{i}. #{nr_all[i].rsc} */ rscs_pre_#{nr_all[i].name}_exec#{i != (nr_all.length - 1) ? ',' : ""}\n" %> <% else %> <%= "/* #{i}. #{nr_all[i].rsc} */ NULL#{i != (nr_all.length - 1) ? ',' : ""}\n" %> <% end %> <% } %> }; rscs_exec rscs_exec_table[] = { <% nr_create_fun = ["ioctl", "fcntl"] nr_all.each_with_index { |syscall, i| if(syscall.used_by_umview? or nr_create_fun.include?(syscall.name)) %> <%= "/* #{i}. #{nr_all[i].rsc} */ rscs_exec_#{nr_all[i].name}#{i != (nr_all.length - 1) ? ',' : ""}\n" %> <% else %> <%= "/* #{i}. #{nr_all[i].rsc} */ NULL#{i != (nr_all.length - 1) ? ',' : ""}\n" %> <% end %> <% } %> }; rscs_post_exec rscs_post_exec_table[] = { <% nr_create_fun = ["ioctl", "fcntl"] nr_all.each_with_index { |syscall, i| if(syscall.used_by_umview? or nr_create_fun.include?(syscall.name)) %> <%= "/* #{i}. #{nr_all[i].rsc} */ rscs_post_#{nr_all[i].name}_exec#{i != (nr_all.length - 1) ? ',' : ""}\n" %> <% else %> <%= "/* #{i}. #{nr_all[i].rsc} */ NULL#{i != (nr_all.length - 1) ? ',' : ""}\n" %> <% end %> <% } %> }; /*########################################################################*/ /*## ##*/ /*## IOCTL MANAGEMENT ##*/ /*## ##*/ /*########################################################################*/ struct ioctl_entry { int request; u_int32_t size_type; }; static int ioctl_entry_compare(void *e, void *request) { return ( ((struct ioctl_entry *)e)->request == *((int *)request)); } #define ioctl_search(request) (list_search(ioctl_list, ioctl_entry_compare, &(request))) #define ioctl_getel(index) ((struct ioctl_entry *)list_getel(ioctl_list, (index))) #define free_ioctl_req(ioctl_req) free(ioctl_req) void rscs_ioctl_register_request(int request, u_int32_t rw, u_int32_t size) { struct ioctl_entry *req; req = calloc(1, sizeof(struct ioctl_entry)); assert(req != NULL); req->request = request; req->size_type = rw | size; list_add(ioctl_list, req); } #ifndef RSCDEBUG static #endif struct iovec *rscs_manage_ioctl_request(struct ioctl_req_header *ioctl_req) { struct ioctl_entry *res; struct ioctl_resp_header *resp; struct iovec *v; int index; v = calloc(1, sizeof(struct iovec)); assert(v != NULL); resp = calloc(1, sizeof(struct ioctl_resp_header)); assert(resp != NULL); ioctl_req->req_ioctl_request = ntohl(ioctl_req->req_ioctl_request); index = ioctl_search(ioctl_req->req_ioctl_request); res = ioctl_getel(index); /* I create the answer */ resp->resp_type = RSC_IOCTL_RESP; resp->resp_size = htonl(sizeof(struct ioctl_resp_header)); if(res == NULL) { /* Negative answer */ resp->resp_size_type = htonl(IOCTL_UNMANAGED); } else { /* Positive one */ resp->resp_size_type = htonl(res->size_type); } v[0].iov_base = resp; v[0].iov_len = ntohl(resp->resp_size); return v; } /**************************************************************************/ /*** ADJUST READ POINTERS ***/ /**************************************************************************/ <% nr_all.each_umview do |syscall| %> <% if syscall.has_read_args? %> /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void <%= syscall.name %>_adjust_read_pointers(struct <%= syscall.name %>_req *<%= syscall.name %>_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) <%= syscall.name %>_req) + sizeof(struct <%= syscall.name %>_req); <% syscall.each_read_arg do |arg| size = arg.size("#{syscall.name}_req->") %> if(<%= syscall.name %>_req-><%= arg.name %> != NULL) { <%= syscall.name %>_req-><%= arg.name %> = var_data; var_data += <%= size %>; } <% end %> } <% end %> <% end %> # if 0 /* I need also of the resp structure because the space for the buffer that need to be * send back are allocated after it. */ static void recvmsg_adjust_read_pointers(struct recvmsg_req *recvmsg_req) { struct msghdr *msg; int i; void *var_data; msg = &(recvmsg_req->msg); /* "var_data" points to the next data to read */ printf("msg = %p\n", msg); var_data = ((void *) recvmsg_req) + sizeof(struct recvmsg_req); printf("var_data: begin = %p\n", var_data); if(msg->msg_name != NULL) { msg->msg_name = var_data; var_data += msg->msg_namelen; } printf("var_data: after msg_name = %p\n", var_data); if(msg->msg_iov != NULL) { msg->msg_iov = calloc(msg->msg_iovlen, sizeof(struct iovec)); /*FIXME: maybe a control on the result of calloc? */ for(i = 0; i < msg->msg_iovlen; i++) { (msg->msg_iov[i]).iov_len = *((size_t *)var_data); (msg->msg_iov[i]).iov_base = malloc((msg->msg_iov[i]).iov_len); var_data += sizeof((msg->msg_iov[i]).iov_len); } } printf("var_data: after msg_iov = %p\n", var_data); if(msg->msg_control != NULL) msg->msg_control = var_data; printf("var_data: after msg_control = %p\n", var_data); } #endif /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void ioctl_adjust_read_pointers(struct ioctl_req *ioctl_req, u_int32_t size_type) { void *var_data; if(ioctl_req->arg != NULL && (size_type & IOCTL_R)) { /* "var_data" points to the next data to read */ var_data = ((void *) ioctl_req) + sizeof(struct ioctl_req); RSC_DEBUG(RSCD_REQ_RESP, "ioctl_req->arg = %p", var_data); ioctl_req->arg = var_data; } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void fcntl_adjust_read_pointers(struct fcntl_req *fcntl_req) { if(fcntl_req->cmd_type & FCNTL_3RD_FLOCK_R) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) fcntl_req) + sizeof(struct fcntl_req); RSC_DEBUG(RSCD_REQ_RESP, "fcntl_req->third.lock = %p", var_data); if(fcntl_req->third.lock != NULL) fcntl_req->third.lock = var_data; } } /**************************************************************************/ /*** ADJUST WRITE POINTERS ***/ /**************************************************************************/ <% nr_all.each_umview do |syscall| %> <% if syscall.has_write_args? %> /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void <%= syscall.name %>_adjust_write_pointers(struct <%= syscall.name %>_req *<%= syscall.name %>_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); <% syscall.each_write_arg do |arg| %> if(<%=syscall.name%>_req-><%=arg.name%> != NULL) { if(my_arch == client_arch) { <% if(arg.read?) %> /* '<%= syscall.name %>_req-><%= arg.name %>' contains the old value */ memcpy(var_data, <%= syscall.name %>_req-><%= arg.name %>, <%= arg.size("#{syscall.name}_req->") %>); <% end %> <%= syscall.name %>_req-><%= arg.name %> = var_data; var_data += <%= arg.size("#{syscall.name}_req->") %>; } else { <% if(not arg.read?) %> <%= syscall.name %>_req-><%= arg.name %> = calloc(1, <%= aconv_size(arg, "my_arch", "client_arch", true, "#{syscall.name}_req->") %>); assert(<%= syscall.name %>_req-><%= arg.name %> != NULL); <% end %> } } <% end %> #if 0 <% syscall.each_write_arg do |arg| size = arg.size("#{syscall.name}_req->") %> RSC_DEBUG(RSCD_REQ_RESP, "<%=syscall.name%>_req-><%=arg.name%> = %p", var_data); if(<%=syscall.name%>_req-><%=arg.name%> != NULL) { <% # Is a value result argument? if(arg.read?) %> /* '<%= syscall.name %>_req-><%= arg.name %>' contains the old value */ memcpy(var_data, <%= syscall.name %>_req-><%= arg.name %>, <%= arg.size("#{syscall.name}_req->") %>); <% end %> <%= syscall.name %>_req-><%= arg.name %> = var_data; var_data += <%= size %>; } <% end %> #endif } <% end %> <% end %> /* Adjusts the write pointers of the request, the space pointed by them * is stored in the response (in fact these informations are sent back to the client). * Note: read/write pointers are sent by the client and have to be sent back to it after * the system call, this kind of arguments are usually called "value-result". So, for * these arguments, their content is copied from the request to the response, in this * way when the syscall change it, the new value resides already in the response. */ #ifndef RSCDEBUG static #endif void ioctl_adjust_write_pointers(struct ioctl_req *ioctl_req, struct sys_resp_header *resp_header, int resp_size, u_int32_t size_type, enum arch client_arch) { void *var_data; if(ioctl_req->arg != NULL && (size_type & IOCTL_W)) { var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); RSC_DEBUG(RSCD_REQ_RESP, "ioctl_req->arg = %p", var_data); /* if 'ioctl_req->arg' is also a read pointer, I need to copy its content */ if(size_type & IOCTL_R) memcpy(var_data, ioctl_req->arg, (size_type & IOCTL_LENMASK)); ioctl_req->arg = var_data; } } /* Adjusts the write pointers of the request, the space pointed by them * is stored in the response (in fact these informations are sent back to the client). * Note: read/write pointers are sent by the client and have to be sent back to it after * the system call, this kind of arguments are usually called "value-result". So, for * these arguments, their content is copied from the request to the response, in this * way when the syscall change it, the new value resides already in the response. */ #ifndef RSCDEBUG static #endif void fcntl_adjust_write_pointers(struct fcntl_req *fcntl_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; if( (fcntl_req->cmd_type & FCNTL_3RD_FLOCK_W) && (fcntl_req->third.lock != NULL)) { /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); RSC_DEBUG(RSCD_REQ_RESP, "fcntl_req->third.lock = %p", var_data); /* 'fcntl_req->third.lock' contains the old value */ memcpy(var_data, fcntl_req->third.lock, sizeof(struct flock)); fcntl_req->third.lock = var_data; } } /**************************************************************************/ /*** EXECUTION FUNCTIONS ***/ /**************************************************************************/ static void rscs_serialize_resp_hdr(struct sys_resp_header *resp) { resp->resp_rsc_const = htons(resp->resp_rsc_const); resp->resp_size = htonl(resp->resp_size); resp->resp_retval = htonl(resp->resp_retval); resp->resp_errno = htonl(resp->resp_errno); } <% nr_all.each_umview do |syscall| %> struct sys_resp_header *rscs_pre_<%= syscall.name %>_exec(void *req, enum arch client_arch) { struct <%= syscall.name %>_req *<%= syscall.name %>_req; struct sys_resp_header *resp_header; int resp_size; <%= syscall.name %>_req = (struct <%= syscall.name %>_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(<%= syscall.name %>_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(<%=syscall.name%>_req), rsc2str(<%=syscall.name%>_req->req_rsc_const), <%=syscall.name%>_req->req_rsc_const, <%=syscall.name%>_req->req_type, <%=syscall.name%>_req->req_type, <%=syscall.name%>_req->req_size, <%=syscall.name%>_req->req_size); if(<%= syscall.name %>_req->req_size < sizeof(struct <%= syscall.name %>_req)) return NULL; <% list_str = syscall.args.collect {|arg| "#{arg.name} = #{arg.type.printf_conv_spec} (0x%lX)"} list_arg = syscall.args.collect { |arg| name = "#{syscall.name}_req->#{arg.name}"; [name, name] }.flatten%> RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: <%= list_str.join('; ') %>", <%= list_arg.join(', ')%>); <% if syscall.has_read_args? %> /* Adjusts the read pointers of the request */ <%= syscall.name %>_adjust_read_pointers(<%= syscall.name %>_req); <% end %> resp_size = sizeof(struct sys_resp_header); <% syscall.write_args.each do |arg| %> if(<%=syscall.name%>_req-><%=arg.name%> != NULL) { <% # If the size is a var, I use it for the right size of the buffer if(arg.is_size_a_var?) %> /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by '<%=arg.size_var.name%>' argument. */ <% if(arg.is_size_a_var?) if(arg.type.pointer? and (arg.type.type !~ /void \*/ or arg.type.type !~ /char \*/)) %> /* The client can have changed the value of <%=arg.size_var %> if it was less than * the size of <%=arg.name%> into server arch. So If <%=arg.size_var %> is equal * to this value I need to change it to the right value on client arch. */ if(<%=arg.size("#{syscall.name}_req->")%> == <%=aconv_size(arg, "client_arch", "my_arch", true, "#{syscall.name}_req->")%>) { resp_size += <%=aconv_size(arg, "my_arch", "client_arch", true, "#{syscall.name}_req->")%>; } else { resp_size += <%=arg.size("#{syscall.name}_req->")%>; } <% else %> resp_size += <%=arg.size("#{syscall.name}_req->")%>; <% end end %> <% else %> resp_size += <%=aconv_size(arg, "my_arch", "client_arch", true, "#{syscall.name}_req->")%>; <% end %> } <% end %> resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; <% if syscall.has_write_args? %> /* Adjusts the write pointers of the request */ <%= syscall.name %>_adjust_write_pointers(<%= syscall.name %>_req, resp_header, resp_size, client_arch); <% end %> RSC_EXDUMP(RSCD_REQ_RESP, <%=syscall.name%>_req, <%=syscall.name%>_req->req_size); /* resp_header->resp_type = <%= syscall.name %>_req->req_type; */ resp_header->resp_rsc_const = <%= syscall.name %>_req->req_rsc_const; return resp_header; } int rscs_exec_<%= syscall.name %>(void *request) { int ret; struct <%= syscall.name %>_req *req = (struct <%= syscall.name %>_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); <% args_list = syscall.args.collect{|arg| "req->#{arg.name}"} # The syscall statfs64 and fstatfs64 takes and additional argument when # called with syscall(). This argument is the sizeof the struct statfs64, # and is not present in the statfs64()/fstatfs64() functions. if(syscall.rsc == "__RSC_statfs64" || syscall.rsc == "__RSC_fstatfs64") args_list.insert(1, "sizeof(struct statfs64)") end %> <% if syscall.sys.nil? %> ret = syscall(nr_and_sys->nr, <%= args_list.join(', ') %>); <% else %> #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, <%= args_list.join(', ') %>); #else <% args_list = args_list.collect{|arg| "(unsigned long)(#{arg})"} %> { unsigned long args[] = { <%= args_list.join(",\n\t\t\t") %> }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif <% end %> return ret; } struct iovec*rscs_post_<%= syscall.name %>_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ <% if syscall.has_write_args? %> /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct <%= syscall.name %>_req *<%= syscall.name %>_req = (struct <%= syscall.name %>_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); <% syscall.write_args.each do |arg| %> <%=aconv(arg, "my_arch", "client_arch", "mem", true, "#{syscall.name}_req->") %>; mem += <%=aconv_size(arg, "my_arch", "client_arch", true, "#{syscall.name}_req->")%>; <% # If it's not a value-result argument, I need to free it if(not arg.read?) %> free(<%= syscall.name %>_req-><%=arg.name%>); <% end %> <% end %> } <% end %> <% has_size_retval = syscall.write_args.inject(false) {|val, arg| val ||= arg.size_retval? } if(has_size_retval) size_list = syscall.write_args.select{|arg| !arg.size_retval?} write_args_retval = syscall.write_args.select{|arg| arg.size_retval?}%> /* If the right size of the buffer is returned by the system call, * I use it to send back only the part of the buffer with data */ /* resp->resp_size = sizeof(struct sys_resp_header); */ <% size_list.each do |arg| %> if(<%=syscall.name%>_req != NULL) resp->resp_size += <%=arg.size("#{syscall.name}_req->")%>; <% end %> /* Note: I suppose that the buffer is the last data into the response, * So I can subtract the unused buffer space, otherwise this doesn't * work. */ if( resp->resp_retval >= 0 ) { <% write_args_retval.each do |arg| %> if(((struct <%=syscall.name%>_req *)req)-><%=arg.name%> != NULL) resp->resp_size -= (<%=arg.size("((struct #{syscall.name}_req *)req)->")%> - resp->resp_retval); <% end %> } <% end%> RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } <% end %> struct sys_resp_header *rscs_pre_ioctl_exec(void *req, enum arch client_arch) { struct ioctl_req *ioctl_req; struct sys_resp_header *resp_header; int resp_size, index; struct ioctl_entry *ioctle; ioctl_req = (struct ioctl_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(ioctl_req->req_type)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(ioctl_req), rsc2str(ioctl_req->req_rsc_const), ioctl_req->req_rsc_const, ioctl_req->req_type, ioctl_req->req_type, ioctl_req->req_size, ioctl_req->req_size); if(ioctl_req->req_size < sizeof(struct ioctl_req)) return NULL; index = ioctl_search(ioctl_req->request); ioctle = ioctl_getel(index); assert(ioctle != NULL); RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: d = %ld (0x%lX); request = %ld (0x%lX); arg = %p (0x%lX)", ioctl_req->d, ioctl_req->d, ioctl_req->request, ioctl_req->request, ioctl_req->arg, ioctl_req->arg); /* Adjusts the read pointers of the request */ ioctl_adjust_read_pointers(ioctl_req, ioctle->size_type); resp_size = sizeof(struct sys_resp_header); if(ioctl_req->arg != NULL && (ioctle->size_type & IOCTL_W)) resp_size += ioctle->size_type & IOCTL_LENMASK; resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ ioctl_adjust_write_pointers(ioctl_req, resp_header, resp_size, ioctle->size_type, client_arch); /* resp_header->resp_type = ioctl_req->req_type; */ resp_header->resp_rsc_const = ioctl_req->req_rsc_const; return resp_header; } int rscs_exec_ioctl(void *request) { int ret; struct ioctl_req *req = (struct ioctl_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->d, req->request, req->arg); return ret; } struct iovec *rscs_post_ioctl_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_fcntl_exec(void *req, enum arch client_arch) { struct fcntl_req *fcntl_req; struct sys_resp_header *resp_header; int resp_size; fcntl_req = (struct fcntl_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(fcntl_req->req_type)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(fcntl_req), rsc2str(fcntl_req->req_rsc_const), fcntl_req->req_rsc_const, fcntl_req->req_type, fcntl_req->req_type, fcntl_req->req_size, fcntl_req->req_size); if(fcntl_req->req_size < sizeof(struct fcntl_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX); cmd = %ld (0x%lX);", fcntl_req->fd, fcntl_req->fd, fcntl_req->cmd, fcntl_req->cmd); resp_size = sizeof(struct sys_resp_header); if(fcntl_req->cmd_type & FCNTL_3RD_FLOCK_W) resp_size += sizeof(struct flock); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* If there is a third argument and it is a 'struct flock' pointer */ if(fcntl_req->cmd_type & FCNTL_3RD_FLOCK) { /* Adjusts the read pointers of the request */ fcntl_adjust_read_pointers(fcntl_req); /* Adjusts the write pointers of the request */ fcntl_adjust_write_pointers(fcntl_req, resp_header, resp_size, client_arch); } resp_header->resp_rsc_const = fcntl_req->req_rsc_const; return resp_header; } int rscs_exec_fcntl(void *request) { int ret; struct fcntl_req *req = (struct fcntl_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); if(req->cmd_type & FCNTL_NO_3RD_ARG) { ret = syscall(nr_and_sys->nr, req->fd, req->cmd); } else if(req->cmd_type & FCNTL_3RD_LONG) { ret = syscall(nr_and_sys->nr, req->fd, req->cmd, req->third.arg); } else { ret = syscall(nr_and_sys->nr, req->fd, req->cmd, req->third.lock); } return ret; } struct iovec *rscs_post_fcntl_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } /*########################################################################*/ /*## ##*/ /*## REQUEST MANAGEMENT ##*/ /*## ##*/ /*########################################################################*/ #if 0 void *req_func_recvmsg(void *req) { struct recvmsg_req *recvmsg_req; struct recvmsg_resp *recvmsg_resp; struct nr_and_sys *nr_and_sys; void *data, *new_ptr; int read_buffer_size, i; recvmsg_req = (struct recvmsg_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s (%p):", rsc2str(recvmsg_req->req_type), recvmsg_req); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader: req_type = %d (0x%X); req_size = %d (0x%X) bytes", recvmsg_req->req_type, recvmsg_req->req_type, recvmsg_req->req_size, recvmsg_req->req_size); RSC_DEBUG(RSCD_REQ_RESP, "\ts = %ld; msg = * ; flags = %ld", recvmsg_req->s, recvmsg_req->flags); recvmsg_adjust_read_pointers(recvmsg_req); RSC_PRINT_MSGHDR(RSCD_REQ_RESP, &(recvmsg_req->msg)); recvmsg_resp = malloc(sizeof(struct recvmsg_resp)); if(recvmsg_resp == NULL) return NULL; bzero(recvmsg_resp, sizeof(struct recvmsg_resp)); recvmsg_resp->resp_type = recvmsg_req->req_type; if( (nr_and_sys = rsc2nr(recvmsg_req->req_type, my_arch)) == NULL) return NULL; { unsigned long args[] = {(unsigned long)(recvmsg_req->s), (unsigned long)(&(recvmsg_req->msg)), (unsigned long)(recvmsg_req->flags)}; recvmsg_resp->resp_retval = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } recvmsg_resp->resp_errno = errno; /* I need to add the buffers read */ read_buffer_size = 0; if(recvmsg_resp->resp_retval > 0) { for(i = 0; i < recvmsg_req->msg.msg_iovlen; i++) read_buffer_size += recvmsg_req->msg.msg_iov[i].iov_len; } recvmsg_resp->resp_size = sizeof(struct recvmsg_resp) + read_buffer_size; if(recvmsg_req->msg.msg_control != NULL) recvmsg_resp->resp_size += recvmsg_req->msg.msg_controllen; if((new_ptr = realloc(recvmsg_resp, recvmsg_resp->resp_size)) == NULL) return NULL; recvmsg_resp = new_ptr; data = ((void *)recvmsg_resp) + sizeof(struct recvmsg_resp); for(i = 0; i < recvmsg_req->msg.msg_iovlen; i++) { memcpy(data, recvmsg_req->msg.msg_iov[i].iov_base, recvmsg_req->msg.msg_iov[i].iov_len); data += recvmsg_req->msg.msg_iov[i].iov_len; } if(recvmsg_req->msg.msg_control != NULL) memcpy(data, recvmsg_req->msg.msg_control, recvmsg_req->msg.msg_controllen); recvmsg_resp->msg_controllen = recvmsg_req->msg.msg_controllen; RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s (%p):", rsc2str(recvmsg_resp->resp_rsc_const), recvmsg_resp); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader: resp_type = %d (0x%X); resp_size = %d (0x%X) bytes; resp_retval = %d (0x%X); resp_errno = %d (0x%X)", recvmsg_resp->resp_type, recvmsg_resp->resp_type, recvmsg_resp->resp_size, recvmsg_resp->resp_size, recvmsg_resp->resp_retval, recvmsg_resp->resp_retval, recvmsg_resp->resp_errno, recvmsg_resp->resp_errno); return recvmsg_resp; } #endif /*########################################################################*/ /*## ##*/ /*## PUBLIC FUNCTIONS ##*/ /*## ##*/ /*########################################################################*/ int rscs_init(enum arch server_arch) { my_arch = server_arch; rscs_es_init(); ioctl_list = init_list(100); if(ioctl_list == NULL) return -1; return 0; } void rsc_server_teardown() { my_arch = ACONV_ARCH_ERROR; teardown_list(ioctl_list, free); ioctl_list = NULL; } struct iovec*rscs_manage_request(int client_arch, void *request) { struct iovec*ret_data; struct req_header *req_hd; req_hd = (struct req_header *)request; req_hd->req_size = ntohl(req_hd->req_size); if( req_hd->req_type == RSC_IOCTL_REQ) { RSC_DEBUG(RSCD_REQ_RESP,"RSC IOCTL Request management"); ret_data = rscs_manage_ioctl_request((struct ioctl_req_header *)request); } else if( req_hd->req_type == RSC_SYS_REQ) { struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; rscs_pre_exec pre_exec_f; int ret; rscs_exec exec_f; rscs_post_exec post_exec_f; req_hd = (struct sys_req_header *)request; /* I convert the filed of the RSC SYS request header */ req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); RSC_DEBUG(RSCD_REQ_RESP,"RSC SYS Request management: %X(%s)", req_hd->req_rsc_const, rsc2str(req_hd->req_rsc_const)); if( req_hd->req_rsc_const < __RSC_FIRST || req_hd->req_rsc_const > __RSC_LAST ) return NULL; pre_exec_f = rscs_pre_exec_table[req_hd->req_rsc_const]; exec_f = rscs_exec_table[req_hd->req_rsc_const]; post_exec_f = rscs_post_exec_table[req_hd->req_rsc_const]; if(pre_exec_f == NULL || exec_f == NULL || post_exec_f == NULL) return NULL; if((resp_hd = pre_exec_f(request, client_arch)) == NULL) return NULL; ret = exec_f(request); ret_data = post_exec_f(request, resp_hd, ret, errno, client_arch); } else { /* Bad request type */ ret_data = NULL; } return ret_data; } umview-0.8.2/um_rsc/librsc_templates/input/templates/server.h0000644000175000017500000000522311753517212023557 0ustar renzorenzo<%# This is part of RSC file generator program server.h: template file for server side functions header Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/include/" %> <% @@filename = "rsc_server.h" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: server side functions header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_SERVER_REQ_RESP_H__ #define __RSC_SERVER_REQ_RESP_H__ #ifndef __USE_LARGEFILE64 #define __USE_LARGEFILE64 #endif #include "aconv.h" #include "rsc_messages.h" #include "rsc_consts.h" #define CONN_OK 0 #define CONN_ERROR -1 #define CONN_CLOSED -2 #define CONN_HANDLER_NOT_FOUND -3 #define CONN_BAD_REQ_TYPE -4 int rscs_init(enum arch server_arch); void rsc_server_teardown(); struct iovec*rscs_manage_request(int client_arch, void *request); /* Ioctl request registration */ void rscs_ioctl_register_request(int request, u_int32_t rw, u_int32_t size); /*************************************************/ /* EVENT SUBSCRIPTION */ /*************************************************/ struct rsc_es_ack *rscs_es_manage_msg(int esfd, void *data); struct rsc_es_resp *rscs_es_event_occured(int esfd, int mfd, int event); #endif /* __RSC_SERVER_REQ_RESP_H__ */ umview-0.8.2/um_rsc/librsc_templates/input/templates/client.c0000644000175000017500000013432111753517212023524 0ustar renzorenzo<%# This is part of RSC file generator program client.c: template file for client side functions Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <%# These first two lines initialize two global variable used by the stub controller # to know: # - the relative path respect the base directory taken in input by the compiler # - the output filename # For example the output file of this template must be saved as "src/rsc_client.c". %> <% @@librsc_relative_path = "/src/" %> <% @@filename = "rsc_client.c" %> <%# This instruction includes an external Ruby file, it's like the C #include directive %> <% require "common_code.rb" %> <%# This is the license of the outputted file %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: client side functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #define _GNU_SOURCE #include #include #include "registered_callbacks.h" #include "debug.h" #include "utils.h" #include "rsc_client.h" #include "rsc_consts.h" #include "event_sub.h" #include #include #include #include #include #include #include #include <%# Creates the list of headers "header". %> <% headers = [] # For each system call, its header list is added to "headers" array nr_all.each_umview { |syscall| headers << syscall.headers } # headers is now an "array of array", the "flatten!" method transforms "headers" # in a flatted array. Then its contents are sorted, the duplicates and # "utime.h" header are removed (this header is removed for some conflicts created # by the inclusion of another header defining the same data types.) headers.flatten!.sort!.uniq!.delete("utime.h") # Each entry inside "headers" is transformed into the C string: "#include
" headers.collect!{ |hd| "#include <#{hd}>" } %> <%# The content of "header" is output in the final file, after each entry a '\n' is outputted %> <%= headers.join("\n") %> <%# This is normal C code, outputted as is into the final file %> #ifndef RSCDEBUG struct ioctl_cache_el { int request; u_int32_t size_type; struct ioctl_cache_el *prev; struct ioctl_cache_el *next; }; struct ioctl_cache { struct ioctl_cache_el *first; struct ioctl_cache_el *last; int size; int nentry; }; #else #include "test_rsc_client.h" #endif #ifndef RSCDEBUG static #endif struct ioctl_cache *ioctl_cache_init(int size); static enum arch my_arch; static enum arch server_arch; static int rsc_sockfd; static int rsc_event_sub_fd; #ifndef RSCDEBUG static #endif struct ioctl_cache *ioctl_cache; int rscc_init(int client_fd, int event_sub_fd, struct reg_cbs **rc, enum arch c_arch, enum arch s_arch) { if(c_arch < ARCH_FIRST || c_arch > ARCH_LAST) return -1; if(s_arch < ARCH_FIRST || s_arch > ARCH_LAST) return -1; rsc_sockfd = client_fd; my_arch = c_arch; server_arch = s_arch; rsc_event_sub_fd = event_sub_fd; /* I init the event subscribe sub-module if there is a valid fd */ if(event_sub_fd >= 0 && rc != NULL) { if((*rc = rscc_es_init(event_sub_fd)) == NULL) return -1; } /* I init the ioctl cache */ ioctl_cache = ioctl_cache_init(20); if(ioctl_cache == NULL) return -1; return 0; } /*########################################################################*/ /*## ##*/ /*## Remote System Call FUNCTIONS - Client side ##*/ /*## ##*/ /*########################################################################*/ /*##########################################################*/ /*## ##*/ /*## REQUEST CREATION FUNCTIONS ##*/ /*## ##*/ /*##########################################################*/ <%# From here stats the main loop. The stub compiler provides to each template an array called "nr_all", # containing all the system calls gathered from the parsing of the four unistd.h files. The class of # "nr_all" is Syscall::ConstantList. # The method "each_umview" is an iterator, it iterates over the only system call supported by UMView; # the list of these system call is provided by the parsing of the IDL file. # Inside the block of the iterator (after the "do" keyword) the current system call is provided; its # class is Syscall::Constant. # In conclusion, the list of all the system call supported by UMView is iterated, for each iteration # the current element ("syscall") is provided inside the block %> <% nr_all.each_umview do |syscall| %> <%# This is an example of the use of the syscall object: the system call name is # generate inside a C comment%> /* This function build the request for the system call '<%= syscall.name %>' */ <%# Here the system call name is used to generate the name of the specific function. # The "syscall.args" expression returns the system call specific arguments, they are joined by a comma and outputted into # the function argument list %> struct iovec *rscc_create_<%= syscall.name %>_request(int *total_size, int *iovec_count, <%= syscall.args.join(', ') %>) { struct <%=syscall.name%>_req *req; enum rsc_constant rsc_const; int req_size; <%# If the system call has some read pointer arguments, the "int i" is defined %> <% if syscall.has_read_args? %> int i; <% end %> struct iovec *v; size_t vcount; <%# This was a hack added recently. @@special_syscall is a hash table defined into the # "common_code.rb" file, they keys are the __RSC_* constants of some system calls # not supported in all the architectures, they values are arrays listing in which # architectures the system call is NOT supported. # If the syscall.rsc constant is defined inside the hash table, the following code # generates a string saved inside the variable "cond". This string is a set of # or-separated equality tests. %> <% # Tests if the syscall.rsc constant is defined inside the hash table if @@special_syscall[syscall.rsc] cond = @@special_syscall[syscall.rsc].collect { |cost| # Each constant inside the array associated with the "syscall.rsc" key # is converted into the correspondent LibAConv architecture constant if cost == "__powerpc__" next "ACONV_PPC" elsif cost == "__x86_64__" next "ACONV_X86_64" elsif cost == "__powerpc64__" next "ACONV_PPC_64" end # The next collect transforms the constant into an equality, and these # equalities are joined by an "or" operator. }.collect{|aconv| "server_arch == #{aconv}"}.join(" || ") %> /* If the destination architecture doesn't support this syscall, I return immediately */ <%# Print the conditions inside the "if" %> if(<%=cond %>) return NULL; <% end %> <%# Here there is some code to manage the read pointer arguments, if they exist. %> <% if syscall.has_read_args? ### If the system call has some read pointers, I define one auxiliary C variable ### for each of them; the name of these variables is: ### _value ### These variables are defined to manage NULL read pointers. # I iterate over the read pointers syscall.read_args.each do |arg| # I define the variable only of those pointer for which # there is a variable containing their size. # The method "is_size_a_var?" returns true if exists for the given # read pointer argument "arg" a "size variable" if(arg.is_size_a_var?) # If the "size variable" is a pointer, it's necessary to remove the '*' character # from the type outputted. For this reason there is an if, and in the true-branch # there is a "sub(/\*/, '')" is called; The "strip" method removes the # leading and trailing white spaces. if(arg.size_var.type.pointer?) %> <%= arg.size_var.type.type.sub(/\*/, '').strip%> <%=arg.size_var.name%>_value; <% else %> <%= arg.size_var.type.type %> <%=arg.size_var.name%>_value; <% end %> <% else %> <%# If "arg" has not a "size variable" (maybe "arg" is a string), a int variable is defined %> int <%=arg.name%>_size_value; <% end end # end of "syscall.read_args.each do |arg|" %> <% ### If the pointed memory size is contained in another variable, which is a pointer ### and this pointer is NULL, there is an error. syscall.args.each do |arg| if(arg.type.pointer? && arg.is_size_a_var? && arg.size_var.type.pointer?) %> /* The size of '<%=arg.name%>' is contained in the memory pointed by '<%=arg.size_var.name%>', * but if the latter is NULL I cannot know the size of '<%=arg.name%>'. */ if(<%=arg.name%> != NULL && <%=arg.size_var.name%> == NULL) return NULL; <% end end end # end of "if syscall.has_read_args?" %> req_size = sizeof(struct <%=syscall.name%>_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); <%# For each argument, I call the function "aconv_size" defined into "common_code.rb" file. # This function returns a string with the calling of the right LibAConv size function for # the type of "arg". %> <% syscall.args.each do |arg| %> req_size += <%=aconv_size(arg, "my_arch", "server_arch")%>; <% end %> } req = calloc(1, req_size); if(req == NULL) return NULL; <%# Another hack added to support the special system calls %> <% if @@special_syscall[syscall.rsc] # I get the values given the "syscall.rsc" key. For each value, # I save the macro string into "str". @@special_syscall[syscall.rsc].each_with_index do |c, i| str = "#ifdef #{c}" str = "#elif defined #{c}" if i != 0 %> <%# I print the string %> <%=str%> /* The system call is not defined in this architecture, so I return NULL */ return NULL; <% end %> #else <% end # end of "if @@special_syscall[syscall.rsc]" %> /* I get the __RSC_* constant */ <%# If it's a network system call the "sys?" methods returns true because a SYS_* constant is defined %> <% if syscall.sys? %> #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_<%=syscall.name%>, <%= syscall.sys? ? syscall.sys : NO_VALUE %>, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, <%= syscall.sys? ? syscall.sys : NO_VALUE %>, my_arch)) == __RSC_ERROR ) { #endif <%# The array "@@x86_64_without64" is defined into the "common_code.rb" file. If syscall.nr is contained into that # list I need to remove the trailing "64" before print the constant. %> <% elsif @@x86_64_without64.include?(syscall.nr) %> #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_<%=syscall.name.sub(/64/, '')%>, <%= syscall.sys? ? syscall.sys : NO_VALUE %>, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(<%= syscall.sys? ? "__NR_socketcall" : "__NR_#{syscall.name}"%>, <%= syscall.sys? ? syscall.sys : NO_VALUE %>, my_arch)) == __RSC_ERROR ) { #endif <% else %> if( (rsc_const = nr2rsc(<%= syscall.sys? ? "__NR_socketcall" : "__NR_#{syscall.name}"%>, <%= syscall.sys? ? syscall.sys : NO_VALUE %>, my_arch)) == __RSC_ERROR ) { <% end %> free(req); return NULL; } <%# I print the closing #endif %> <% if @@special_syscall[syscall.rsc] %> #endif <% end %> req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; <% if(syscall.has_read_args?) # For each read pointer argument "arg" I initialize two variables used some rows below. syscall.read_args.each do |arg| # I save the size variable name defined before into "size_arg_name" argument. size_arg_name = arg.is_size_a_var? ? "#{arg.size_var.name}_value" : "#{arg.name}_size_value" # If save the size value of the pointer into "size_arg_value". if(arg.is_size_a_var? && arg.size_var.type.pointer?) size_arg_value = "*#{arg.size_var.name}" else size_arg_value = aconv_size(arg, "my_arch", "server_arch", true) end %> /* I manage the case in which the read pointer is NULL*/ <%# I use the "name" method on "arg" to get the name of the argument. # I use the previously defined "size_arg_name" and "size_arg_value" to initialize # the size variables %> if(<%=arg.name%> == NULL) <%=size_arg_name%> = 0; else <%=size_arg_name%> = <%=size_arg_value%>; <% end end %> <%# I create a list of all the size variable. To do so I select only the read arguments # and I generate the variable names %> <% size_list = syscall.args.select{|arg| arg.read?}.collect do |arg| if(arg.is_size_a_var?) "#{arg.size_var.name}_value" else "#{arg.name}_size_value" end end %> <%# If the list isn't empty, I print it. To do so I append a '+' sign after each element # using the "join" method %> <% if not size_list.empty? %> req->req_size += <%="#{size_list.join(' + ')}"%>; <% end %> /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { <%# I iterate over all the arguments to generate the assignment code %> <% syscall.args.each do |arg| # If "arg" is an array, I generate the assignment code for each item if arg.type.array? %> if(<%=arg.name%> != NULL) { <% arg.type.array_size.times do |i| %> (req-><%=arg.name%>)[<%=i%>] = <%=arg.name%>[<%=i%>]; <% end %> } <% else %> req-><%=arg.name%> = <%=arg.name%>; <% end end %> } else { void *mem = (void *)req + sizeof(struct sys_req_header); <%# I define some new variables %> <% syscall.args.each do |arg| # If the argument IS a "size variable" and it's not a pointer, I save # into "parg" the argument for which it is the "size variable". if (arg.is_a_size_var? and not arg.type.pointer?) parg = arg.pointer_arg # If "parg" is a pointer and it's type is different from "void *" or "char *", # I define the new C variable if(parg.type.pointer? and (parg.type.type !~ /void \*/ and parg.type.type !~ /char \*/)) %> <%=arg.type%> <%=arg.name%>_new = <%=arg.name%>; <% end end end%> <%# For each argument I call the LibAConv functions %> <% syscall.args.each do |arg| if arg.type.array? %> if(<%=arg.name%> != NULL) { <%=aconv(arg, "my_arch", "server_arch", "mem")%>; } <% else %> <% if (arg.is_a_size_var? and not arg.type.pointer?) parg = arg.pointer_arg if(parg.type.pointer? and (parg.type.type !~ /void \*/ and parg.type.type !~ /char \*/)) %> if(<%=arg.name%> < <%=aconv_size(parg, "my_arch", "server_arch", true)%>) <%=arg.name%>_new = <%=aconv_size(parg, "my_arch", "server_arch", true)%>; <%=aconv(arg, "my_arch", "server_arch", "mem", false, "", "_new")%>; mem += <%=aconv_size(arg, "my_arch", "server_arch")%>; <% else %> <%=aconv(arg, "my_arch", "server_arch", "mem", false)%>; mem += <%=aconv_size(arg, "my_arch", "server_arch")%>; <% end else %> <%=aconv(arg, "my_arch", "server_arch", "mem", false)%>; mem += <%=aconv_size(arg, "my_arch", "server_arch")%>; <% end end end %> } <%# I calculate the value of the Vector Vount "vcount", used to allocate # the right memory area for the iovec structure. If there aren't read pointer # "vcount" is equal to 1 because there is only the request header, otherwise I # have to add the number of read pointers; to do so I select them from the argument # list and I get the size of the resulting array.%> <% if syscall.has_read_args? # the +1 is for the request structure vcount = 1 + syscall.args.select{|arg| arg.read?}.length else vcount = 1 end%> /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ <%# Here I save the value of the Ruby "vcount" into the C "vcount" %> vcount = <%=vcount%>; <% syscall.read_args.each do |arg| %> if(<%=arg.name%> == NULL) vcount--; <% end %> v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; <%# I assign to the iovec elements the read pointers %> <% if syscall.has_read_args? %> i = 1; <% end%> <% syscall.read_args.each_with_index do |arg, i| size_arg_name = arg.is_size_a_var? ? "#{arg.size_var.name}_value" : "#{arg.name}_size_value" %> if(<%=arg.name %> != NULL) { v[i].iov_len = <%=size_arg_name%>; if(my_arch == server_arch) { v[i].iov_base = <%=arg.name%>; } else { <% if (arg.is_a_size_var? and arg.type.pointer?) parg = arg.pointer_arg if(parg.type.pointer? and (parg.type.type !~ /void \*/ and parg.type.type !~ /char \*/)) %> <%=arg.type.type.sub(/\*/, "")%> <%=arg.name%>_new = *<%=arg.name%>; <% end end %> v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; <% if (arg.is_a_size_var? and arg.type.pointer?) parg = arg.pointer_arg if(parg.type.pointer? and (parg.type.type !~ /void \*/ and parg.type.type !~ /char \*/)) %> if(*<%=arg.name%> < <%=aconv_size(parg, "my_arch", "server_arch", true)%>) <%=arg.name%>_new = <%=aconv_size(parg, "my_arch", "server_arch", true)%>; <%= aconv(arg, "my_arch", "server_arch", "v[i].iov_base", true, "", "_new") %>; <% else %> <%= aconv(arg, "my_arch", "server_arch", "v[i].iov_base", true) %>; <% end else %> <%= aconv(arg, "my_arch", "server_arch", "v[i].iov_base", true) %>; <% end %> } *total_size += v[i].iov_len; <%# the following line prints a 'i++' if and only if the is not the last iteration %> <%= (i == (syscall.read_args.size - 1)) ? '' : 'i++;' %> } <% end %> *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct <%=syscall.name%>_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); <%# The "list_str" and "list_arg" contain, respectively, the formatted string to print and # the list of arguments. %> <% list_str = syscall.args.collect {|arg| "#{arg.name} = #{arg.type.printf_conv_spec} (0x%lX)"} list_arg = syscall.args.collect {|arg| name = "req->#{arg.name}"; [name, name] }.flatten%> RSC_DEBUG(RSCD_MINIMAL, "\tArguments: <%= list_str.join('; ') %>", <%= list_arg.join(', ')%>); return v; } <%# Here ends the iteration of over all the system calls supported by UMView to produce # the definitions of the rscc_create__request() functions %> <% end %> /*##########################################################*/ /*## ##*/ /*## RESPONSE MANAGEMENT FUNCTIONS ##*/ /*## ##*/ /*##########################################################*/ <%# Here the iteration over the system calls supported by UMView starts again, to produce # the code for the rscc_manage__response() functions %> <% nr_all.each_umview do |syscall| %> struct iovec *rscc_manage_<%=syscall.name%>_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, <%= syscall.args.join(', ')%>) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); <%# I insert the code to manage write arguments, if they exist %> <% if syscall.has_write_args?%> /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { <%#There is more than 1 read argument %> int i; vcount = <%= syscall.write_args.size%>; <% syscall.write_args.each do |arg| %> if(<%=arg.name%> == NULL) vcount--; <% end %> if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; <% read_sizes = [] # This iterator iterates over the write arguments and provides, # inside the block, of the index besides of the argument syscall.each_write_arg_with_index do |arg, j| # Here I control if the write pointer "arg" has the tag. if(arg.size_retval?) %> if(<%=arg.name%> != NULL && resp_header->resp_retval > 0) { v[i].iov_base = <%=arg.name%>; v[i].iov_len = resp_header->resp_retval; *nbytes += resp_header->resp_retval; <%= j == (syscall.args.select{|a| a.write?}.length - 1) ? "" : "i++;"%> } <% else%> if(<%=arg.name%> != NULL) { v[i].iov_base = <%=arg.name%>; v[i].iov_len = <%=arg.size%>; *nbytes += <%=arg.size%>; <%= j == (syscall.args.select{|a| a.write?}.length - 1) ? "" : "i++;"%> } <% end end read_sizes = syscall.args.select{|arg| arg.read?}.collect{|arg| arg.size} %> } } <% end %> *iovec_count = vcount; return v; } <% end %> /*##########################################################*/ /*## ##*/ /*## RSCC FUNCTIONS ##*/ /*## ##*/ /*##########################################################*/ <%# Here the iteration over the system calls supported by UMView starts again, to produce # the code for the rscc_() functions %> <% nr_all.each_umview do |syscall| %> int rscc_<%= syscall.name %>(<%= syscall.args.join(', ') %>) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_<%= syscall.name %>_request(&nbytes, &iovec_count, <%= syscall.args.collect{|arg| arg.name}.join(', ') %>); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall '<%= syscall.name %>'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_<%=syscall.name%>_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_<%=syscall.name%>_response(&resp_header, &iovec_count, &nbytes, <%=syscall.args.collect{|a| a.name}.join(', ')%>); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } <% end %> # if 0 int rsc_recvmsg(int s, struct msghdr *msg, int flags) { struct recvmsg_req recvmsg_req; struct recvmsg_resp recvmsg_resp; int nwrite, nread, i, total_size; size_t *iov_len_array; enum rsc_constant rsc_const; memset(&recvmsg_req, 0, sizeof(struct recvmsg_req)); if( (rsc_const = nr2rsc(__NR_socketcall, SYS_RECVMSG, my_arch)) == __RSC_ERROR ) return -1; recvmsg_req.req_rsc_const = htons(rsc_const); /* The size of the request is formed by: * 1. the size of structure recvmsg_req * 2. the size of the msg->msg_name and msg->msg_controll buffers * 3. the sizes of iov_base buffers inside the msg->msg_iov array */ total_size = sizeof(struct recvmsg_req); if(msg->msg_name != NULL) total_size += msg->msg_namelen; if(msg->msg_control != NULL) total_size += msg->msg_controllen; if(msg->msg_iov != NULL) total_size += msg->msg_iovlen * sizeof(size_t); recvmsg_req.req_size = htonl(total_size); recvmsg_req.s = s; memcpy(&(recvmsg_req.msg), msg, sizeof(recvmsg_req.msg)); recvmsg_req.flags = flags; printf("RECVMSG: Header: req_rsc_const = %d (%lX); req_size = %d (%lX)\n", ntohl(recvmsg_req.req_rsc_const), ntohl(recvmsg_req.req_rsc_const), ntohl(recvmsg_req.req_size), ntohl(recvmsg_req.req_size)); printf("s = %d, flags = %d\n", recvmsg_req.s, recvmsg_req.flags); RSC_PRINT_MSGHDR(RSCD_REQ_RESP, msg); /* I send the request header */ nwrite = write_n_bytes(rsc_sockfd, &recvmsg_req, sizeof(struct recvmsg_req)); if(nwrite != sizeof(struct recvmsg_req)) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, sizeof(struct recvmsg_req)); return -1; } /* Now I have to send the data pointed by the pointer inside the msg structure: */ /* 1. "msg_name": it can be null, so I send it only if it isn't null. */ if(msg->msg_name != NULL) { printf("Sending msg_name (len = %d)\n", msg->msg_namelen); nwrite = write_n_bytes(rsc_sockfd, msg->msg_name, msg->msg_namelen); printf("Sent %d/%d bytes\n", nwrite, msg->msg_namelen); if(nwrite != msg->msg_namelen) { fprintf(stderr, "I've sent only %d/%d bytes of msg->msg_name.\n", nwrite, msg->msg_namelen); return -1; } } /* 2. "msg_iov": it's an array of buffers so I don't need to send them, but I have * to send the length of each buffer. */ if(msg->msg_iov != NULL) { iov_len_array = calloc(msg->msg_iovlen, sizeof(size_t)); for(i = 0; i < msg->msg_iovlen; i++) { printf("msg->msg_iov[%d].iov_len = %d\n", i, (msg->msg_iov[i]).iov_len); iov_len_array[i] = (msg->msg_iov[i]).iov_len; } } printf("msg->msg_iovlen = %d\n", msg->msg_iovlen); for(i = 0; i < msg->msg_iovlen; i++) { printf("iov_len_array[%d] = %d\n", i, iov_len_array[i]); } nwrite = write_n_bytes(rsc_sockfd, iov_len_array, msg->msg_iovlen * sizeof(size_t)); printf("Sent %d/%d byte od msg->msg_iov\n", nwrite, msg->msg_iovlen); if(nwrite != msg->msg_iovlen * sizeof(size_t)) { fprintf(stderr, "I've sent only %d/%d bytes of msg->msg_name.\n", nwrite, msg->msg_iovlen); return -1; } /* 3. "msg_control" */ if(msg->msg_control != NULL) { printf("Sending msg_control (len = %d)\n", msg->msg_controllen); nwrite = write_n_bytes(rsc_sockfd, msg->msg_control, msg->msg_controllen); printf("Sent %d/%d byte od msg->msg_control\n", nwrite, msg->msg_controllen); if(nwrite != msg->msg_controllen) { fprintf(stderr, "I've sent only %d/%d bytes of msg->msg_name.\n", nwrite, msg->msg_controllen); return -1; } } nread = read_n_bytes(rsc_sockfd, &recvmsg_resp, sizeof(struct recvmsg_resp)); if(nread != sizeof(struct recvmsg_resp)) { fprintf(stderr, "I've read only %d/%d bytes.\n", nwrite, sizeof(struct recvmsg_req)); return -1; } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s", rsc2str(recvmsg_resp.resp_type)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader: resp_type = %d (0x%lX); resp_size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", recvmsg_resp.resp_type, recvmsg_resp.resp_type, recvmsg_resp.resp_size, recvmsg_resp.resp_size, recvmsg_resp.resp_retval, recvmsg_resp.resp_retval, recvmsg_resp.resp_errno, recvmsg_resp.resp_errno); if(recvmsg_resp.resp_retval != -1) { int i; for(i = 0; i < msg->msg_iovlen; i++) { nread = read_n_bytes(rsc_sockfd, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len); printf("Reading into buffer # %d; read %d bytes; buffer size = %d bytes\n", i, nread, msg->msg_iov[i].iov_len); } } printf("############## => recvmsg_resp.msg_controllen = %d\n", recvmsg_resp.msg_controllen); msg->msg_controllen = recvmsg_resp.msg_controllen; if(recvmsg_resp.msg_controllen != 0) nread = read_n_bytes(rsc_sockfd, msg->msg_control, recvmsg_resp.msg_controllen); else msg->msg_control = NULL; RSC_PRINT_MSGHDR(RSCD_REQ_RESP, msg); errno = recvmsg_resp.resp_errno; return recvmsg_resp.resp_retval; } #endif /* This function build the request for the system call 'ioctl' */ struct iovec *rscc_create_ioctl_request(int *total_size, int *iovec_count, u_int32_t size_type, int d, int request, void *arg) { struct ioctl_req *ioctl_req; enum rsc_constant rsc_const; int i; struct iovec *v; size_t vcount; int arg_size_value; ioctl_req = calloc(1, sizeof(struct ioctl_req)); if(ioctl_req == NULL) return NULL; if( (rsc_const = nr2rsc(__NR_ioctl, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(ioctl_req); return NULL; } ioctl_req->req_type = RSC_SYS_REQ; ioctl_req->req_rsc_const = htons(rsc_const); /* If arg is NULL or is a write pointer, don't send it */ if(arg != NULL && (size_type & IOCTL_R)) arg_size_value = size_type & IOCTL_LENMASK; else arg_size_value = 0; ioctl_req->req_size = htonl(sizeof(struct ioctl_req) + arg_size_value); ioctl_req->d = d; ioctl_req->request = request; ioctl_req->arg = arg; /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; if(arg != NULL && (size_type & IOCTL_R)) vcount++; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = ioctl_req; v[0].iov_len = sizeof(struct ioctl_req); *total_size = v[0].iov_len; i = 1; if(arg != NULL && (size_type & IOCTL_R)) { v[i].iov_base = arg; v[i].iov_len = arg_size_value; *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(ioctl_req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct ioctl_req), rsc2str(ntohs(ioctl_req->req_rsc_const)), ntohs(ioctl_req->req_rsc_const), ntohl(ioctl_req->req_size), ntohl(ioctl_req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: d = %ld (0x%lX); request = %ld (0x%lX); arg = %p (0x%lX)", ioctl_req->d, ioctl_req->d, ioctl_req->request, ioctl_req->request, ioctl_req->arg, ioctl_req->arg); return v; } struct iovec *rscc_manage_ioctl_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, u_int32_t size_type, void *arg) { struct iovec *v = NULL; size_t vcount = 0; int byte_num = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_type = %d (0x%lX); resp_size = %d (0x%lX) bytes; resp_rsc_const = %d (0x%lX); resp_retval = %d (0x%lX); errno = %d (0x%lX)\n", sizeof(struct sys_resp_header), resp_header->resp_type, resp_header->resp_type, resp_header->resp_size, resp_header->resp_size, resp_header->resp_rsc_const, resp_header->resp_rsc_const, resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); if((resp_header->resp_size > sizeof(struct sys_resp_header)) && (arg != NULL) && (size_type & IOCTL_W)) { v = calloc(1, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = arg; v[0].iov_len = size_type & IOCTL_LENMASK; vcount = 1; byte_num = v[0].iov_len; } *nbytes = byte_num; *iovec_count = vcount; return v; } int rscc_ioctl(int d, int request, void *arg) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; u_int32_t size_type; /* I get the type and the size of 'arg' */ size_type = rscc_check_ioctl_request(request); /* An error occurs or the 'request' isn't managed */ if(size_type == 0 || size_type == IOCTL_UNMANAGED) return -1; /* I build the request */ v = rscc_create_ioctl_request(&nbytes, &iovec_count, size_type, d, request, arg); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'ioctl'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I read the additional data, if there is. */ v = rscc_manage_ioctl_response(&resp_header, &iovec_count, &nbytes, size_type, arg); if(v != NULL) { nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } /***********************************************************************************************/ /***********************************************************************************************/ /***********************************************************************************************/ #ifndef RSCDEBUG static #endif struct ioctl_cache *ioctl_cache_init(int size) { struct ioctl_cache *cache; cache = calloc(1, sizeof(struct ioctl_cache)); if(cache == NULL) return NULL; cache->size = size; cache->nentry = 0; return cache; } #ifndef RSCDEBUG static #endif void ioctl_cache_add(struct ioctl_cache *cache, int request, u_int32_t size_type) { struct ioctl_cache_el *el; el = calloc(1, sizeof(struct ioctl_cache_el)); assert(el != NULL); /* I fill the request and update the pointers */ el->request = request; el->size_type = size_type; /* There isn't room, I have to pop the last element, * before push it the new one */ if(cache->nentry == cache->size) { cache->last = cache->last->prev; free(cache->last->next); cache->last->next = NULL; cache->nentry -= 1; } else if(cache->nentry == 0) cache->last = el; el->next = cache->first; if(cache->first != NULL) cache->first->prev = el; cache->first = el; cache->nentry += 1; } #ifndef RSCDEBUG static #endif u_int32_t ioctl_cache_search(struct ioctl_cache *cache, int request) { struct ioctl_cache_el *el; for(el = cache->first; el != NULL; el = el->next) { if(el->request == request) return el->size_type; } return 0; } /* Returns the size_type for the given request. The returned values * can be: * - 0: if an error occurs * - IOCTL_UNMANAGED: if the server doesn't manage 'request' * - otherwise is the size_type value */ u_int32_t rscc_check_ioctl_request(int request) { struct ioctl_req_header req; struct ioctl_resp_header resp; int ret; u_int32_t size_type; /* I control if the request is in the cache */ size_type = ioctl_cache_search(ioctl_cache, request); if(size_type == 0) { /* otherwise I call the server */ bzero(&req, sizeof(struct ioctl_req_header)); req.req_type = RSC_IOCTL_REQ; req.req_size = htonl(sizeof(struct ioctl_req_header)); req.req_ioctl_request = htonl(request); /* I send the request */ ret = write_n_bytes(rsc_sockfd, &req, sizeof(struct ioctl_req_header)); if(ret != sizeof(struct ioctl_req_header)) return 0; /* I wait the answer */ ret = read_n_bytes(rsc_sockfd, &resp, sizeof(struct ioctl_resp_header)); if(ret != sizeof(struct ioctl_resp_header)) return 0; resp.resp_size = ntohl(resp.resp_size); resp.resp_size_type = ntohl(resp.resp_size_type); /* I add it to the cache */ ioctl_cache_add(ioctl_cache, request, resp.resp_size_type); size_type = resp.resp_size_type; } return size_type; } #ifndef RSCDEBUG static #endif u_int16_t fcntl_cmd_type(int cmd) { u_int16_t res = 0; switch(cmd) { case F_GETFD: case F_GETFL: case F_GETOWN: case F_GETSIG: case F_GETLEASE: res = FCNTL_NO_3RD_ARG; break; case F_DUPFD: case F_SETFD: case F_SETFL: case F_SETOWN: case F_SETSIG: case F_SETLEASE: case F_NOTIFY: res = FCNTL_3RD_LONG; break; case F_SETLK: case F_SETLKW: res = FCNTL_3RD_FLOCK_R; break; case F_GETLK: res = FCNTL_3RD_FLOCK_RW; break; default: res = 0; break; } return res; } /* This function build the request for the system call 'fcntl' */ struct iovec *rscc_create_fcntl_request(int *total_size, int *iovec_count, u_int16_t cmd_type, int fd, int cmd, long third_arg) { struct fcntl_req *fcntl_req; enum rsc_constant rsc_const; struct iovec *v; size_t vcount; int third_arg_size; fcntl_req = calloc(1, sizeof(struct fcntl_req)); if(fcntl_req == NULL) return NULL; if( (rsc_const = nr2rsc(__NR_fcntl, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(fcntl_req); return NULL; } fcntl_req->req_type = RSC_SYS_REQ; fcntl_req->req_rsc_const = htons(rsc_const); fcntl_req->fd = fd; fcntl_req->cmd = cmd; fcntl_req->cmd_type = cmd_type; /* If there is a third argument, I manage it */ if(cmd_type == FCNTL_NO_3RD_ARG) { fcntl_req->req_size = htonl(sizeof(struct fcntl_req)); *iovec_count = 1; v = calloc(*iovec_count, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = fcntl_req; v[0].iov_len = sizeof(struct fcntl_req); *total_size = v[0].iov_len; } else { /* I set the request fields accordingly with the * type of the third argument */ if(cmd_type == FCNTL_3RD_LONG) { third_arg_size = 0; fcntl_req->third.arg = third_arg; vcount = 1; } else { struct flock *lock = (struct flock *)third_arg; vcount = 1; third_arg_size = 0; if(lock != NULL && (cmd_type == FCNTL_3RD_FLOCK_R || cmd_type == FCNTL_3RD_FLOCK_RW)) { third_arg_size = sizeof(struct flock); vcount = 2; } fcntl_req->third.lock = lock; } fcntl_req->req_size = htonl(sizeof(struct fcntl_req) + third_arg_size); /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = fcntl_req; v[0].iov_len = sizeof(struct fcntl_req); *total_size = v[0].iov_len; /* If vcount == 2, the third argument is a non-NULL pointer * to a struct flock. */ if(vcount == 2) { v[1].iov_base = fcntl_req->third.lock; v[1].iov_len = sizeof(struct flock); *total_size += v[1].iov_len; } *iovec_count = vcount; } rsc_const = nr2rsc(__NR_fcntl, NO_VALUE, my_arch); RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(fcntl_req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct fcntl_req), rsc2str(ntohs(fcntl_req->req_rsc_const)), ntohs(fcntl_req->req_rsc_const), ntohl(fcntl_req->req_size), ntohl(fcntl_req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX); cmd = %ld (0x%lX);", fcntl_req->fd, fcntl_req->fd, fcntl_req->cmd, fcntl_req->cmd); return v; } struct iovec *rscc_manage_fcntl_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, u_int16_t cmd_type, long third_arg) { struct iovec *v = NULL; size_t vcount = 0; int bytes_num = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_type = %d (0x%lX); resp_size = %d (0x%lX) bytes; resp_rsc_const = %d (0x%lX); resp_retval = %d (0x%lX); errno = %d (0x%lX)\n", sizeof(struct sys_resp_header), resp_header->resp_type, resp_header->resp_type, resp_header->resp_size, resp_header->resp_size, resp_header->resp_rsc_const, resp_header->resp_rsc_const, resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* If the third argument is a write pointer to a struct flock and the * size of the response is greater than the size of a normal response, * read the flock structure */ if( ((cmd_type == FCNTL_3RD_FLOCK_W) || (cmd_type == FCNTL_3RD_FLOCK_RW)) && (resp_header->resp_size > sizeof(struct sys_resp_header)) ) { /* I read the 'lock' argument (id it's not NULL) */ struct flock *lock = (struct flock *)third_arg; if( lock != NULL) { v = calloc(1, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = lock; v[0].iov_len = sizeof(struct flock); vcount = 1; bytes_num = v[0].iov_len; } } *iovec_count = vcount; *nbytes = bytes_num; return v; } int rscc_fcntl(int fd, int cmd, ...) { va_list ap; struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; long third_arg = 0; u_int16_t cmd_type; /* I get some info about 'cmd' */ if((cmd_type = fcntl_cmd_type(cmd)) == 0) return -1; /* If there is a third argument, I read it */ if(cmd_type != FCNTL_NO_3RD_ARG) { va_start(ap, cmd); third_arg = va_arg(ap, long); va_end(ap); } /* I build the request */ v = rscc_create_fcntl_request(&nbytes, &iovec_count, cmd_type, fd, cmd, third_arg); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'fcntl'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I read the additional data, if there is. */ v = rscc_manage_fcntl_response(&resp_header, &iovec_count, &nbytes, cmd_type, third_arg); if(v != NULL) { nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } umview-0.8.2/um_rsc/librsc_templates/input/templates/rsc_consts.c0000644000175000017500000002043511753517212024426 0ustar renzorenzo<%# This is part of RSC file generator program rsc_consts.c: template file for RSC constants management Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/src/" %> <% @@filename = "rsc_consts.c" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: RSC constants management * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include "aconv.h" #include "nr_to_rsc.h" #include "rsc_to_nr.h" #include "debug.h" /*########################################################################*/ /*## ##*/ /*## LOCAL VARIABLES ##*/ /*## ##*/ /*########################################################################*/ /* Strings returned when is required a string for a __RSC_* or __NR_* * constant that doesn't exist. */ char *rsc_not_existing = "__RSC_ CONSTANT DOESN'T EXIST!"; char *nr_not_existing = "__NR_ CONSTANT DOESN'T EXIST!"; /**************************************************************************/ /* The following tables are used to convert to string a __NR_* or */ /* __RSC_* constant. */ /**************************************************************************/ <%= nr_all.table_rsc_to_str() %> <%= nr_x86.table_nr_to_str %> <%= nr_x86_64.table_nr_to_str %> <%= nr_ppc.table_nr_to_str %> /* SYS_ values are equal in each architecture, * so a single table is sufficent. */ char *sys_to_str[] = { /* 0. Isn't used */ "__NR_socketcall, UNDEFINED SYS_*", /* 1. SYS_SOCKET */ "__NR_socketcall, SYS_SOCKET", /* 2. SYS_BIND */ "__NR_socketcall, SYS_BIND", /* 3. SYS_CONNECT */ "__NR_socketcall, SYS_CONNECT", /* 4. SYS_LISTEN */ "__NR_socketcall, SYS_LISTEN", /* 5. SYS_ACCEPT */ "__NR_socketcall, SYS_ACCEPT", /* 6. SYS_GETSOCKNAME */ "__NR_socketcall, SYS_GETSOCKNAME", /* 7. SYS_GETPEERNAME */ "__NR_socketcall, SYS_GETPEERNAME", /* 8. SYS_SOCKETPAIR */ "__NR_socketcall, SYS_SOCKETPAIR", /* 9. SYS_SEND */ "__NR_socketcall, SYS_SEND", /* 10. SYS_RECV */ "__NR_socketcall, SYS_RECV", /* 11. SYS_SENDTO */ "__NR_socketcall, SYS_SENDTO", /* 12. SYS_RECVFROM */ "__NR_socketcall, SYS_RECVFROM", /* 13. SYS_SHUTDOWN */ "__NR_socketcall, SYS_SHUTDOWN", /* 14. SYS_SETSOCKOPT */ "__NR_socketcall, SYS_SETSOCKOPT", /* 15. SYS_GETSOCKOPT */ "__NR_socketcall, SYS_GETSOCKOPT", /* 16. SYS_SENDMSG */ "__NR_socketcall, SYS_SENDMSG", /* 17 SYS_RECVMSG */ "__NR_socketcall, SYS_RECVMSG" }; /*########################################################################*/ /*## ##*/ /*## LOCAL FUNCTIONS ##*/ /*## ##*/ /*########################################################################*/ static enum rsc_constant get_rsc(int32_t nr_const, int32_t sys, enum rsc_constant table[], int table_size) { enum rsc_constant res; if((nr_const < 0) || (nr_const >= table_size )) return __RSC_ERROR; res = table[nr_const]; /* If "nr_const" is __NR_socketcall, then I have to get the right * __RSC_* constant using the SYS_* one. */ if(res == __RSC_socketcall) { if( (sys != NO_VALUE) && (sys > 0) && (sys < SYS_TO_RSC_SIZE) ) res = sys_to_rsc[sys]; else /* I need the SYS_ value (and I need that is correct) if __NR_ is __NR_socketcall! */ res = __RSC_ERROR; } return res; } static struct nr_and_sys *get_nr(enum rsc_constant rsc_const, struct nr_and_sys table[]) { struct nr_and_sys *res; if((rsc_const < __RSC_FIRST) || (rsc_const > __RSC_LAST)) return NULL; res = &table[rsc_const]; /* If the resulting structure is empty (both fields defined as NO_VALUE) * I return NUUL */ if( (res->nr == NO_VALUE) && (res->sys == NO_VALUE) ) res = NULL; return res; } static char *get_str(int32_t nr_const, int32_t sys, char *table[], int table_size) { char *res; if((nr_const < 0) || (nr_const >= table_size )) return nr_not_existing; res = table[nr_const]; /* If "nr_const" is __NR_socketcall, then I have to get the right * __RSC_* constant using the SYS_* one. */ if(strcmp("__NR_socketcall", res) == 0) { if( (sys != NO_VALUE) && (sys > 0) && (sys < SYS_TO_STR_SIZE) ) { res = sys_to_str[sys]; } else { /* I need a correct SYS_ value __NR_ is __NR_socketcall! */ res = nr_not_existing; } } return res; } /*########################################################################*/ /*## ##*/ /*## LIBRARY FUNCTIONS ##*/ /*## ##*/ /*########################################################################*/ /* sys can be equal to NO_VALUE */ enum rsc_constant nr2rsc(int32_t nr_const, int32_t sys, enum arch arch) { enum rsc_constant res; switch(arch) { case ACONV_X86: res = get_rsc(nr_const, sys, x86_to_rsc, X86_TO_RSC_SIZE); break; case ACONV_PPC: res = get_rsc(nr_const, sys, ppc_to_rsc, PPC_TO_RSC_SIZE); break; case ACONV_X86_64: res = get_rsc(nr_const, sys, x86_64_to_rsc, X86_64_TO_RSC_SIZE); break; default: res = __RSC_ERROR; break; } RSC_DEBUG(RSCD_REQ_RESP, "nr2rsc: %s(# %d; sys = %d) => %s (# %d)", nr2str(nr_const, sys, arch), nr_const, sys, res == __RSC_ERROR ? rsc_not_existing : rsc2str(res), res); return res ; } struct nr_and_sys *rsc2nr(enum rsc_constant rsc_const, enum arch arch) { struct nr_and_sys *res; switch(arch) { case ACONV_X86: res = get_nr(rsc_const, rsc_to_x86); break; case ACONV_PPC: res = get_nr(rsc_const, rsc_to_ppc); break; case ACONV_X86_64: res = get_nr(rsc_const, rsc_to_x86_64); break; default: res = NULL; break; } RSC_DEBUG(RSCD_REQ_RESP, "rsc2nr: %s(# %d) => %s (# %d; sys = %d)", rsc2str(rsc_const), rsc_const, res == NULL ? nr_not_existing : nr2str(res->nr, res->sys, arch), res == NULL ? -1 : res->nr, res == NULL ? -1 : res->sys); return res; } char *rsc2str(enum rsc_constant rsc_const) { if((rsc_const < __RSC_FIRST) || (rsc_const > __RSC_LAST)) return rsc_not_existing; return rsc_to_str[rsc_const]; } char *nr2str(int32_t nr_const, int32_t sys, enum arch arch) { char *res; switch(arch) { case ACONV_X86: res = get_str(nr_const, sys, x86_to_str, X86_TO_STR_SIZE); break; case ACONV_PPC: res = get_str(nr_const, sys, ppc_to_str, PPC_TO_STR_SIZE); break; case ACONV_X86_64: res = get_str(nr_const, sys, x86_64_to_str, X86_64_TO_STR_SIZE); break; default: res = nr_not_existing; break; } return res; } umview-0.8.2/um_rsc/librsc_templates/input/templates/testing_tools_fill_request.h0000644000175000017500000000661011753517212027725 0ustar renzorenzo<%# This is part of RSC file generator program testing_tools_fill_request.h: template file for the header of the fill RSC request functions used by tests Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/tests/tools/" %> <% @@filename = "fill_request.h" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: header of the fill RSC request functions used by tests * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __FILL_REQUEST_HEADER__ #define __FILL_REQUEST_HEADER__ #include #include #include #include #include #include "rsc_client.h" #define FALSE 0 #define TRUE 1 struct sockaddr_in *fill_struct_sockaddr_in(void); char *fill_string(char *str); /**********************************************************/ /* Fill request */ /**********************************************************/ <% nr_all.each_umview do |syscall| if(syscall.has_read_args?) %> struct <%=syscall.name%>_req *fill_<%=syscall.name%>_request(<%=syscall.read_args.collect{|arg| "int #{arg.name}_null"}.join(', ')%>); <% else %> struct <%=syscall.name%>_req *fill_<%=syscall.name%>_request(void); <% end end %> #define FILL_IOCTL_R 0x1 #define FILL_IOCTL_W 0x2 #define FILL_IOCTL_RW (FILL_IOCTL_R | FILL_IOCTL_W) struct ioctl_req *fill_ioctl_request(int arg_null, int how); struct fcntl_req *fill_fcntl_request(u_int16_t cmd_type, int lock_null); /**********************************************************/ /* Free filled request */ /**********************************************************/ <% nr_all.each_umview do |syscall| %> void free_filled_<%=syscall.name%>_request(struct <%=syscall.name%>_req *req, int only_pointed_memory); <% end %> void free_filled_fcntl_request(struct fcntl_req *req, int only_pointed_memory); void free_filled_ioctl_request(struct ioctl_req *req, int only_pointed_memory); #endif /* __FILL_REQUEST_HEADER__ */ umview-0.8.2/um_rsc/librsc_templates/input/templates/client.h0000644000175000017500000001124611753517212023531 0ustar renzorenzo<%# This is part of RSC file generator program client.h: template file for client side functions header Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/include/" %> <% @@filename = "rsc_client.h" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: client side functions header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_CLIENT_HEADER__ #define __RSC_CLIENT_HEADER__ #ifndef __USE_LARGEFILE64 #define __USE_LARGEFILE64 #endif #include "aconv.h" #include "rsc_messages.h" #include "rsc_consts.h" #include #include #include <% headers = [] nr_all.each_umview { |syscall| headers << syscall.headers } headers.flatten!.sort!.uniq!.delete("utime.h") headers.collect!{ |hd| "#include <#{hd}>" } %> <%= headers.join("\n") %> /*************************************************/ /* CALLBACK REGISTRATION STRUCTURES */ /*************************************************/ struct reg_cbs { struct reg_cb *v; int size; int nentry; }; struct reg_cb { int fd; int how; void (* cb)(); void *arg; /* Added to patch the event subscribe loop problem */ int ack; /* Is the value of the ACK received. It's initialized to -1 */ int cb_executed; /* True if the callback has been already executed, false otherwise */ }; /*************************************************/ /* INIT FUNCTION */ /*************************************************/ int rscc_init(int client_fd, int event_sub_fd, struct reg_cbs **rc, enum arch c_arch, enum arch s_arch); /*************************************************/ /* EVENT SUBSCRIPTION */ /*************************************************/ int rscc_es_send_req(struct reg_cbs *reg_cbs, int server_fd, int event_sub_fd, int how, void (* cb)(), void *arg); /*************************************************/ /* INTERFACE 1: rscc functions */ /*************************************************/ <% nr_all.each_umview do |syscall| %> int rscc_<%= syscall.name %>(<%= syscall.args.join(', ')%>); <% end %> int rscc_ioctl(int d, int request, void *arg); int rscc_fcntl(int fd, int cmd, ...); /*************************************************************/ /* INTERFACE 2: create_request/manage_response functions */ /*************************************************************/ <% nr_all.each_umview do |syscall| %> struct iovec *rscc_create_<%= syscall.name %>_request(int *total_size, int *iovec_count, <%= "#{syscall.args.join(', ')}" %>); struct iovec *rscc_manage_<%=syscall.name%>_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, <%= syscall.args.join(', ')%>); <% end %> struct iovec *rscc_create_fcntl_request(int *total_size, int *iovec_count, u_int16_t cmd_type, int fd, int cmd, long third_arg); struct iovec *rscc_manage_fcntl_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, u_int16_t cmd_type, long third_arg); u_int32_t rscc_check_ioctl_request(int request); struct iovec *rscc_create_ioctl_request(int *total_size, int *iovec_count, u_int32_t size_type, int d, int request, void *arg); struct iovec *rscc_manage_ioctl_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, u_int32_t size_type, void *arg); #endif /* __RSC_CLIENT_HEADER__ */ umview-0.8.2/um_rsc/librsc_templates/input/templates/req_resp.h0000644000175000017500000002500311753517212024067 0ustar renzorenzo<%# This is part of RSC file generator program req_resp.h: template file for messages structure header Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/include" %> <% @@filename = "rsc_messages.h" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: messages structure header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_MESSAGE_H__ #define __RSC_MESSAGE_H__ #include #include #include #include #include #include /*########################################################################*/ /*## ##*/ /*## REQUESTS/RESPONSE HEADERS ##*/ /*## ##*/ /*########################################################################*/ /* Define the common headers used by all request and response messages */ /* The following constant are the values admitted for 'req_type' and * 'resp_type' fields and they are used to multiplex the contents of * the message. */ #define RSC_SYS_REQ 1 #define RSC_IOCTL_REQ 2 #define RSC_SYS_RESP 3 #define RSC_IOCTL_RESP 4 #define NO_SYS_CONST 0 /**************************************************************************/ /*** REQUEST ***/ /**************************************************************************/ /* Used to get the size of a request message */ #define rsc_req_msg_size(req_hdr) (ntohl((req_hdr)->req_size)) /* The request fields shared by all kind of requests */ #define REQ_HEADER u_int32_t req_size; int8_t req_type; /* The request header structure. It contains only the fields defined by * REQ_HEADER constant. */ struct req_header { REQ_HEADER } __attribute__((packed)); /**************************************************************************/ /*** RESPONSE ***/ /**************************************************************************/ /* Used to get the size of a response message */ #define rsc_resp_msg_size(resp_hdr) (ntohl((resp_hdr)->resp_size)) /* The response fields shared by all kind of requests */ #define RESP_HEADER u_int32_t resp_size; int8_t resp_type; /* The response header structure. It contains only the fields defined by * RESP_HEADER constant. */ struct resp_header { RESP_HEADER; } __attribute__((packed)); /*########################################################################*/ /*## ##*/ /*## IOCTL REQUEST MANAGEMENT ##*/ /*## ##*/ /*########################################################################*/ /**************************************************************************/ /*** REQUEST ***/ /**************************************************************************/ /* The ioctl request is used by the client to ask the client if * 'req_ioctl_request' is managed. */ struct ioctl_req_header { REQ_HEADER int32_t req_ioctl_request; } __attribute__((packed)); /**************************************************************************/ /*** RESPONSE ***/ /**************************************************************************/ /* This message is sent by the server in response to a 'ioctl_req_header'. * It contains a single fields ('resp_size_type'), which is a bitmask of * two values. * The 4 most significant bits inform if the argument is a read, * write or read/write argument, the other bits tell the length of that * argument. */ #define IOCTL_R 0x10000000 #define IOCTL_W 0x20000000 #define IOCTL_RW (IOCTL_R | IOCTL_W) #define IOCTL_LENMASK 0x0fffffff #define IOCTL_UNMANAGED 0x40000000 struct ioctl_resp_header { RESP_HEADER u_int32_t resp_size_type; } __attribute__((packed)); /*########################################################################*/ /*## ##*/ /*## SYSCALL EXECUTION REQUEST/RESPONSE ##*/ /*## ##*/ /*########################################################################*/ /**************************************************************************/ /*** REQUEST ***/ /**************************************************************************/ /* Define a syscall execution request message for each system call. * Each message has a common field called 'req_rsc_const' that contains * the __RSC_* constant to identify the system call. */ #define SYS_REQ_HEADER REQ_HEADER u_int16_t req_rsc_const; /* This is a structure representing the common header of all the requests. */ struct sys_req_header { SYS_REQ_HEADER } __attribute__((packed)); /* Now there is the list of all syscall messages */ struct ioctl_req { SYS_REQ_HEADER int d; int request; void *arg; } __attribute__((packed)); /* The fcntl syscall can have 2 or 3 arguments and the third argument can have two different types, * base on the value of the second argument ('cmd'). The fcntl request use the filed 'cmd_type' * to comunicate if the third argument is present and which is its type. */ #define FCNTL_NO_3RD_ARG 0x01 #define FCNTL_3RD_LONG 0x02 #define FCNTL_3RD_FLOCK 0x04 #define FCNTL_3RD_FLOCK_R (0x10 | FCNTL_3RD_FLOCK) /* 0x14 0001 0100 */ #define FCNTL_3RD_FLOCK_W (0x20 | FCNTL_3RD_FLOCK) /* 0x24 0010 0100 */ #define FCNTL_3RD_FLOCK_RW (FCNTL_3RD_FLOCK_R | FCNTL_3RD_FLOCK_W) /* 0x34 0011 0100 */ struct fcntl_req { SYS_REQ_HEADER int8_t cmd_type; int fd; int cmd; union { long arg; struct flock *lock; } third; } __attribute__((packed)); <% nr_all.each_umview do |syscall| field_list = syscall.args.collect{ |arg| "\t#{arg};\n"} %> struct <%= syscall.name %>_req { SYS_REQ_HEADER <%=field_list%> } __attribute__((packed)); <% end %> /**************************************************************************/ /*** REQUEST ***/ /**************************************************************************/ /* There is a unique syscall execution response for all the syscalls. * The informations are: * - 'resp_rsc_const': the __RSC_* constant identifying the syscall. * - 'resp_retval': the value returned by the syscall * - 'resp_errno': the errno value after the execution of the syscall. */ #define SYS_RESP_HEADER RESP_HEADER u_int16_t resp_rsc_const; int32_t resp_retval; int32_t resp_errno; struct sys_resp_header { RESP_HEADER u_int16_t resp_rsc_const; int32_t resp_retval; int32_t resp_errno; } __attribute__((packed)); /*########################################################################*/ /*## ##*/ /*## EVENT SUBSCRIPTION ##*/ /*## ##*/ /*########################################################################*/ /* The following request are use by the event subscription module, they * differ from the other message because they don't share the same * REQ_HEADER/RESP_HEADER fields */ /* Returns the size of the event subscription message based on the * "event_sub_type" given in input. */ int rsc_es_msg_size(u_int8_t type); /* The following constant are used to demultiplex the content of this * kind of messages */ enum event_sub_type { EVENT_SUB_REQ = 1, EVENT_SUB_ACK, EVENT_SUB_RESP, EVENT_SUB_DEREG }; /* These constants are used by the ACK messages */ enum event_sub_ack { ACK_NOT_INIT = -1, ACK_FD_READY = 1, /* The fd is ready */ ACK_FD_REG, /* The fd was not ready, so is monitored by the server */ ACK_FD_DEREG_READY, /* The fd was ready and it has been deregistered */ ACK_FD_DEREG_NOT_READY /* The fd wasn't ready and has been deregistered */ }; /* The request header consists of one field, the 'event_sub_type' constant */ #define RSC_ES_COMMON_FIELDS u_int8_t type; struct rsc_es_hdr { RSC_ES_COMMON_FIELDS } __attribute__((packed)); /* Used by the client to register a new event at server-side */ struct rsc_es_req { RSC_ES_COMMON_FIELDS int fd; int how; }__attribute__((packed)); /* Used by the server to ACK a 'rsc_es_req' message. */ struct rsc_es_ack { RSC_ES_COMMON_FIELDS u_int8_t response; int fd; int how; }__attribute__((packed)); /* Used by the server to inform that the event 'how', registered for * fd 'fd', was occurred. */ struct rsc_es_resp { RSC_ES_COMMON_FIELDS int fd; int how; }__attribute__((packed)); /* Used by the client to ask the server to deregister the event 'how' * for fd 'fd'. */ struct rsc_es_dereg { RSC_ES_COMMON_FIELDS int fd; int how; }__attribute__((packed)); #endif /* __RSC_MESSAGE_H__ */ umview-0.8.2/um_rsc/librsc_templates/input/templates/rsc_consts.h0000644000175000017500000000755311753517212024441 0ustar renzorenzo<%# This is part of RSC file generator program rsc_consts.c: template file for __RSC_* constants definition and management functions Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/include/" %> <% @@filename = "rsc_consts.h" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: __RSC_* constants definition and management functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_CONSTS_HEADER__ #define __RSC_CONSTS_HEADER__ #include #include "aconv.h" /* A struct nr_and_sys that doesn't contain a .sys value has the .sys * field equal to "NO_VALUE". * A empty struct nr_and_sys has the .nr field equal to "NO_VALUE", * the .sys field could have any value. */ #define NO_VALUE (-1) struct nr_and_sys { int32_t nr; int32_t sys; }; /*########################################################################*/ /*## __RSC_* CONSTANTS ##*/ /*########################################################################*/ enum rsc_constant { __RSC_ERROR = -1, /* Used when there isn't a valid __RSC_ constant */ __RSC_FIRST = 0, <% nr_all.each_with_index { |const, i| if( i == 0 )%> <%= "#{const.rsc} = __RSC_FIRST,\n" %> <% else %> <%= "#{const.rsc},\n" %> <% end }%> __RSC_LAST = <%= nr_all.last.rsc %> }; /* From __RSC_* to __NR_* constants and vice versa */ struct nr_and_sys *rsc2nr(enum rsc_constant rsc_const, enum arch arch); enum rsc_constant nr2rsc(int32_t nr_const, int32_t sys, enum arch arch); /*########################################################################*/ /*## CONSTANTS to STRINGS ##*/ /*########################################################################*/ /* Strings returned when is required a string for a __RSC_* or __NR_* * constant that doesn't exist. */ extern char *rsc_not_existing; extern char *nr_not_existing; extern char *rsc_to_str[]; /* The following tables are used to convert to string a __NR_* or * __RSC_* constant. */ #define X86_TO_STR_SIZE <%= nr_x86.max.nr_num + 1 %> extern char * x86_to_str[]; #define X86_64_TO_STR_SIZE <%= nr_x86_64.max.nr_num + 1 %> extern char * x86_64_to_str[]; #define PPC_TO_STR_SIZE <%= nr_ppc.max.nr_num + 1 %> extern char * ppc_to_str[]; /* SYS_ values are equal in each architecture, so a single table is * sufficient. */ #define SYS_TO_STR_SIZE 18 extern char *sys_to_str[]; #endif /* __RSC_CONSTANT_HEADER__ */ umview-0.8.2/um_rsc/librsc_templates/input/templates/test_syscall_execution.c0000644000175000017500000002144111753517212027040 0ustar renzorenzo<%# This is part of RSC file generator program test_syscall_execution.c: template file for system call execution tests. Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "tests/" %> <% @@filename = "test_syscall_execution.c" %> <% require "test_common_code.rb" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: system call execution tests * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include "rsc_client.h" #include "rsc_server.h" #include "test_rsc_server.h" #define __USE_LARGEFILE64 #include "fill_request.h" #include "fill_write_pointers.h" #include "type_equality.h" <% headers = [] nr_all.each_umview { |syscall| headers << syscall.headers } headers.flatten!.sort!.uniq!.delete("utime.h") headers.collect!{ |hd| "#include <#{hd}>" } %> <%= headers.join("\n") %> static void dump(void *p, int size, int bytenum) { int i; fprintf(stderr, "Mem %p[%d bytes]:", p, size); for(i = 0; i < size; i++) { if(i % bytenum == 0) fprintf(stderr, "\n\t%p:\t", p+i); fprintf(stderr, "%.2X", 0xFF & *(char *)(p+i)); } fprintf(stderr, "\n"); } <% nr_all.each_umview do |syscall| %> void client_test_<%=syscall.name%>(int fd) { <% if @@special_syscall[syscall.rsc] @@special_syscall[syscall.rsc].each_with_index do |c, i| str = "#ifdef #{c}" str = "#elif defined #{c}" if i != 0 %> <%=str%> return NULL; <% end %> #else <% end %> struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct <%=syscall.name%>_req *in = fill_<%=syscall.name%>_request(<%=syscall.read_args.collect{|a| "FALSE"}.join(', ')%>); struct <%=syscall.name%>_req *local = fill_<%=syscall.name%>_request(<%=syscall.read_args.collect{|a| "FALSE"}.join(', ')%>); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_<%=syscall.name%>_request(&nbytes, &iov_count, <%= syscall.args.collect{|a| "in->#{a.name}"}.join(', ')%>); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_<%=syscall.name%>_response(&resp_hd, &iov_count, &nbytes, <%= syscall.args.collect{|a| "in->#{a.name}"}.join(', ')%>); <% if syscall.has_write_args? %> assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ <%=syscall.name%>_fill_write_pointers(<%= syscall.args.collect{|a| "local->#{a.name}"}.join(', ')%>); <% else %> assert(resp_iov == NULL); <% end %> <% syscall.args.each do |arg| %> <% if arg.type.pointer? %> <% if arg.type.type =~ /void \*/ %> assert(<%=compare_func_name(arg)%>(local-><%=arg.name%>, in-><%=arg.name%>, <%=arg.size("in->")%>)); <% else %> assert(<%=compare_func_name(arg)%>(local-><%=arg.name%>, in-><%=arg.name%>)); <% end %> <% else %> <% if arg.type.array?%> <% arg.type.array_size.times do |i| %> assert(<%=compare_func_name(arg)%>(&local-><%=arg.name%>[<%=i%>], &in-><%=arg.name%>[<%=i%>])); <% end %> <% else %> assert(local-><%=arg.name%> == in-><%=arg.name%>); <% end %> <% end %> <% end %> free_filled_<%=syscall.name%>_request(in, 0); free_filled_<%=syscall.name%>_request(local, 0); <% if @@special_syscall[syscall.rsc] %> #endif <% end %> } void server_test_<%=syscall.name%>(int fd, enum arch server_arch, enum arch client_arch) { <% if @@special_syscall[syscall.rsc] @@special_syscall[syscall.rsc].each_with_index do |c, i| str = "#ifdef #{c}" str = "#elif defined #{c}" if i != 0 %> <%=str%> return NULL; <% end %> #else <% end %> int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct <%=syscall.name%>_req *input = fill_<%=syscall.name%>_request(<%=syscall.read_args.collect{|a| "FALSE"}.join(', ')%>); struct <%=syscall.name%>_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_<%=syscall.name%>_exec(req_hd, client_arch); req = (struct <%=syscall.name%>_req *) req_hd; /* I test the content of the request */ <% syscall.args.each do |arg| %> <% # Only read pointers and non-pointer args can be checked if not arg.write? %> <% if arg.type.pointer? %> <% if arg.type.type =~ /void \*/ %> assert(<%=compare_func_name(arg)%>(req-><%=arg.name%>, input-><%=arg.name%>, <%=arg.size("input->")%>)); <% else %> assert(<%=compare_func_name(arg)%>(req-><%=arg.name%>, input-><%=arg.name%>)); <% end %> <% else %> <% if arg.type.array?%> <% arg.type.array_size.times do |i| %> assert(<%=compare_func_name(arg)%>(&req-><%=arg.name%>[<%=i%>], &input-><%=arg.name%>[<%=i%>])); <% end %> <% else %> assert(req-><%=arg.name%> == input-><%=arg.name%>); <% end %> <% end %> <% end %> <% end %> <% if syscall.has_write_args? %> /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = <%=syscall.name%>_fill_write_pointers(<%= syscall.args.collect{|a| "req->#{a.name}"}.join(', ')%>); <% else %> /* The syscall doesn't have write pointers, so I do nothing */ <% end %> /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_<%=syscall.name%>_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_<%=syscall.name%>_request(input, 0); <% if @@special_syscall[syscall.rsc] %> #endif <% end %> } <% end %> /*******************************************************************/ /* Public test functions */ /*******************************************************************/ void test_syscall_exec_client(int fd, enum arch myarch, enum arch sarch) { <% nr_all.each_umview do |syscall| %> <% if @@special_syscall[syscall.rsc] cond = @@special_syscall[syscall.rsc].collect{|c| a = "" if(c == "__powerpc__") a = "ACONV_PPC" else a = "ACONV_X86_64" end "sarch != #{a}" }.join(" && ") %> if(<%=cond%>) client_test_<%=syscall.name%>(fd); <% else %> client_test_<%=syscall.name%>(fd); <% end %> <% end %> } void test_syscall_exec_server(int fd, enum arch carch, enum arch myarch) { <% nr_all.each_umview do |syscall| %> server_test_<%=syscall.name%>(fd, myarch, carch); <% end %> } umview-0.8.2/um_rsc/librsc_templates/input/templates/nr_to_rsc.h0000644000175000017500000000554211753517212024245 0ustar renzorenzo<%# This is part of RSC file generator program nr_to_rsc.h: template file for __NR_* to __RSC_* constants conversion header Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/src/include/" %> <% @@filename = "nr_to_rsc.h" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: __NR_* to __RSC_* constants conversion header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __NR_TO_RSC_HEADER__ #define __NR_TO_RSC_HEADER__ #include #include "rsc_consts.h" /* SYS_ values are equal in each architecture, * so a single table is sufficent. */ #define SYS_TO_RSC_SIZE ((sizeof(sys_to_rsc))/(sizeof(int32_t))) int32_t sys_to_rsc[] = { /* 0. Isn't used */ __RSC_ERROR, /* 1. SYS_SOCKET */ __RSC_socket, /* 2. SYS_BIND */ __RSC_bind, /* 3. SYS_CONNECT */ __RSC_connect, /* 4. SYS_LISTEN */ __RSC_listen, /* 5. SYS_ACCEPT */ __RSC_accept, /* 6. SYS_GETSOCKNAME */ __RSC_getsockname, /* 7. SYS_GETPEERNAME */ __RSC_getpeername, /* 8. SYS_SOCKETPAIR */ __RSC_socketpair, /* 9. SYS_SEND */ __RSC_send, /* 10. SYS_RECV */ __RSC_recv, /* 11. SYS_SENDTO */ __RSC_sendto, /* 12. SYS_RECVFROM */ __RSC_recvfrom, /* 13. SYS_SHUTDOWN */ __RSC_shutdown, /* 14. SYS_SETSOCKOPT */ __RSC_setsockopt, /* 15. SYS_GETSOCKOPT */ __RSC_getsockopt, /* 16. SYS_SENDMSG */ __RSC_sendmsg, /* 17 SYS_RECVMSG */ __RSC_recvmsg }; <%= nr_x86.table_nr_to_rsc %> <%= nr_x86_64.table_nr_to_rsc %> <%= nr_ppc.table_nr_to_rsc %> #endif /* __NR_TO_RSC_HEADER__ */ umview-0.8.2/um_rsc/librsc_templates/input/templates/rsc_to_nr.h0000644000175000017500000000411311753517212024236 0ustar renzorenzo<%# This is part of RSC file generator program rsc_to_nr.h: template file for __RSC_* to __NR_* constants conversion header Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/src/include/" %> <% @@filename = "rsc_to_nr.h" %> <% @@overwrite_existing_copy = false %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: __RSC_* to __NR_* constants conversion header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_TO_NR_HEADER__ #define __RSC_TO_NR_HEADER__ #include #include #include "rsc_consts.h" <%= nr_x86.table_rsc_to_arch %> <%= nr_x86_64.table_rsc_to_arch %> <%= nr_ppc.table_rsc_to_arch %> #endif /* __RSC_TO_NR_HEADER__ */ umview-0.8.2/um_rsc/librsc_templates/input/templates/server_tests.h0000644000175000017500000000557311753517212025011 0ustar renzorenzo<%# This is part of RSC file generator program server_tests.h: template file for the header containing private server side functions to be tested Copyright (C) 2007 Andrea Forni This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. %> <% @@librsc_relative_path = "/src/include/" %> <% @@filename = "test_rsc_server.h" %> /* * This is part of Remote System Call (RSC) Library. * * <%=@@filename%>: header containing private server side functions to be tested * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_SERVER_TESTS_H__ #define __RSC_SERVER_TESTS_H__ #ifdef RSCDEBUG #include "rsc_messages.h" struct ioctl_resp_header *rscs_manage_ioctl_request(struct ioctl_req_header *ioctl_req); <% nr_all.each_umview do |syscall| if(syscall.has_read_args?) %> void <%= syscall.name %>_adjust_read_pointers(struct <%= syscall.name %>_req *<%= syscall.name %>_req); <% end end%> <% nr_all.each_umview do |syscall| if(syscall.has_write_args?) %> void <%= syscall.name %>_adjust_write_pointers(struct <%= syscall.name %>_req *<%= syscall.name %>_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); <% end end%> <% nr_all.each_umview do |syscall| %> struct sys_resp_header *rscs_pre_<%= syscall.name %>_exec(void *req, enum arch client_arch); int rscs_exec_<%= syscall.name %>(void *request); struct sys_resp_header *rscs_post_<%= syscall.name %>_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); <% end %> #endif /* RSCDEBUG */ #endif /* __RSC_SERVER_TESTS_H__ */ umview-0.8.2/um_rsc/librsc_templates/input/syscalls_rsc.list0000644000175000017500000002065711753517212023513 0ustar renzorenzo# # This is part of RSC file generator program # # syscalls_rsc.list: the system call list describing the different # syscalls used given in input to the rsc_file_gen.rb # program. # # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # #__RSC* constants | Arguments | Headers # Created: Sun May 07 15:22:57 CEST 2006 __RSC__llseek | unsigned int fd, unsigned long int offset_high, unsigned long int offset_low, loff_t *result{W}, unsigned int whence | unistd.h, sys/types.h, linux/unistd.h, errno.h, sys/syscall.h __RSC_access | const char *pathname{R}, int mode | unistd.h, sys/syscall.h __RSC_chdir | const char *path{R} | unistd.h, sys/syscall.h __RSC_chmod | const char *path{R}, mode_t mode | sys/types.h, sys/stat.h, sys/syscall.h __RSC_chown | const char *path{R}, uid_t owner, gid_t group | sys/types.h, unistd.h, sys/syscall.h __RSC_chown32 | const char *path{R}, uid_t owner, gid_t group | sys/types.h, unistd.h, sys/syscall.h __RSC_close | int fd | unistd.h, sys/syscall.h __RSC_dup | int oldfd | unistd.h, sys/syscall.h __RSC_dup2 | int oldfd, int newfd | unistd.h, sys/syscall.h __RSC_fchdir | int fd | unistd.h, sys/syscall.h __RSC_fchmod | int fildes, mode_t mode | sys/types.h, sys/stat.h, sys/syscall.h __RSC_fchown | int fd, uid_t owner, gid_t group | sys/types.h, unistd.h, sys/syscall.h _RSC_fchown32 | int fd, uid_t owner, gid_t group | sys/types.h, unistd.h, sys/syscall.h __RSC_fdatasync | int fd | unistd.h, sys/syscall.h __RSC_fgetxattr | int filedes, const char *name{R}, void *value{W}[size], size_t size | sys/types.h, sys/syscall.h __RSC_fstat64 | int filedes, struct stat64 *buf{W} | sys/types.h, sys/stat.h, unistd.h, sys/syscall.h __RSC_fstat64 | int filedes, struct stat64 *buf{W} | sys/types.h, sys/stat.h, unistd.h, sys/syscall.h __RSC_fsync | int fd | unistd.h, sys/syscall.h __RSC_getdents64 | unsigned int fd, struct dirent64 *dirp{W}[count], unsigned int count | unistd.h, linux/types.h, linux/unistd.h, errno.h, sys/syscall.h, dirent.h __RSC_getxattr | const char *path{R}, const char *name{R}, void *value{W}[size], size_t size | sys/types.h, sys/syscall.h __RSC_lchown | const char *path{R}, uid_t owner, gid_t group | sys/types.h, unistd.h, sys/syscall.h __RSC_lchown32 | const char *path{R}, uid_t owner, gid_t group | sys/types.h, unistd.h, sys/syscall.h __RSC_lgetxattr | const char *path{R}, const char *name{R}, void *value{W}[size], size_t size | sys/types.h, sys/syscall.h __RSC_link | const char *oldpath{R}, const char *newpath{R} | unistd.h, sys/syscall.h __RSC_lseek | int fildes, off_t offset, int whence | sys/types.h, unistd.h, sys/syscall.h __RSC_lstat64 | const char *path{R}, struct stat64 *buf{W} | sys/types.h, sys/stat.h, unistd.h, sys/syscall.h __RSC_mkdir | const char *pathname{R}, mode_t mode | sys/stat.h, sys/types.h, sys/syscall.h __RSC_mount | const char *source{R}, const char *target{R}, const char *filesystemtype{R}, unsigned long int mountflags, const void *data{R}=act_as_a_string= | sys/mount.h, sys/syscall.h __RSC_open | const char *pathname{R}, int flags | sys/types.h, sys/stat.h, fcntl.h, sys/syscall.h __RSC_pread64 | int fd, void *buf{W}[count], size_t count, off_t offset | unistd.h, sys/syscall.h __RSC_pwrite64 | int fd, const void *buf{R}[count], size_t count, off_t offset | unistd.h, sys/syscall.h __RSC_read | int fd, void *buf{W}[count], size_t count | unistd.h, sys/syscall.h __RSC_readlink | const char *path{R}, char *buf{W}[bufsiz], size_t bufsiz | unistd.h, sys/syscall.h __RSC_rename | const char *oldpath{R}, const char *newpath{R} | stdio.h, sys/syscall.h __RSC_rmdir | const char *pathname{R} | unistd.h, sys/syscall.h __RSC_stat64 | const char *path{R}, struct stat64 *buf{W} | sys/types.h, sys/stat.h, unistd.h, sys/syscall.h __RSC_symlink | const char *oldpath{R}, const char *newpath{R} | unistd.h, sys/syscall.h __RSC_umount2 | const char *target{R}, int flags | sys/mount.h, sys/syscall.h __RSC_unlink | const char *pathname{R} | unistd.h, sys/syscall.h __RSC_utime | const char *filename{R}, const struct utimbuf *buf{R} | sys/types.h, utime.h, sys/time.h, sys/syscall.h __RSC_utimes | const char *filename{R}, const struct timeval tv[2] | sys/types.h, utime.h, sys/time.h, sys/syscall.h __RSC_write | int fd, const void *buf{R}[count], size_t count | unistd.h, sys/syscall.h __RSC_adjtimex | struct timex *buf{RW} | sys/timex.h __RSC_clock_getres | clockid_t clk_id, struct timespec *res{W} | time.h __RSC_clock_gettime | clockid_t clk_id, struct timespec *tp{W} | time.h __RSC_clock_settime | clockid_t clk_id, const struct timespec *tp{R} | time.h __RSC_fchown32 | int fd, uid_t owner, gid_t group | sys/types.h, unistd.h __RSC_fstatfs64 | unsigned int fd, struct statfs64 *buf{W} | sys/statfs.h __RSC_ftruncate64 | int fd, __off64_t length | unistd.h, sys/types.h __RSC_getdomainname | char *name{W}[len], size_t len | unistd.h __RSC_gethostname | char *name{W}[len], size_t len | unistd.h __RSC_gettimeofday | struct timeval *tv{W}, struct timezone *tz{W} | sys/time.h, time.h __RSC_pread | int fd, void *buf{W}, size_t count, off_t offset | unistd.h __RSC_pwrite | int fd, const void *buf{R}, size_t count, off_t offset | unistd.h __RSC_setdomainname | const char *name{R}[len], size_t len | unistd.h __RSC_sethostname | const char *name{R}[len], size_t len | unistd.h __RSC_settimeofday | const struct timeval *tv{R} , const struct timezone *tz{R} | sys/time.h, time.h __RSC_statfs64 | const char *path{R}, struct statfs64 *buf{W} | sys/statfs.h __RSC_truncate64 | const char *path{R}, __off64_t length | unistd.h, sys/types.h __RSC_uname | struct utsname *buf{W} | sys/utsname.h ######################################### # NETWORK SYSTEM CALL ######################################### __RSC_accept | int sockfd, struct sockaddr *addr{W}[addrlen], socklen_t *addrlen{RW} | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h __RSC_bind | int sockfd, const struct sockaddr *my_addr{R}[addrlen], socklen_t addrlen | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h __RSC_connect | int sockfd, const struct sockaddr *serv_addr{R}[addrlen], socklen_t addrlen | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h __RSC_getpeername | int s, struct sockaddr *name{W}[namelen], socklen_t *namelen{RW} | sys/socket.h, sys/syscall.h, linux/net.h __RSC_getsockname | int s, struct sockaddr *name{W}[namelen], socklen_t *namelen{RW} | sys/socket.h, sys/syscall.h, linux/net.h __RSC_getsockopt | int s, int level, int optname, void *optval{W}[optlen], socklen_t *optlen{RW} | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h __RSC_listen | int sockfd, int backlog | sys/socket.h, sys/syscall.h, linux/net.h __RSC_recv | int s, void *buf{W}[len], size_t len, int flags | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h __RSC_recvfrom | int s, void *buf{W}[len], size_t len, int flags, struct sockaddr *from{R}[fromlen], socklen_t *fromlen{RW} | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h __RSC_send | int s, const void *buf{R}[len], size_t len, int flags | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h __RSC_sendto | int s, const void *buf{R}[len], size_t len, int flags, const struct sockaddr *to{R}[tolen], socklen_t tolen | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h __RSC_setsockopt | int s, int level, int optname, const void *optval{R}[optlen], socklen_t optlen | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h __RSC_shutdown | int s, int how | sys/socket.h, sys/syscall.h, linux/net.h __RSC_socket | int domain, int type, int protocol | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h ######################################### # COMPLEX STRUCTURES AS ARG ######################################### #__RSC_recvmsg | int s, struct msghdr *msg, int flags | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h #__RSC_sendmsg | int s, const struct msghdr *msg, int flags | sys/types.h, sys/socket.h, sys/syscall.h, linux/net.h umview-0.8.2/um_rsc/librsc_templates/program/0000755000175000017500000000000011753517351020414 5ustar renzorenzoumview-0.8.2/um_rsc/librsc_templates/program/tests/0000755000175000017500000000000011753517351021556 5ustar renzorenzoumview-0.8.2/um_rsc/librsc_templates/program/tests/c_test.rb0000755000175000017500000001075211753517212023370 0ustar renzorenzo#!/usr/bin/ruby # # This is part of RSC file generator program # # c_test.rb: UnitTest for C module # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # require File.join(File.dirname(__FILE__), '..', 'src', 'c.rb') require 'test/unit' module C # This class is a Unit::Test for the C.Type class. class TypeTest < Test::Unit::TestCase def test_object # Testing object variables t1 = C::Type.new(" \t\t struct \t foo \t\t * \t ", false) t2 = C::Type.new("const int", true) assert_equal false, t1.const? assert_equal true, t2.const? assert_equal true, t1.struct? assert_equal false, t2.struct? assert_equal true, t1.pointer? assert_equal false, t2.pointer? assert_equal "struct foo *", t1.type assert_equal "const int", t2.type assert_equal false, t1.array? assert_equal false, t2.array? assert_equal 0, t1.array_size assert_equal 0, t2.array_size t3 = C::Type.new("const int", true, :array => true, :array_size => 10) assert_equal true, t3.array? assert_equal 10, t3.array_size end def test_printf_conv_spec # Testing printf character types = [ [["int *", 'struct timeval'], '%p'], [["int", "size_t", "socklen_t", "mode_t", "uid_t", "gid_t", "off_t"], '%ld'], [["unsigned int"], '%u'], [["unsigned long int", "nfds_t"], '%lu'] ] types.each { |types, char| types.each { |type| t1 = C::Type.new(type, false) assert_equal char, t1.printf_conv_spec } } # A unmanaged type raise an exception t2 = C::Type.new("foo", false) assert_raise(RuntimeError) { t2.printf_conv_spec } end end # This class is a Unit::Test for the C.Argument class. class ArgumentTest < Test::Unit::TestCase def test_new # Testing exceptions assert_raise(RuntimeError) { C::Argument.new('int *a') } assert_raise(RuntimeError) { C::Argument.new('int a{R}') } assert_raise(RuntimeError) { C::Argument.new('int a{W}') } assert_raise(RuntimeError) { C::Argument.new('int a{RW}') } assert_raise(RuntimeError) { C::Argument.new('int a{bad_value}') } # Testing boolean arguments: read?, write? and is_size_a_var? v1 = C::Argument.new('int *a{R}[a]') assert_equal true, v1.read? assert_equal false, v1.write? v2 = C::Argument.new('int *a{W}') assert_equal false, v2.read? assert_equal true, v2.write? v3 = C::Argument.new('int *a{RW}') assert_equal true, v3.read? assert_equal true, v3.write? assert_equal true, v1.is_size_a_var? assert_equal false, v2.is_size_a_var? v4 = C::Argument.new('int a') assert_equal false, v4.read? assert_equal false, v4.write? assert_equal false, v4.is_size_a_var? # Testing right type menagement assert_equal 'unsigned long int', C::Argument.new('unsigned long int a').type.type assert_equal 'unsigned int', C::Argument.new('unsigned int a').type.type end def test_size # size of a non-pointer var v1 = C::Argument.new('int a') assert_equal nil, v1.size # size if a non-pointer var v3 = C::Argument.new('const int *a{R}[size]') v3.size_var = C::Argument.new('int size') assert_equal "size", v3.size assert_equal "struct->size", v3.size("struct->") # size if a pointer var v3 = C::Argument.new('const int *a{R}[size]') v3.size_var = C::Argument.new('int *size{R}') assert_equal "*size", v3.size assert_equal "*(struct->size)", v3.size("struct->") # size isn't a var v2 = C::Argument.new('const int *a{R}') assert_equal "sizeof(int)", v2.size # the variable is a string v4 = C::Argument.new('char *a{R}') assert_equal "(strlen(a) + 1)", v4.size end def test_size_retval v3 = C::Argument.new('const int *a{R}[size]') assert_equal true, v3.size_retval? v3 = C::Argument.new('const int *a{R}[size]') assert_equal false, v3.size_retval? end end end umview-0.8.2/um_rsc/librsc_templates/program/src/0000755000175000017500000000000011753517351021203 5ustar renzorenzoumview-0.8.2/um_rsc/librsc_templates/program/src/c.rb0000755000175000017500000003244611753517212021762 0ustar renzorenzo#!/usr/bin/ruby -w # # This is part of RSC file generator program # # c.rb: module representing C types # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # This module implements the classes Type and Argument used by the main # script. The class Type represent a C type, the Argument class an argument # of the system call. module C # It takes in input an argument list (_args_list_) and # adjust the _size_var_ attribute of each argument with Type _pointer_. # In fact this attribute is initially set to a string with the name of # the attribute containing the size of the pointed memory. def self.adjust_size_var_ref(args_list) args_list.each { |arg| if not arg.size_var.nil? arg.size_var = args_list.find{ |arg2| arg.size_var == arg2.name } if(not arg.size_var.nil?) arg.size_var.is_a_size_var = true arg.size_var.pointer_arg = arg end end } end # The class Type try to represent all the C type of the system call's argument used by # UMVIEW. class Type attr_reader :type, :array_size # The initialization function takes 2 mandatory arguments: # * _type_: is the type represented by the object # * _const_: true if is a constant type, false otherwise # And some options. The allowed options are: # * :array : true if the type is an array of type, false otherwise # * :array_size : is equal to the size of the array if +array+ = true, 0 otherwise # def initialize(type, const, options = {}) @type = type.strip.gsub(/\s+/, ' ') @const = const @struct = (@type =~ /^struct/) ? true : false @pointer = (@type =~ /\*$/) ? true : false @array = false @array_size = 0 @act_as_a_string = false if(options[:array]) @array = true if(options[:array_size]) @array_size = options[:array_size] end elsif(options[:act_as_a_string]) @act_as_a_string = options[:act_as_a_string] end end # True if the type is constant, false otherwise. def const?() @const end # True if the type is a structure, false otherwise. def struct?() @struct end # True if the type is an array, false otherwise. def array?() @array end # True if the type is a pointer, false otherwise. def pointer?() @pointer end # True if the type is a pointer with a type different from char * # but it behaves as it is def act_as_a_string?() @act_as_a_string end # Return a string with the appropriate conversion specification to use with +printf+ # function. For example for the type : # +int+:: the sting returned is "%ld" # unsinged int:: the string returned id "%u" # and so on def printf_conv_spec() int = ["int", "size_t", "socklen_t", "mode_t", "uid_t", "gid_t", "off_t", "off64_t", "__off64_t", "clockid_t"] unsigned_long_int = ["unsigned long int", "nfds_t"] char = "" # "It's a "char *", but not an array of "char *" #if (@type == 'char *') && (not self.array?) # char = "%s" #els if @pointer || @type == 'struct timeval' char = "%p" elsif int.include? @type char = "%ld" elsif @type == "unsigned int" char = "%u" elsif unsigned_long_int.include? @type char = "%lu" else raise "printf_conv_spec doesn't menage type '#{@type}'" end return char end def to_s string = "" #string += "const " if @const string += "#{@type.to_s}" end def inspect "'#{@type}'. c? = #{@const}; s? = #{@struct}; p? = #{@pointer}; a? = #{@array}; as = #{@array_size}" end end # The class represent a system call argument. class Argument attr_accessor :type, :name, :size_var, :pointer_arg attr_writer :is_a_size_var attr_reader :read, :write, :size_retval # The initialize function is an overloaded functions that can take to sets of different arguments. # ---- # The first set is composed by one argument: # _string_:: a C variable declaration string to parse to extract all the informations # # ---- # The second set is composed by six arguments: # _type_:: is a Type object with the type variable # _name_:: is the name of the variable # The other arguments are valid only if the _type_ is a _pointer_: # _read_:: is true if the memory pointed is only read by the system call and not modified, false otherwise # _write_:: is true if the memory pointed is modified by the system call, false otherwise # _size_var_:: is set to the name of another system call argument that contains the size of the pointed memory # _size_retval_:: is true if the return value of the system call gives the exact size of the # pointed memory used # A _value_-_result_ variable has both _read_ and _write_ set to true. # def initialize(*args) case args.size when 1 @type, @name, @read, @write, @size_var, @size_retval = parse_string(args.first) when 6 @type , @name, @read, @write, @size_var, @size_retval = args @type.strip! @name.strip! else raise ArgumentError, "This method takes either 1 or 6 arguments." end @size = nil if(@type.pointer? && !@read && !@write) raise "The type '#{@type}' is a pointer and it needs the R|W|RW flag" elsif((@read || @write) && !@type.pointer?) raise "The type '#{@type}' has the R|W|RW flag but it's not a pointer" end @is_a_size_var = false @pointer_arg = nil end # If the Type of the Argument object is a pointer this method returns a string of C code that # calculate the size of the pointed memory; otherwise returns nil. # # The _pre_string_ optional arguments it's used to prepend a string to the name of the Argument or # to the name of the Argument that specify the size of the pointed memory. # # Example: you have the Argument is char *foo and in you C code, this argument is saved in # a filed of the structure struct bar s with the same name; so you can access +foo+ thought +s+ in this way: s.foo # Now, if you call #size without the _pre_string_ you get (strlen(foo) + 1), but this piece of # code is wrong because +foo+ is inside a structure. To resolve the problem, you pass the string 's.' # to #size and you get (strlen(s.foo) + 1). def size(pre_string = "") if !@type.pointer? @size = nil elsif is_size_a_var? @size = "#{pre_string}#{@size_var.name}" if @size_var.type.pointer? if pre_string.empty? @size = "*#{@size}" else @size = "*(#{@size})" end end elsif (@type.type == "char *" or @type.act_as_a_string?) # Is a string (A char pointer) without a length var @size = "(strlen(#{pre_string}#{@name}) + 1)" else @size = "sizeof(#{@type.type[/(?:const *)?((\w+ *)+)(?: *\*)?/, 1].strip})" end return @size end # Returns true if the Argument is a size var for another Argument, in other words it contains # the size of the memory pointed by another Argument. def is_a_size_var? return @is_a_size_var end def rec_xdr_func(str_type, is_pointer, is_struct, is_array, array_size, xdr, var, size, arch1, arch2) needs_4args = ['xdr_long2', 'xdr_u_long2', 'xdr_off_t', 'xdr_nfds_t', 'xdr___time_t', 'xdr___suseconds_t', 'xdr_utimbuf'] func = "" if is_pointer if str_type == "char *" func = "xdr_string(#{xdr}, &(#{var}), #{size})" elsif str_type == "void *" func = "xdr_vector(#{xdr}, (char *)(#{var}), #{size}, sizeof(int), (xdrproc_t)xdr_u_int)" else foo_type = Argument.new(str_type.sub(/\*$/, '') + " foo").type f = rec_xdr_func(foo_type.type, foo_type.pointer?, foo_type.struct?, foo_type.array?, foo_type.array_size, xdr, var, size, arch1, arch2).sub(/\(.*\)/, ''); func = "xdr_pointer(#{xdr}, (char **)&(#{var}), sizeof(#{foo_type.type}), (xdrproc_t)#{f})" end elsif is_array foo_type = Argument.new(str_type + " foo").type f = rec_xdr_func(foo_type.type, foo_type.pointer?, foo_type.struct?, foo_type.array?, foo_type.array_size, xdr, var, size, arch1, arch2).sub(/\(.*\)/, ''); func = "xdr_vector(#{xdr}, (char *)(#{var}), #{array_size}, sizeof(#{str_type}), (xdrproc_t)#{f})" elsif is_struct func = "xdr_#{str_type.sub(/struct/, '').strip}(#{xdr}, &#{var})" else f = case when str_type == 'int': 'xdr_int' when str_type == 'unsigned int': 'xdr_u_int' when str_type == 'long' || str_type == 'long int': 'xdr_long2' when str_type == 'unsigned long' || str_type == 'unsigned long int': 'xdr_u_long2' else "xdr_#{str_type}" end func = "#{f}(#{xdr}, &#{var}" func += ", #{arch1}, #{arch2}" if needs_4args.include? f func += ")" end return func end def xdr_func(xdr, var, size, arch1, arch2) rec_xdr_func(@type.type, @type.pointer?, @type.struct?, @type.array?, @type.array_size, xdr, var, size, arch1, arch2) end def parse_string(string) string.strip! type = nil varname = nil puts "\nparse_string: string to parse = '#{string}'." if $DEBUG type = '(const)? *((?:(?:struct +\w+)|(?:(?:(?:unsigned)? *(?:long)? *)(?:\w+))) *(?:\*?))' varname = '(\w+)' array_size = '(?:\[(\d+)\])?' buf_rw = '\{((?:\w*))\}' buf_size_var = '(?:\[(:?\w+)\])?' buf_retval = '(?:<(retval)>)?' buff_act_as = '(?:=(act_as_a_string)=)' buf_attr = "(?:#{buf_rw}(?:#{buff_act_as}|(?:#{buf_size_var}#{buf_retval})))?" regexp = Regexp.new("#{type} *#{varname}#{array_size}#{buf_attr}") res = nil if(res = regexp.match(string)) const = res[1].nil? ? false : true type_str = res[2] varname = res[3] array_size = res[4] rw = res[5] act_as_a_string = res[6] size = res[7] retval = res[8].nil? ? false : true if($DEBUG) puts "=> Groups in the regexp:" puts "\t$1 = #{$1}" puts "\t$2 = #{$2}" puts "\t$3 = #{$3}" puts "\t$4 = #{$4}" puts "\t$5 = #{$5}" puts "\t$6 = #{$6}" puts "\t$7 = #{$7}" puts "\t$8 = #{$8}" puts "\t$9 = #{$9}" end if(!array_size.nil?) type = Type.new(type_str, const, :array => true, :array_size => array_size.to_i) else type = Type.new(type_str, const, :act_as_a_string => (not act_as_a_string.nil?)) end if($DEBUG) puts "=> Type object created:" puts type.inspect end read = write = false if(!rw.nil?) if rw.to_sym == :R read = true elsif rw.to_sym == :W write = true elsif rw.to_sym == :RW read = write = true else raise "'#{rw}' is not a right value for the R|W|RW flag" end end end return [type, varname, read, write, size, retval] end def to_s string = "#{@type}" string += @type.pointer? ? "" : " " string += "#{@name}" if(@type.array?) string += "[#{@type.array_size}]" end return string end # returns true if the size of the pointed memory is contained in another Argument. def is_size_a_var?() !@size_var.nil? end # returns true if the size of the pointed memory is determined by the system call return value. def size_retval?() @size_retval end # returns true if the pointed memory is read and written by the system call. def rw?() @read and @write end # returns true if the pointed memory is only read by the system call and not modified. def read?() @read end # returns true if the pointed memory is written by the system call. def write?() @write end def inspect "(#{self.object_id})> '#{@name}'; s = '#{@size}'; r? = #{@read}; w? = #{@write}; srv = #{@size_retval}; t = #{@type.inspect}" end private :parse_string, :rec_xdr_func end end if(__FILE__ == $0) SCRIPT_DIR = File.dirname __FILE__ File.open("#{SCRIPT_DIR}/../input_files/syscalls_rsc.list", "r") { |file| file.each() { |line| line.strip! # I'm not interested in empty lines or comments if(line !~ /^#|^$/) rsc_const, args, headers = line.split("|").collect{|el| el.strip! } str_arg_list = args.split(',') arg_list = [] str_arg_list.each { |str_arg| arg_list << C::Argument.new(str_arg) } header_list = headers.split(',') end } } end umview-0.8.2/um_rsc/librsc_templates/program/src/syscall_constant.rb0000755000175000017500000003432511753517212025121 0ustar renzorenzo#!/usr/bin/ruby -w # # This is part of RSC file generator program # # syscall_constant.rb: Syscall module to store and manage # system call informations # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # require 'c.rb' #--#################################################################### ## CONSTANTS #++#################################################################### NO_VALUE = "NO_VALUE" #--#################################################################### ## CLASSES #++#################################################################### # This module contains classes used to store and menage system call informations. # The class Arch represent an computer architecture. The class Constant a system # call constant with all the related informations necessary to write the templates. # The ConstantList represents a system call Constant list. module Syscall # The class Arch represent a computer architecture. The allowed architecture # are x86, x86_64 and ppc. class Arch attr_reader :arch @@allowed_archs = { :x86 => :x86, :x86_64 => :x86_64, :ppc => :ppc }.freeze # The _arch_ is String or Symbol with the following values: x86, x86_64 or ppc. def initialize(arch) @arch = @@allowed_archs[arch.to_sym] if @arch.nil? raise "Wrong architecture(\"#{arch}\"), I cannot create the object" end end # Rteurns a sting representation of the architecture def to_s @@allowed_archs[@arch].to_s end end # The class represent a system call and contains all the useful informations # needed by the templates. class Constant include Comparable attr_accessor :nr, :sys, :rsc, :rsc_num, :name, :headers, :args attr_writer :nr_num, :used_by_umview attr :fake @@nr_sys = { "__RSC_socket" => "SYS_SOCKET", "__RSC_bind" => "SYS_BIND", "__RSC_connect" => "SYS_CONNECT", "__RSC_listen" => "SYS_LISTEN", "__RSC_accept" => "SYS_ACCEPT", "__RSC_getsockname" => "SYS_GETSOCKNAME", "__RSC_getpeername" => "SYS_GETPEERNAME", "__RSC_socketpair" => "SYS_SOCKETPAIR", "__RSC_send" => "SYS_SEND", # <- I've changed this one "__RSC_recv" => "SYS_RECV", # <- I've changed this one "__RSC_sendto" => "SYS_SENDTO", "__RSC_recvfrom" => "SYS_RECVFROM", "__RSC_shutdown" => "SYS_SHUTDOWN", "__RSC_setsockopt" => "SYS_SETSOCKOPT", "__RSC_getsockopt" => "SYS_GETSOCKOPT", "__RSC_sendmsg" => "SYS_SENDMSG", "__RSC_recvmsg" => "SYS_RECVMSG" } # Initialize the Constant object. _nr_ is the \_\_NR\_\* constant that represent the # system call, _num_ is the number associated at the constant _nr_ and _fake # is true if the system call is not defined in any unistd.h header. def initialize(nr, num, fake = false) @nr = nr.strip @name = @nr.sub(/__NR_/, "") # True if is a fake syscall not defined in any unistd.h file @fake = fake @nr_num = @fake ? -1 : num.to_i @rsc = "__RSC_" + @name @sys = @@nr_sys[@rsc] @rsc_num = -1 @used_by_umview = false end # true if there is at least a read and write pointer in the system call argument list def has_rw_args? return @args.find {|arg| arg.rw? } end # true if there is at least a read pointer in the system call argument list def has_read_args? return @args.find {|arg| arg.read? } end # true if there is at least a write pointer in the system call argument list def has_write_args? return @args.find {|arg| arg.write? } end # Returns an array containing only the read pointers def read_args() list = rearrange_rw_args(:read?) return list end # Returns an array containing only the read/write pointers def rw_args() list = rearrange_rw_args(:rw?) return list end # Returns an array containing only the write pointers def write_args() list = rearrange_rw_args(:write?) return list end # This method takes in input an #Argument list (_arg_list_) and re-arrange the # write pointer arguments. Each of these argument is put after its _size_-_var_ # argument (the argument that contains the size of the pointed memory). # # This method can be useful when is necessary to generate C code that sends # the system call arguments over a socket. In this way are sent the size of the pointed # memory and then the content of the pointed memory, in this way the receiver of these data # can know the length of the buffer sent, before the data of the buffer arrive. def Constant.swap_write_args(arg_list) list = [] arg_list.each { |arg| if(arg.is_size_a_var? && arg.size_var.write?) list << arg.size_var end list << arg if !list.include?(arg) } return list end # Iterate over the read pointer arguments. def each_read_arg(&block) # :yields: argument list = rearrange_rw_args(:read?) each = list.method(:each) each.call(&block) end # Iterate over the write pointer arguments. def each_write_arg(&block) # :yields: argument list = rearrange_rw_args(:write?) each = list.method(:each) each.call(&block) end # Iterate over the write pointer arguments. def each_write_arg_with_index(&block) # :yields: argument, index list = rearrange_rw_args(:write?) each = list.method(:each_with_index) each.call(&block) end # true if Constant is a fake system call, flase otherwise def fake?() @fake end # true if Constant has a SYS\_\* constant. It happens in the architectures (like x86 and ppc) # where the "socket call" are grouped in one system call: \_\_NR\_socketcall. def sys?() @sys.nil? ? false : true end # true if the system call that can be managed by a module of UMVIEW. def used_by_umview?() @used_by_umview end # returns the integer value of the \_\_NR\_\* constant of raise an exception # if #fake? returns true def nr_num if(@fake) raise "Fake system call doesn't have a number" else @nr_num end end # Returns a String that representation a Constant object. def to_s string = "+>> NAME = '#{@name}'; NR = '#{@nr}'(#{@nr_num}), SYS = '#{@sys}', RSC = '#{@rsc}'(#{@rsc_num})\n" string += "|- FAKE? = '#{@fake}', USED_BY_UMVIEW? = '#{@used_by_umview}'" if(@used_by_umview) string += "\n" string += "|- HEADERS = #{@headers.join(', ')}\n" string += "|- ARGUMENTS:\n" @args.each {|arg| string += " |- #{arg.inspect}\n" } else string += "\n" end return string end # Compares two Constant objects. These objects are compared by their \_\_NR\_* integer value. def <=>(b) @nr_num <=> b.nr_num end ######################################################################## ## Private Methods ######################################################################## private def rearrange_rw_args(selector_method) # Selects only writeable arguments and re-arrange them putting writable-size-vars # before their buffers selected_args = @args.select{|arg| arg.send(selector_method) } list = [] selected_args.each do |arg| # arg is a var AND his size is contained in another var AND this size var is non in the list? # If yes, add the size var. if(arg.is_size_a_var? && arg.size_var.send(selector_method) && !list.include?(arg.size_var)) list << arg.size_var end list << arg if not list.include?(arg) end return list end end # The class is a list of system call Constant. class ConstantList < Array attr_accessor :nr_all, :arch # It takes in input an Hash table where: # the keys:: are String representing the \_\_RSC\_* constants used by the _um_rsc_ module # to identify the system calls # the values:: are a object containing the list of headers files needed by the system call # and the list of C.Argument # # It use this hash table to set the Constant used by UMVIEW and their header and C.Argument lists. def set_used_by_umview(hash) hash.each { |umview_rsc, hdrs_args| self.each { |el| if(el.rsc == umview_rsc) el.used_by_umview = true el.headers = hdrs_args.headers el.args = hdrs_args.args end } } end # Sort the ConstantList using the \_\_RSC\_* constant and sets the _rsc_num_ of each C.Argument # to the position in the sorted list. def sort_rsc! self.sort!{|a, b| a.rsc <=> b.rsc} self.each_index { |i| self[i].rsc_num = i } end # Returns the maximum C.Argument in the list. def max max = self.first self.each {|el| if((el <=> max) == 1) max = el end } return max end # Returns an array with the only Constant used by UMVIEW. def umview() return self.select {|el| el.used_by_umview?} end # Iterate only on those Constant that are used by UMVIEW. # #-- # The & convert the block given in input to a Proc object #++ def each_umview(&block) # :yields: syscall_constant list = self.select {|el| el.used_by_umview?} # here the & convert the Proc to a block, because each takes in # input a block and not a Proc list.each(&block) end # Merge the ConstantList with _other_syslist_. def merge(other_syslist) hash = self.to_hash(:nr) hash_other_syslist = other_syslist.to_hash(:nr) hash.merge!(hash_other_syslist) return ConstantList.hash_to_sysconstlist(hash) end # Return a string containing a C table rsc_to_, # used by the _um_rsc_ module to convert a architecture independent # \_\_RSC\_* constant to a architecture dependent \_\_NR\* constant. def table_rsc_to_arch() string = String.new hash = to_hash(:nr) string << "struct nr_and_sys rsc_to_#{@arch}[] = {\n" i = 0 @nr_all.each {|el| arch_el = hash[el.nr] string << "\t/* #{i}. #{el.rsc} */ " if(arch_el.nil?) if(!el.sys.nil? && @arch.arch != :x86_64) @num = hash["__NR_socketcall"].nr_num string << "{#{@num}, #{el.sys}}" else # There isn't a corresponding __NR_ for the given __RSC_ constant in this architecture string << "{#{NO_VALUE}, #{NO_VALUE}}" end else #There is a __NR_* constant but not a SYS_ one string << "{#{arch_el.nr_num}, #{NO_VALUE}}" end string << "#{i != (@nr_all.length - 1) ? "," : ""}\n" i += 1 } string << "};\n" end # Return a string containing a C table _to_rsc, # used by the _um_rsc_ module to convert a architecture dependent # \_\_NR\_* constant to a architecture independent \_\_RSC\* constant. def table_nr_to_rsc string = table_nr_to_everything("enum rsc_constant", "#{@arch}_to_rsc", true){ |el, not_used| if(not_used) "__RSC_ERROR" else el.rsc end } return string end # Return a string containing a C table _to_str, # used by the _um_rsc_ module to convert a architecture dependent # \_\_NR\_* constant to string. def table_nr_to_str string = table_nr_to_everything("char *", "#{@arch}_to_str"){ |el, not_used| if(not_used) "\"UNDEFINED\"" else "\"#{el.nr}\"" end } return string end # Return a string containing a C table _to_str, # used by the _um_rsc_ module to convert a architecture independent # \_\_RSC\_* constant to string. def table_rsc_to_str() string = String.new string << "char *rsc_to_str[] = {\n" self.each_index {|i| el = self[i] string << "\t/* #{i}. #{el.rsc} */ \"#{el.rsc}\"#{i != self.length ? "," : ""}\n" } string << "};\n" return string end # Converts the ConstantList to and Hash table, where each entry has: # key:: the key is computed calling the method _key_ of the Constant # value:: the Constant it-self def to_hash(key) hash = Hash.new self.each { |el| hash[el.send(key)] = el } return hash end #--##################################################################### ## Class Methods #++##################################################################### # This method is specular to #to_hash, it create a ConstantList from and # Hash table. def self.hash_to_sysconstlist(hash) syscall_list = ConstantList.new hash.each_value { |el| syscall_list << el } return syscall_list end ######################################################################## ## Private Methods ######################################################################## private # Generic function used to produce the code for "nr_to_rsc" and # "nr_to_src" tables. def table_nr_to_everything(array_type, array_name, define_size_constant = false) string = String.new hash = to_hash(:nr) max = self.max if(define_size_constant) string << "#define #{array_name.upcase}_SIZE\t((sizeof(#{array_name}))/(sizeof(#{array_type})))\n" end string << "#{array_type} #{array_name}[] = {\n" (max.nr_num + 1).times {|i| ith_el = self.select{|el| el.nr_num == i unless el.fake? }.first if(ith_el.nil?) string << "\t/* #{i}. NOT USED */ #{yield(ith_el, true)}" else string << "\t/* #{i}. #{ith_el.nr} */ #{yield(ith_el, false)}" end string << "#{i != max.nr_num ? "," : ""}\n" } string << "};\n" return string end end end # module umview-0.8.2/um_rsc/librsc_templates/program/src/file_parser.rb0000755000175000017500000000573211753517212024031 0ustar renzorenzo#!/usr/bin/ruby -w # # This is part of RSC file generator program # # file_parser.rb: Parser class used to parse unistd.h header files # and syscall list file # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # require 'optparse' require 'ostruct' require 'c.rb' require 'syscall_constant.rb' #--#################################################################### ## COSTANTS #++#################################################################### # This class parses different type of file. See the different class methods. class Parser # Parses the unistd.h header _filename_ to extract the \_\_NR_* constants # and their integer value. # # Returns an hash table where the key is the \_\_NR\_* constant and # the value is a Syscall.Constant def self.parse_unistd(filename) hash = Hash.new File.open(filename, "r") { |f| f.each() { |line| if(line =~ /^#define (__NR_\w*)\s+?(.*)/) nr = $1.strip num = $2.strip #puts "Extracted from Regexp: nr = '#{nr}'; num = '#{num}'" if(num =~ /\((\w+)\+(\d+)\)/) nr_ref = $1 n = $2.to_i num = hash[nr_ref].nr_num + n elsif(num =~/__NR_\w+/) num = hash[num].nr_num end hash[nr] = Syscall::Constant.new(nr, num.to_i) end } } return Syscall::ConstantList.hash_to_sysconstlist(hash) end # Parse the syslist _filename_ and returns an hast table, where the # key is a \_\_RSC\_* string and the value is a OpenStruct with the # following attributes: # _args_:: containing the system call argument list # _headers_:: containing the C headers required by the system call def self.parse_syslist(filename) hash = {} File.open(filename, "r") { |file| file.each() { |line| line.strip! # I'm not interested in empty lines or comments if(line !~ /^#|^$/) rsc_const, args, headers = line.split("|").collect{|el| el.strip! } str_arg_list = args.split(',') arg_list = [] str_arg_list.each { |str_arg| begin arg_list << C::Argument.new(str_arg) rescue Exception => e $stderr.puts "Error parsing #{rsc_const} line: #{e}" $stderr.puts e.backtrace exit(-1) end } header_list = headers.split(',').collect{|el| el.strip} C::adjust_size_var_ref(arg_list) hash[rsc_const] = OpenStruct.new hash[rsc_const].args = arg_list hash[rsc_const].headers = header_list end } } return hash end end umview-0.8.2/um_rsc/librsc_templates/program/rsc_file_gen.rb0000755000175000017500000001707011753517212023364 0ustar renzorenzo#!/usr/bin/ruby -w # # This is part of RSC file generator program # # rsc_file_gen.rb: the RSC file generator program # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # $:.unshift File.join(File.dirname(__FILE__), "src") require 'optparse' require 'ostruct' require 'pp' require 'erb' require 'c.rb' require 'syscall_constant.rb' require 'file_parser.rb' ####################################################################### ## COSTANTS ####################################################################### REGEXP_TEMPLATE_EXT = /\.(c|h)$/ ####################################################################### ## LOCAL FUNCTIONS ####################################################################### def create_file(complete_path, text) prepare_file(complete_path) File.open(complete_path, "w") { |f| f.printf("%s", text) } end def get_binding(nr_x86, nr_x86_64, nr_ppc, nr_all) return binding() end # Test if the directories in the path of "filename" exists and, if not, it # create them. # Then tests if the file already exits and backup, in this way a backup copy # always exists def prepare_file(filename, backup_file = true) dir = File.dirname filename # If the directory doesn't exist, create it if(!File.exists? dir) dirpath = "" dir.each("/") {|dir| dir.sub!(/\//, "") dirpath += dir + "/" #puts "==> #{dirpath}" Dir.mkdir dirpath unless File.exists? dirpath } end end ####################################################################### ## MAIN PROGRAM ####################################################################### # Parsing arguments opts = OptionParser.new { |opts| opts.program_name = __FILE__ opts.banner = "Usage #{opts.program_name} syscall_list_file unistd_dir/ templates_dir/ librsc_dir/" opts.separator "" opts.separator "The program needs 4 argument, the first 3 are input arguments:" opts.separator " - 'syscall_list_file' is the file containing the system calls description." opts.separator " - 'unistd_dir' is the directory containing the 4 unistd.h headers, " opts.separator " one for each architecture (unistd_ppc.h, unistd_x86_64.h, unistd_x86.h)." opts.separator " - 'templates_dir' is the directory containing the templates to parse" opts.separator "The last argument ('librsc_dir') is the base output directory." opts.separator "" opts.separator "OPTIONS:" opts.on_tail("-h", "--help", "Show this help.") { puts opts; exit 0 } } opts.parse!(ARGV) if(ARGV.size != 4) puts opts exit(-1) end @syscall_list_file = ARGV[0] @unistd_dir = ARGV[1] @template_dir = ARGV[2] @librsc_dir = ARGV[3] nr_x86 = Parser::parse_unistd("#{@unistd_dir}/unistd_x86.h") nr_x86_64 = Parser::parse_unistd("#{@unistd_dir}/unistd_x86_64.h") nr_x86_64.delete_if{ |el| el.nr == "__NR_syscall_max" } # is not a sycall number nr_ppc = Parser::parse_unistd("#{@unistd_dir}/unistd_ppc.h") nr_ppc.delete_if{ |el| el.nr == "__NR_syscalls" } # is not a sycall number nr_all = nr_x86.merge(nr_x86_64) nr_all = nr_all.merge(nr_ppc) # I need to add 2 syscall that are not into the 3 hashes: __RSC_send and __RSC_recv # In this way I can associate to SYS_SEND and SYS_RECV in architectures like x86 and PPC nr_all << Syscall::Constant.new("__NR_send", -1, true) nr_all << Syscall::Constant.new("__NR_recv", -1, true) nr_all.sort_rsc! # I set the @nr_all attribute nr_x86.nr_all = nr_all nr_x86_64.nr_all = nr_all nr_ppc.nr_all = nr_all nr_x86.arch = Syscall::Arch.new(:x86) nr_x86_64.arch = Syscall::Arch.new(:x86_64) nr_ppc.arch = Syscall::Arch.new(:ppc) ### I generate the files: ################################################# # I add the template directory to the library path, because in the template # dir can reside some pieces of ruby code used by templates $:.unshift @template_dir template_dir = Dir.new(@template_dir) umview_rscs = Parser::parse_syslist(@syscall_list_file) # Setting which syscall are used in umview and which not nr_x86.set_used_by_umview(umview_rscs) nr_x86_64.set_used_by_umview(umview_rscs) nr_ppc.set_used_by_umview(umview_rscs) nr_all.set_used_by_umview(umview_rscs) nr_all_umview = nr_all.select{ |el| el.used_by_umview? } # Template parsing num_created_files = 0 template_dir.each { |filename| abs_path = File::join(template_dir.path, filename) if(File.file?(abs_path) && abs_path =~ REGEXP_TEMPLATE_EXT) # I open the template file template = File.open(abs_path, "r") { |f| f.read } # I create the parser message = ERB.new(template, 0, ">") # Is the template variables to default values @@librsc_relative_path = nil @@filename = nil @@overwrite_existing_copy = true begin # I parse the template result = message.result(get_binding(nr_x86, nr_x86_64, nr_ppc, nr_all)) rescue Exception => e $stderr.puts "Error occured during the parsing of \"#{abs_path}\":" $stderr.puts e.backtrace raise e end if(@@librsc_relative_path.nil?) raise "The variable \"@@librsc_relative_path\" is not defined in \"#{abs_path}\"" end if(@@filename.nil?) raise "The variable \"@@filename\" is not defined in \"#{abs_path}\"" end if(@@overwrite_existing_copy.class != TrueClass && @@overwrite_existing_copy.class != FalseClass) raise "The variable \"@@overwrite_existing_copy\" in \"#{abs_path}\" must contain a boolean value." end # I test if output file already exists and if there are some changes from # the "result" complete_path = "#{@librsc_dir}/#{@@librsc_relative_path}/#{@@filename}" # I control if the output file already exists if(File.file?(complete_path)) old_file = File.open(complete_path, "r") { |file| file.read } # If already exists, I control if it's different from the one that # I'm generating. If yes, I create a backup copy of the old # version before generating the file (I do this if, and only if, # the @@overwrite_existing_copy is set to true. if( old_file != result && @@overwrite_existing_copy ) #puts "#{complete_path} exists AND old_file != result AND @@overwrite_existing_copy = true" # Backup the old version before create the new one time = Time.new time_str = "#{time.to_f}_#{time.strftime("%d-%b-%y_%H-%M")}" backup_name = "#{File.dirname complete_path}/.#{File.basename complete_path}-bak_#{time_str}" File.rename(complete_path, backup_name) create_file(complete_path,result) num_created_files += 1 $stderr.puts "=> File \"#{complete_path}\": " $stderr.puts "| already exists and it's different from the one generated by the template, so" $stderr.puts "| a backup copy of the old version was created: \"#{File.basename backup_name}\"." $stderr.puts end else # The file doesn't exist, so I create it create_file(complete_path,result) num_created_files += 1 end end } nr_all.each_umview { |e| puts e } if $DEBUG puts "Created #{num_created_files} files." umview-0.8.2/um_rsc/librsc_templates/program/Rakefile.rb0000644000175000017500000000226611753517212022465 0ustar renzorenzo# # This is part of RSC file generator program # # Rekefile.rb: a ruby Makefile to manage the project # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. require 'rake/clean' CLEAN.add('doc') task :default => [:doc] desc "Create the library's documentation" task :doc do sh "rdoc" end desc "Execute the library tests" task :test do test_dir = 'tests' tests_list = ['c_test.rb'] tests_list_complete_path = tests_list.collect{|d| File::join(test_dir, d)} tests_list_complete_path.each do |test_path| ruby test_path end end umview-0.8.2/um_rsc/librsc_templates/Makefile0000644000175000017500000000165011753517212020403 0ustar renzorenzo# # This is part of RSC file generator program # # Makefile: librsc file generator makefile # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. .PHONY: templates templates: ruby program/rsc_file_gen.rb input/syscalls_rsc.list input/unistd_files/ input/templates/ ../librsc umview-0.8.2/um_rsc/librsc/0000755000175000017500000000000011753517351014667 5ustar renzorenzoumview-0.8.2/um_rsc/librsc/tests/0000755000175000017500000000000011753517351016031 5ustar renzorenzoumview-0.8.2/um_rsc/librsc/tests/tools/0000755000175000017500000000000011753517351017171 5ustar renzorenzoumview-0.8.2/um_rsc/librsc/tests/tools/fill_request.c0000644000175000017500000016747411753517212022052 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * fill_request.c: fill RSC request functions used by tests * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include "aconv.h" #include "rsc_client.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "fill_request.h" /* Fills a struct sockaddr_in and return it type-casted * to "struct sockaddr" */ struct sockaddr_in *fill_struct_sockaddr_in(void) { struct sockaddr_in *addr_in; addr_in = calloc(1, sizeof(struct sockaddr_in)); assert(!(addr_in == NULL)); addr_in->sin_family = AF_INET; addr_in->sin_addr.s_addr = htonl(INADDR_ANY); addr_in->sin_port = htons(9000); return addr_in; } char *fill_string(char *str) { char *path; if(str == NULL) str = "/tmp/"; path = calloc(1, strlen(str) + 1); assert(!(path == NULL)); strncpy(path, str, strlen(str) + 1); return path; } struct _llseek_req *fill__llseek_request(void) { struct _llseek_req *request; loff_t *result; request = calloc(1, sizeof(struct _llseek_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC__llseek); request->req_size = htonl(sizeof(struct _llseek_req)); request->fd = 10; request->offset_high = 100; request->offset_low = 50; result = calloc(1, sizeof(loff_t)); assert(!(result == NULL)); request->result = result; request->whence = SEEK_SET; return request; } struct accept_req *fill_accept_request(int addrlen_null) { struct accept_req *request; socklen_t *addrlen; int size_addrlen; request = calloc(1, sizeof(struct accept_req)); assert(!(request == NULL)); request->addr = (struct sockaddr *)fill_struct_sockaddr_in(); if(addrlen_null) { addrlen = NULL; size_addrlen = 0; } else { size_addrlen = sizeof(socklen_t); addrlen = calloc(2, size_addrlen); assert(!(addrlen == NULL)); /* Fill the buffer */ *addrlen = sizeof(struct sockaddr_in); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_accept); request->req_size = htonl(sizeof(struct accept_req) + size_addrlen); request->sockfd = 10; request->addrlen = addrlen; return request; } struct access_req *fill_access_request(int pathname_null) { struct access_req *request; char *pathname; int size_pathname; request = calloc(1, sizeof(struct access_req)); assert(!(request == NULL)); if(pathname_null) { pathname = NULL; size_pathname = 0; } else { pathname = fill_string(NULL); size_pathname = (strlen(pathname) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_access); request->req_size = htonl(sizeof(struct access_req) + size_pathname); request->pathname = pathname; request->mode = R_OK; return request; } struct adjtimex_req *fill_adjtimex_request(int buf_null) { struct adjtimex_req *request; struct timex *buf; int size_buf; request = calloc(1, sizeof(struct adjtimex_req)); assert(!(request == NULL)); if(buf_null) { size_buf = 0; buf = NULL; } else { size_buf = sizeof(struct timex); buf = calloc(1, size_buf); assert(!(buf == NULL)); /* Fill the buffer */ /* update only the time offset (request->offset). Only the root can do it, * normal users have to set 'modes' to 0. */ buf->modes = ADJ_OFFSET; buf->offset = 10; buf->freq = 1; buf->maxerror = 2; buf->esterror = 3; buf->status = 4; buf->constant = 5; buf->precision = 6; buf->tolerance = 7; buf->time.tv_sec = 10; buf->time.tv_usec = 20; buf->tick = 8; } request->buf = buf; request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_adjtimex); request->req_size = htonl(sizeof(struct adjtimex_req) + size_buf); return request; } struct bind_req *fill_bind_request(int my_addr_null) { struct bind_req *request; socklen_t size_my_addr; request = calloc(1, sizeof(struct bind_req)); assert(!(request == NULL)); if(my_addr_null) { request->my_addr = NULL; size_my_addr = 0; } else { request->my_addr = (struct sockaddr *)fill_struct_sockaddr_in(); size_my_addr = sizeof(struct sockaddr_in); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_bind); request->req_size = htonl(sizeof(struct bind_req) + size_my_addr); request->sockfd = 10; request->addrlen = size_my_addr; return request; } struct chdir_req *fill_chdir_request(int path_null) { struct chdir_req *request; char *path; int size_path; request = calloc(1, sizeof(struct chdir_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_chdir); request->req_size = htonl(sizeof(struct chdir_req) + size_path); request->path = path; return request; } struct chmod_req *fill_chmod_request(int path_null) { struct chmod_req *request; char *path; int size_path; request = calloc(1, sizeof(struct chmod_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_chmod); request->req_size = htonl(sizeof(struct chmod_req) + size_path); request->path = path; request->mode = S_IRUSR || S_IWUSR; return request; } struct chown_req *fill_chown_request(int path_null) { struct chown_req *request; char *path; int size_path; request = calloc(1, sizeof(struct chown_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_chown); request->req_size = htonl(sizeof(struct chown_req) + size_path); request->path = path; request->owner = 0; request->group = 0; return request; } struct chown32_req *fill_chown32_request(int path_null) { struct chown32_req *request; char *path; int size_path; request = calloc(1, sizeof(struct chown32_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_chown32); request->req_size = htonl(sizeof(struct chown32_req) + size_path); request->path = path; request->owner = 0; request->group = 0; return request; } struct clock_getres_req *fill_clock_getres_request(void) { struct clock_getres_req *request; request = calloc(1, sizeof(struct clock_getres_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_clock_getres); request->req_size = htonl(sizeof(struct clock_getres_req)); request->clk_id = 1; request->res = calloc(1, sizeof(struct timespec)); assert(!(request->res == NULL)); return request; } struct clock_gettime_req *fill_clock_gettime_request(void) { struct clock_gettime_req *request; request = calloc(1, sizeof(struct clock_gettime_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_clock_gettime); request->req_size = htonl(sizeof(struct clock_gettime_req)); request->clk_id = 1; request->tp = calloc(1, sizeof(struct timespec)); assert(!(request->tp == NULL)); return request; } struct clock_settime_req *fill_clock_settime_request(int tp_null) { struct clock_settime_req *request; struct timespec *tp; int size_tp; request = calloc(1, sizeof(struct clock_settime_req)); assert(!(request == NULL)); if(tp_null) { size_tp = 0; tp = NULL; } else { size_tp = sizeof(struct timespec); tp = calloc(1, size_tp); assert(!(tp == NULL)); /* Fill the buffer */ tp->tv_sec = 10; tp->tv_nsec = 10; } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_clock_settime); request->req_size = htonl(sizeof(struct clock_settime_req) + size_tp); request->clk_id = 1; request->tp = tp; return request; } struct close_req *fill_close_request(void) { struct close_req *request; request = calloc(1, sizeof(struct close_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_close); request->req_size = htonl(sizeof(struct close_req)); request->fd = 10; return request; } struct connect_req *fill_connect_request(int serv_addr_null) { struct connect_req *request; struct sockaddr *serv_addr; socklen_t size_serv_addr; request = calloc(1, sizeof(struct connect_req)); assert(!(request == NULL)); if(serv_addr_null) { size_serv_addr = 0; serv_addr = NULL; } else { size_serv_addr = sizeof(struct sockaddr_in); serv_addr = (struct sockaddr *)fill_struct_sockaddr_in(); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_connect); request->req_size = htonl(sizeof(struct connect_req) + size_serv_addr); request->sockfd = 10; request->serv_addr = serv_addr; request->addrlen = size_serv_addr; return request; } struct dup_req *fill_dup_request(void) { struct dup_req *request; request = calloc(1, sizeof(struct dup_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_dup); request->req_size = htonl(sizeof(struct dup_req)); request->oldfd = 10; return request; } struct dup2_req *fill_dup2_request(void) { struct dup2_req *request; request = calloc(1, sizeof(struct dup2_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_dup2); request->req_size = htonl(sizeof(struct dup2_req)); request->oldfd = 10; request->newfd = 11; return request; } struct fchdir_req *fill_fchdir_request(void) { struct fchdir_req *request; request = calloc(1, sizeof(struct fchdir_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_fchdir); request->req_size = htonl(sizeof(struct fchdir_req)); request->fd = 10; return request; } struct fchmod_req *fill_fchmod_request(void) { struct fchmod_req *request; request = calloc(1, sizeof(struct fchmod_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_fchmod); request->req_size = htonl(sizeof(struct fchmod_req)); request->fildes = 10; request->mode = S_IRGRP || S_IWGRP; return request; } struct fchown_req *fill_fchown_request(void) { struct fchown_req *request; request = calloc(1, sizeof(struct fchown_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_fchown); request->req_size = htonl(sizeof(struct fchown_req)); request->fd = 10; request->owner = 0; request->group = 0; return request; } struct fchown32_req *fill_fchown32_request(void) { struct fchown32_req *request; request = calloc(1, sizeof(struct fchown32_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_fchown32); request->req_size = htonl(sizeof(struct fchown32_req)); request->fd = 10; request->owner = 0; request->group = 0; return request; } struct fcntl_req *fill_fcntl_request(u_int16_t cmd_type, int lock_null) { struct fcntl_req *request; int buffer_size = 0; request = calloc(1, sizeof(struct fcntl_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_fcntl); request->cmd_type = cmd_type; request->fd = 10; switch(cmd_type) { case FCNTL_NO_3RD_ARG: request->cmd = F_GETFD; break; case FCNTL_3RD_LONG: request->cmd = F_DUPFD; request->third.arg = 12345; break; case FCNTL_3RD_FLOCK_R: request->cmd = F_SETLK; break; case FCNTL_3RD_FLOCK_RW: request->cmd = F_GETLK; break; case FCNTL_3RD_FLOCK_W: fprintf(stderr, "A fcntl command that use the 'struct flock' only for writing doesn't exist"); assert(0); break; default: fprintf(stderr, "wrong cmd_type: %lX", cmd_type); assert(0); break; } if(cmd_type & FCNTL_3RD_FLOCK) { if(!lock_null) { request->third.lock = calloc(1, sizeof(struct flock)); assert(!(request->third.lock == NULL)); request->third.lock->l_type = F_RDLCK; request->third.lock->l_whence = SEEK_SET; request->third.lock->l_start = 33; request->third.lock->l_len = 40; request->third.lock->l_pid = 123; if(cmd_type == FCNTL_3RD_FLOCK_R || cmd_type == FCNTL_3RD_FLOCK_RW) buffer_size = sizeof(struct flock); } else { request->third.lock = NULL; } } request->req_size = htonl(sizeof(struct fcntl_req) + buffer_size); return request; } struct fcntl64_req *fill_fcntl64_request(void) { #if 0 struct fcntl64_req *request; request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_fcntl64); request->req_size = htonl(sizeof(struct fcntl64_req)); request->fd = /* FIXME */; request->cmd = /* FIXME */; return request; #endif return NULL; } struct fdatasync_req *fill_fdatasync_request(void) { struct fdatasync_req *request; request = calloc(1, sizeof(struct fdatasync_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_fdatasync); request->req_size = htonl(sizeof(struct fdatasync_req)); request->fd = 10; return request; } struct fgetxattr_req *fill_fgetxattr_request(int name_null) { struct fgetxattr_req *request; char *name; int size_name; request = calloc(1, sizeof(struct fgetxattr_req)); assert(!(request == NULL)); if(name_null) { name = NULL; size_name = 0; } else { name = fill_string("user.mime_type"); size_name = (strlen(name) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_fgetxattr); request->req_size = htonl(sizeof(struct fgetxattr_req) + size_name); request->filedes = 10; request->name = name; request->value = calloc(20, sizeof(char)); assert(!(request->value == NULL)); request->size = sizeof(char) * 20; return request; } struct fstat64_req *fill_fstat64_request(void) { struct fstat64_req *request; request = calloc(1, sizeof(struct fstat64_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_fstat64); request->req_size = htonl(sizeof(struct fstat64_req)); request->filedes = 10; request->buf = calloc(1, sizeof(struct stat64)); assert(!(request->buf == NULL)); return request; } struct fstatfs64_req *fill_fstatfs64_request(void) { struct fstatfs64_req *request; request = calloc(1, sizeof(struct fstatfs64_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_fstatfs64); request->req_size = htonl(sizeof(struct fstatfs64_req)); request->fd = 10; request->buf = calloc(1, sizeof(struct statfs64)); assert(!(request->buf == NULL)); return request; } struct fsync_req *fill_fsync_request(void) { struct fsync_req *request; request = calloc(1, sizeof(struct fsync_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_fsync); request->req_size = htonl(sizeof(struct fsync_req)); request->fd = 10; return request; } struct getpeername_req *fill_getpeername_request(int namelen_null) { struct getpeername_req *request; socklen_t *namelen; int size_namelen; request = calloc(1, sizeof(struct getpeername_req)); assert(!(request == NULL)); if(namelen_null) { size_namelen = 0; namelen = NULL; } else { size_namelen = sizeof(socklen_t); namelen = calloc(1, size_namelen); assert(!(namelen == NULL)); *namelen = sizeof(struct sockaddr_in); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_getpeername); request->req_size = htonl(sizeof(struct getpeername_req) + size_namelen); request->s = 10; request->name = calloc(1, sizeof(struct sockaddr_in)); assert(!(request->name == NULL)); request->namelen = namelen; return request; } struct getsockname_req *fill_getsockname_request(int namelen_null) { struct getsockname_req *request; socklen_t *namelen; int size_namelen; request = calloc(1, sizeof(struct getsockname_req)); assert(!(request == NULL)); if(namelen_null) { size_namelen = 0; namelen = NULL; } else { size_namelen = sizeof(socklen_t); namelen = calloc(1, size_namelen); assert(!(namelen == NULL)); *namelen = sizeof(struct sockaddr); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_getsockname); request->req_size = htonl(sizeof(struct getsockname_req) + size_namelen); request->s = 10; request->name = calloc(1, sizeof(struct sockaddr)); assert(!(request->name == NULL)); request->namelen = namelen; return request; } struct getsockopt_req *fill_getsockopt_request(int optlen_null) { struct getsockopt_req *request; socklen_t *optlen; int size_optlen; request = calloc(1, sizeof(struct getsockopt_req)); assert(!(request == NULL)); if(optlen_null) { size_optlen = 0; optlen = NULL; } else { size_optlen = sizeof(socklen_t); optlen = calloc(1, size_optlen); assert(!(optlen == NULL)); /* Fill the buffer */ *optlen = sizeof(int); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_getsockopt); request->req_size = htonl(sizeof(struct getsockopt_req) + size_optlen); request->s = 10; request->level = SOL_SOCKET; request->optname = SO_REUSEADDR; request->optval = calloc(1, sizeof(int)); assert(!(request->optval == NULL)); request->optlen = optlen; return request; } struct gettimeofday_req *fill_gettimeofday_request(void) { struct gettimeofday_req *request; request = calloc(1, sizeof(struct gettimeofday_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_gettimeofday); request->req_size = htonl(sizeof(struct gettimeofday_req)); request->tv = calloc(1, sizeof(struct timeval)); assert(!(request->tv == NULL)); request->tz = calloc(1, sizeof(struct timezone)); assert(!(request->tz == NULL)); return request; } struct getxattr_req *fill_getxattr_request(int path_null, int name_null) { struct getxattr_req *request; char *path; int size_path; char *name; int size_name; request = calloc(1, sizeof(struct getxattr_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } if(name_null) { name = NULL; size_name = 0; } else { name = fill_string("user.mime_type"); size_name = (strlen(name) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_getxattr); request->req_size = htonl(sizeof(struct getxattr_req) + size_path + size_name); request->path = path; request->name = name; request->value = calloc(20, sizeof(char)); assert(!(request->value == NULL)); request->size = 20 * sizeof(char); return request; } struct lchown_req *fill_lchown_request(int path_null) { struct lchown_req *request; char *path; int size_path; request = calloc(1, sizeof(struct lchown_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_lchown); request->req_size = htonl(sizeof(struct lchown_req) + size_path); request->path = path; request->owner = 0; request->group = 0; return request; } struct lchown32_req *fill_lchown32_request(int path_null) { struct lchown32_req *request; char *path; int size_path; request = calloc(1, sizeof(struct lchown32_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_lchown32); request->req_size = htonl(sizeof(struct lchown32_req) + size_path); request->path = path; request->owner = 0; request->group = 0; return request; } struct lgetxattr_req *fill_lgetxattr_request(int path_null, int name_null) { struct lgetxattr_req *request; char *path; int size_path; char *name; int size_name; request = calloc(1, sizeof(struct lgetxattr_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } if(name_null) { name = NULL; size_name = 0; } else { name = fill_string("user.mime_type"); size_name = (strlen(name) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_lgetxattr); request->req_size = htonl(sizeof(struct lgetxattr_req) + size_path + size_name); request->path = path; request->name = name; request->value = calloc(20, sizeof(char)); assert(!(request->value == NULL)); request->size = 20 * sizeof(char); return request; } struct link_req *fill_link_request(int oldpath_null, int newpath_null) { struct link_req *request; char *oldpath; int size_oldpath; char *newpath; int size_newpath; request = calloc(1, sizeof(struct link_req)); assert(!(request == NULL)); if(oldpath_null) { oldpath = NULL; size_oldpath = 0; } else { oldpath = fill_string(NULL); size_oldpath = (strlen(oldpath) + 1); } if(newpath_null) { newpath = NULL; size_newpath = 0; } else { newpath = fill_string(NULL); size_newpath = (strlen(newpath) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_link); request->req_size = htonl(sizeof(struct link_req) + size_oldpath + size_newpath); request->oldpath = oldpath; request->newpath = newpath; return request; } struct listen_req *fill_listen_request(void) { struct listen_req *request; request = calloc(1, sizeof(struct listen_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_listen); request->req_size = htonl(sizeof(struct listen_req)); request->sockfd = 10; request->backlog = 5; return request; } struct lseek_req *fill_lseek_request(void) { struct lseek_req *request; request = calloc(1, sizeof(struct lseek_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_lseek); request->req_size = htonl(sizeof(struct lseek_req)); request->fildes = 10; request->offset = 100; request->whence = SEEK_SET; return request; } struct lstat64_req *fill_lstat64_request(int path_null) { struct lstat64_req *request; char *path; int size_path; request = calloc(1, sizeof(struct lstat64_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = strlen(path) + 1; assert(!(path == NULL)); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_lstat64); request->req_size = htonl(sizeof(struct lstat64_req) + size_path); request->path = path; request->buf = calloc(1, sizeof(struct stat64)); assert(!(request->buf == NULL)); return request; } struct mkdir_req *fill_mkdir_request(int pathname_null) { struct mkdir_req *request; char *pathname; int size_pathname; request = calloc(1, sizeof(struct mkdir_req)); assert(!(request == NULL)); if(pathname_null) { pathname = NULL; size_pathname = 0; } else { pathname = fill_string(NULL); size_pathname = (strlen(pathname) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_mkdir); request->req_size = htonl(sizeof(struct mkdir_req) + size_pathname); request->pathname = pathname; request->mode = 0700; return request; } struct mount_req *fill_mount_request(int source_null, int target_null, int filesystemtype_null, int data_null) { struct mount_req *request; char *source; int size_source; char *target; int size_target; char *filesystemtype; int size_filesystemtype; void *data; int size_data; request = calloc(1, sizeof(struct mount_req)); assert(!(request == NULL)); if(source_null) { size_source = 0; source = NULL; } else { source = fill_string("/dev/hda1"); size_source = (strlen(source) + 1); } if(target_null) { size_target = 0; target = NULL; } else { target = fill_string(NULL); size_target = (strlen(target) + 1); } if(filesystemtype_null) { size_filesystemtype = 0; filesystemtype = NULL; } else { filesystemtype = fill_string("ext3"); size_filesystemtype = (strlen(filesystemtype) + 1); } if(data_null) { size_data = 0; data = NULL; } else { data = fill_string("defaults,user,umask=077"); size_data = (strlen(data) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_mount); request->req_size = htonl(sizeof(struct mount_req) + size_source + size_target + size_filesystemtype + size_data); request->source = source; request->target = target; request->filesystemtype = filesystemtype; request->mountflags = MS_NOEXEC; request->data = data; return request; } #if 0 struct mmap_req *fill_mmap_request(void) { struct mmap_req *request; request = calloc(1, sizeof(struct mmap_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_mmap); request->req_size = htonl(sizeof(struct mmap_req)); request->start = 0; request->length = 100; request->prot = PROT_NONE; request->flags = MAP_SHARED; request->fd = 10; request->offset = 20; return request; } struct mmap2_req *fill_mmap2_request(void) { struct mmap2_req *request; request = calloc(1, sizeof(struct mmap2_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_mmap2); request->req_size = htonl(sizeof(struct mmap2_req)); request->start = 0; request->length = 100; request->prot = PROT_NONE; request->flags = MAP_SHARED; request->fd = 10; request->pgoffset = 20; return request; } #endif struct open_req *fill_open_request(int pathname_null) { struct open_req *request; char *pathname; int size_pathname; request = calloc(1, sizeof(struct open_req)); assert(!(request == NULL)); if(pathname_null) { pathname = NULL; size_pathname = 0; } else { pathname = fill_string(NULL); size_pathname = (strlen(pathname) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_open); request->req_size = htonl(sizeof(struct open_req) + size_pathname); request->pathname = pathname; request->flags = O_RDONLY; return request; } struct pread64_req *fill_pread64_request(void) { struct pread64_req *request; request = calloc(1, sizeof(struct pread64_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_pread64); request->req_size = htonl(sizeof(struct pread64_req)); request->fd = 10; request->buf = calloc(200, sizeof(char)); assert(!(request->buf == NULL)); request->count = 100; request->offset = 20; return request; } struct pwrite64_req *fill_pwrite64_request(int buf_null) { struct pwrite64_req *request; void *buf; size_t size_buf; request = calloc(1, sizeof(struct pwrite64_req)); assert(!(request == NULL)); if(buf_null) { size_buf = 0; buf = NULL; } else { size_buf = sizeof(char) * 30; buf = calloc(1, size_buf); assert(!(buf == NULL)); /* Fill the buffer */ memset(buf, 'a', size_buf); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_pwrite64); request->req_size = htonl(sizeof(struct pwrite64_req) + size_buf); request->fd = 10; request->buf = buf; request->count = size_buf; request->offset = 20; return request; } struct read_req *fill_read_request(void) { struct read_req *request; request = calloc(1, sizeof(struct read_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_read); request->req_size = htonl(sizeof(struct read_req)); request->fd = 10; request->buf = calloc(20, sizeof(char)); assert(!(request->buf == NULL)); request->count = sizeof(char) * 20; return request; } struct readlink_req *fill_readlink_request(int path_null) { struct readlink_req *request; char *path; int size_path; request = calloc(1, sizeof(struct readlink_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_readlink); request->req_size = htonl(sizeof(struct readlink_req) + size_path); request->path = path; request->buf = calloc(20, sizeof(char)); assert(!(request->buf == NULL)); request->bufsiz = sizeof(char) * 20; return request; } struct recv_req *fill_recv_request(void) { struct recv_req *request; request = calloc(1, sizeof(struct recv_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_recv); request->req_size = htonl(sizeof(struct recv_req)); request->s = 10; request->buf = calloc(20, sizeof(char)); assert(!(request->buf == NULL)); request->len = sizeof(char) * 20; request->flags = MSG_WAITALL; return request; } struct recvfrom_req *fill_recvfrom_request(int fromlen_null, int from_null) { struct recvfrom_req *request; struct sockaddr *from; socklen_t size_from; socklen_t *fromlen; int size_fromlen; request = calloc(1, sizeof(struct recvfrom_req)); assert(!(request == NULL)); if(from_null) { from = NULL; size_from = 0; } else { from = (struct sockaddr *)fill_struct_sockaddr_in(); size_from = sizeof(struct sockaddr_in); } if(fromlen_null) { size_fromlen = 0; fromlen = NULL; } else { size_fromlen = sizeof(socklen_t); fromlen = calloc(1, size_fromlen); assert(!(fromlen == NULL)); *fromlen = sizeof(struct sockaddr_in); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_recvfrom); request->req_size = htonl(sizeof(struct recvfrom_req) + size_from + size_fromlen); request->s = 10; request->buf = calloc(20, sizeof(char)); assert(!(request->buf == NULL)); request->len = sizeof(char) * 20; request->flags = MSG_WAITALL; request->from = from; request->fromlen = fromlen; return request; } struct rename_req *fill_rename_request(int oldpath_null, int newpath_null) { struct rename_req *request; char *oldpath; int size_oldpath; char *newpath; int size_newpath; request = calloc(1, sizeof(struct rename_req)); assert(!(request == NULL)); if(oldpath_null) { oldpath = NULL; size_oldpath = 0; } else { oldpath = fill_string(NULL); size_oldpath = (strlen(oldpath) + 1); } if(newpath_null) { newpath = NULL; size_newpath = 0; } else { newpath = fill_string(NULL); size_newpath = (strlen(newpath) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_rename); request->req_size = htonl(sizeof(struct rename_req) + size_oldpath + size_newpath); request->oldpath = oldpath; request->newpath = newpath; return request; } struct rmdir_req *fill_rmdir_request(int pathname_null) { struct rmdir_req *request; char *pathname; int size_pathname; request = calloc(1, sizeof(struct rmdir_req)); assert(!(request == NULL)); if(pathname_null) { pathname = NULL; size_pathname = 0; } else { pathname = fill_string(NULL); size_pathname = (strlen(pathname) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_rmdir); request->req_size = htonl(sizeof(struct rmdir_req) + size_pathname); request->pathname = pathname; return request; } struct send_req *fill_send_request(int buf_null) { struct send_req *request; void *buf; size_t size_buf; request = calloc(1, sizeof(struct send_req)); assert(!(request == NULL)); if(buf_null) { size_buf = 0; buf = NULL; } else { size_buf = sizeof(char) * 20; buf = calloc(1, size_buf); assert(!(buf == NULL)); /* Fill the buffer */ memset(buf, 'a', size_buf); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_send); request->req_size = htonl(sizeof(struct send_req) + size_buf); request->s = 10; request->buf = buf; request->len = size_buf; request->flags = 0; return request; } struct sendto_req *fill_sendto_request(int buf_null, int to_null) { struct sendto_req *request; void *buf; size_t size_buf; struct sockaddr *to; socklen_t size_to; request = calloc(1, sizeof(struct sendto_req)); assert(!(request == NULL)); if(buf_null) { size_buf = 0; buf = NULL; } else { size_buf = sizeof(char) * 20; buf = calloc(1, size_buf); assert(!(buf == NULL)); /* Fill the buffer */ memset(buf, 'a', size_buf); } if(to_null) { to = NULL; size_to = 0; } else { to = (struct sockaddr *)fill_struct_sockaddr_in(); size_to = sizeof(struct sockaddr_in); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_sendto); request->req_size = htonl(sizeof(struct sendto_req) + size_buf + size_to); request->s = 10; request->buf = buf; request->len = size_buf; request->flags = 0; request->to = to; request->tolen = size_to; return request; } struct setdomainname_req *fill_setdomainname_request(int name_null) { struct setdomainname_req *request; char *name; int size_name; request = calloc(1, sizeof(struct setdomainname_req)); assert(!(request == NULL)); if(name_null) { name = NULL; size_name = 0; } else { name = fill_string("domainname"); size_name = (strlen(name) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_setdomainname); request->req_size = htonl(sizeof(struct setdomainname_req) + size_name); request->name = name; request->len = size_name; return request; } struct sethostname_req *fill_sethostname_request(int name_null) { struct sethostname_req *request; int size_name; char *name; request = calloc(1, sizeof(struct sethostname_req)); assert(!(request == NULL)); if(name_null) { name = NULL; size_name = 0; } else { name = fill_string("hostname"); size_name = strlen(name) + 1; } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_sethostname); request->req_size = htonl(sizeof(struct sethostname_req)); request->name = name; request->len = size_name; return request; } struct setsockopt_req *fill_setsockopt_request(int optval_null) { struct setsockopt_req *request; int *optval; socklen_t size_optval; request = calloc(1, sizeof(struct setsockopt_req)); assert(!(request == NULL)); if(optval_null) { size_optval = 0; optval = NULL; } else { size_optval = sizeof(int); optval = calloc(1, size_optval); assert(!(optval == NULL)); /* Fill the buffer */ *optval = htonl(1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_setsockopt); request->req_size = htonl(sizeof(struct setsockopt_req) + size_optval); request->s = 10; request->level = SOL_SOCKET; request->optname = SO_REUSEADDR; request->optval = optval; request->optlen = size_optval; return request; } struct settimeofday_req *fill_settimeofday_request(int tv_null, int tz_null) { struct settimeofday_req *request; struct timeval *tv; struct timezone *tz; int size_tv, size_tz; request = calloc(1, sizeof(struct settimeofday_req)); assert(!(request == NULL)); if(tv_null) { size_tv = 0; tv = NULL; } else { size_tv = sizeof(struct timeval); tv = calloc(1, size_tv); assert(!(tv == NULL)); /* Fill the buffer */ tv->tv_sec = 10; tv->tv_usec = 30; } if(tz_null) { size_tz = 0; tz = NULL; } else { size_tz = sizeof(struct timezone); tz = calloc(1, size_tz); assert(!(tz == NULL)); /* Fill the buffer */ tz->tz_minuteswest = 20; tz->tz_dsttime = 40; } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_settimeofday); request->req_size = htonl(sizeof(struct settimeofday_req) + size_tv + size_tz); request->tv = tv; request->tz = tz; return request; } struct shutdown_req *fill_shutdown_request(void) { struct shutdown_req *request; request = calloc(1, sizeof(struct shutdown_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_shutdown); request->req_size = htonl(sizeof(struct shutdown_req)); request->s = 10; request->how = SHUT_RDWR; return request; } struct socket_req *fill_socket_request(void) { struct socket_req *request; request = calloc(1, sizeof(struct socket_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_socket); request->req_size = htonl(sizeof(struct socket_req)); request->domain = AF_INET; request->type = SOCK_STREAM; request->protocol = 0; return request; } struct stat64_req *fill_stat64_request(int path_null) { struct stat64_req *request; char *path; int size_path; request = calloc(1, sizeof(struct stat64_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_stat64); request->req_size = htonl(sizeof(struct stat64_req) + size_path); request->path = path; request->buf = calloc(1, sizeof(struct stat64)); assert(!(request->buf == NULL)); return request; } struct statfs64_req *fill_statfs64_request(int path_null) { struct statfs64_req *request; char *path; int size_path; request = calloc(1, sizeof(struct statfs64_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_statfs64); request->req_size = htonl(sizeof(struct statfs64_req) + size_path); request->path = path; request->buf = calloc(1, sizeof(struct statfs64)); assert(!(request->buf == NULL)); return request; } struct symlink_req *fill_symlink_request(int oldpath_null, int newpath_null) { struct symlink_req *request; char *oldpath; int size_oldpath; char *newpath; int size_newpath; request = calloc(1, sizeof(struct symlink_req)); assert(!(request == NULL)); if(oldpath_null) { oldpath = NULL; size_oldpath = 0; } else { oldpath = fill_string(NULL); size_oldpath = (strlen(oldpath) + 1); } if(newpath_null) { newpath = NULL; size_newpath = 0; } else { newpath = fill_string(NULL); size_newpath = (strlen(newpath) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_symlink); request->req_size = htonl(sizeof(struct symlink_req) + size_oldpath + size_newpath); request->oldpath = oldpath; request->newpath = newpath; return request; } struct umount2_req *fill_umount2_request(int target_null) { struct umount2_req *request; char *target; int size_target; request = calloc(1, sizeof(struct umount2_req)); assert(!(request == NULL)); if(target_null) { target = NULL; size_target = 0; } else { target = fill_string(NULL); size_target = (strlen(target) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_umount2); request->req_size = htonl(sizeof(struct umount2_req) + size_target); request->target = target; /* request->flags = MNT_DETACH; */ request->flags = 0; return request; } struct uname_req *fill_uname_request(void) { struct uname_req *request; request = calloc(1, sizeof(struct uname_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_uname); request->req_size = htonl(sizeof(struct uname_req)); request->buf = calloc(1, sizeof(struct utsname)); assert(!(request->buf == NULL)); return request; } struct unlink_req *fill_unlink_request(int pathname_null) { struct unlink_req *request; char *pathname; int size_pathname; request = calloc(1, sizeof(struct unlink_req)); assert(!(request == NULL)); if(pathname_null) { pathname = NULL; size_pathname = 0; } else { pathname = fill_string(NULL); size_pathname = (strlen(pathname) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_unlink); request->req_size = htonl(sizeof(struct unlink_req) + size_pathname); request->pathname = pathname; return request; } struct utime_req *fill_utime_request(int filename_null, int buf_null) { struct utime_req *request; char *filename; int size_filename; struct utimbuf *buf; int size_buf; request = calloc(1, sizeof(struct utime_req)); assert(!(request == NULL)); if(filename_null) { filename = NULL; size_filename = 0; } else { filename = fill_string(NULL); size_filename = (strlen(filename) + 1); } if(buf_null) { size_buf = 0; buf = NULL; } else { size_buf = sizeof(struct utimbuf); buf = calloc(1, size_buf); assert(!(buf == NULL)); /* Fill the buffer */ buf->actime = 200; buf->modtime = 100; } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_utime); request->req_size = htonl(sizeof(struct utime_req) + size_filename + size_buf); request->filename = filename; request->buf = buf; return request; } struct utimes_req *fill_utimes_request(int filename_null) { struct utimes_req *request; char *filename; int size_filename; request = calloc(1, sizeof(struct utimes_req)); assert(!(request == NULL)); if(filename_null) { filename = NULL; size_filename = 0; } else { filename = fill_string(NULL); size_filename = (strlen(filename) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_utimes); request->req_size = htonl(sizeof(struct utimes_req) + size_filename); request->filename = filename; request->tv[0].tv_sec = 100; request->tv[0].tv_usec = 100; request->tv[1].tv_sec = 100; request->tv[1].tv_usec = 100; return request; } struct write_req *fill_write_request(int buf_null) { struct write_req *request; void *buf; size_t size_buf; request = calloc(1, sizeof(struct write_req)); assert(!(request == NULL)); if(buf_null) { size_buf = 0; buf = NULL; } else { size_buf = 10 * sizeof(char); buf = calloc(1, size_buf); assert(!(buf == NULL)); /* Fill the buffer */ memset(buf, 'a', size_buf); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_write); request->req_size = htonl(sizeof(struct write_req) + size_buf); request->fd = 10; request->buf = buf; request->count = size_buf; return request; } struct ftruncate64_req *fill_ftruncate64_request(void) { struct ftruncate64_req *request; request = calloc(1, sizeof(struct ftruncate64_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_ftruncate64); request->req_size = htonl(sizeof(struct ftruncate64_req)); request->fd = 10; request->length = 200; return request; } struct getdents64_req *fill_getdents64_request(void) { struct getdents64_req *request; request = calloc(1, sizeof(struct getdents64_req)); assert(!(request == NULL)); request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_getdents64); request->req_size = htonl(sizeof(struct getdents64_req)); request->fd = 10; request->dirp = calloc(1, sizeof(struct dirent64)); assert(!(request->dirp == NULL)); request->count = sizeof(struct dirent64); return request; } struct truncate64_req *fill_truncate64_request(int path_null) { struct truncate64_req *request; char *path; int size_path; request = calloc(1, sizeof(struct truncate64_req)); assert(!(request == NULL)); if(path_null) { path = NULL; size_path = 0; } else { path = fill_string(NULL); size_path = (strlen(path) + 1); } request->req_type = RSC_SYS_REQ; request->req_rsc_const = htons(__RSC_truncate64); request->req_size = htonl(sizeof(struct truncate64_req) + size_path); request->path = path; request->length = 200; return request; } /**********************************************************/ /* Free filled request */ /**********************************************************/ void free_filled__llseek_request(struct _llseek_req *req, int only_pointed_memory) { if(req->result != NULL) free(req->result); if(! only_pointed_memory) free(req); } void free_filled_accept_request(struct accept_req *req, int only_pointed_memory) { if(req->addr != NULL) free(req->addr); if(req->addrlen != NULL) free(req->addrlen); if(! only_pointed_memory) free(req); } void free_filled_access_request(struct access_req *req, int only_pointed_memory) { if(req->pathname != NULL) free(req->pathname); if(! only_pointed_memory) free(req); } void free_filled_adjtimex_request(struct adjtimex_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_bind_request(struct bind_req *req, int only_pointed_memory) { if(req->my_addr != NULL) free(req->my_addr); if(! only_pointed_memory) free(req); } void free_filled_chdir_request(struct chdir_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(! only_pointed_memory) free(req); } void free_filled_chmod_request(struct chmod_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(! only_pointed_memory) free(req); } void free_filled_chown_request(struct chown_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(! only_pointed_memory) free(req); } void free_filled_chown32_request(struct chown32_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(! only_pointed_memory) free(req); } void free_filled_clock_getres_request(struct clock_getres_req *req, int only_pointed_memory) { if(req->res != NULL) free(req->res); if(! only_pointed_memory) free(req); } void free_filled_clock_gettime_request(struct clock_gettime_req *req, int only_pointed_memory) { if(req->tp != NULL) free(req->tp); if(! only_pointed_memory) free(req); } void free_filled_clock_settime_request(struct clock_settime_req *req, int only_pointed_memory) { if(req->tp != NULL) free(req->tp); if(! only_pointed_memory) free(req); } void free_filled_close_request(struct close_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_connect_request(struct connect_req *req, int only_pointed_memory) { if(req->serv_addr != NULL) free(req->serv_addr); if(! only_pointed_memory) free(req); } void free_filled_dup_request(struct dup_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_dup2_request(struct dup2_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_fchdir_request(struct fchdir_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_fchmod_request(struct fchmod_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_fchown_request(struct fchown_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_fchown32_request(struct fchown32_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_fdatasync_request(struct fdatasync_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_fgetxattr_request(struct fgetxattr_req *req, int only_pointed_memory) { if(req->name != NULL) free(req->name); if(req->value != NULL) free(req->value); if(! only_pointed_memory) free(req); } void free_filled_fstat64_request(struct fstat64_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_fstatfs64_request(struct fstatfs64_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_fsync_request(struct fsync_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_ftruncate64_request(struct ftruncate64_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_getdents64_request(struct getdents64_req *req, int only_pointed_memory) { if(req->dirp != NULL) free(req->dirp); if(! only_pointed_memory) free(req); } void free_filled_getpeername_request(struct getpeername_req *req, int only_pointed_memory) { if(req->name != NULL) free(req->name); if(req->namelen != NULL) free(req->namelen); if(! only_pointed_memory) free(req); } void free_filled_getsockname_request(struct getsockname_req *req, int only_pointed_memory) { if(req->name != NULL) free(req->name); if(req->namelen != NULL) free(req->namelen); if(! only_pointed_memory) free(req); } void free_filled_getsockopt_request(struct getsockopt_req *req, int only_pointed_memory) { if(req->optval != NULL) free(req->optval); if(req->optlen != NULL) free(req->optlen); if(! only_pointed_memory) free(req); } void free_filled_gettimeofday_request(struct gettimeofday_req *req, int only_pointed_memory) { if(req->tv != NULL) free(req->tv); if(req->tz != NULL) free(req->tz); if(! only_pointed_memory) free(req); } void free_filled_getxattr_request(struct getxattr_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(req->name != NULL) free(req->name); if(req->value != NULL) free(req->value); if(! only_pointed_memory) free(req); } void free_filled_lchown_request(struct lchown_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(! only_pointed_memory) free(req); } void free_filled_lchown32_request(struct lchown32_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(! only_pointed_memory) free(req); } void free_filled_lgetxattr_request(struct lgetxattr_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(req->name != NULL) free(req->name); if(req->value != NULL) free(req->value); if(! only_pointed_memory) free(req); } void free_filled_link_request(struct link_req *req, int only_pointed_memory) { if(req->oldpath != NULL) free(req->oldpath); if(req->newpath != NULL) free(req->newpath); if(! only_pointed_memory) free(req); } void free_filled_listen_request(struct listen_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_lseek_request(struct lseek_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_lstat64_request(struct lstat64_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_mkdir_request(struct mkdir_req *req, int only_pointed_memory) { if(req->pathname != NULL) free(req->pathname); if(! only_pointed_memory) free(req); } void free_filled_mount_request(struct mount_req *req, int only_pointed_memory) { if(req->source != NULL) free(req->source); if(req->target != NULL) free(req->target); if(req->filesystemtype != NULL) free(req->filesystemtype); if(req->data != NULL) free(req->data); if(! only_pointed_memory) free(req); } void free_filled_open_request(struct open_req *req, int only_pointed_memory) { if(req->pathname != NULL) free(req->pathname); if(! only_pointed_memory) free(req); } void free_filled_pread64_request(struct pread64_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_pwrite64_request(struct pwrite64_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_read_request(struct read_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_readlink_request(struct readlink_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_recv_request(struct recv_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_recvfrom_request(struct recvfrom_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(req->from != NULL) free(req->from); if(req->fromlen != NULL) free(req->fromlen); if(! only_pointed_memory) free(req); } void free_filled_rename_request(struct rename_req *req, int only_pointed_memory) { if(req->oldpath != NULL) free(req->oldpath); if(req->newpath != NULL) free(req->newpath); if(! only_pointed_memory) free(req); } void free_filled_rmdir_request(struct rmdir_req *req, int only_pointed_memory) { if(req->pathname != NULL) free(req->pathname); if(! only_pointed_memory) free(req); } void free_filled_send_request(struct send_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_sendto_request(struct sendto_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(req->to != NULL) free(req->to); if(! only_pointed_memory) free(req); } void free_filled_setdomainname_request(struct setdomainname_req *req, int only_pointed_memory) { if(req->name != NULL) free(req->name); if(! only_pointed_memory) free(req); } void free_filled_sethostname_request(struct sethostname_req *req, int only_pointed_memory) { if(req->name != NULL) free(req->name); if(! only_pointed_memory) free(req); } void free_filled_setsockopt_request(struct setsockopt_req *req, int only_pointed_memory) { if(req->optval != NULL) free(req->optval); if(! only_pointed_memory) free(req); } void free_filled_settimeofday_request(struct settimeofday_req *req, int only_pointed_memory) { if(req->tv != NULL) free(req->tv); if(req->tz != NULL) free(req->tz); if(! only_pointed_memory) free(req); } void free_filled_shutdown_request(struct shutdown_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_socket_request(struct socket_req *req, int only_pointed_memory) { if(! only_pointed_memory) free(req); } void free_filled_stat64_request(struct stat64_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_statfs64_request(struct statfs64_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_symlink_request(struct symlink_req *req, int only_pointed_memory) { if(req->oldpath != NULL) free(req->oldpath); if(req->newpath != NULL) free(req->newpath); if(! only_pointed_memory) free(req); } void free_filled_truncate64_request(struct truncate64_req *req, int only_pointed_memory) { if(req->path != NULL) free(req->path); if(! only_pointed_memory) free(req); } void free_filled_umount2_request(struct umount2_req *req, int only_pointed_memory) { if(req->target != NULL) free(req->target); if(! only_pointed_memory) free(req); } void free_filled_uname_request(struct uname_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_unlink_request(struct unlink_req *req, int only_pointed_memory) { if(req->pathname != NULL) free(req->pathname); if(! only_pointed_memory) free(req); } void free_filled_utime_request(struct utime_req *req, int only_pointed_memory) { if(req->filename != NULL) free(req->filename); if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_utimes_request(struct utimes_req *req, int only_pointed_memory) { if(req->filename != NULL) free(req->filename); if(! only_pointed_memory) free(req); } void free_filled_write_request(struct write_req *req, int only_pointed_memory) { if(req->buf != NULL) free(req->buf); if(! only_pointed_memory) free(req); } void free_filled_fcntl_request(struct fcntl_req *req, int only_pointed_memory) { if(req->cmd_type & FCNTL_3RD_FLOCK) free(req->third.lock); if(! only_pointed_memory) free(req); } void free_filled_ioctl_request(struct ioctl_req *req, int only_pointed_memory) { if(req->arg != NULL) free(req->arg); if(! only_pointed_memory) free(req); } struct ioctl_req *fill_ioctl_request(int arg_null, int how) { struct ioctl_req *request; char *arg; int size_arg; request = calloc(1, sizeof(struct ioctl_req)); assert(!(request == NULL)); if(arg_null) { size_arg = 0; arg = NULL; } else { size_arg = 100; arg = calloc(1, size_arg); assert(!(arg == NULL)); /* Fill the buffer */ memset(arg, 'a', size_arg); } request->arg = arg; request->req_type = htonl(__RSC_ioctl); request->req_size = htonl(sizeof(struct ioctl_req) + size_arg); request->d = 10; switch(how) { case FILL_IOCTL_R: request->request = 10; break; case FILL_IOCTL_W: request->request = 20; break; default: request->request = 30; break; } return request; } umview-0.8.2/um_rsc/librsc/tests/tools/type_equality.c0000644000175000017500000001221211753517212022225 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * type_equality.c: functions to test the equality of two variables * with same type * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ /* This module contains functions that test the equality of two structures, * strings or void buffers. */ #include #include #include #include #include #ifndef __USE_LARGEFILE64 #define __USE_LARGEFILE64 #endif #include #include #include #include #include #include "type_equality.h" int compare_struct_sockaddr(struct sockaddr *a, struct sockaddr *b) { if(a == NULL && b == NULL) return 1; if(a == NULL || b == NULL) return 0; return ( (a->sa_family == b->sa_family) && (memcmp(a->sa_data, b->sa_data, 14 * sizeof(char)) == 0) ); } int compare_struct_statfs64(struct statfs64 *a, struct statfs64 *b) { if(a == NULL && b ==NULL) return 1; if(a == NULL || b == NULL) return 0; return ( (b->f_type == a->f_type) && (b->f_bsize == a->f_bsize) && (b->f_blocks == a->f_blocks) && (b->f_bfree == a->f_bfree) && (b->f_bavail == a->f_bavail) && (b->f_files == a->f_files) && (b->f_ffree == a->f_ffree) && /* (b->f_fsid == a->f_fsid) && */ (b->f_namelen == a->f_namelen) && (b->f_frsize == a->f_frsize) ); } int compare_struct_timespec(struct timespec *a, struct timespec *b) { if(a == NULL && b ==NULL) return 1; if(a == NULL || b == NULL) return 0; return ( (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec) ); } int compare_struct_timeval(struct timeval *a, struct timeval *b) { if(a == NULL && b ==NULL) return 1; if(a == NULL || b == NULL) return 0; return ( (a->tv_sec == b->tv_sec) && (a->tv_usec == b->tv_usec) ); } int compare_struct_timex(struct timex *a, struct timex *b) { if(a == NULL && b ==NULL) return 1; if(a == NULL || b == NULL) return 0; return ( (b->modes == a->modes) && (b->offset == a->offset) && (b->freq == a->freq) && (b->maxerror == a->maxerror) && (b->esterror == a->esterror) && (b->status == a->status) && (b->constant == a->constant) && (b->precision == a->precision) && (b->tolerance == a->tolerance) && compare_struct_timeval(&b->time, &a->time) && (b->tick == a->tick) ); } int compare_struct_timezone(struct timezone *a, struct timezone *b) { if(a == NULL && b ==NULL) return 1; if(a == NULL || b == NULL) return 0; return ( (a->tz_minuteswest == b->tz_minuteswest) && (a->tz_dsttime == b->tz_dsttime) ); } int compare_struct_utimbuf(struct utimbuf *a, struct utimbuf *b) { if(a == NULL && b ==NULL) return 1; if(a == NULL || b == NULL) return 0; return ( (a->actime == b->actime) && (a->modtime == b->modtime)); } int compare_struct_stat64(struct stat64 *a, struct stat64 *b) { if(a == NULL && b ==NULL) return 1; if(a == NULL || b == NULL) return 0; return( (a->st_dev == b->st_dev) && (a->st_ino == b->st_ino) && (a->st_mode == b->st_mode) && (a->st_nlink == b->st_nlink) && (a->st_uid == b->st_uid) && (a->st_gid == b->st_gid) && (a->st_rdev == b->st_rdev) && (a->st_size == b->st_size) && (a->st_atime == b->st_atime) && (a->st_mtime == b->st_mtime) && (a->st_ctime == b->st_ctime) && (a->st_blksize == b->st_blksize) && (a->st_blocks == b->st_blocks)); } int compare_struct_dirent64(struct dirent64 *a, struct dirent64 *b) { if(a == NULL && b ==NULL) return 1; if(a == NULL || b == NULL) return 0; return ( (a->d_ino == b->d_ino) && (a->d_off == b->d_off) && (a->d_reclen == b->d_reclen) && (a->d_type == b->d_type) && (strcmp(a->d_name, b->d_name) == 0)); } int compare_struct_utsname(struct utsname *a, struct utsname *b) { if(a == NULL && b ==NULL) return 1; if(a == NULL || b == NULL) return 0; return ( (strcmp(a->sysname, b->sysname) == 0) && (strcmp(a->nodename, b->nodename) == 0) && (strcmp(a->release, b->release) == 0) && (strcmp(a->version, b->version) == 0) && (strcmp(a->machine, b->machine) == 0)); } int compare_struct_flock(struct flock *a, struct flock *b) { if(a == NULL && b ==NULL) return 1; if(a == NULL || b == NULL) return 0; return ( (a->l_type == b->l_type) && (a->l_whence == b->l_whence) && (a->l_start == b->l_start) && (a->l_len == b->l_len) && (a->l_pid == b->l_pid)); } umview-0.8.2/um_rsc/librsc/tests/tools/fill_request.h0000644000175000017500000002662311753517212022045 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * fill_request.h: header of the fill RSC request functions used by tests * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __FILL_REQUEST_HEADER__ #define __FILL_REQUEST_HEADER__ #include #include #include #include #include #include "rsc_client.h" #define FALSE 0 #define TRUE 1 struct sockaddr_in *fill_struct_sockaddr_in(void); char *fill_string(char *str); /**********************************************************/ /* Fill request */ /**********************************************************/ struct _llseek_req *fill__llseek_request(void); struct accept_req *fill_accept_request(int addrlen_null); struct access_req *fill_access_request(int pathname_null); struct adjtimex_req *fill_adjtimex_request(int buf_null); struct bind_req *fill_bind_request(int my_addr_null); struct chdir_req *fill_chdir_request(int path_null); struct chmod_req *fill_chmod_request(int path_null); struct chown_req *fill_chown_request(int path_null); struct chown32_req *fill_chown32_request(int path_null); struct clock_getres_req *fill_clock_getres_request(void); struct clock_gettime_req *fill_clock_gettime_request(void); struct clock_settime_req *fill_clock_settime_request(int tp_null); struct close_req *fill_close_request(void); struct connect_req *fill_connect_request(int serv_addr_null); struct dup_req *fill_dup_request(void); struct dup2_req *fill_dup2_request(void); struct fchdir_req *fill_fchdir_request(void); struct fchmod_req *fill_fchmod_request(void); struct fchown_req *fill_fchown_request(void); struct fchown32_req *fill_fchown32_request(void); struct fdatasync_req *fill_fdatasync_request(void); struct fgetxattr_req *fill_fgetxattr_request(int name_null); struct fstat64_req *fill_fstat64_request(void); struct fstatfs64_req *fill_fstatfs64_request(void); struct fsync_req *fill_fsync_request(void); struct ftruncate64_req *fill_ftruncate64_request(void); struct getdents64_req *fill_getdents64_request(void); struct getpeername_req *fill_getpeername_request(int namelen_null); struct getsockname_req *fill_getsockname_request(int namelen_null); struct getsockopt_req *fill_getsockopt_request(int optlen_null); struct gettimeofday_req *fill_gettimeofday_request(void); struct getxattr_req *fill_getxattr_request(int path_null, int name_null); struct lchown_req *fill_lchown_request(int path_null); struct lchown32_req *fill_lchown32_request(int path_null); struct lgetxattr_req *fill_lgetxattr_request(int path_null, int name_null); struct link_req *fill_link_request(int oldpath_null, int newpath_null); struct listen_req *fill_listen_request(void); struct lseek_req *fill_lseek_request(void); struct lstat64_req *fill_lstat64_request(int path_null); struct mkdir_req *fill_mkdir_request(int pathname_null); struct mount_req *fill_mount_request(int source_null, int target_null, int filesystemtype_null, int data_null); struct open_req *fill_open_request(int pathname_null); struct pread64_req *fill_pread64_request(void); struct pwrite64_req *fill_pwrite64_request(int buf_null); struct read_req *fill_read_request(void); struct readlink_req *fill_readlink_request(int path_null); struct recv_req *fill_recv_request(void); struct recvfrom_req *fill_recvfrom_request(int fromlen_null, int from_null); struct rename_req *fill_rename_request(int oldpath_null, int newpath_null); struct rmdir_req *fill_rmdir_request(int pathname_null); struct send_req *fill_send_request(int buf_null); struct sendto_req *fill_sendto_request(int buf_null, int to_null); struct setdomainname_req *fill_setdomainname_request(int name_null); struct sethostname_req *fill_sethostname_request(int name_null); struct setsockopt_req *fill_setsockopt_request(int optval_null); struct settimeofday_req *fill_settimeofday_request(int tv_null, int tz_null); struct shutdown_req *fill_shutdown_request(void); struct socket_req *fill_socket_request(void); struct stat64_req *fill_stat64_request(int path_null); struct statfs64_req *fill_statfs64_request(int path_null); struct symlink_req *fill_symlink_request(int oldpath_null, int newpath_null); struct truncate64_req *fill_truncate64_request(int path_null); struct umount2_req *fill_umount2_request(int target_null); struct uname_req *fill_uname_request(void); struct unlink_req *fill_unlink_request(int pathname_null); struct utime_req *fill_utime_request(int filename_null, int buf_null); struct utimes_req *fill_utimes_request(int filename_null); struct write_req *fill_write_request(int buf_null); #define FILL_IOCTL_R 0x1 #define FILL_IOCTL_W 0x2 #define FILL_IOCTL_RW (FILL_IOCTL_R | FILL_IOCTL_W) struct ioctl_req *fill_ioctl_request(int arg_null, int how); struct fcntl_req *fill_fcntl_request(u_int16_t cmd_type, int lock_null); /**********************************************************/ /* Free filled request */ /**********************************************************/ void free_filled__llseek_request(struct _llseek_req *req, int only_pointed_memory); void free_filled_accept_request(struct accept_req *req, int only_pointed_memory); void free_filled_access_request(struct access_req *req, int only_pointed_memory); void free_filled_adjtimex_request(struct adjtimex_req *req, int only_pointed_memory); void free_filled_bind_request(struct bind_req *req, int only_pointed_memory); void free_filled_chdir_request(struct chdir_req *req, int only_pointed_memory); void free_filled_chmod_request(struct chmod_req *req, int only_pointed_memory); void free_filled_chown_request(struct chown_req *req, int only_pointed_memory); void free_filled_chown32_request(struct chown32_req *req, int only_pointed_memory); void free_filled_clock_getres_request(struct clock_getres_req *req, int only_pointed_memory); void free_filled_clock_gettime_request(struct clock_gettime_req *req, int only_pointed_memory); void free_filled_clock_settime_request(struct clock_settime_req *req, int only_pointed_memory); void free_filled_close_request(struct close_req *req, int only_pointed_memory); void free_filled_connect_request(struct connect_req *req, int only_pointed_memory); void free_filled_dup_request(struct dup_req *req, int only_pointed_memory); void free_filled_dup2_request(struct dup2_req *req, int only_pointed_memory); void free_filled_fchdir_request(struct fchdir_req *req, int only_pointed_memory); void free_filled_fchmod_request(struct fchmod_req *req, int only_pointed_memory); void free_filled_fchown_request(struct fchown_req *req, int only_pointed_memory); void free_filled_fchown32_request(struct fchown32_req *req, int only_pointed_memory); void free_filled_fdatasync_request(struct fdatasync_req *req, int only_pointed_memory); void free_filled_fgetxattr_request(struct fgetxattr_req *req, int only_pointed_memory); void free_filled_fstat64_request(struct fstat64_req *req, int only_pointed_memory); void free_filled_fstatfs64_request(struct fstatfs64_req *req, int only_pointed_memory); void free_filled_fsync_request(struct fsync_req *req, int only_pointed_memory); void free_filled_ftruncate64_request(struct ftruncate64_req *req, int only_pointed_memory); void free_filled_getdents64_request(struct getdents64_req *req, int only_pointed_memory); void free_filled_getpeername_request(struct getpeername_req *req, int only_pointed_memory); void free_filled_getsockname_request(struct getsockname_req *req, int only_pointed_memory); void free_filled_getsockopt_request(struct getsockopt_req *req, int only_pointed_memory); void free_filled_gettimeofday_request(struct gettimeofday_req *req, int only_pointed_memory); void free_filled_getxattr_request(struct getxattr_req *req, int only_pointed_memory); void free_filled_lchown_request(struct lchown_req *req, int only_pointed_memory); void free_filled_lchown32_request(struct lchown32_req *req, int only_pointed_memory); void free_filled_lgetxattr_request(struct lgetxattr_req *req, int only_pointed_memory); void free_filled_link_request(struct link_req *req, int only_pointed_memory); void free_filled_listen_request(struct listen_req *req, int only_pointed_memory); void free_filled_lseek_request(struct lseek_req *req, int only_pointed_memory); void free_filled_lstat64_request(struct lstat64_req *req, int only_pointed_memory); void free_filled_mkdir_request(struct mkdir_req *req, int only_pointed_memory); void free_filled_mount_request(struct mount_req *req, int only_pointed_memory); void free_filled_open_request(struct open_req *req, int only_pointed_memory); void free_filled_pread64_request(struct pread64_req *req, int only_pointed_memory); void free_filled_pwrite64_request(struct pwrite64_req *req, int only_pointed_memory); void free_filled_read_request(struct read_req *req, int only_pointed_memory); void free_filled_readlink_request(struct readlink_req *req, int only_pointed_memory); void free_filled_recv_request(struct recv_req *req, int only_pointed_memory); void free_filled_recvfrom_request(struct recvfrom_req *req, int only_pointed_memory); void free_filled_rename_request(struct rename_req *req, int only_pointed_memory); void free_filled_rmdir_request(struct rmdir_req *req, int only_pointed_memory); void free_filled_send_request(struct send_req *req, int only_pointed_memory); void free_filled_sendto_request(struct sendto_req *req, int only_pointed_memory); void free_filled_setdomainname_request(struct setdomainname_req *req, int only_pointed_memory); void free_filled_sethostname_request(struct sethostname_req *req, int only_pointed_memory); void free_filled_setsockopt_request(struct setsockopt_req *req, int only_pointed_memory); void free_filled_settimeofday_request(struct settimeofday_req *req, int only_pointed_memory); void free_filled_shutdown_request(struct shutdown_req *req, int only_pointed_memory); void free_filled_socket_request(struct socket_req *req, int only_pointed_memory); void free_filled_stat64_request(struct stat64_req *req, int only_pointed_memory); void free_filled_statfs64_request(struct statfs64_req *req, int only_pointed_memory); void free_filled_symlink_request(struct symlink_req *req, int only_pointed_memory); void free_filled_truncate64_request(struct truncate64_req *req, int only_pointed_memory); void free_filled_umount2_request(struct umount2_req *req, int only_pointed_memory); void free_filled_uname_request(struct uname_req *req, int only_pointed_memory); void free_filled_unlink_request(struct unlink_req *req, int only_pointed_memory); void free_filled_utime_request(struct utime_req *req, int only_pointed_memory); void free_filled_utimes_request(struct utimes_req *req, int only_pointed_memory); void free_filled_write_request(struct write_req *req, int only_pointed_memory); void free_filled_fcntl_request(struct fcntl_req *req, int only_pointed_memory); void free_filled_ioctl_request(struct ioctl_req *req, int only_pointed_memory); #endif /* __FILL_REQUEST_HEADER__ */ umview-0.8.2/um_rsc/librsc/tests/tools/fill_write_pointers.c0000644000175000017500000001754511753517212023430 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * fill_write_pointers.c: functions used during the tests * to fill write syscall buffers * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include "rsc_client.h" #include "fill_request.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include int simple_fill() { errno = 0; return 0; } int _llseek_fill_write_pointers(unsigned int fd, unsigned long int offset_high, unsigned long int offset_low, loff_t *result, unsigned int whence) { if(result != NULL) *result = 10; return 0; } int accept_fill_write_pointers(int sockfd, struct sockaddr *addr, socklen_t *addrlen) { struct sockaddr *a; if(addr != NULL) { a = fill_struct_sockaddr_in(); memcpy(addr, a, sizeof(struct sockaddr_in)); free(a); if(addrlen != NULL) *addrlen = sizeof(struct sockaddr_in); } else { if(addrlen != NULL) *addrlen = 0; } return 0; } int adjtimex_fill_write_pointers(struct timex *buf) { if(buf != NULL) buf->offset = 20; return 0; } int clock_getres_fill_write_pointers(clockid_t clk_id, struct timespec *res) { if(res != NULL) { res->tv_sec = 10; res->tv_nsec = 100; } return 0; } int clock_gettime_fill_write_pointers(clockid_t clk_id, struct timespec *tp) { if(tp != NULL) { tp->tv_sec = 10; tp->tv_nsec = 100; } return 0; } int fgetxattr_fill_write_pointers(int filedes, char *name, void *value, size_t size) { if(value != NULL) memset(value, 'b', size); return 0; } int fstat64_fill_write_pointers(int filedes, struct stat64 *buf) { if(buf != NULL) { buf->st_dev = 10; buf->st_ino = 10 ; buf->st_mode = S_IRWXU; buf->st_nlink = 2; buf->st_uid = 1000; buf->st_gid = 1000; buf->st_rdev = 1; buf->st_size = 1024; buf->st_atime = 1000; buf->st_mtime = 2000; buf->st_ctime = 3000; buf->st_blksize = 512; buf->st_blocks = 2; } return 0; } int fstatfs64_fill_write_pointers(unsigned int fd, struct statfs64 *buf) { if(buf != NULL) { buf->f_type = 1; buf->f_bsize = 512; buf->f_blocks = 2; buf->f_bfree = 3; buf->f_bavail = 3; buf->f_files = 10; buf->f_ffree = 2; buf->f_namelen = 200; buf->f_frsize = 1; } return 0; } int getdents64_fill_write_pointers(unsigned int fd, struct dirent64 *dirp, unsigned int count) { if(dirp != NULL) { dirp->d_ino = 2; dirp->d_off = 10; dirp->d_reclen = 20; dirp->d_type = 30; dirp->d_name[0] = '/'; dirp->d_name[1] = 't'; dirp->d_name[2] = 'm'; dirp->d_name[3] = 'p'; dirp->d_name[4] = '/'; dirp->d_name[5] = '\0'; } return 0; } int getpeername_fill_write_pointers(int s, struct sockaddr *name, socklen_t *namelen) { if(name != NULL) { struct sockaddr *a; a = fill_struct_sockaddr_in(); memcpy(name, a, sizeof(struct sockaddr_in)); if(namelen != NULL) *namelen = sizeof(struct sockaddr_in); free(a); } else if(namelen != NULL) *namelen = 0; return 0; } int getsockname_fill_write_pointers(int s, struct sockaddr *name, socklen_t *namelen) { if(name != NULL) { struct sockaddr *a; a = fill_struct_sockaddr_in(); memcpy(name, a, sizeof(struct sockaddr_in)); if(namelen != NULL) *namelen = sizeof(struct sockaddr_in); free(a); } else if(namelen != NULL) *namelen = 0; return 0; } int getsockopt_fill_write_pointers(int s, int level, int optname, void *optval, socklen_t *optlen) { if(optlen != NULL) { if(optval != NULL ) { *optlen = sizeof(int); memset(optval, 1, sizeof(int)); } else { *optlen = 0; } } return 0; } int gettimeofday_fill_write_pointers(struct timeval *tv, struct timezone *tz) { if(tv != NULL) { tv->tv_sec = 10; tv->tv_usec = 20; } if(tz != NULL) { tz->tz_minuteswest = 60; tz->tz_dsttime = 1; } return 0; } int getxattr_fill_write_pointers(char *path, char *name, void *value, size_t size) { if(value != NULL) memset(value, 'b', size); return 0; } int lgetxattr_fill_write_pointers(char *path, char *name, void *value, size_t size) { if(value != NULL) memset(value, 'b', size); return 0; } int lstat64_fill_write_pointers(char *path, struct stat64 *buf) { if(buf != NULL) { buf->st_dev = 10; buf->st_ino = 10 ; buf->st_mode = S_IRWXU; buf->st_nlink = 2; buf->st_uid = 1000; buf->st_gid = 1000; buf->st_rdev = 1; buf->st_size = 1024; buf->st_atime = 1000; buf->st_mtime = 2000; buf->st_ctime = 3000; buf->st_blksize = 512; buf->st_blocks = 2; } return 0; } int pread64_fill_write_pointers(int fd, void *buf, size_t count, off_t offset) { if(buf != NULL) memset(buf, 'b', count); return 0; } int read_fill_write_pointers(int fd, void *buf, size_t count) { if(buf != NULL) memset(buf, 'b', count); return count; } int readlink_fill_write_pointers(char *path, char *buf, size_t bufsiz) { if(buf != NULL) { char *str; size_t str_len; str = fill_string(NULL); str_len = strlen(str); memcpy(buf, str, str_len > bufsiz ? bufsiz : str_len ); free(str); } return 0; } int recv_fill_write_pointers(int s, void *buf, size_t len, int flags) { if(buf != NULL) memset(buf, 'b', len); return 0; } int recvfrom_fill_write_pointers(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { if(buf != NULL) memset(buf, 'b', len); if(fromlen != NULL) *fromlen = sizeof(struct sockaddr); return 0; } int stat64_fill_write_pointers(char *path, struct stat64 *buf) { if(buf != NULL) { buf->st_dev = 10; buf->st_ino = 10 ; buf->st_mode = S_IRWXU; buf->st_nlink = 2; buf->st_uid = 1000; buf->st_gid = 1000; buf->st_rdev = 1; buf->st_size = 1024; buf->st_atime = 1000; buf->st_mtime = 2000; buf->st_ctime = 3000; buf->st_blksize = 512; buf->st_blocks = 2; } return 0; } int statfs64_fill_write_pointers(char *path, struct statfs64 *buf) { if(buf != NULL) { buf->f_type = 1; buf->f_bsize = 512; buf->f_blocks = 2; buf->f_bfree = 3; buf->f_bavail = 3; buf->f_files = 10; buf->f_ffree = 2; buf->f_namelen = 200; buf->f_frsize = 1; } return 0; } int uname_fill_write_pointers(struct utsname *buf) { if(buf != NULL) { strcpy(buf->sysname, "sysname"); strcpy(buf->nodename, "nodename"); strcpy(buf->release, "release"); strcpy(buf->version, "1"); strcpy(buf->machine, "x86"); } return 0; } int ioctl_fill_write_pointers(int d, int request, void *arg) { if(arg != NULL && (request == 20 || request == 30)) memset(arg, 'b', 100); return 0; } int fcntl_fill_write_pointers(int16_t cmd_type, int fd, int cmd, struct flock *lock) { if((cmd_type & FCNTL_3RD_FLOCK_W) && lock != NULL) { lock->l_type = F_WRLCK; lock->l_whence = SEEK_END; lock->l_start = 66; lock->l_len = 80; lock->l_pid = 246; } return 0; } umview-0.8.2/um_rsc/librsc/tests/tools/type_equality.h0000644000175000017500000000536611753517212022246 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * type_equality.h: functions to test the equality of two variables * with same type * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ /* This module contains functions that test the equality of two structures, * strings or void buffers. */ #ifndef __TEST_TYPE_EQUALITY__ #define __TEST_TYPE_EQUALITY__ #include #include #include #include #include #include #include #ifndef __USE_LARGEFILE64 #define __USE_LARGEFILE64 #endif #include #include #include #include /* "a" and "b" are pointers. * Are equal if bot are NULL OR if both * are not NULL and have the same value. */ #define compare_simple_type(a,b) ( (((a) == NULL) && ((b) == NULL)) || ( ((a) != NULL) && ((b) != NULL) && (*(a) == *(b)) ) ) #define compare_loff_t(a,b) compare_simple_type(a,b) #define compare_socklen_t(a,b) compare_simple_type(a,b) #define compare_time_t(a,b) compare_simple_type(a,b) #define compare_mem(a,b,n) ( ((a) == NULL && (b) == NULL) || (((a) != NULL) && ((b) != NULL) && (memcmp(a,b,n) == 0)) ) #define compare_string(a,b) ( ((a) == NULL && (b) == NULL) || (((a) != NULL) && ((b) != NULL) && (strcmp(a, b) == 0)) ) int compare_struct_sockaddr(struct sockaddr *a, struct sockaddr *b); int compare_struct_timespec(struct timespec *a, struct timespec *b); int compare_struct_timeval(struct timeval *a, struct timeval *b); int compare_struct_timex(struct timex *a, struct timex *b); int compare_struct_timezone(struct timezone *a, struct timezone *b); int compare_struct_utimbuf(struct utimbuf *a, struct utimbuf *b); int compare_struct_stat64(struct stat64 *a, struct stat64 *b); int compare_struct_statfs64(struct statfs64 *a, struct statfs64 *b); int compare_struct_dirent64(struct dirent64 *a, struct dirent64 *b); int compare_struct_utsname(struct utsname *a, struct utsname *b); int compare_struct_flock(struct flock *a, struct flock *b); #endif /* __TEST_TYPE_EQUALITY__ */ umview-0.8.2/um_rsc/librsc/tests/tools/client_server.c0000644000175000017500000000574111753517212022204 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * client_server.c: client and server setup functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include int setup_client(char *server_addr, char *server_port) { int sockfd; struct sockaddr_in client; struct addrinfo hints, *res; bzero(&hints, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; hints.ai_family = AF_INET; if(getaddrinfo(server_addr, server_port, &hints, &res) != 0) { fprintf(stderr, "socket() error: %s\n", strerror(errno)); return -1; } sockfd = socket(res->ai_family, res->ai_socktype, 0); if(sockfd == -1) { fprintf(stderr, "socket() error: %s\n", strerror(errno)); return -1; } bzero(&client, sizeof(client)); client.sin_family = AF_INET; client.sin_port = htons(0); client.sin_addr.s_addr = INADDR_ANY; if(bind(sockfd, (struct sockaddr *)&client, sizeof(client)) == -1) { fprintf(stderr, "bind() error: %s\n", strerror(errno)); return -1; } if(connect(sockfd, res->ai_addr, res->ai_addrlen) == -1) { fprintf(stderr, "connect() error: %s\n", strerror(errno)); return -1; } free(res); return sockfd; } int setup_server(short int server_port) { int sockfd, connfd, optval; struct sockaddr_in server, client; socklen_t addrlen; sockfd = socket(PF_INET, SOCK_STREAM, 0); if(sockfd == -1) { fprintf(stderr, "socket() error: %s\n", strerror(errno)); return -1; } optval = 1; setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)); bzero(&server, sizeof(server)); server.sin_family = AF_INET; server.sin_port = htons(server_port); server.sin_addr.s_addr = INADDR_ANY; if(bind(sockfd, (struct sockaddr *)&server, sizeof(server)) == -1) { fprintf(stderr, "bind() error: %s\n", strerror(errno)); return -1; } if(listen(sockfd, 10) == -1) { fprintf(stderr, "listen() error: %s\n", strerror(errno)); return -1; } addrlen = sizeof(client); if((connfd = accept(sockfd, (struct sockaddr *)&client, &addrlen)) == -1) { fprintf(stderr, "accept() error: %s\n", strerror(errno)); return -1; } return connfd; } umview-0.8.2/um_rsc/librsc/tests/tools/fill_write_pointers.h0000644000175000017500000000677511753517212023440 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * fill_write_pointers.h: header of the functions used during the tests * to fill write syscall buffers * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __FILL_WRITE_POINTERS__ #define __FILL_WRITE_POINTERS__ #include #include #include "rsc_client.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include int simple_fill(); int _llseek_fill_write_pointers(unsigned int fd, unsigned long int offset_high, unsigned long int offset_low, loff_t *result, unsigned int whence); int accept_fill_write_pointers(int sockfd, struct sockaddr *addr, socklen_t *addrlen); int adjtimex_fill_write_pointers(struct timex *buf); int clock_getres_fill_write_pointers(clockid_t clk_id, struct timespec *res); int clock_gettime_fill_write_pointers(clockid_t clk_id, struct timespec *tp); int fgetxattr_fill_write_pointers(int filedes, char *name, void *value, size_t size); int fstat64_fill_write_pointers(int filedes, struct stat64 *buf); int fstatfs64_fill_write_pointers(unsigned int fd, struct statfs64 *buf); int getdents64_fill_write_pointers(unsigned int fd, struct dirent64 *dirp, unsigned int count); int getpeername_fill_write_pointers(int s, struct sockaddr *name, socklen_t *namelen); int getsockname_fill_write_pointers(int s, struct sockaddr *name, socklen_t *namelen); int getsockopt_fill_write_pointers(int s, int level, int optname, void *optval, socklen_t *optlen); int gettimeofday_fill_write_pointers(struct timeval *tv, struct timezone *tz); int getxattr_fill_write_pointers(char *path, char *name, void *value, size_t size); int lgetxattr_fill_write_pointers(char *path, char *name, void *value, size_t size); int lstat64_fill_write_pointers(char *path, struct stat64 *buf); int pread64_fill_write_pointers(int fd, void *buf, size_t count, off_t offset); int read_fill_write_pointers(int fd, void *buf, size_t count); int readlink_fill_write_pointers(char *path, char *buf, size_t bufsiz); int recv_fill_write_pointers(int s, void *buf, size_t len, int flags); int recvfrom_fill_write_pointers(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); int stat64_fill_write_pointers(char *path, struct stat64 *buf); int statfs64_fill_write_pointers(char *path, struct statfs64 *buf); int uname_fill_write_pointers(struct utsname *buf); int ioctl_fill_write_pointers(int d, int request, void *arg); int fcntl_fill_write_pointers(int16_t cmd_type, int fd, int cmd, struct flock *lock); #endif /* __FILL_WRITE_POINTERS__ */ umview-0.8.2/um_rsc/librsc/tests/tools/client_server.h0000644000175000017500000000203211753517212022177 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * client_server.h: client and server setup functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __CLIENT_SERVER_HEADER__ #define __CLIENT_SERVER_HEADER__ int setup_client(char *server_addr, char *server_port); int setup_server(short int server_port); #endif /* __CLIENT_SERVER_HEADER__ */ umview-0.8.2/um_rsc/librsc/tests/client.c0000644000175000017500000000265411753517212017456 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * client.c: client program used by the tests * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include "tests.h" #include "client_server.h" static char *server_addr; static char *server_port; void test_aconv(void) { int fd; fd = setup_client(server_addr, server_port); assert(fd != -1); test_client(&fd); } int main(int argc, char *argv[]) { if(argc != 1 && argc > 3) { fprintf(stderr, "USAGE: %s [ADDRESS] [PORT]\n", argv[0]); exit(-1); } server_addr = "127.0.0.1"; server_port = "10000"; if(argc >= 2) { server_addr = argv[1]; } if(argc >= 3) { server_port = argv[2]; } test_aconv(); return 0; } umview-0.8.2/um_rsc/librsc/tests/tests.c0000644000175000017500000000721111753517212017334 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * tests.c: functions grouping all the tests to do * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include "rsc_client.h" #include "rsc_server.h" #include "tests.h" #include "aconv.h" static enum arch test_init() { enum arch a; a = aconv_get_host_arch(); assert(a != ACONV_ARCH_ERROR); # if defined __x86_64__ assert(a == ACONV_X86_64); # elif defined __i386__ assert(a == ACONV_X86); # elif defined __powerpc__ if(sizeof(long) == 8) assert(a == ACONV_PPC_64); else assert(a == ACONV_PPC); # elif defined __powerpc64__ assert(a == ACONV_PPC_64); # endif return a; } void *test_client(void *fdp) { enum arch myarch, sarch, buf; int ret, fd = *(int *)fdp; /*** INIT ***/ myarch = test_init(); /* Send my arch to server */ buf = htonl(myarch); assert(write(fd, &buf, sizeof(myarch)) == sizeof(myarch)); /* Read the server arch */ assert(read(fd, &buf, sizeof(sarch)) == sizeof(sarch)); sarch = ntohl(buf); fprintf(stderr, "Client: my arch = %s, server arch = %s\n", aconv_arch2str(myarch), aconv_arch2str(sarch)); ret = rscc_init(fd, -1, NULL, myarch, sarch); assert(ret == 0); /*** TESTS ***/ fprintf(stderr, "test_list... "); fflush(stderr); test_list(); fprintf(stderr, "done\n"); fprintf(stderr, "test_type_equality... "); fflush(stderr); test_type_equality(); fprintf(stderr, "done\n"); fprintf(stderr, "test_ioctl_mngmt... "); fflush(stderr); test_ioctl_mngmt_client(fd); fprintf(stderr, "done\n"); fprintf(stderr, "test_libaconv... "); fflush(stderr); test_libaconv_client(fd, myarch, sarch); fprintf(stderr, "done\n"); fprintf(stderr, "test_syscall_exec... "); fflush(stderr); test_syscall_exec_client(fd, myarch, sarch); fprintf(stderr, "done\n"); return NULL; } void *test_server(void *fdp) { int ret, fd = *(int *)fdp; enum arch myarch, carch, buf; /*** INIT ***/ myarch = test_init(); /* Read the client arch */ assert(read(fd, &buf, sizeof(carch)) == sizeof(carch)); carch = ntohl(buf); /* Send my arch to client */ buf = htonl(myarch); assert(write(fd, &buf, sizeof(myarch)) == sizeof(myarch)); fprintf(stderr, "Server: my arch = %s, client arch = %s\n", aconv_arch2str(myarch), aconv_arch2str(carch)); ret = rscs_init(myarch); assert(ret == 0); /*** TESTS ***/ fprintf(stderr, "test_list... "); fflush(stderr); test_list(); fprintf(stderr, "done\n"); fprintf(stderr, "test_type_equality... "); fflush(stderr); test_type_equality(); fprintf(stderr, "done\n"); fprintf(stderr, "test_ioctl_mngmt... "); fflush(stderr); test_ioctl_mngmt_server(fd); fprintf(stderr, "done\n"); fprintf(stderr, "test_libaconv... "); fflush(stderr); test_libaconv_server(fd, carch, myarch); fprintf(stderr, "done\n"); fprintf(stderr, "test_syscall_exec... "); fflush(stderr); test_syscall_exec_server(fd, carch, myarch); fprintf(stderr, "done\n"); return NULL; } umview-0.8.2/um_rsc/librsc/tests/test_reg_cbs.c0000644000175000017500000001045511753517212020641 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * test_reg_cbs.c: callback registration data structure tests * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include "rsc_client.h" #include "registered_callbacks.h" struct reg_cbs *reg_cbs_add, *reg_cbs_del; /********************************************************************/ /* Init test */ /********************************************************************/ static void test_init() { struct reg_cbs *p; int i; p = init_reg_cb(); assert(!(p == NULL)); assert(!(p->nentry != 0)); assert(!(p->size != REG_CB_INITIAL_SIZE)); for(i = 0; i < p->size; i++) { assert(!(p->v[i].fd != -1)); assert(!(p->v[i].how != -1)); assert(!(p->v[i].cb != NULL)); assert(!(p->v[i].arg != NULL)); } free(p->v); free(p); } /********************************************************************/ /* Add test */ /********************************************************************/ static void test_entry(struct reg_cbs *p, int i, int fd, int how, void (* cb)(), void *arg) { assert(!(p->v[i].fd != fd)); assert(!(p->v[i].how != how)); assert(!(p->v[i].cb != cb)); assert(!(p->v[i].arg != arg)); assert(!(p->v[i].ack != ACK_NOT_INIT)); } static void test_add() { int i, ret; /* I fill the array and for each entry I controll its arguments */ for(i = 0; i < reg_cbs_add->size; i++) { ret = reg_cb_add(reg_cbs_add, NULL, NULL, i+1, i+2); assert(!(ret != i)); test_entry(reg_cbs_add, i, i+1, i+2, 0, NULL); assert(!(reg_cbs_add->nentry != i+1)); } assert(!(reg_cbs_add->nentry != i)); /* I add another entry to test the reallocation of the array */ reg_cb_add(reg_cbs_add, NULL, NULL, 100, 200); /* I test the new entry */ test_entry(reg_cbs_add, 10, 100, 200, NULL, NULL); /* and the new size, nfds */ assert(!(reg_cbs_add->size != 20)); assert(!(reg_cbs_add->nentry != 11)); /* I test the newly creted empty entries */ for(i = reg_cbs_add->nentry; i < reg_cbs_add->size; i++) test_entry(reg_cbs_add, i, -1, -1, NULL, NULL); } static void add_setup(void) { reg_cbs_add = init_reg_cb(); assert(!(reg_cbs_add == NULL)); } static void add_teardown(void) { free(reg_cbs_add->v); free(reg_cbs_add); } /********************************************************************/ /* Del test */ /********************************************************************/ static void test_del() { reg_cb_del(reg_cbs_del, 3); test_entry(reg_cbs_del, 3, -1, -1, NULL, NULL); assert(!(reg_cbs_del->nentry != 9)); reg_cb_del(reg_cbs_del, 5); test_entry(reg_cbs_del, 5, -1, -1, NULL, NULL); assert(!(reg_cbs_del->nentry != 8)); reg_cb_add(reg_cbs_del, NULL, NULL, 66, 77); test_entry(reg_cbs_del, 3, 66, 77, NULL, NULL); assert(!(reg_cbs_del->nentry != 9)); } static void del_setup(void) { int i; reg_cbs_del = init_reg_cb(); assert(!(reg_cbs_del == NULL)); /* I fill the array and for each entry I controll its arguments */ for(i = 0; i < reg_cbs_del->size; i++) { reg_cb_add(reg_cbs_del, NULL, NULL, i+1, i+2); } } static void del_teardown(void) { free(reg_cbs_del->v); free(reg_cbs_del); } /****************************************************/ /* Library functions */ /****************************************************/ void test_reg_cbs(void) { test_init(); add_setup(); test_add(); add_teardown(); del_setup(); test_del(); del_teardown(); } umview-0.8.2/um_rsc/librsc/tests/server.c0000644000175000017500000000245711753517212017507 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * server.c: server program used by the tests * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include "tests.h" #include "client_server.h" static int server_port; void test_aconv(void) { int fd; fd = setup_server(server_port); assert(fd != -1); test_server(&fd); } int main(int argc, char *argv[]) { if(argc != 1 && argc > 2) { fprintf(stderr, "USAGE: %s [PORT]\n", argv[0]); exit(-1); } server_port = 10000; if(argc >= 2) { server_port = atoi(argv[1]); } test_aconv(); return 0; } umview-0.8.2/um_rsc/librsc/tests/tests.h0000644000175000017500000000265711753517212017352 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * tests.h: list of the tests done * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __TESTS_HEADER__ #define __TESTS_HEADER__ #include "aconv.h" void *test_client(void *fdp); void *test_server(void *fdp); void test_list(void); void test_type_equality(void); void test_ioctl_mngmt_client(int fd); void test_ioctl_mngmt_server(int fd); void test_libaconv_client(int fd, enum arch client_arch, enum arch server_arch); void test_libaconv_server(int fd, enum arch client_arch, enum arch server_arch); void test_syscall_exec_client(int fd, enum arch client_arch, enum arch server_arch); void test_syscall_exec_server(int fd, enum arch client_arch, enum arch server_arch); #endif /* __TESTS_HEADER__ */ umview-0.8.2/um_rsc/librsc/tests/test_list.c0000644000175000017500000001164111753517212020206 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * test_list.c: List data structure tests * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include "generic_list.h" int initial_size; struct list *list_a, *list_d; /********************************************************************/ /* Init test */ /********************************************************************/ static void test_init(void) { struct list *l; l = init_list(100); assert(!(l == NULL)); assert(!(l->nentry != 0)); assert(!(l->size != 100)); free(l->v); free(l); } /********************************************************************/ /* Add test */ /********************************************************************/ static void test_entry(struct list *l, int i, int *num) { assert(!(l->v[i] != num)); if(num != NULL) assert(!(*((int *)l->v[i]) != *num)); } static void test_add(void) { int i, *num; /* I fill the array and for each entry I controll its arguments */ for(i = 0; i < list_a->size; i++) { num = calloc(1, sizeof(int)); assert(!(num == NULL)); *num = i+1; list_add(list_a, num); test_entry(list_a, i, num); assert(!(list_a->nentry != i+1)); } assert(!(list_a->nentry != i)); /* I add another entry to test the reallocation of the array */ num = calloc(1, sizeof(int)); assert(!(num == NULL)); *num = 1234; list_add(list_a, num); /* I test the new entry */ test_entry(list_a, initial_size, num); /* and the new size, nfds */ assert(!(list_a->size != initial_size*2)); assert(!(list_a->nentry != initial_size+1)); /* I test the newly created empty entries */ for(i = list_a->nentry; i < list_a->size; i++) assert(!(list_a->v[i] != NULL)); } static void add_setup(void) { initial_size = 10; list_a = init_list(initial_size); assert(!(list_a == NULL)); } static void add_teardown(void) { free(list_a->v); free(list_a); } /********************************************************************/ /* Del/Search test */ /********************************************************************/ static void test_del(void) { int *num; num = list_del(list_d, 3); test_entry(list_d, 3, NULL); assert(!(*num != 3)); free(num); assert(!(list_d->nentry != initial_size - 1)); num = list_del(list_d, 5); test_entry(list_d, 5, NULL); assert(!(*num != 5)); free(num); assert(!(list_d->nentry != initial_size - 2)); num = calloc(1, sizeof(int)); list_add(list_d, num); test_entry(list_d, 3, num); assert(!(list_d->nentry != initial_size - 1)); free(num); } static int compare_int(void *a, void *b) { return (*(int *)a == *(int *)b); } static void test_search(void) { int *num, val, i; val = 5; i = list_search(list_d, compare_int, &val); assert(!(i != 5)); num = list_getel(list_d, i); assert(!(num != list_d->v[5])); assert(!(*num != 5)); /* Now I delete it and search again */ list_del(list_d, 5); assert(!(list_d->v[5] != NULL)); i = list_search(list_d, compare_int, &val); assert(!(i != -1)); num = list_getel(list_d, i); assert(!(num != NULL)); /* Now I try to get an element with negative or too big index */ num = list_getel(list_d, -1); assert(!(num != NULL)); free(num); num = list_getel(list_d, -2); assert(!(num != NULL)); free(num); num = list_getel(list_d, 12345); assert(!(num != NULL)); free(num); } static void del_setup(void) { int i, *num; initial_size = 10; list_d = init_list(initial_size); assert(!(list_d == NULL)); /* I fill the array and for each entry I control its arguments */ for(i = 0; i < list_d->size; i++) { num = calloc(1, sizeof(int)); assert(!(num == NULL)); *num = i; list_add(list_d, num); } } static void del_teardown(void) { free(list_d->v); free(list_d); } /****************************************************/ /* Library functions */ /****************************************************/ void test_list(void) { test_init(); add_setup(); test_add(); add_teardown(); del_setup(); test_del(); del_teardown(); } umview-0.8.2/um_rsc/librsc/tests/test_ioctl_mngmt.c0000644000175000017500000001337411753517212021554 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * test_ioctl_mngmt.c: ioctl management tests * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include "rsc_server.h" #include "rsc_client.h" #include "test_rsc_client.h" #include "test_rsc_server.h" /********************************************************************/ /* Cache test */ /********************************************************************/ static void test_cache(void) { struct ioctl_cache *c; u_int32_t res; int size = 3; c = ioctl_cache_init(size); assert(!(c == NULL)); assert(!(c->first != NULL)); assert(!(c->last != NULL)); assert(!(c->size != size)); assert(!(c->nentry != 0)); /* Add element 1 */ ioctl_cache_add(c, 10, 11); assert(!(c->first == NULL)); assert(!(c->first->next != NULL)); assert(!(c->first->prev != NULL)); assert(!(c->first->request != 10)); assert(!(c->first->size_type != 11)); assert(!(c->nentry != 1)); assert(!(c->size != size)); /* Add element 2 */ ioctl_cache_add(c, 20, 22); assert(!(c->first == NULL)); assert(!(c->first->next == NULL)); assert(!(c->first->prev != NULL)); assert(!(c->first->request != 20)); assert(!(c->first->size_type != 22)); assert(!(c->nentry != 2)); assert(!(c->size != size)); assert(!(c->first->next->request != 10)); assert(!(c->first->next->size_type != 11)); assert(!(c->first->next->prev != c->first)); /* Add element 2 */ ioctl_cache_add(c, 30, 33); assert(!(c->first == NULL)); assert(!(c->first->next == NULL)); assert(!(c->first->prev != NULL)); assert(!(c->first->request != 30)); assert(!(c->first->size_type != 33)); assert(!(c->nentry != 3)); assert(!(c->size != size)); assert(!(c->first->next->request != 20)); assert(!(c->first->next->size_type != 22)); assert(!(c->first->next->prev != c->first)); assert(!(c->first->next->next->request != 10)); assert(!(c->first->next->next->size_type != 11)); assert(!(c->first->next->next->prev != c->first->next)); assert(!(c->last->request != 10)); assert(!(c->last->size_type != 11)); assert(!(c->last->prev != c->first->next)); /* Now the queue is full */ ioctl_cache_add(c, 40, 44); assert(!(c->first == NULL)); assert(!(c->first->next == NULL)); assert(!(c->first->prev != NULL)); assert(!(c->first->request != 40)); assert(!(c->first->size_type != 44)); assert(!(c->nentry != 3)); assert(!(c->size != size)); assert(!(c->first->next->request != 30)); assert(!(c->first->next->size_type != 33)); assert(!(c->first->next->prev != c->first)); assert(!(c->first->next->next->request != 20)); assert(!(c->first->next->next->size_type != 22)); assert(!(c->first->next->next->prev != c->first->next)); /* Search */ res = ioctl_cache_search(c, 20); assert(!(res != 22)); res = ioctl_cache_search(c, 30); assert(!(res != 33)); res = ioctl_cache_search(c, 40); assert(!(res != 44)); res = ioctl_cache_search(c, 50); assert(!(res != 0)); } /********************************************************************/ /* Query test */ /********************************************************************/ static void test_server_query(int fd) { int ret, i; struct ioctl_req_header req; struct ioctl_resp_header *resp; for(i = 0; i < 4; i++) { ret = read(fd, &req, sizeof(struct ioctl_req_header)); assert(!(ret != sizeof(struct ioctl_req_header))); req.req_size = ntohl(req.req_size); resp = rscs_manage_ioctl_request(&req); ret = write(fd, resp, sizeof(struct ioctl_resp_header)); assert(ret == sizeof(struct ioctl_resp_header)); } } static void test_client_query(int fd) { int res; /* Here there is the client code */ res = rscc_check_ioctl_request(100); assert(!(res == 0)); assert(!((res & IOCTL_R) != IOCTL_R)); assert(!((res & IOCTL_LENMASK) != sizeof(char))); res = rscc_check_ioctl_request(101); assert(!(res == 0)); assert(!((res & IOCTL_W) != IOCTL_W)); assert(!((res & IOCTL_LENMASK) != sizeof(int))); res = rscc_check_ioctl_request(102); assert(!(res == 0)); assert(!((res & (IOCTL_R | IOCTL_W)) != (IOCTL_R | IOCTL_W))); assert(!((res & IOCTL_LENMASK) != sizeof(long long))); /* I query for a request that doesn't exists */ res = rscc_check_ioctl_request(123); assert(!(res != IOCTL_UNMANAGED)); } /****************************************************/ /* Library functions */ /****************************************************/ void test_ioctl_mngmt_client(int fd) { test_cache(); test_client_query(fd); } void test_ioctl_mngmt_server(int fd) { test_cache(); /* I register dome fake ioctl requests */ rscs_ioctl_register_request(100, IOCTL_R, sizeof(char)); rscs_ioctl_register_request(101, IOCTL_W, sizeof(int)); rscs_ioctl_register_request(102, IOCTL_R | IOCTL_W, sizeof(long long)); test_server_query(fd); } umview-0.8.2/um_rsc/librsc/tests/Makefile0000644000175000017500000000334511753517212017472 0ustar renzorenzo# # This is part of Remote System Call (RSC) Library. # # Makefile: tests makefile # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # LIB_RSC_DIR = ../ RSC_LIB = $(LIB_RSC_DIR)librsc.a CC = gcc CFLAGS = -Wall -g -O0 -I../include/ -I../src/include/ -Itools/ -DRSCDEBUG tools_sources = $(shell ls tools/*.c) sources_no_main = tests.c $(shell ls test_*.c) sources = $(sources_no_main) $(tools_sources) .PHONY: clean tgz send run send sppc s64 tags all: tags client server run run: tags selftests ./selftests $(RSC_LIB): make -C ${LIB_RSC_DIR} TEST='true' selftests: selftests.c ${sources:.c=.o} $(RSC_LIB) $(CC) $(CFLAGS) -o $@ $^ -lpthread client: client.c ${sources:.c=.o} $(RSC_LIB) $(CC) $(CFLAGS) -o $@ $^ -lpthread server: server.c ${sources:.c=.o} $(RSC_LIB) $(CC) $(CFLAGS) -o $@ $^ -lpthread tags: ctags-exuberant -R ../ %.d: %.c set -e; $(CC) -MM $(CFLAGS) $< \ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ [ -s $@ ] || rm -f $@ include $(this_dir_sources:.c=.d) cleanlib: clean make -C ../ clean clean: rm -f *.o *.d selftests server client tools/*.o tools/*.d umview-0.8.2/um_rsc/librsc/tests/selftests.c0000644000175000017500000000270511753517212020211 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * selftests.c: program used to execute both client and server tests on * the same machine * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include "tests.h" void test_aconv(void) { pthread_t server_thread; int serverfd, clientfd, ret; int fd[2]; /* I create the client and server fds */ ret = socketpair(PF_UNIX, SOCK_STREAM, 0, fd); assert(ret == 0); clientfd = fd[0]; serverfd = fd[1]; pthread_create(&server_thread, NULL, test_server, &serverfd); test_client(&clientfd); pthread_join(server_thread, NULL); } int main(void) { test_aconv(); return 0; } umview-0.8.2/um_rsc/librsc/tests/test_libaconv.c0000644000175000017500000017444211753517212021041 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * test_libaconv.c: Architecture Conversion tests * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #include #include "aconv.h" #include #define __USE_LARGEFILE64 #include #include #include #include #include /*******************************************************************/ /* Test size functions */ /*******************************************************************/ static void test_size_fun(enum arch from, enum arch to) { assert(aconv_long_size(from, to) == sizeof(long)); assert(aconv_u_long_size(from, to) == sizeof(unsigned long)); assert(aconv___uid_t_size(from, to) == sizeof(__uid_t)); assert(aconv___gid_t_size(from, to) == sizeof(__gid_t)); assert(aconv___time_t_size(from, to) == sizeof(__time_t)); assert(aconv___dev_t_size(from, to) == sizeof(__dev_t)); assert(aconv___ino_t_size(from, to) == sizeof(__ino_t)); assert(aconv___mode_t_size(from, to) == sizeof(__mode_t)); assert(aconv___nlink_t_size(from, to) == sizeof(__nlink_t)); assert(aconv___blksize_t_size(from, to) == sizeof(__blksize_t)); assert(aconv___blkcnt64_t_size(from, to) == sizeof(__blkcnt64_t)); assert(aconv___off_t_size(from, to) == sizeof(__off_t)); } /*******************************************************************/ /* Test conversion functions */ /*******************************************************************/ static void test_char_w(int fd, enum arch from, enum arch to) { char c[] = {0xF1, 0x02}; int csize = sizeof(c) / sizeof(char); char *out; int ret, i; int size = aconv_char_size(from, to); assert(size == 1); for(i = 0; i < csize; i++) { assert((out = malloc(size)) != NULL); ret = aconv_char(&c[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &c[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_char(&c[i], from, to, NULL); if(from == to) assert(ret == ACONV_UNNEC); else assert(ret == ACONV_OK); assert(write(fd, &c[i], size) == size); } } static void test_char_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(char); char *in; char c[] = {0xF1, 0x02}; int csize = sizeof(c) / sizeof(char); assert(size == 1); for(i = 0; i < csize; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == c[i]); assert(read(fd, in, size) == size); assert(*in == c[i]); free(in); } } static void test_u_char_w(int fd, enum arch from, enum arch to) { unsigned char c[] = {0xF1, 0x02}; int csize = sizeof(c) / sizeof(unsigned char); unsigned char *out; int ret, i; int size = aconv_char_size(from, to); assert(size == 1); for(i = 0; i < csize; i++) { assert((out = malloc(size)) != NULL); ret = aconv_u_char(&c[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &c[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_u_char(&c[i], from, to, NULL); if(from == to) assert(ret == ACONV_UNNEC); else assert(ret == ACONV_OK); assert(write(fd, &c[i], size) == size); } } static void test_u_char_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(unsigned char); unsigned char *in; unsigned char c[] = {0xF1, 0x02}; int csize = sizeof(c) / sizeof(unsigned char); assert(size == 1); for(i = 0; i < csize; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == c[i]); assert(read(fd, in, size) == size); assert(*in == c[i]); free(in); } } static void test_short_w(int fd, enum arch from, enum arch to) { int ret, i; short num[] = {0x0012, 0xFFAB }; int num_size = sizeof(num) / sizeof(short); int size = aconv_short_size(from, to); short *out; assert(size == 2); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_short(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_short(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_short_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(short); short *in; short num[] = {0x0012, 0xFFAB }; int num_size = sizeof(num) / sizeof(short); assert(size == 2); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_u_short_w(int fd, enum arch from, enum arch to) { int ret, i; unsigned short num[] = {0x0012, 0xFFAB }; int num_size = sizeof(num) / sizeof(unsigned short); int size = aconv_u_short_size(from, to); unsigned short *out; assert(size == 2); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_u_short(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_u_short(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_u_short_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(unsigned short); unsigned short *in; unsigned short num[] = {0x0012, 0xFFAB }; int num_size = sizeof(num) / sizeof(unsigned short); assert(size == 2); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_int_w(int fd, enum arch from, enum arch to) { int ret, i; int num[] = {0x00123456, 0xFF90ABCD }; int num_size = sizeof(num) / sizeof(int); int size = aconv_int_size(from, to); int *out; assert(size == 4); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_int(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_int(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_int_r(int fd, enum arch from, enum arch to) { int size = sizeof(int); int *in, i; int num[] = {0x00123456, 0xFF90ABCD }; int num_size = sizeof(num) / sizeof(int); assert(size == 4); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_u_int_w(int fd, enum arch from, enum arch to) { int ret, i; unsigned int num[] = {0x00123456, 0xFF90ABCD }; int num_size = sizeof(num) / sizeof(unsigned int); int size = aconv_u_int_size(from, to); unsigned int *out; assert(size == 4); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_u_int(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_u_int(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_u_int_r(int fd, enum arch from, enum arch to) { int size = sizeof(unsigned int); int *in, i; unsigned int num[] = {0x00123456, 0xFF90ABCD }; unsigned int num_size = sizeof(num) / sizeof(unsigned int); assert(size == 4); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_long_w(int fd, enum arch from, enum arch to) { int ret, n; # if __WORDSIZE == 64 /* positive and negative longs */ long num[] = { 0x0011A67890ABCDEF, 0xFF22B67890ABCDEF, 171 /* 0x00000000000000AB*/, -51 /* 0xFFFFFFFFFFFFFFCD */ }; # else long num[] = { 0x0011A678, 0xFF22B678, 171 /* 0x000000AB */, -51 /* 0xFFFFFFCD */}; #endif int num_size = sizeof(num) / sizeof(long); int size = aconv_long_size(from, to); long *out; int from_bn, to_bn, i; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; if(from_bn == to_bn) if(from_bn == ACONV_64BIT) assert(size == 8); else assert(size == 4); else if(from_bn == ACONV_32BIT && to_bn == ACONV_64BIT) assert(size == 8); else assert(size == 4); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_long(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); /* If the conversion isn't necessary, the data isn't copied to 'out', * so I do it */ memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); n = write(fd, out, size); assert(n == size); free(out); #if 0 ret = aconv_long(&num[i], from, to, NULL); if((from & ACONV_BITNUM_MASK) != (to & ACONV_BITNUM_MASK)) { assert(ret == ACONV_ERROR); } else { if(from == to) assert(ret == ACONV_UNNEC); else assert(ret == ACONV_OK); n = write(fd, &num[i], size); assert(n == size); } #endif } } static void test_long_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(long); long *in; int from_bn, to_bn, num_size; # if __WORDSIZE == 64 long num[] = { 0x0011A67890ABCDEF, 0xFF22B67890ABCDEF, 171 /* 0x00000000000000AB*/, -51 /* 0xFFFFFFFFFFFFFFCD */ }; assert(size == 8); # else long num[] = { 0x0011A678, 0xFF22B678, 171 /* 0x000000AB */, -51 /* 0xFFFFFFCD */}; assert(size == 4); # endif num_size = sizeof(num) / sizeof(long); from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); /* Same arch or same bit number */ if(from == to || from_bn == to_bn) { assert(*in == num[i]); /* 32 => 64 */ } else if(from_bn == ACONV_32BIT && to_bn == ACONV_64BIT) { # if __WORDSIZE == 64 switch(i) { case 0: assert(*in == 0x000000000011A678); break; case 1: assert(*in == 0xFFFFFFFFFF22B678); break; case 2: assert(*in == 171); break; case 3: assert(*in == -51); break; } # endif /* 64 => 32 */ } else if(from_bn == ACONV_64BIT && to_bn == ACONV_32BIT) { switch(i) { case 0: assert(*in == INT_MAX); break; case 1: assert(*in == INT_MIN); break; case 2: assert(*in == 171); break; case 3: assert(*in == -51); break; } } else { assert(0); } free(in); } } static void test_u_long_w(int fd, enum arch from, enum arch to) { int ret, n; # if __WORDSIZE == 64 /* positive and negative longs */ unsigned long num[] = { 0x0011A67890ABCDEF, 0xFF22B67890ABCDEF, 171 /* 0x00000000000000AB*/}; # else unsigned long num[] = { 0x0011A678, 0xFF22B678, 171 /* 0x000000AB */}; #endif int num_size = sizeof(num) / sizeof(unsigned long); int size = aconv_u_long_size(from, to); unsigned long *out; int from_bn, to_bn, i; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; if(from_bn == to_bn) if(from_bn == ACONV_64BIT) assert(size == 8); else assert(size == 4); else if(from_bn == ACONV_32BIT && to_bn == ACONV_64BIT) assert(size == 8); else assert(size == 4); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_u_long(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); /* If the conversion isn't necessary, the data isn't copied to 'out', * so I do it */ memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); n = write(fd, out, size); assert(n == size); free(out); #if 0 ret = aconv_u_long(&num[i], from, to, NULL); if((from & ACONV_BITNUM_MASK) != (to & ACONV_BITNUM_MASK)) { assert(ret == ACONV_ERROR); } else { if(from == to) assert(ret == ACONV_UNNEC); else assert(ret == ACONV_OK); n = write(fd, &num[i], size); assert(n == size); } #endif } } static void test_u_long_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(unsigned long); unsigned long *in; int from_bn, to_bn, num_size; # if __WORDSIZE == 64 unsigned long num[] = { 0x0011A67890ABCDEF, 0xFF22B67890ABCDEF, 171 /* 0x00000000000000AB*/}; assert(size == 8); # else unsigned long num[] = { 0x0011A678, 0xFF22B678, 171 /* 0x000000AB */}; assert(size == 4); # endif num_size = sizeof(num) / sizeof(unsigned long); from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); /* Same arch or same bit number */ if(from == to || from_bn == to_bn) { assert(*in == num[i]); /* 32 => 64 */ } else if(from_bn == ACONV_32BIT && to_bn == ACONV_64BIT) { # if __WORDSIZE == 64 switch(i) { case 0: assert(*in == 0x000000000011A678); break; case 1: assert(*in == 0x00000000FF22B678); break; case 2: assert(*in == 171); break; } # endif /* 64 => 32 */ } else if(from_bn == ACONV_64BIT && to_bn == ACONV_32BIT) { switch(i) { case 0: assert(*in == UINT_MAX); break; case 1: assert(*in == UINT_MAX); break; case 2: assert(*in == 171); break; } } else { assert(0); } free(in); } } static void test_longlong_w(int fd, enum arch from, enum arch to) { int ret, i; long long num[] = {0x000000ABCDEF1234LL, 0xFFFF567890BBBBBBLL }; int num_size = sizeof(num) / sizeof(long long); int size = aconv_longlong_size(from, to); long long *out; assert(size == 8); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_longlong(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_longlong(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_longlong_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(long long); long long *in; long long num[] = {0x000000ABCDEF1234LL, 0xFFFF567890BBBBBBLL }; int num_size = sizeof(num) / sizeof(long long); assert(size == 8); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_u_longlong_w(int fd, enum arch from, enum arch to) { int ret, i; unsigned long long num[] = {0x000000ABCDEF1234ULL, 0xFFFF567890BBBBBBULL }; int num_size = sizeof(num) / sizeof(unsigned long long); int size = aconv_u_longlong_size(from, to); unsigned long long *out; assert(size == 8); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_u_longlong(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_u_longlong(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_u_longlong_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(unsigned long long); unsigned long long *in; unsigned long long num[] = {0x000000ABCDEF1234ULL, 0xFFFF567890BBBBBBULL }; int num_size = sizeof(num) / sizeof(unsigned long long); assert(size == 8); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_pointer_w(int fd, enum arch from, enum arch to) { int i, ret, a, b; int from_bn, to_bn; #if __WORDSIZE == 64 int *ps[] = { &a, NULL, &b, (int *)0x0000000012345678, (int *)0x99ABCDEF00000000}; #else int *ps[] = { &a, NULL, &b, (int *)0x12345678, (int *)0x99ABCDEF}; #endif int ps_size = sizeof(ps) / sizeof(long); int size = aconv_pointer_size(from, to); int **out; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; if(to_bn == ACONV_64BIT) assert(size == 8); else assert(size == 4); for(i = 0; i < ps_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_pointer(ps[i], from, to, out); if(from == to || from_bn == to_bn) { /* assert(ret == ACONV_UNNEC); */ memcpy(out, &ps[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); } } static void test_pointer_r(int fd, enum arch from, enum arch to) { int from_bn, to_bn, i, a, b; int **c; #if __WORDSIZE == 64 int *ps[] = { &a, NULL, &b, (int *)0x0000000012345678, (int *)0x99ABCDEF00000000}; #else int *ps[] = { &a, NULL, &b, (int *)0x12345678, (int *)0x99ABCDEF}; #endif int ps_size = sizeof(ps) / sizeof(long); int *in; int size = sizeof(long *); from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; for(i = 0; i < ps_size; i++) { assert(read(fd, &in, size) == size); if(ps[i] != NULL) assert(in != NULL); else assert(in == NULL); } } static void test_string_w(int fd, enum arch from, enum arch to) { int ret, i; char *str[] = {"", "Hello world!!!" }; int str_size = sizeof(str) / sizeof(char *); char *out; for(i = 0; i < str_size; i++) { int size = aconv_string_size(str[i], from, to); assert(size == strlen(str[i]) + 1); assert((out = malloc(size)) != NULL); ret = aconv_string(str[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, str[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_string(str[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, str[i], size) == size); } } static void test_string_r(int fd, enum arch from, enum arch to) { char *in; char *str[] = {"", "Hello world!!!" }; int i, str_size = sizeof(str) / sizeof(char *); for(i = 0; i < str_size; i++) { int size = strlen(str[i]) + 1; assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(strcmp(str[i], in) == 0); assert(read(fd, in, size) == size); assert(strcmp(str[i], in) == 0); free(in); } } static void test_mode_t_w(int fd, enum arch from, enum arch to) { int ret, i; mode_t num[] = {0xFF123456, 0x0000ABCD }; int num_size = sizeof(num) / sizeof(mode_t); int size = aconv_mode_t_size(from, to); mode_t *out; assert(size == sizeof(mode_t)); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_mode_t(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_mode_t(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_mode_t_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(mode_t); mode_t *in; mode_t num[] = {0xFF123456, 0x0000ABCD }; int num_size = sizeof(num) / sizeof(mode_t); assert(sizeof(mode_t) == 4); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_loff_t_w(int fd, enum arch from, enum arch to) { int ret, i; loff_t num[] = {0xFFFFFFAB123456LL, 0x000000ABCDEF9087LL }; int num_size = sizeof(num) / sizeof(loff_t); int size = aconv_loff_t_size(from, to); loff_t *out; assert(size == sizeof(loff_t)); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_loff_t(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_loff_t(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_loff_t_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(loff_t); loff_t *in; loff_t num[] = {0xFFFFFFAB123456LL, 0x000000ABCDEF9087LL }; int num_size = sizeof(num) / sizeof(loff_t); assert(sizeof(loff_t) == 8); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_uid_t_w(int fd, enum arch from, enum arch to) { int ret, i; uid_t num[] = {0xFF123456, 0x0000ABCD }; int num_size = sizeof(num) / sizeof(uid_t); int size = aconv_uid_t_size(from, to); uid_t *out; assert(size == sizeof(uid_t)); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_uid_t(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_uid_t(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_uid_t_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(uid_t); uid_t *in; uid_t num[] = {0xFF123456, 0x0000ABCD }; int num_size = sizeof(num) / sizeof(uid_t); assert(sizeof(uid_t) == 4); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_gid_t_w(int fd, enum arch from, enum arch to) { int ret, i; gid_t num[] = {0xFF123456, 0x0000ABCD }; int num_size = sizeof(num) / sizeof(gid_t); int size = aconv_gid_t_size(from, to); gid_t *out; assert(size == sizeof(gid_t)); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_gid_t(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_gid_t(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_gid_t_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(gid_t); gid_t *in; gid_t num[] = {0xFF123456, 0x0000ABCD }; int num_size = sizeof(num) / sizeof(gid_t); assert(sizeof(gid_t) == 4); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_clockid_t_w(int fd, enum arch from, enum arch to) { int ret, i; clockid_t num[] = {0xFF123456, 0x0000ABCD }; int num_size = sizeof(num) / sizeof(clockid_t); int size = aconv_clockid_t_size(from, to); clockid_t *out; assert(size == sizeof(clockid_t)); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_clockid_t(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_clockid_t(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_clockid_t_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(clockid_t); clockid_t *in; clockid_t num[] = {0xFF123456, 0x0000ABCD }; int num_size = sizeof(num) / sizeof(clockid_t); assert(sizeof(clockid_t) == 4); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test___off64_t_w(int fd, enum arch from, enum arch to) { int ret, i; __off64_t num[] = {0xFFFFFFAB123456LL, 0x000000ABCDEF9087LL }; int num_size = sizeof(num) / sizeof(__off64_t); int size = aconv___off64_t_size(from, to); __off64_t *out; assert(size == sizeof(__off64_t)); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv___off64_t(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv___off64_t(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test___off64_t_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(__off64_t); __off64_t *in; __off64_t num[] = {0xFFFFFFAB123456LL, 0x000000ABCDEF9087LL }; int num_size = sizeof(num) / sizeof(__off64_t); assert(sizeof(__off64_t) == 8); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_socklen_t_w(int fd, enum arch from, enum arch to) { int ret, i; socklen_t num[] = {0xFF123456, 0x0000ABCD }; int num_size = sizeof(num) / sizeof(socklen_t); int size = aconv_socklen_t_size(from, to); socklen_t *out; assert(size == sizeof(socklen_t)); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_socklen_t(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); ret = aconv_socklen_t(&num[i], from, to, NULL); if(from != to) assert(ret == ACONV_OK); else assert(ret == ACONV_UNNEC); assert(write(fd, &num[i], size) == size); } } static void test_socklen_t_r(int fd, enum arch from, enum arch to) { int i, size = sizeof(socklen_t); socklen_t *in; socklen_t num[] = {0xFF123456, 0x0000ABCD }; int num_size = sizeof(num) / sizeof(socklen_t); assert(sizeof(socklen_t) == 4); for(i = 0; i < num_size; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(*in == num[i]); assert(read(fd, in, size) == size); assert(*in == num[i]); free(in); } } static void test_size_t_w(int fd, enum arch from, enum arch to) { int from_bn, to_bn, ret, i; int size = aconv_size_t_size(from, to); #if __WORDSIZE == 64 size_t num[] = {0xFF1234567890ABCD, 0x00ABCDEF12345678, 0xFF123456, 0x0000ABCD}; #else size_t num[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFF123456, 0x0000ABCD }; #endif int num_size = sizeof(num) / sizeof(size_t); size_t *out; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; if(to_bn == ACONV_32BIT) assert(size == 4); else assert(size == 8); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_size_t(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); if(from_bn == to_bn) { ret = aconv_size_t(&num[i], from, to, NULL); if(from == to) assert(ret == ACONV_UNNEC); else assert(ret == ACONV_OK); assert(write(fd, &num[i], size) == size); } free(out); } } static void test_size_t_r(int fd, enum arch from, enum arch to) { int i, from_bn, to_bn; int size = sizeof(size_t); size_t in; unsigned long num32to32[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFF123456, 0x0000ABCD }; unsigned long long num64to64[] = {0xFF1234567890ABCDULL, 0x00ABCDEF12345678ULL, 0xFF123456ULL, 0x0000ABCDULL}; unsigned long long num32to64[] = {0x00000000FFFFFFFFULL, 0x00000000FFFFFFFFULL, 0x00000000FF123456ULL, 0x000000000000ABCDULL }; unsigned long num64to32[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFF123456, 0x0000ABCD }; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; for(i = 0; i < 4; i++) { assert(read(fd, &in, size) == size); if(from_bn == to_bn) { if(from_bn == ACONV_32BIT) assert(in == num32to32[i]); else assert(in == num64to64[i]); } else if(from_bn == ACONV_32BIT && to_bn == ACONV_64BIT) { assert(in == num32to64[i]); } else if(from_bn == ACONV_64BIT && to_bn == ACONV_32BIT) { assert(in == num64to32[i]); } if(from_bn == to_bn) { assert(read(fd, &in, size) == size); if(from_bn == ACONV_64BIT) assert(in == num64to64[i]); else assert(in == num32to32[i]); } } } static void test_off_t_w(int fd, enum arch from, enum arch to) { int from_bn, to_bn, ret, i; int size = aconv_off_t_size(from, to); #if __WORDSIZE == 64 off_t num[] = {0xFF1234567890ABCD, 0x00ABCDEF12345678, 0xFF123456, 0x0000ABCD}; #else off_t num[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFF123456, 0x0000ABCD }; #endif int num_size = sizeof(num) / sizeof(off_t); off_t *out; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; if(to_bn == ACONV_32BIT) assert(size == 4); else assert(size == 8); for(i = 0; i < num_size; i++) { assert((out = malloc(size)) != NULL); ret = aconv_off_t(&num[i], from, to, out); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, &num[i], size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); if(from_bn == to_bn) { ret = aconv_off_t(&num[i], from, to, NULL); if(from == to) assert(ret == ACONV_UNNEC); else assert(ret == ACONV_OK); assert(write(fd, &num[i], size) == size); } free(out); } } static void test_off_t_r(int fd, enum arch from, enum arch to) { int i, from_bn, to_bn; int size = sizeof(off_t); off_t in; unsigned long num32to32[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFF123456, 0x0000ABCD }; unsigned long long num64to64[] = {0xFF1234567890ABCDULL, 0x00ABCDEF12345678ULL, 0xFF123456ULL, 0x0000ABCDULL}; unsigned long long num32to64[] = {0x00000000FFFFFFFFULL, 0x00000000FFFFFFFFULL, 0x00000000FF123456ULL, 0x000000000000ABCDULL }; unsigned long num64to32[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFF123456, 0x0000ABCD }; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; for(i = 0; i < 4; i++) { assert(read(fd, &in, size) == size); if(from_bn == to_bn) { if(from_bn == ACONV_32BIT) assert(in == num32to32[i]); else assert(in == num64to64[i]); } else if(from_bn == ACONV_32BIT && to_bn == ACONV_64BIT) { assert(in == num32to64[i]); } else if(from_bn == ACONV_64BIT && to_bn == ACONV_32BIT) { assert(in == num64to32[i]); } if(from_bn == to_bn) { assert(read(fd, &in, size) == size); if(from_bn == ACONV_64BIT) assert(in == num64to64[i]); else assert(in == num32to32[i]); } } } static void test_array_w(int fd, enum arch from, enum arch to) { int ai[] = {1, 2, 3, 4, 5}; long al[] = {0xAL, 0xBL, 0xCL, -42, 0xEL}; long l0, l1, l2, l4; /* long *ap[] = {&l0, &l1, &l2, NULL, &l4}; */ int *out; void *in; int ret, size, i; int from_bn, to_bn; aconv_size_fun sizef; aconv_fun aconvf; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; for(i = 0; i < 2; i++) { switch(i) { case 0: sizef = aconv_int_size; aconvf = aconv_int; in = ai; break; case 1: sizef = aconv_long_size; aconvf = aconv_long; in = al; break; /* case 2: */ /* sizef = aconv_pointer_size; */ /* aconvf = aconv_pointer; */ /* in = ap; */ /* break; */ default: assert(0); break; } size = 5 * sizef(from, to); out = malloc(size); assert(out != NULL); ret = aconv_array(in, from, to, 5, out, sizef, aconvf); if(from == to) { assert(ret == ACONV_UNNEC); memcpy(out, in, size); } else assert(ret == ACONV_OK); assert(write(fd, out, size) == size); free(out); if(from_bn == to_bn) { ret = aconv_array(in, from, to, 5, NULL, sizef, aconvf); assert(ret == ACONV_OK || ret == ACONV_UNNEC); assert(write(fd, in, size) == size); } } } static void test_array_r(int fd, enum arch from, enum arch to) { int ai[] = {1, 2, 3, 4, 5}; long al[] = {0xAL, 0xBL, 0xCL, -42, 0xEL}; void *in; int size, i, j; int from_bn, to_bn; aconv_size_fun sizef; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; for(j = 0; j < 2; j++) { switch(j) { case 0: sizef = aconv_int_size; break; case 1: sizef = aconv_long_size; break; /* case 2: */ /* sizef = aconv_pointer_size; break; */ default: assert(0); break; } size = 5 * sizef(from, to); in = malloc(size); assert(in != NULL); assert(read(fd, in, size) == size); for(i = 0; i < 5; i++) { switch(j) { case 0: assert(ai[i] == ((int *)in)[i]); break; case 1: assert(al[i] == ((long *)in)[i]); break; case 2: if(i == 3) assert(((long **)in)[i] == NULL); else assert(((long **)in)[i] != NULL); break; default: assert(0); break; } } free(in); if(from_bn == to_bn) { size = 5 * sizef(from, to); in = malloc(size); assert(in != NULL); assert(read(fd, in, size) == size); for(i = 0; i < 5; i++) { switch(j) { case 0: assert(ai[i] == ((int *)in)[i]); break; case 1: assert(al[i] == ((long *)in)[i]); break; case 2: if(i == 3) assert(((long **)in)[i] == NULL); else assert(((long **)in)[i] != NULL); break; default: assert(0); break; } } free(in); } } } static void test_struct_dirent64_w(int fd, enum arch from, enum arch to) { struct dirent64 d; int size = aconv_struct_dirent64_size(from, to); int ret; void *out; d.d_ino = 0x1122334455667788; d.d_off = 0x9900AABBCCDDEEFF; d.d_reclen = 0x1234; d.d_type = 0xFF; bzero(d.d_name, 256); memset(d.d_name, 'b', 255); assert((out = malloc(size)) != NULL); ret = aconv_struct_dirent64(&d, from, to, out); assert(ret != ACONV_ERROR); if(from == to) memcpy(out, &d, size); assert(write(fd, out, size) == size); free(out); } static void test_struct_dirent64_r(int fd, enum arch from, enum arch to) { struct dirent64 d; int size = aconv_struct_dirent64_size(from, to); struct dirent64 *in; assert(size == sizeof(struct dirent64)); d.d_ino = 0x1122334455667788; d.d_off = 0x9900AABBCCDDEEFF; d.d_reclen = 0x1234; d.d_type = 0xFF; bzero(d.d_name, 256); memset(d.d_name, 'b', 255); assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(d.d_ino == in->d_ino); assert(d.d_off == in->d_off); assert(d.d_reclen == in->d_reclen); assert(d.d_type == in->d_type); assert(memcmp(d.d_name, in->d_name, 256) == 0); free(in); } static void test_struct_sockaddr_w(int fd, enum arch from, enum arch to) { struct sockaddr *s; int size = aconv_struct_sockaddr_size(from, to); int ret, i; void *out; for(i = 0; i < 2; i++) { assert((s = malloc(size)) != NULL); switch(i) { case 0: s->sa_family = 0x11; bzero(s->sa_data, 14); memset(s->sa_data, 'b', 13); break; case 1: { struct sockaddr_in *sin = (struct sockaddr *)s; sin->sin_family = AF_INET; sin->sin_port = htons(0xAA); sin->sin_addr.s_addr = htonl(INADDR_LOOPBACK); break; } default: assert(0); break; } assert((out = malloc(size)) != NULL); ret = aconv_struct_sockaddr(s, from, to, out); assert(ret != ACONV_ERROR); if(from == to) memcpy(out, s, size); assert(write(fd, out, size) == size); free(out); free(s); } } static void test_struct_sockaddr_r(int fd, enum arch from, enum arch to) { int size = aconv_struct_sockaddr_size(from, to); struct sockaddr *in; int i; for(i = 0; i < 2; i++) { assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); switch(i) { case 0: { struct sockaddr e; e.sa_family = 0x11; bzero(e.sa_data, 14); memset(e.sa_data, 'b', 13); assert(in->sa_family == e.sa_family); assert(memcmp(e.sa_data, in->sa_data, 14) == 0); break; } case 1: { struct sockaddr_in *sin = (struct sockaddr *)in; assert(sin->sin_family == AF_INET); assert(sin->sin_port == htons(0xAA)); assert(sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)); break; } default: assert(0); break; } free(in); } } static void test_struct_timespec_w(int fd, enum arch from, enum arch to) { struct timespec t; int size = aconv_struct_timespec_size(from, to); int ret; void *out; t.tv_sec = 0x12345678; t.tv_nsec = 0x09ABCDEF; assert((out = malloc(size)) != NULL); ret = aconv_struct_timespec(&t, from, to, out); assert(ret != ACONV_ERROR); if(from == to) memcpy(out, &t, size); assert(write(fd, out, size) == size); free(out); } static void test_struct_timespec_r(int fd, enum arch from, enum arch to) { struct timespec t; int size = aconv_struct_timespec_size(from, to); struct timespec *in; assert(size == sizeof(struct timespec)); t.tv_sec = 0x12345678; t.tv_nsec = 0x09ABCDEF; assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(t.tv_sec == in->tv_sec); assert(t.tv_nsec == in->tv_nsec); free(in); } static void test_struct_timeval_w(int fd, enum arch from, enum arch to) { struct timeval t; int size = aconv_struct_timeval_size(from, to); int ret; void *out; t.tv_sec = 0x12345678; t.tv_usec = 0x09ABCDEF; assert((out = malloc(size)) != NULL); ret = aconv_struct_timeval(&t, from, to, out); assert(ret != ACONV_ERROR); if(from == to) memcpy(out, &t, size); assert(write(fd, out, size) == size); free(out); } static void test_struct_timeval_r(int fd, enum arch from, enum arch to) { struct timeval t; int size = aconv_struct_timeval_size(from, to); struct timeval *in; assert(size == sizeof(struct timeval)); t.tv_sec = 0x12345678; t.tv_usec = 0x09ABCDEF; assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(t.tv_sec == in->tv_sec); assert(t.tv_usec == in->tv_usec); free(in); } static void test_struct_timezone_w(int fd, enum arch from, enum arch to) { struct timezone t; int size = aconv_struct_timezone_size(from, to); int ret; void *out; t.tz_minuteswest = 0x12345678; t.tz_dsttime = 0x09ABCDEF; assert((out = malloc(size)) != NULL); ret = aconv_struct_timezone(&t, from, to, out); assert(ret != ACONV_ERROR); if(from == to) memcpy(out, &t, size); assert(write(fd, out, size) == size); free(out); } static void test_struct_timezone_r(int fd, enum arch from, enum arch to) { struct timezone t; int size = aconv_struct_timezone_size(from, to); struct timezone *in; assert(size == sizeof(struct timezone)); t.tz_minuteswest = 0x12345678; t.tz_dsttime = 0x09ABCDEF; assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(t.tz_minuteswest == in->tz_minuteswest); assert(t.tz_dsttime == in->tz_dsttime); free(in); } static void test_struct_utimbuf_w(int fd, enum arch from, enum arch to) { struct utimbuf t; int size = aconv_struct_utimbuf_size(from, to); int ret; void *out; t.actime = 0x12345678; t.modtime = 0x09ABCDEF; assert((out = malloc(size)) != NULL); ret = aconv_struct_utimbuf(&t, from, to, out); assert(ret != ACONV_ERROR); if(from == to) memcpy(out, &t, size); assert(write(fd, out, size) == size); free(out); } static void test_struct_utimbuf_r(int fd, enum arch from, enum arch to) { struct utimbuf t; int size = aconv_struct_utimbuf_size(from, to); struct utimbuf *in; assert(size == sizeof(struct utimbuf)); t.actime = 0x12345678; t.modtime = 0x09ABCDEF; assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(t.actime == in->actime); assert(t.modtime == in->modtime); free(in); } static void test_struct_utsname_w(int fd, enum arch from, enum arch to) { struct utsname t; int size = aconv_struct_utsname_size(from, to); int ret; void *out; memset(t.sysname, 'a', _UTSNAME_SYSNAME_LENGTH); memset(t.nodename, 'b', _UTSNAME_NODENAME_LENGTH); memset(t.release, 'c', _UTSNAME_RELEASE_LENGTH); memset(t.version, 'd', _UTSNAME_VERSION_LENGTH); memset(t.machine, 'e', _UTSNAME_MACHINE_LENGTH); #if _UTSNAME_DOMAIN_LENGTH - 0 # ifdef __USE_GNU memset(t.domainname, 'f', _UTSNAME_DOMAIN_LENGTH); # else memset(t.__domainname, 'g', _UTSNAME_DOMAIN_LENGTH); # endif #endif assert((out = malloc(size)) != NULL); ret = aconv_struct_utsname(&t, from, to, out); assert(ret != ACONV_ERROR); if(from == to) memcpy(out, &t, size); assert(write(fd, out, size) == size); free(out); } static void test_struct_utsname_r(int fd, enum arch from, enum arch to) { struct utsname t; int size = aconv_struct_utsname_size(from, to); struct utsname *in; assert(size == sizeof(struct utsname)); memset(t.sysname, 'a', _UTSNAME_SYSNAME_LENGTH); memset(t.nodename, 'b', _UTSNAME_NODENAME_LENGTH); memset(t.release, 'c', _UTSNAME_RELEASE_LENGTH); memset(t.version, 'd', _UTSNAME_VERSION_LENGTH); memset(t.machine, 'e', _UTSNAME_MACHINE_LENGTH); #if _UTSNAME_DOMAIN_LENGTH - 0 # ifdef __USE_GNU memset(t.domainname, 'f', _UTSNAME_DOMAIN_LENGTH); # else memset(t.__domainname, 'g', _UTSNAME_DOMAIN_LENGTH); # endif #endif assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(memcmp(t.sysname, in->sysname, _UTSNAME_SYSNAME_LENGTH) == 0); assert(memcmp(t.nodename, in->nodename, _UTSNAME_NODENAME_LENGTH) == 0); assert(memcmp(t.release, in->release, _UTSNAME_RELEASE_LENGTH) == 0); assert(memcmp(t.version, in->version, _UTSNAME_VERSION_LENGTH) == 0); assert(memcmp(t.machine, in->machine, _UTSNAME_MACHINE_LENGTH) == 0); #if _UTSNAME_DOMAIN_LENGTH - 0 # ifdef __USE_GNU assert(memcmp(t.domainname, in->domainname, _UTSNAME_DOMAIN_LENGTH) == 0); # else assert(memcmp(t.__domainname, in->__domainname, _UTSNAME_DOMAIN_LENGTH) == 0); # endif #endif free(in); } static void test_struct_timex_w(int fd, enum arch from, enum arch to) { struct timex t; int size = aconv_struct_timex_size(from, to); int ret; void *out; t.modes = 0x12345678; /* unsigned int modes */ t.offset = 0x00abcdefL; /* long offset */ t.freq = 0x0f112233L; /* long freq */ t.maxerror = 0x00445566L; /* long maxerror */ t.esterror = 0x0faabbccL; /* long esterror */ t.status = 0x0f123456; /* int status */ t.constant = 0x00778899L; /* long constant */ t.precision = 0x0fccddeeL; /* long precision */ t.tolerance = 0x09876543L; /* long tolerance */ t.time.tv_sec = 0x12345678; /* struct timeval time */ t.time.tv_usec = 0x09abcdef; /* struct timeval time */ t.tick = 0x0abcdef6L; /* long tick */ t.ppsfreq = 0x00778844L; /* long ppsfreq */ t.jitter = 0x00aaddeeL; /* long jitter */ t.shift = 0x01112223; /* int shift */ t.stabil = 0x0f765432L; /* long stabil */ t.jitcnt = 0x0abcdef2L; /* long jitcnt */ t.calcnt = 0x01234567L; /* long calcnt */ t.errcnt = 0x00066551L; /* long errcnt */ t.stbcnt = 0x021343d7L; /* long stbcnt */ assert((out = malloc(size)) != NULL); ret = aconv_struct_timex(&t, from, to, out); assert(ret != ACONV_ERROR); if(from == to) memcpy(out, &t, size); assert(write(fd, out, size) == size); free(out); } static void test_struct_timex_r(int fd, enum arch from, enum arch to) { struct timex t; int size = aconv_struct_timex_size(from, to); struct timex *in; assert(size == sizeof(struct timex)); t.modes = 0x12345678; /* unsigned int modes */ t.offset = 0x00abcdefL; /* long offset */ t.freq = 0x0f112233L; /* long freq */ t.maxerror = 0x00445566L; /* long maxerror */ t.esterror = 0x0faabbccL; /* long esterror */ t.status = 0x0f123456; /* int status */ t.constant = 0x00778899L; /* long constant */ t.precision = 0x0fccddeeL; /* long precision */ t.tolerance = 0x09876543L; /* long tolerance */ t.time.tv_sec = 0x12345678; /* struct timeval time */ t.time.tv_usec = 0x09abcdef; /* struct timeval time */ t.tick = 0x0abcdef6L; /* long tick */ t.ppsfreq = 0x00778844L; /* long ppsfreq */ t.jitter = 0x00aaddeeL; /* long jitter */ t.shift = 0x01112223; /* int shift */ t.stabil = 0x0f765432L; /* long stabil */ t.jitcnt = 0x0abcdef2L; /* long jitcnt */ t.calcnt = 0x01234567L; /* long calcnt */ t.errcnt = 0x00066551L; /* long errcnt */ t.stbcnt = 0x021343d7L; /* long stbcnt */ assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(t.modes == in->modes); assert(t.offset == in->offset); assert(t.freq == in->freq); assert(t.maxerror == in->maxerror); assert(t.esterror == in->esterror); assert(t.status == in->status); assert(t.constant == in->constant); assert(t.precision == in->precision); assert(t.tolerance == in->tolerance); assert(t.time.tv_sec == in->time.tv_sec); assert(t.time.tv_usec == in->time.tv_usec); assert(t.tick == in->tick); assert(t.ppsfreq == in->ppsfreq); assert(t.jitter == in->jitter); assert(t.shift == in->shift); assert(t.stabil == in->stabil); assert(t.jitcnt == in->jitcnt); assert(t.calcnt == in->calcnt); assert(t.errcnt == in->errcnt); assert(t.stbcnt == in->stbcnt); free(in); } static void test_struct_statfs64_w(int fd, enum arch from, enum arch to) { struct statfs64 s; int size = aconv_struct_statfs64_size(from, to); int ret; void *out; s.f_type = 0x01234567; s.f_bsize = 0x09abcdef; s.f_blocks = 0x01122667; s.f_bfree = 0x0ab45678; s.f_bavail = 0x0afd3455; s.f_files = 0x06667888; s.f_ffree = 0x0defffe3; s.f_fsid.__val[0] = 0xabbcd232; s.f_fsid.__val[1] = 0x12345ade; s.f_namelen = 0x09876543; s.f_frsize = 0x0aacaabb; s.f_spare[0]= 0x01112234; s.f_spare[1]= 0x02412234; s.f_spare[2]= 0x0111ab34; s.f_spare[3]= 0x0fd12254; s.f_spare[4]= 0x011a22a4; assert((out = malloc(size)) != NULL); ret = aconv_struct_statfs64(&s, from, to, out); assert(ret != ACONV_ERROR); if(from == to) memcpy(out, &s, size); assert(write(fd, out, size) == size); free(out); } static void test_struct_statfs64_r(int fd, enum arch from, enum arch to) { struct statfs64 s; int size = aconv_struct_statfs64_size(from, to); struct statfs64 *in; assert(size == sizeof(struct statfs64)); s.f_type = 0x01234567; s.f_bsize = 0x09abcdef; s.f_blocks = 0x01122667; s.f_bfree = 0x0ab45678; s.f_bavail = 0x0afd3455; s.f_files = 0x06667888; s.f_ffree = 0x0defffe3; s.f_fsid.__val[0] = 0xabbcd232; s.f_fsid.__val[1] = 0x12345ade; s.f_namelen = 0x09876543; s.f_frsize = 0x0aacaabb; s.f_spare[0]= 0x01112234; s.f_spare[1]= 0x02412234; s.f_spare[2]= 0x0111ab34; s.f_spare[3]= 0x0fd12254; s.f_spare[4]= 0x011a22a4; assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); assert(s.f_type == in->f_type); assert(s.f_bsize == in->f_bsize); assert(s.f_blocks == in->f_blocks); assert(s.f_bfree == in->f_bfree); assert(s.f_bavail == in->f_bavail); assert(s.f_files == in->f_files); assert(s.f_ffree == in->f_ffree); assert(s.f_fsid.__val[0] == in->f_fsid.__val[0]); assert(s.f_fsid.__val[1] == in->f_fsid.__val[1]); assert(s.f_namelen == in->f_namelen); assert(s.f_frsize == in->f_frsize); assert(s.f_spare[0] == in->f_spare[0]); assert(s.f_spare[1] == in->f_spare[1]); assert(s.f_spare[2] == in->f_spare[2]); assert(s.f_spare[3] == in->f_spare[3]); assert(s.f_spare[4] == in->f_spare[4]); free(in); } static void test_struct_stat64_w(int fd, enum arch from, enum arch to) { struct stat64 s; int size = aconv_struct_stat64_size(from, to); int ret; void *out; bzero(&s, sizeof(struct stat64)); s.st_dev = 0x00123456; #if defined __i386__ s.__st_ino = 0x00927655; #else s.st_ino = 0x00927655; #endif s.st_mode = 0x001122bb; s.st_nlink = 0x00fedab2; s.st_uid = 0x00445678; s.st_gid = 0x00777666; s.st_rdev = 0x001234aa; s.st_size = 0x0012cdef; s.st_blksize = 0x0099a821; s.st_blocks = 0x00123678; #ifdef __USE_MISC s.st_atim.tv_sec = 0x00abcdab; s.st_atim.tv_nsec = 0x00aeedab; s.st_mtim.tv_sec = 0x00ef4546; s.st_mtim.tv_nsec = 0x00e22546; s.st_ctim.tv_sec = 0x002be84d; s.st_ctim.tv_nsec = 0x0023484d; #else s.st_atime = 0x0044456; s.st_atimensec = 0x0054321f; s.st_mtime = 0x00fedd34; s.st_mtimensec = 0x00eeabcd; s.st_ctime = 0x00344567; s.st_ctimensec = 0x007888ed; #endif s.st_ino = 0x00927655; assert((out = calloc(1, size)) != NULL); ret = aconv_struct_stat64(&s, from, to, out); assert(ret != ACONV_ERROR); if(from == to) memcpy(out, &s, size); assert(write(fd, out, size) == size); free(out); } static void test_struct_stat64_r(int fd, enum arch from, enum arch to) { struct stat64 s; int size = aconv_struct_stat64_size(from, to); struct stat64 *in; assert(size == sizeof(struct stat64)); bzero(&s, sizeof(struct stat64)); s.st_dev = 0x00123456; #if defined __i386__ s.__st_ino = 0x00927655; #else s.st_ino = 0x00927655; #endif s.st_mode = 0x001122bb; s.st_nlink = 0x00fedab2; s.st_uid = 0x00445678; s.st_gid = 0x00777666; s.st_rdev = 0x001234aa; s.st_size = 0x0012cdef; s.st_blksize = 0x0099a821; s.st_blocks = 0x00123678; #ifdef __USE_MISC s.st_atim.tv_sec = 0x00abcdab; s.st_atim.tv_nsec = 0x00aeedab; s.st_mtim.tv_sec = 0x00ef4546; s.st_mtim.tv_nsec = 0x00e22546; s.st_ctim.tv_sec = 0x002be84d; s.st_ctim.tv_nsec = 0x0023484d; #else s.st_atime = 0x0044456; s.st_atimensec = 0x0054321f; s.st_mtime = 0x00fedd34; s.st_mtimensec = 0x00eeabcd; s.st_ctime = 0x00344567; s.st_ctimensec = 0x007888ed; #endif s.st_ino = 0x00927655; #if 0 printf("s.st_dev = %p (%d)\n", &s.st_dev, sizeof(s.st_dev)); #if defined __i386__ printf("s.__st_ino = %p (%d)\n", &s.__st_ino, sizeof(s.__st_ino)); #else printf("s.st_ino = %p (%d)\n", &s.st_ino, sizeof(s.st_ino)); #endif printf("s.st_mode = %p (%d)\n", &s.st_mode, sizeof(s.st_mode)); printf("s.st_nlink = %p (%d)\n", &s.st_nlink, sizeof(s.st_nlink)); printf("s.st_uid = %p (%d)\n", &s.st_uid, sizeof(s.st_uid)); printf("s.st_gid = %p (%d)\n", &s.st_gid, sizeof(s.st_gid)); printf("s.st_rdev = %p (%d)\n", &s.st_rdev, sizeof(s.st_rdev)); #ifdef __powerpc__ printf("s.__pad2 = %p (%d)\n", &s.__pad2, sizeof(s.__pad2)); #endif printf("s.st_size = %p (%d)\n", &s.st_size, sizeof(s.st_size)); printf("s.st_blksize = %p (%d)\n", &s.st_blksize, sizeof(s.st_blksize)); printf("s.st_blocks = %p (%d)\n", &s.st_blocks, sizeof(s.st_blocks)); #ifdef __USE_MISC printf("s.st_atim.tv_sec = %p (%d)\n", &s.st_atim.tv_sec , sizeof(s.st_atim.tv_sec )); printf("s.st_atim.tv_nsec = %p (%d)\n", &s.st_atim.tv_nsec, sizeof(s.st_atim.tv_nsec)); printf("s.st_mtim.tv_sec = %p (%d)\n", &s.st_mtim.tv_sec , sizeof(s.st_mtim.tv_sec )); printf("s.st_mtim.tv_nsec = %p (%d)\n", &s.st_mtim.tv_nsec, sizeof(s.st_mtim.tv_nsec)); printf("s.st_ctim.tv_sec = %p (%d)\n", &s.st_ctim.tv_sec , sizeof(s.st_ctim.tv_sec )); printf("s.st_ctim.tv_nsec = %p (%d)\n", &s.st_ctim.tv_nsec, sizeof(s.st_ctim.tv_nsec)); #else printf("s.st_atime = %p (%d)\n", &s.st_atime, sizeof(s.st_atime)); printf("s.st_atimensec = %p (%d)\n", &s.st_atimensec, sizeof(s.st_atimensec)); printf("s.st_mtime = %p (%d)\n", &s.st_mtime, sizeof(s.st_mtime)); printf("s.st_mtimensec = %p (%d)\n", &s.st_mtimensec, sizeof(s.st_mtimensec)); printf("s.st_ctime = %p (%d)\n", &s.st_ctime, sizeof(s.st_ctime)); printf("s.st_ctimensec = %p (%d)\n", &s.st_ctimensec, sizeof(s.st_ctimensec)); #endif printf("s.st_ino = %p (%d)\n", &s.st_ino, sizeof(s.st_ino)); #endif /* fprintf(stderr, "Read: expected:\n"); dump(&s, size, to/8); */ assert((in = malloc(size)) != NULL); bzero(in, size); assert(read(fd, in, size) == size); /* fprintf(stderr, "Read: returned:\n"); dump(in, size, to/8); */ assert(s.st_dev == in->st_dev); #if defined __i386__ assert(s.__st_ino == in->__st_ino); #else assert(s.st_ino == in->st_ino); #endif assert(s.st_mode == in->st_mode); assert(s.st_nlink == in->st_nlink); assert(s.st_uid == in->st_uid); assert(s.st_gid == in->st_gid); assert(s.st_rdev == in->st_rdev); assert(s.st_size == in->st_size); assert(s.st_blksize == in->st_blksize); assert(s.st_blocks == in->st_blocks); #ifdef __USE_MISC assert(s.st_atim.tv_sec == in->st_atim.tv_sec); assert(s.st_atim.tv_nsec == in->st_atim.tv_nsec); assert(s.st_mtim.tv_sec == in->st_mtim.tv_sec); assert(s.st_mtim.tv_nsec == in->st_mtim.tv_nsec); assert(s.st_ctim.tv_sec == in->st_ctim.tv_sec); assert(s.st_ctim.tv_nsec == in->st_ctim.tv_nsec); #else assert(s.st_atime == in->st_atime); assert(s.st_atimensec == in->st_atimensec); assert(s.st_mtime == in->st_mtime); assert(s.st_mtimensec == in->st_mtimensec); assert(s.st_ctime == in->st_ctime); assert(s.st_ctimensec == in->st_ctimensec); #endif assert(s.st_ino == in->st_ino); free(in); } /* If from == to I try to send a struct sockaddr_in (in this way * I can test its fields without problems), otherwise I sent an * array of char */ static void test_bytes_w(int fd, enum arch from, enum arch to) { void *out; int size, ret; char str[256]; size = aconv_bytes_size(256, from, to); memset(str, 'd', 256); assert((out = calloc(1, size)) != NULL); ret = aconv_bytes(str, from, to, out, size); assert(ret != ACONV_ERROR); if(from == to) memcpy(out, str, size); assert(write(fd, out, size) == size); free(out); } static void test_bytes_r(int fd, enum arch from, enum arch to) { void *in; int size = aconv_bytes_size(256, from, to); char str[256]; assert((in = malloc(size)) != NULL); assert(read(fd, in, size) == size); memset(str, 'd', 256); assert(memcmp(str, in, 256) == 0); free(in); } /*******************************************************************/ /* Public test functions */ /*******************************************************************/ void test_libaconv_client(int fd, enum arch myarch, enum arch sarch) { test_char_w(fd, myarch, sarch); test_char_r(fd, sarch, myarch); test_u_char_w(fd, myarch, sarch); test_u_char_r(fd, sarch, myarch); test_short_w(fd, myarch, sarch); test_short_r(fd, sarch, myarch); test_u_short_w(fd, myarch, sarch); test_u_short_r(fd, sarch, myarch); test_int_w(fd, myarch, sarch); test_int_r(fd, sarch, myarch); test_u_int_w(fd, myarch, sarch); test_u_int_r(fd, sarch, myarch); test_long_w(fd, myarch, sarch); test_long_r(fd, sarch, myarch); test_u_long_w(fd, myarch, sarch); test_u_long_r(fd, sarch, myarch); test_longlong_w(fd, myarch, sarch); test_longlong_r(fd, sarch, myarch); test_u_longlong_w(fd, myarch, sarch); test_u_longlong_r(fd, sarch, myarch); test_string_w(fd, myarch, sarch); test_string_r(fd, sarch, myarch); test_pointer_w(fd, myarch, sarch); test_pointer_r(fd, sarch, myarch); test_mode_t_w(fd, myarch, sarch); test_mode_t_r(fd, sarch, myarch); test_loff_t_w(fd, myarch, sarch); test_loff_t_r(fd, sarch, myarch); test_uid_t_w(fd, myarch, sarch); test_uid_t_r(fd, sarch, myarch); test_gid_t_w(fd, myarch, sarch); test_gid_t_r(fd, sarch, myarch); test_clockid_t_w(fd, myarch, sarch); test_clockid_t_r(fd, sarch, myarch); test___off64_t_w(fd, myarch, sarch); test___off64_t_r(fd, sarch, myarch); test_socklen_t_w(fd, myarch, sarch); test_socklen_t_r(fd, sarch, myarch); test_socklen_t_w(fd, myarch, sarch); test_socklen_t_r(fd, sarch, myarch); test_size_t_w(fd, myarch, sarch); test_size_t_r(fd, sarch, myarch); test_off_t_w(fd, myarch, sarch); test_off_t_r(fd, sarch, myarch); test_array_w(fd, myarch, sarch); test_array_r(fd, sarch, myarch); test_struct_dirent64_w(fd, myarch, sarch); test_struct_dirent64_r(fd, sarch, myarch); test_struct_sockaddr_w(fd, myarch, sarch); test_struct_sockaddr_r(fd, sarch, myarch); test_struct_timespec_w(fd, myarch, sarch); test_struct_timespec_r(fd, sarch, myarch); test_struct_timeval_w(fd, myarch, sarch); test_struct_timeval_r(fd, sarch, myarch); test_struct_timezone_w(fd, myarch, sarch); test_struct_timezone_r(fd, sarch, myarch); test_struct_utimbuf_w(fd, myarch, sarch); test_struct_utimbuf_r(fd, sarch, myarch); test_struct_utsname_w(fd, myarch, sarch); test_struct_utsname_r(fd, sarch, myarch); test_struct_timex_w(fd, myarch, sarch); test_struct_timex_r(fd, sarch, myarch); test_struct_statfs64_w(fd, myarch, sarch); test_struct_statfs64_r(fd, sarch, myarch); test_struct_stat64_w(fd, myarch, sarch); test_struct_stat64_r(fd, sarch, myarch); test_bytes_w(fd, myarch, sarch); test_bytes_r(fd, sarch, myarch); return NULL; } void test_libaconv_server(int fd, enum arch carch, enum arch myarch) { test_size_fun(carch, myarch); test_char_r(fd, carch, myarch); test_char_w(fd, myarch, carch); test_u_char_r(fd, carch, myarch); test_u_char_w(fd, myarch, carch); test_short_r(fd, carch, myarch); test_short_w(fd, myarch, carch); test_u_short_r(fd, carch, myarch); test_u_short_w(fd, myarch, carch); test_int_r(fd, carch, myarch); test_int_w(fd, myarch, carch); test_u_int_r(fd, carch, myarch); test_u_int_w(fd, myarch, carch); test_long_r(fd, carch, myarch); test_long_w(fd, myarch, carch); test_u_long_r(fd, carch, myarch); test_u_long_w(fd, myarch, carch); test_longlong_r(fd, carch, myarch); test_longlong_w(fd, myarch, carch); test_u_longlong_r(fd, carch, myarch); test_u_longlong_w(fd, myarch, carch); test_string_r(fd, carch, myarch); test_string_w(fd, myarch, carch); test_pointer_r(fd, carch, myarch); test_pointer_w(fd, myarch, carch); test_mode_t_r(fd, carch, myarch); test_mode_t_w(fd, myarch, carch); test_loff_t_r(fd, carch, myarch); test_loff_t_w(fd, myarch, carch); test_uid_t_r(fd, carch, myarch); test_uid_t_w(fd, myarch, carch); test_gid_t_r(fd, carch, myarch); test_gid_t_w(fd, myarch, carch); test_clockid_t_r(fd, carch, myarch); test_clockid_t_w(fd, myarch, carch); test___off64_t_r(fd, carch, myarch); test___off64_t_w(fd, myarch, carch); test_socklen_t_r(fd, carch, myarch); test_socklen_t_w(fd, myarch, carch); test_socklen_t_r(fd, carch, myarch); test_socklen_t_w(fd, myarch, carch); test_size_t_r(fd, carch, myarch); test_size_t_w(fd, myarch, carch); test_off_t_r(fd, carch, myarch); test_off_t_w(fd, myarch, carch); test_array_r(fd, carch, myarch); test_array_w(fd, myarch, carch); test_struct_dirent64_r(fd, carch, myarch); test_struct_dirent64_w(fd, myarch, carch); test_struct_sockaddr_r(fd, carch, myarch); test_struct_sockaddr_w(fd, myarch, carch); test_struct_timespec_r(fd, carch, myarch); test_struct_timespec_w(fd, myarch, carch); test_struct_timeval_r(fd, carch, myarch); test_struct_timeval_w(fd, myarch, carch); test_struct_timezone_r(fd, carch, myarch); test_struct_timezone_w(fd, myarch, carch); test_struct_utimbuf_r(fd, carch, myarch); test_struct_utimbuf_w(fd, myarch, carch); test_struct_utsname_r(fd, carch, myarch); test_struct_utsname_w(fd, myarch, carch); test_struct_timex_r(fd, carch, myarch); test_struct_timex_w(fd, myarch, carch); test_struct_statfs64_r(fd, carch, myarch); test_struct_statfs64_w(fd, myarch, carch); test_struct_stat64_r(fd, carch, myarch); test_struct_stat64_w(fd, myarch, carch); test_bytes_r(fd, carch, myarch); test_bytes_w(fd, myarch, carch); return NULL; } umview-0.8.2/um_rsc/librsc/tests/test_syscall_execution.c0000644000175000017500000060350011753517212022771 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * test_syscall_execution.c: system call execution tests * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include "rsc_client.h" #include "rsc_server.h" #include "test_rsc_server.h" #define __USE_LARGEFILE64 #include "fill_request.h" #include "fill_write_pointers.h" #include "type_equality.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void dump(void *p, int size, int bytenum) { int i; fprintf(stderr, "Mem %p[%d bytes]:", p, size); for(i = 0; i < size; i++) { if(i % bytenum == 0) fprintf(stderr, "\n\t%p:\t", p+i); fprintf(stderr, "%.2X", 0xFF & *(char *)(p+i)); } fprintf(stderr, "\n"); } void client_test__llseek(int fd) { #ifdef __x86_64__ return NULL; #else struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct _llseek_req *in = fill__llseek_request(); struct _llseek_req *local = fill__llseek_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create__llseek_request(&nbytes, &iov_count, in->fd, in->offset_high, in->offset_low, in->result, in->whence); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage__llseek_response(&resp_hd, &iov_count, &nbytes, in->fd, in->offset_high, in->offset_low, in->result, in->whence); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ _llseek_fill_write_pointers(local->fd, local->offset_high, local->offset_low, local->result, local->whence); assert(local->fd == in->fd); assert(local->offset_high == in->offset_high); assert(local->offset_low == in->offset_low); assert(compare_loff_t(local->result, in->result)); assert(local->whence == in->whence); free_filled__llseek_request(in, 0); free_filled__llseek_request(local, 0); #endif } void server_test__llseek(int fd, enum arch server_arch, enum arch client_arch) { #ifdef __x86_64__ return NULL; #else int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct _llseek_req *input = fill__llseek_request(); struct _llseek_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre__llseek_exec(req_hd, client_arch); req = (struct _llseek_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); assert(req->offset_high == input->offset_high); assert(req->offset_low == input->offset_low); assert(req->whence == input->whence); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = _llseek_fill_write_pointers(req->fd, req->offset_high, req->offset_low, req->result, req->whence); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post__llseek_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled__llseek_request(input, 0); #endif } void client_test_accept(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct accept_req *in = fill_accept_request(FALSE); struct accept_req *local = fill_accept_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_accept_request(&nbytes, &iov_count, in->sockfd, in->addr, in->addrlen); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_accept_response(&resp_hd, &iov_count, &nbytes, in->sockfd, in->addr, in->addrlen); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ accept_fill_write_pointers(local->sockfd, local->addr, local->addrlen); assert(local->sockfd == in->sockfd); assert(compare_struct_sockaddr(local->addr, in->addr)); assert(compare_socklen_t(local->addrlen, in->addrlen)); free_filled_accept_request(in, 0); free_filled_accept_request(local, 0); } void server_test_accept(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct accept_req *input = fill_accept_request(FALSE); struct accept_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_accept_exec(req_hd, client_arch); req = (struct accept_req *) req_hd; /* I test the content of the request */ assert(req->sockfd == input->sockfd); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = accept_fill_write_pointers(req->sockfd, req->addr, req->addrlen); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_accept_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_accept_request(input, 0); } void client_test_access(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct access_req *in = fill_access_request(FALSE); struct access_req *local = fill_access_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_access_request(&nbytes, &iov_count, in->pathname, in->mode); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_access_response(&resp_hd, &iov_count, &nbytes, in->pathname, in->mode); assert(resp_iov == NULL); assert(compare_string(local->pathname, in->pathname)); assert(local->mode == in->mode); free_filled_access_request(in, 0); free_filled_access_request(local, 0); } void server_test_access(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct access_req *input = fill_access_request(FALSE); struct access_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_access_exec(req_hd, client_arch); req = (struct access_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->pathname, input->pathname)); assert(req->mode == input->mode); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_access_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_access_request(input, 0); } void client_test_adjtimex(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct adjtimex_req *in = fill_adjtimex_request(FALSE); struct adjtimex_req *local = fill_adjtimex_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_adjtimex_request(&nbytes, &iov_count, in->buf); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_adjtimex_response(&resp_hd, &iov_count, &nbytes, in->buf); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ adjtimex_fill_write_pointers(local->buf); assert(compare_struct_timex(local->buf, in->buf)); free_filled_adjtimex_request(in, 0); free_filled_adjtimex_request(local, 0); } void server_test_adjtimex(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct adjtimex_req *input = fill_adjtimex_request(FALSE); struct adjtimex_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_adjtimex_exec(req_hd, client_arch); req = (struct adjtimex_req *) req_hd; /* I test the content of the request */ /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = adjtimex_fill_write_pointers(req->buf); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_adjtimex_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_adjtimex_request(input, 0); } void client_test_bind(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct bind_req *in = fill_bind_request(FALSE); struct bind_req *local = fill_bind_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_bind_request(&nbytes, &iov_count, in->sockfd, in->my_addr, in->addrlen); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_bind_response(&resp_hd, &iov_count, &nbytes, in->sockfd, in->my_addr, in->addrlen); assert(resp_iov == NULL); assert(local->sockfd == in->sockfd); assert(compare_struct_sockaddr(local->my_addr, in->my_addr)); assert(local->addrlen == in->addrlen); free_filled_bind_request(in, 0); free_filled_bind_request(local, 0); } void server_test_bind(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct bind_req *input = fill_bind_request(FALSE); struct bind_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_bind_exec(req_hd, client_arch); req = (struct bind_req *) req_hd; /* I test the content of the request */ assert(req->sockfd == input->sockfd); assert(compare_struct_sockaddr(req->my_addr, input->my_addr)); assert(req->addrlen == input->addrlen); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_bind_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_bind_request(input, 0); } void client_test_chdir(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct chdir_req *in = fill_chdir_request(FALSE); struct chdir_req *local = fill_chdir_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_chdir_request(&nbytes, &iov_count, in->path); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_chdir_response(&resp_hd, &iov_count, &nbytes, in->path); assert(resp_iov == NULL); assert(compare_string(local->path, in->path)); free_filled_chdir_request(in, 0); free_filled_chdir_request(local, 0); } void server_test_chdir(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct chdir_req *input = fill_chdir_request(FALSE); struct chdir_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_chdir_exec(req_hd, client_arch); req = (struct chdir_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_chdir_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_chdir_request(input, 0); } void client_test_chmod(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct chmod_req *in = fill_chmod_request(FALSE); struct chmod_req *local = fill_chmod_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_chmod_request(&nbytes, &iov_count, in->path, in->mode); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_chmod_response(&resp_hd, &iov_count, &nbytes, in->path, in->mode); assert(resp_iov == NULL); assert(compare_string(local->path, in->path)); assert(local->mode == in->mode); free_filled_chmod_request(in, 0); free_filled_chmod_request(local, 0); } void server_test_chmod(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct chmod_req *input = fill_chmod_request(FALSE); struct chmod_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_chmod_exec(req_hd, client_arch); req = (struct chmod_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); assert(req->mode == input->mode); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_chmod_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_chmod_request(input, 0); } void client_test_chown(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct chown_req *in = fill_chown_request(FALSE); struct chown_req *local = fill_chown_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_chown_request(&nbytes, &iov_count, in->path, in->owner, in->group); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_chown_response(&resp_hd, &iov_count, &nbytes, in->path, in->owner, in->group); assert(resp_iov == NULL); assert(compare_string(local->path, in->path)); assert(local->owner == in->owner); assert(local->group == in->group); free_filled_chown_request(in, 0); free_filled_chown_request(local, 0); } void server_test_chown(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct chown_req *input = fill_chown_request(FALSE); struct chown_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_chown_exec(req_hd, client_arch); req = (struct chown_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); assert(req->owner == input->owner); assert(req->group == input->group); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_chown_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_chown_request(input, 0); } void client_test_chown32(int fd) { #ifdef __powerpc__ return NULL; #elif defined __x86_64__ return NULL; #else struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct chown32_req *in = fill_chown32_request(FALSE); struct chown32_req *local = fill_chown32_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_chown32_request(&nbytes, &iov_count, in->path, in->owner, in->group); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_chown32_response(&resp_hd, &iov_count, &nbytes, in->path, in->owner, in->group); assert(resp_iov == NULL); assert(compare_string(local->path, in->path)); assert(local->owner == in->owner); assert(local->group == in->group); free_filled_chown32_request(in, 0); free_filled_chown32_request(local, 0); #endif } void server_test_chown32(int fd, enum arch server_arch, enum arch client_arch) { #ifdef __powerpc__ return NULL; #elif defined __x86_64__ return NULL; #else int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct chown32_req *input = fill_chown32_request(FALSE); struct chown32_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_chown32_exec(req_hd, client_arch); req = (struct chown32_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); assert(req->owner == input->owner); assert(req->group == input->group); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_chown32_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_chown32_request(input, 0); #endif } void client_test_clock_getres(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct clock_getres_req *in = fill_clock_getres_request(); struct clock_getres_req *local = fill_clock_getres_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_clock_getres_request(&nbytes, &iov_count, in->clk_id, in->res); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_clock_getres_response(&resp_hd, &iov_count, &nbytes, in->clk_id, in->res); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ clock_getres_fill_write_pointers(local->clk_id, local->res); assert(local->clk_id == in->clk_id); assert(compare_struct_timespec(local->res, in->res)); free_filled_clock_getres_request(in, 0); free_filled_clock_getres_request(local, 0); } void server_test_clock_getres(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct clock_getres_req *input = fill_clock_getres_request(); struct clock_getres_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_clock_getres_exec(req_hd, client_arch); req = (struct clock_getres_req *) req_hd; /* I test the content of the request */ assert(req->clk_id == input->clk_id); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = clock_getres_fill_write_pointers(req->clk_id, req->res); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_clock_getres_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_clock_getres_request(input, 0); } void client_test_clock_gettime(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct clock_gettime_req *in = fill_clock_gettime_request(); struct clock_gettime_req *local = fill_clock_gettime_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_clock_gettime_request(&nbytes, &iov_count, in->clk_id, in->tp); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_clock_gettime_response(&resp_hd, &iov_count, &nbytes, in->clk_id, in->tp); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ clock_gettime_fill_write_pointers(local->clk_id, local->tp); assert(local->clk_id == in->clk_id); assert(compare_struct_timespec(local->tp, in->tp)); free_filled_clock_gettime_request(in, 0); free_filled_clock_gettime_request(local, 0); } void server_test_clock_gettime(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct clock_gettime_req *input = fill_clock_gettime_request(); struct clock_gettime_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_clock_gettime_exec(req_hd, client_arch); req = (struct clock_gettime_req *) req_hd; /* I test the content of the request */ assert(req->clk_id == input->clk_id); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = clock_gettime_fill_write_pointers(req->clk_id, req->tp); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_clock_gettime_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_clock_gettime_request(input, 0); } void client_test_clock_settime(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct clock_settime_req *in = fill_clock_settime_request(FALSE); struct clock_settime_req *local = fill_clock_settime_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_clock_settime_request(&nbytes, &iov_count, in->clk_id, in->tp); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_clock_settime_response(&resp_hd, &iov_count, &nbytes, in->clk_id, in->tp); assert(resp_iov == NULL); assert(local->clk_id == in->clk_id); assert(compare_struct_timespec(local->tp, in->tp)); free_filled_clock_settime_request(in, 0); free_filled_clock_settime_request(local, 0); } void server_test_clock_settime(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct clock_settime_req *input = fill_clock_settime_request(FALSE); struct clock_settime_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_clock_settime_exec(req_hd, client_arch); req = (struct clock_settime_req *) req_hd; /* I test the content of the request */ assert(req->clk_id == input->clk_id); assert(compare_struct_timespec(req->tp, input->tp)); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_clock_settime_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_clock_settime_request(input, 0); } void client_test_close(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct close_req *in = fill_close_request(); struct close_req *local = fill_close_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_close_request(&nbytes, &iov_count, in->fd); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_close_response(&resp_hd, &iov_count, &nbytes, in->fd); assert(resp_iov == NULL); assert(local->fd == in->fd); free_filled_close_request(in, 0); free_filled_close_request(local, 0); } void server_test_close(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct close_req *input = fill_close_request(); struct close_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_close_exec(req_hd, client_arch); req = (struct close_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_close_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_close_request(input, 0); } void client_test_connect(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct connect_req *in = fill_connect_request(FALSE); struct connect_req *local = fill_connect_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_connect_request(&nbytes, &iov_count, in->sockfd, in->serv_addr, in->addrlen); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_connect_response(&resp_hd, &iov_count, &nbytes, in->sockfd, in->serv_addr, in->addrlen); assert(resp_iov == NULL); assert(local->sockfd == in->sockfd); assert(compare_struct_sockaddr(local->serv_addr, in->serv_addr)); assert(local->addrlen == in->addrlen); free_filled_connect_request(in, 0); free_filled_connect_request(local, 0); } void server_test_connect(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct connect_req *input = fill_connect_request(FALSE); struct connect_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_connect_exec(req_hd, client_arch); req = (struct connect_req *) req_hd; /* I test the content of the request */ assert(req->sockfd == input->sockfd); assert(compare_struct_sockaddr(req->serv_addr, input->serv_addr)); assert(req->addrlen == input->addrlen); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_connect_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_connect_request(input, 0); } void client_test_dup(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct dup_req *in = fill_dup_request(); struct dup_req *local = fill_dup_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_dup_request(&nbytes, &iov_count, in->oldfd); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_dup_response(&resp_hd, &iov_count, &nbytes, in->oldfd); assert(resp_iov == NULL); assert(local->oldfd == in->oldfd); free_filled_dup_request(in, 0); free_filled_dup_request(local, 0); } void server_test_dup(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct dup_req *input = fill_dup_request(); struct dup_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_dup_exec(req_hd, client_arch); req = (struct dup_req *) req_hd; /* I test the content of the request */ assert(req->oldfd == input->oldfd); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_dup_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_dup_request(input, 0); } void client_test_dup2(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct dup2_req *in = fill_dup2_request(); struct dup2_req *local = fill_dup2_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_dup2_request(&nbytes, &iov_count, in->oldfd, in->newfd); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_dup2_response(&resp_hd, &iov_count, &nbytes, in->oldfd, in->newfd); assert(resp_iov == NULL); assert(local->oldfd == in->oldfd); assert(local->newfd == in->newfd); free_filled_dup2_request(in, 0); free_filled_dup2_request(local, 0); } void server_test_dup2(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct dup2_req *input = fill_dup2_request(); struct dup2_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_dup2_exec(req_hd, client_arch); req = (struct dup2_req *) req_hd; /* I test the content of the request */ assert(req->oldfd == input->oldfd); assert(req->newfd == input->newfd); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_dup2_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_dup2_request(input, 0); } void client_test_fchdir(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct fchdir_req *in = fill_fchdir_request(); struct fchdir_req *local = fill_fchdir_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_fchdir_request(&nbytes, &iov_count, in->fd); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_fchdir_response(&resp_hd, &iov_count, &nbytes, in->fd); assert(resp_iov == NULL); assert(local->fd == in->fd); free_filled_fchdir_request(in, 0); free_filled_fchdir_request(local, 0); } void server_test_fchdir(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct fchdir_req *input = fill_fchdir_request(); struct fchdir_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_fchdir_exec(req_hd, client_arch); req = (struct fchdir_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_fchdir_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_fchdir_request(input, 0); } void client_test_fchmod(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct fchmod_req *in = fill_fchmod_request(); struct fchmod_req *local = fill_fchmod_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_fchmod_request(&nbytes, &iov_count, in->fildes, in->mode); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_fchmod_response(&resp_hd, &iov_count, &nbytes, in->fildes, in->mode); assert(resp_iov == NULL); assert(local->fildes == in->fildes); assert(local->mode == in->mode); free_filled_fchmod_request(in, 0); free_filled_fchmod_request(local, 0); } void server_test_fchmod(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct fchmod_req *input = fill_fchmod_request(); struct fchmod_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_fchmod_exec(req_hd, client_arch); req = (struct fchmod_req *) req_hd; /* I test the content of the request */ assert(req->fildes == input->fildes); assert(req->mode == input->mode); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_fchmod_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_fchmod_request(input, 0); } void client_test_fchown(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct fchown_req *in = fill_fchown_request(); struct fchown_req *local = fill_fchown_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_fchown_request(&nbytes, &iov_count, in->fd, in->owner, in->group); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_fchown_response(&resp_hd, &iov_count, &nbytes, in->fd, in->owner, in->group); assert(resp_iov == NULL); assert(local->fd == in->fd); assert(local->owner == in->owner); assert(local->group == in->group); free_filled_fchown_request(in, 0); free_filled_fchown_request(local, 0); } void server_test_fchown(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct fchown_req *input = fill_fchown_request(); struct fchown_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_fchown_exec(req_hd, client_arch); req = (struct fchown_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); assert(req->owner == input->owner); assert(req->group == input->group); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_fchown_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_fchown_request(input, 0); } void client_test_fchown32(int fd) { #ifdef __powerpc__ return NULL; #elif defined __x86_64__ return NULL; #else struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct fchown32_req *in = fill_fchown32_request(); struct fchown32_req *local = fill_fchown32_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_fchown32_request(&nbytes, &iov_count, in->fd, in->owner, in->group); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_fchown32_response(&resp_hd, &iov_count, &nbytes, in->fd, in->owner, in->group); assert(resp_iov == NULL); assert(local->fd == in->fd); assert(local->owner == in->owner); assert(local->group == in->group); free_filled_fchown32_request(in, 0); free_filled_fchown32_request(local, 0); #endif } void server_test_fchown32(int fd, enum arch server_arch, enum arch client_arch) { #ifdef __powerpc__ return NULL; #elif defined __x86_64__ return NULL; #else int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct fchown32_req *input = fill_fchown32_request(); struct fchown32_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_fchown32_exec(req_hd, client_arch); req = (struct fchown32_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); assert(req->owner == input->owner); assert(req->group == input->group); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_fchown32_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_fchown32_request(input, 0); #endif } void client_test_fdatasync(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct fdatasync_req *in = fill_fdatasync_request(); struct fdatasync_req *local = fill_fdatasync_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_fdatasync_request(&nbytes, &iov_count, in->fd); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_fdatasync_response(&resp_hd, &iov_count, &nbytes, in->fd); assert(resp_iov == NULL); assert(local->fd == in->fd); free_filled_fdatasync_request(in, 0); free_filled_fdatasync_request(local, 0); } void server_test_fdatasync(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct fdatasync_req *input = fill_fdatasync_request(); struct fdatasync_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_fdatasync_exec(req_hd, client_arch); req = (struct fdatasync_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_fdatasync_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_fdatasync_request(input, 0); } void client_test_fgetxattr(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct fgetxattr_req *in = fill_fgetxattr_request(FALSE); struct fgetxattr_req *local = fill_fgetxattr_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_fgetxattr_request(&nbytes, &iov_count, in->filedes, in->name, in->value, in->size); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_fgetxattr_response(&resp_hd, &iov_count, &nbytes, in->filedes, in->name, in->value, in->size); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ fgetxattr_fill_write_pointers(local->filedes, local->name, local->value, local->size); assert(local->filedes == in->filedes); assert(compare_string(local->name, in->name)); assert(compare_mem(local->value, in->value, in->size)); assert(local->size == in->size); free_filled_fgetxattr_request(in, 0); free_filled_fgetxattr_request(local, 0); } void server_test_fgetxattr(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct fgetxattr_req *input = fill_fgetxattr_request(FALSE); struct fgetxattr_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_fgetxattr_exec(req_hd, client_arch); req = (struct fgetxattr_req *) req_hd; /* I test the content of the request */ assert(req->filedes == input->filedes); assert(compare_string(req->name, input->name)); assert(req->size == input->size); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = fgetxattr_fill_write_pointers(req->filedes, req->name, req->value, req->size); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_fgetxattr_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_fgetxattr_request(input, 0); } void client_test_fstat64(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct fstat64_req *in = fill_fstat64_request(); struct fstat64_req *local = fill_fstat64_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_fstat64_request(&nbytes, &iov_count, in->filedes, in->buf); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_fstat64_response(&resp_hd, &iov_count, &nbytes, in->filedes, in->buf); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ fstat64_fill_write_pointers(local->filedes, local->buf); assert(local->filedes == in->filedes); assert(compare_struct_stat64(local->buf, in->buf)); free_filled_fstat64_request(in, 0); free_filled_fstat64_request(local, 0); } void server_test_fstat64(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct fstat64_req *input = fill_fstat64_request(); struct fstat64_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_fstat64_exec(req_hd, client_arch); req = (struct fstat64_req *) req_hd; /* I test the content of the request */ assert(req->filedes == input->filedes); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = fstat64_fill_write_pointers(req->filedes, req->buf); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_fstat64_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_fstat64_request(input, 0); } void client_test_fstatfs64(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct fstatfs64_req *in = fill_fstatfs64_request(); struct fstatfs64_req *local = fill_fstatfs64_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_fstatfs64_request(&nbytes, &iov_count, in->fd, in->buf); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_fstatfs64_response(&resp_hd, &iov_count, &nbytes, in->fd, in->buf); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ fstatfs64_fill_write_pointers(local->fd, local->buf); assert(local->fd == in->fd); assert(compare_struct_statfs64(local->buf, in->buf)); free_filled_fstatfs64_request(in, 0); free_filled_fstatfs64_request(local, 0); } void server_test_fstatfs64(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct fstatfs64_req *input = fill_fstatfs64_request(); struct fstatfs64_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_fstatfs64_exec(req_hd, client_arch); req = (struct fstatfs64_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = fstatfs64_fill_write_pointers(req->fd, req->buf); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_fstatfs64_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_fstatfs64_request(input, 0); } void client_test_fsync(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct fsync_req *in = fill_fsync_request(); struct fsync_req *local = fill_fsync_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_fsync_request(&nbytes, &iov_count, in->fd); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_fsync_response(&resp_hd, &iov_count, &nbytes, in->fd); assert(resp_iov == NULL); assert(local->fd == in->fd); free_filled_fsync_request(in, 0); free_filled_fsync_request(local, 0); } void server_test_fsync(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct fsync_req *input = fill_fsync_request(); struct fsync_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_fsync_exec(req_hd, client_arch); req = (struct fsync_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_fsync_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_fsync_request(input, 0); } void client_test_ftruncate64(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct ftruncate64_req *in = fill_ftruncate64_request(); struct ftruncate64_req *local = fill_ftruncate64_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_ftruncate64_request(&nbytes, &iov_count, in->fd, in->length); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_ftruncate64_response(&resp_hd, &iov_count, &nbytes, in->fd, in->length); assert(resp_iov == NULL); assert(local->fd == in->fd); assert(local->length == in->length); free_filled_ftruncate64_request(in, 0); free_filled_ftruncate64_request(local, 0); } void server_test_ftruncate64(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct ftruncate64_req *input = fill_ftruncate64_request(); struct ftruncate64_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_ftruncate64_exec(req_hd, client_arch); req = (struct ftruncate64_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); assert(req->length == input->length); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_ftruncate64_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_ftruncate64_request(input, 0); } void client_test_getdents64(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct getdents64_req *in = fill_getdents64_request(); struct getdents64_req *local = fill_getdents64_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_getdents64_request(&nbytes, &iov_count, in->fd, in->dirp, in->count); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_getdents64_response(&resp_hd, &iov_count, &nbytes, in->fd, in->dirp, in->count); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ getdents64_fill_write_pointers(local->fd, local->dirp, local->count); assert(local->fd == in->fd); assert(compare_struct_dirent64(local->dirp, in->dirp)); assert(local->count == in->count); free_filled_getdents64_request(in, 0); free_filled_getdents64_request(local, 0); } void server_test_getdents64(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct getdents64_req *input = fill_getdents64_request(); struct getdents64_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_getdents64_exec(req_hd, client_arch); req = (struct getdents64_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); assert(req->count == input->count); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = getdents64_fill_write_pointers(req->fd, req->dirp, req->count); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_getdents64_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_getdents64_request(input, 0); } void client_test_getpeername(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct getpeername_req *in = fill_getpeername_request(FALSE); struct getpeername_req *local = fill_getpeername_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_getpeername_request(&nbytes, &iov_count, in->s, in->name, in->namelen); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_getpeername_response(&resp_hd, &iov_count, &nbytes, in->s, in->name, in->namelen); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ getpeername_fill_write_pointers(local->s, local->name, local->namelen); assert(local->s == in->s); assert(compare_struct_sockaddr(local->name, in->name)); assert(compare_socklen_t(local->namelen, in->namelen)); free_filled_getpeername_request(in, 0); free_filled_getpeername_request(local, 0); } void server_test_getpeername(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct getpeername_req *input = fill_getpeername_request(FALSE); struct getpeername_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_getpeername_exec(req_hd, client_arch); req = (struct getpeername_req *) req_hd; /* I test the content of the request */ assert(req->s == input->s); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = getpeername_fill_write_pointers(req->s, req->name, req->namelen); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_getpeername_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_getpeername_request(input, 0); } void client_test_getsockname(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct getsockname_req *in = fill_getsockname_request(FALSE); struct getsockname_req *local = fill_getsockname_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_getsockname_request(&nbytes, &iov_count, in->s, in->name, in->namelen); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_getsockname_response(&resp_hd, &iov_count, &nbytes, in->s, in->name, in->namelen); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ getsockname_fill_write_pointers(local->s, local->name, local->namelen); assert(local->s == in->s); assert(compare_struct_sockaddr(local->name, in->name)); assert(compare_socklen_t(local->namelen, in->namelen)); free_filled_getsockname_request(in, 0); free_filled_getsockname_request(local, 0); } void server_test_getsockname(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct getsockname_req *input = fill_getsockname_request(FALSE); struct getsockname_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_getsockname_exec(req_hd, client_arch); req = (struct getsockname_req *) req_hd; /* I test the content of the request */ assert(req->s == input->s); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = getsockname_fill_write_pointers(req->s, req->name, req->namelen); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_getsockname_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_getsockname_request(input, 0); } void client_test_getsockopt(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct getsockopt_req *in = fill_getsockopt_request(FALSE); struct getsockopt_req *local = fill_getsockopt_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_getsockopt_request(&nbytes, &iov_count, in->s, in->level, in->optname, in->optval, in->optlen); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_getsockopt_response(&resp_hd, &iov_count, &nbytes, in->s, in->level, in->optname, in->optval, in->optlen); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ getsockopt_fill_write_pointers(local->s, local->level, local->optname, local->optval, local->optlen); assert(local->s == in->s); assert(local->level == in->level); assert(local->optname == in->optname); assert(compare_mem(local->optval, in->optval, *(in->optlen))); assert(compare_socklen_t(local->optlen, in->optlen)); free_filled_getsockopt_request(in, 0); free_filled_getsockopt_request(local, 0); } void server_test_getsockopt(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct getsockopt_req *input = fill_getsockopt_request(FALSE); struct getsockopt_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_getsockopt_exec(req_hd, client_arch); req = (struct getsockopt_req *) req_hd; /* I test the content of the request */ assert(req->s == input->s); assert(req->level == input->level); assert(req->optname == input->optname); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = getsockopt_fill_write_pointers(req->s, req->level, req->optname, req->optval, req->optlen); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_getsockopt_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_getsockopt_request(input, 0); } void client_test_gettimeofday(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct gettimeofday_req *in = fill_gettimeofday_request(); struct gettimeofday_req *local = fill_gettimeofday_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_gettimeofday_request(&nbytes, &iov_count, in->tv, in->tz); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_gettimeofday_response(&resp_hd, &iov_count, &nbytes, in->tv, in->tz); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ gettimeofday_fill_write_pointers(local->tv, local->tz); assert(compare_struct_timeval(local->tv, in->tv)); assert(compare_struct_timezone(local->tz, in->tz)); free_filled_gettimeofday_request(in, 0); free_filled_gettimeofday_request(local, 0); } void server_test_gettimeofday(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct gettimeofday_req *input = fill_gettimeofday_request(); struct gettimeofday_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_gettimeofday_exec(req_hd, client_arch); req = (struct gettimeofday_req *) req_hd; /* I test the content of the request */ /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = gettimeofday_fill_write_pointers(req->tv, req->tz); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_gettimeofday_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_gettimeofday_request(input, 0); } void client_test_getxattr(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct getxattr_req *in = fill_getxattr_request(FALSE, FALSE); struct getxattr_req *local = fill_getxattr_request(FALSE, FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_getxattr_request(&nbytes, &iov_count, in->path, in->name, in->value, in->size); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_getxattr_response(&resp_hd, &iov_count, &nbytes, in->path, in->name, in->value, in->size); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ getxattr_fill_write_pointers(local->path, local->name, local->value, local->size); assert(compare_string(local->path, in->path)); assert(compare_string(local->name, in->name)); assert(compare_mem(local->value, in->value, in->size)); assert(local->size == in->size); free_filled_getxattr_request(in, 0); free_filled_getxattr_request(local, 0); } void server_test_getxattr(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct getxattr_req *input = fill_getxattr_request(FALSE, FALSE); struct getxattr_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_getxattr_exec(req_hd, client_arch); req = (struct getxattr_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); assert(compare_string(req->name, input->name)); assert(req->size == input->size); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = getxattr_fill_write_pointers(req->path, req->name, req->value, req->size); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_getxattr_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_getxattr_request(input, 0); } void client_test_lchown(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct lchown_req *in = fill_lchown_request(FALSE); struct lchown_req *local = fill_lchown_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_lchown_request(&nbytes, &iov_count, in->path, in->owner, in->group); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_lchown_response(&resp_hd, &iov_count, &nbytes, in->path, in->owner, in->group); assert(resp_iov == NULL); assert(compare_string(local->path, in->path)); assert(local->owner == in->owner); assert(local->group == in->group); free_filled_lchown_request(in, 0); free_filled_lchown_request(local, 0); } void server_test_lchown(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct lchown_req *input = fill_lchown_request(FALSE); struct lchown_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_lchown_exec(req_hd, client_arch); req = (struct lchown_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); assert(req->owner == input->owner); assert(req->group == input->group); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_lchown_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_lchown_request(input, 0); } void client_test_lchown32(int fd) { #ifdef __powerpc__ return NULL; #elif defined __x86_64__ return NULL; #else struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct lchown32_req *in = fill_lchown32_request(FALSE); struct lchown32_req *local = fill_lchown32_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_lchown32_request(&nbytes, &iov_count, in->path, in->owner, in->group); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_lchown32_response(&resp_hd, &iov_count, &nbytes, in->path, in->owner, in->group); assert(resp_iov == NULL); assert(compare_string(local->path, in->path)); assert(local->owner == in->owner); assert(local->group == in->group); free_filled_lchown32_request(in, 0); free_filled_lchown32_request(local, 0); #endif } void server_test_lchown32(int fd, enum arch server_arch, enum arch client_arch) { #ifdef __powerpc__ return NULL; #elif defined __x86_64__ return NULL; #else int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct lchown32_req *input = fill_lchown32_request(FALSE); struct lchown32_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_lchown32_exec(req_hd, client_arch); req = (struct lchown32_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); assert(req->owner == input->owner); assert(req->group == input->group); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_lchown32_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_lchown32_request(input, 0); #endif } void client_test_lgetxattr(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct lgetxattr_req *in = fill_lgetxattr_request(FALSE, FALSE); struct lgetxattr_req *local = fill_lgetxattr_request(FALSE, FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_lgetxattr_request(&nbytes, &iov_count, in->path, in->name, in->value, in->size); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_lgetxattr_response(&resp_hd, &iov_count, &nbytes, in->path, in->name, in->value, in->size); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ lgetxattr_fill_write_pointers(local->path, local->name, local->value, local->size); assert(compare_string(local->path, in->path)); assert(compare_string(local->name, in->name)); assert(compare_mem(local->value, in->value, in->size)); assert(local->size == in->size); free_filled_lgetxattr_request(in, 0); free_filled_lgetxattr_request(local, 0); } void server_test_lgetxattr(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct lgetxattr_req *input = fill_lgetxattr_request(FALSE, FALSE); struct lgetxattr_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_lgetxattr_exec(req_hd, client_arch); req = (struct lgetxattr_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); assert(compare_string(req->name, input->name)); assert(req->size == input->size); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = lgetxattr_fill_write_pointers(req->path, req->name, req->value, req->size); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_lgetxattr_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_lgetxattr_request(input, 0); } void client_test_link(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct link_req *in = fill_link_request(FALSE, FALSE); struct link_req *local = fill_link_request(FALSE, FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_link_request(&nbytes, &iov_count, in->oldpath, in->newpath); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_link_response(&resp_hd, &iov_count, &nbytes, in->oldpath, in->newpath); assert(resp_iov == NULL); assert(compare_string(local->oldpath, in->oldpath)); assert(compare_string(local->newpath, in->newpath)); free_filled_link_request(in, 0); free_filled_link_request(local, 0); } void server_test_link(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct link_req *input = fill_link_request(FALSE, FALSE); struct link_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_link_exec(req_hd, client_arch); req = (struct link_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->oldpath, input->oldpath)); assert(compare_string(req->newpath, input->newpath)); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_link_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_link_request(input, 0); } void client_test_listen(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct listen_req *in = fill_listen_request(); struct listen_req *local = fill_listen_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_listen_request(&nbytes, &iov_count, in->sockfd, in->backlog); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_listen_response(&resp_hd, &iov_count, &nbytes, in->sockfd, in->backlog); assert(resp_iov == NULL); assert(local->sockfd == in->sockfd); assert(local->backlog == in->backlog); free_filled_listen_request(in, 0); free_filled_listen_request(local, 0); } void server_test_listen(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct listen_req *input = fill_listen_request(); struct listen_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_listen_exec(req_hd, client_arch); req = (struct listen_req *) req_hd; /* I test the content of the request */ assert(req->sockfd == input->sockfd); assert(req->backlog == input->backlog); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_listen_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_listen_request(input, 0); } void client_test_lseek(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct lseek_req *in = fill_lseek_request(); struct lseek_req *local = fill_lseek_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_lseek_request(&nbytes, &iov_count, in->fildes, in->offset, in->whence); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_lseek_response(&resp_hd, &iov_count, &nbytes, in->fildes, in->offset, in->whence); assert(resp_iov == NULL); assert(local->fildes == in->fildes); assert(local->offset == in->offset); assert(local->whence == in->whence); free_filled_lseek_request(in, 0); free_filled_lseek_request(local, 0); } void server_test_lseek(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct lseek_req *input = fill_lseek_request(); struct lseek_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_lseek_exec(req_hd, client_arch); req = (struct lseek_req *) req_hd; /* I test the content of the request */ assert(req->fildes == input->fildes); assert(req->offset == input->offset); assert(req->whence == input->whence); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_lseek_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_lseek_request(input, 0); } void client_test_lstat64(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct lstat64_req *in = fill_lstat64_request(FALSE); struct lstat64_req *local = fill_lstat64_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_lstat64_request(&nbytes, &iov_count, in->path, in->buf); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_lstat64_response(&resp_hd, &iov_count, &nbytes, in->path, in->buf); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ lstat64_fill_write_pointers(local->path, local->buf); assert(compare_string(local->path, in->path)); assert(compare_struct_stat64(local->buf, in->buf)); free_filled_lstat64_request(in, 0); free_filled_lstat64_request(local, 0); } void server_test_lstat64(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct lstat64_req *input = fill_lstat64_request(FALSE); struct lstat64_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_lstat64_exec(req_hd, client_arch); req = (struct lstat64_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = lstat64_fill_write_pointers(req->path, req->buf); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_lstat64_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_lstat64_request(input, 0); } void client_test_mkdir(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct mkdir_req *in = fill_mkdir_request(FALSE); struct mkdir_req *local = fill_mkdir_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_mkdir_request(&nbytes, &iov_count, in->pathname, in->mode); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_mkdir_response(&resp_hd, &iov_count, &nbytes, in->pathname, in->mode); assert(resp_iov == NULL); assert(compare_string(local->pathname, in->pathname)); assert(local->mode == in->mode); free_filled_mkdir_request(in, 0); free_filled_mkdir_request(local, 0); } void server_test_mkdir(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct mkdir_req *input = fill_mkdir_request(FALSE); struct mkdir_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_mkdir_exec(req_hd, client_arch); req = (struct mkdir_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->pathname, input->pathname)); assert(req->mode == input->mode); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_mkdir_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_mkdir_request(input, 0); } void client_test_mount(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct mount_req *in = fill_mount_request(FALSE, FALSE, FALSE, FALSE); struct mount_req *local = fill_mount_request(FALSE, FALSE, FALSE, FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_mount_request(&nbytes, &iov_count, in->source, in->target, in->filesystemtype, in->mountflags, in->data); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_mount_response(&resp_hd, &iov_count, &nbytes, in->source, in->target, in->filesystemtype, in->mountflags, in->data); assert(resp_iov == NULL); assert(compare_string(local->source, in->source)); assert(compare_string(local->target, in->target)); assert(compare_string(local->filesystemtype, in->filesystemtype)); assert(local->mountflags == in->mountflags); assert(compare_mem(local->data, in->data, (strlen(in->data) + 1))); free_filled_mount_request(in, 0); free_filled_mount_request(local, 0); } void server_test_mount(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct mount_req *input = fill_mount_request(FALSE, FALSE, FALSE, FALSE); struct mount_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_mount_exec(req_hd, client_arch); req = (struct mount_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->source, input->source)); assert(compare_string(req->target, input->target)); assert(compare_string(req->filesystemtype, input->filesystemtype)); assert(req->mountflags == input->mountflags); assert(compare_mem(req->data, input->data, (strlen(input->data) + 1))); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_mount_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_mount_request(input, 0); } void client_test_open(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct open_req *in = fill_open_request(FALSE); struct open_req *local = fill_open_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_open_request(&nbytes, &iov_count, in->pathname, in->flags); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_open_response(&resp_hd, &iov_count, &nbytes, in->pathname, in->flags); assert(resp_iov == NULL); assert(compare_string(local->pathname, in->pathname)); assert(local->flags == in->flags); free_filled_open_request(in, 0); free_filled_open_request(local, 0); } void server_test_open(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct open_req *input = fill_open_request(FALSE); struct open_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_open_exec(req_hd, client_arch); req = (struct open_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->pathname, input->pathname)); assert(req->flags == input->flags); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_open_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_open_request(input, 0); } void client_test_pread64(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct pread64_req *in = fill_pread64_request(); struct pread64_req *local = fill_pread64_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_pread64_request(&nbytes, &iov_count, in->fd, in->buf, in->count, in->offset); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_pread64_response(&resp_hd, &iov_count, &nbytes, in->fd, in->buf, in->count, in->offset); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ pread64_fill_write_pointers(local->fd, local->buf, local->count, local->offset); assert(local->fd == in->fd); assert(compare_mem(local->buf, in->buf, in->count)); assert(local->count == in->count); assert(local->offset == in->offset); free_filled_pread64_request(in, 0); free_filled_pread64_request(local, 0); } void server_test_pread64(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct pread64_req *input = fill_pread64_request(); struct pread64_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_pread64_exec(req_hd, client_arch); req = (struct pread64_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); assert(req->count == input->count); assert(req->offset == input->offset); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = pread64_fill_write_pointers(req->fd, req->buf, req->count, req->offset); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_pread64_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_pread64_request(input, 0); } void client_test_pwrite64(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct pwrite64_req *in = fill_pwrite64_request(FALSE); struct pwrite64_req *local = fill_pwrite64_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_pwrite64_request(&nbytes, &iov_count, in->fd, in->buf, in->count, in->offset); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_pwrite64_response(&resp_hd, &iov_count, &nbytes, in->fd, in->buf, in->count, in->offset); assert(resp_iov == NULL); assert(local->fd == in->fd); assert(compare_mem(local->buf, in->buf, in->count)); assert(local->count == in->count); assert(local->offset == in->offset); free_filled_pwrite64_request(in, 0); free_filled_pwrite64_request(local, 0); } void server_test_pwrite64(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct pwrite64_req *input = fill_pwrite64_request(FALSE); struct pwrite64_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_pwrite64_exec(req_hd, client_arch); req = (struct pwrite64_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); assert(compare_mem(req->buf, input->buf, input->count)); assert(req->count == input->count); assert(req->offset == input->offset); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_pwrite64_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_pwrite64_request(input, 0); } void client_test_read(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct read_req *in = fill_read_request(); struct read_req *local = fill_read_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_read_request(&nbytes, &iov_count, in->fd, in->buf, in->count); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_read_response(&resp_hd, &iov_count, &nbytes, in->fd, in->buf, in->count); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ read_fill_write_pointers(local->fd, local->buf, local->count); assert(local->fd == in->fd); assert(compare_mem(local->buf, in->buf, in->count)); assert(local->count == in->count); free_filled_read_request(in, 0); free_filled_read_request(local, 0); } void server_test_read(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct read_req *input = fill_read_request(); struct read_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_read_exec(req_hd, client_arch); req = (struct read_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); assert(req->count == input->count); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = read_fill_write_pointers(req->fd, req->buf, req->count); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_read_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_read_request(input, 0); } void client_test_readlink(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct readlink_req *in = fill_readlink_request(FALSE); struct readlink_req *local = fill_readlink_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_readlink_request(&nbytes, &iov_count, in->path, in->buf, in->bufsiz); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_readlink_response(&resp_hd, &iov_count, &nbytes, in->path, in->buf, in->bufsiz); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ readlink_fill_write_pointers(local->path, local->buf, local->bufsiz); assert(compare_string(local->path, in->path)); assert(compare_string(local->buf, in->buf)); assert(local->bufsiz == in->bufsiz); free_filled_readlink_request(in, 0); free_filled_readlink_request(local, 0); } void server_test_readlink(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct readlink_req *input = fill_readlink_request(FALSE); struct readlink_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_readlink_exec(req_hd, client_arch); req = (struct readlink_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); assert(req->bufsiz == input->bufsiz); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = readlink_fill_write_pointers(req->path, req->buf, req->bufsiz); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_readlink_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_readlink_request(input, 0); } void client_test_recv(int fd) { #ifdef __x86_64__ return NULL; #else struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct recv_req *in = fill_recv_request(); struct recv_req *local = fill_recv_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_recv_request(&nbytes, &iov_count, in->s, in->buf, in->len, in->flags); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_recv_response(&resp_hd, &iov_count, &nbytes, in->s, in->buf, in->len, in->flags); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ recv_fill_write_pointers(local->s, local->buf, local->len, local->flags); assert(local->s == in->s); assert(compare_mem(local->buf, in->buf, in->len)); assert(local->len == in->len); assert(local->flags == in->flags); free_filled_recv_request(in, 0); free_filled_recv_request(local, 0); #endif } void server_test_recv(int fd, enum arch server_arch, enum arch client_arch) { #ifdef __x86_64__ return NULL; #else int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct recv_req *input = fill_recv_request(); struct recv_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_recv_exec(req_hd, client_arch); req = (struct recv_req *) req_hd; /* I test the content of the request */ assert(req->s == input->s); assert(req->len == input->len); assert(req->flags == input->flags); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = recv_fill_write_pointers(req->s, req->buf, req->len, req->flags); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_recv_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_recv_request(input, 0); #endif } void client_test_recvfrom(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct recvfrom_req *in = fill_recvfrom_request(FALSE, FALSE); struct recvfrom_req *local = fill_recvfrom_request(FALSE, FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_recvfrom_request(&nbytes, &iov_count, in->s, in->buf, in->len, in->flags, in->from, in->fromlen); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_recvfrom_response(&resp_hd, &iov_count, &nbytes, in->s, in->buf, in->len, in->flags, in->from, in->fromlen); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ recvfrom_fill_write_pointers(local->s, local->buf, local->len, local->flags, local->from, local->fromlen); assert(local->s == in->s); assert(compare_mem(local->buf, in->buf, in->len)); assert(local->len == in->len); assert(local->flags == in->flags); assert(compare_struct_sockaddr(local->from, in->from)); assert(compare_socklen_t(local->fromlen, in->fromlen)); free_filled_recvfrom_request(in, 0); free_filled_recvfrom_request(local, 0); } void server_test_recvfrom(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct recvfrom_req *input = fill_recvfrom_request(FALSE, FALSE); struct recvfrom_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_recvfrom_exec(req_hd, client_arch); req = (struct recvfrom_req *) req_hd; /* I test the content of the request */ assert(req->s == input->s); assert(req->len == input->len); assert(req->flags == input->flags); assert(compare_struct_sockaddr(req->from, input->from)); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = recvfrom_fill_write_pointers(req->s, req->buf, req->len, req->flags, req->from, req->fromlen); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_recvfrom_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_recvfrom_request(input, 0); } void client_test_rename(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct rename_req *in = fill_rename_request(FALSE, FALSE); struct rename_req *local = fill_rename_request(FALSE, FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_rename_request(&nbytes, &iov_count, in->oldpath, in->newpath); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_rename_response(&resp_hd, &iov_count, &nbytes, in->oldpath, in->newpath); assert(resp_iov == NULL); assert(compare_string(local->oldpath, in->oldpath)); assert(compare_string(local->newpath, in->newpath)); free_filled_rename_request(in, 0); free_filled_rename_request(local, 0); } void server_test_rename(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct rename_req *input = fill_rename_request(FALSE, FALSE); struct rename_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_rename_exec(req_hd, client_arch); req = (struct rename_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->oldpath, input->oldpath)); assert(compare_string(req->newpath, input->newpath)); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_rename_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_rename_request(input, 0); } void client_test_rmdir(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct rmdir_req *in = fill_rmdir_request(FALSE); struct rmdir_req *local = fill_rmdir_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_rmdir_request(&nbytes, &iov_count, in->pathname); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_rmdir_response(&resp_hd, &iov_count, &nbytes, in->pathname); assert(resp_iov == NULL); assert(compare_string(local->pathname, in->pathname)); free_filled_rmdir_request(in, 0); free_filled_rmdir_request(local, 0); } void server_test_rmdir(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct rmdir_req *input = fill_rmdir_request(FALSE); struct rmdir_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_rmdir_exec(req_hd, client_arch); req = (struct rmdir_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->pathname, input->pathname)); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_rmdir_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_rmdir_request(input, 0); } void client_test_send(int fd) { #ifdef __x86_64__ return NULL; #else struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct send_req *in = fill_send_request(FALSE); struct send_req *local = fill_send_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_send_request(&nbytes, &iov_count, in->s, in->buf, in->len, in->flags); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_send_response(&resp_hd, &iov_count, &nbytes, in->s, in->buf, in->len, in->flags); assert(resp_iov == NULL); assert(local->s == in->s); assert(compare_mem(local->buf, in->buf, in->len)); assert(local->len == in->len); assert(local->flags == in->flags); free_filled_send_request(in, 0); free_filled_send_request(local, 0); #endif } void server_test_send(int fd, enum arch server_arch, enum arch client_arch) { #ifdef __x86_64__ return NULL; #else int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct send_req *input = fill_send_request(FALSE); struct send_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_send_exec(req_hd, client_arch); req = (struct send_req *) req_hd; /* I test the content of the request */ assert(req->s == input->s); assert(compare_mem(req->buf, input->buf, input->len)); assert(req->len == input->len); assert(req->flags == input->flags); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_send_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_send_request(input, 0); #endif } void client_test_sendto(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct sendto_req *in = fill_sendto_request(FALSE, FALSE); struct sendto_req *local = fill_sendto_request(FALSE, FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_sendto_request(&nbytes, &iov_count, in->s, in->buf, in->len, in->flags, in->to, in->tolen); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_sendto_response(&resp_hd, &iov_count, &nbytes, in->s, in->buf, in->len, in->flags, in->to, in->tolen); assert(resp_iov == NULL); assert(local->s == in->s); assert(compare_mem(local->buf, in->buf, in->len)); assert(local->len == in->len); assert(local->flags == in->flags); assert(compare_struct_sockaddr(local->to, in->to)); assert(local->tolen == in->tolen); free_filled_sendto_request(in, 0); free_filled_sendto_request(local, 0); } void server_test_sendto(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct sendto_req *input = fill_sendto_request(FALSE, FALSE); struct sendto_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_sendto_exec(req_hd, client_arch); req = (struct sendto_req *) req_hd; /* I test the content of the request */ assert(req->s == input->s); assert(compare_mem(req->buf, input->buf, input->len)); assert(req->len == input->len); assert(req->flags == input->flags); assert(compare_struct_sockaddr(req->to, input->to)); assert(req->tolen == input->tolen); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_sendto_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_sendto_request(input, 0); } void client_test_setdomainname(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct setdomainname_req *in = fill_setdomainname_request(FALSE); struct setdomainname_req *local = fill_setdomainname_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_setdomainname_request(&nbytes, &iov_count, in->name, in->len); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_setdomainname_response(&resp_hd, &iov_count, &nbytes, in->name, in->len); assert(resp_iov == NULL); assert(compare_string(local->name, in->name)); assert(local->len == in->len); free_filled_setdomainname_request(in, 0); free_filled_setdomainname_request(local, 0); } void server_test_setdomainname(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct setdomainname_req *input = fill_setdomainname_request(FALSE); struct setdomainname_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_setdomainname_exec(req_hd, client_arch); req = (struct setdomainname_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->name, input->name)); assert(req->len == input->len); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_setdomainname_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_setdomainname_request(input, 0); } void client_test_sethostname(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct sethostname_req *in = fill_sethostname_request(FALSE); struct sethostname_req *local = fill_sethostname_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_sethostname_request(&nbytes, &iov_count, in->name, in->len); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_sethostname_response(&resp_hd, &iov_count, &nbytes, in->name, in->len); assert(resp_iov == NULL); assert(compare_string(local->name, in->name)); assert(local->len == in->len); free_filled_sethostname_request(in, 0); free_filled_sethostname_request(local, 0); } void server_test_sethostname(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct sethostname_req *input = fill_sethostname_request(FALSE); struct sethostname_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_sethostname_exec(req_hd, client_arch); req = (struct sethostname_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->name, input->name)); assert(req->len == input->len); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_sethostname_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_sethostname_request(input, 0); } void client_test_setsockopt(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct setsockopt_req *in = fill_setsockopt_request(FALSE); struct setsockopt_req *local = fill_setsockopt_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_setsockopt_request(&nbytes, &iov_count, in->s, in->level, in->optname, in->optval, in->optlen); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_setsockopt_response(&resp_hd, &iov_count, &nbytes, in->s, in->level, in->optname, in->optval, in->optlen); assert(resp_iov == NULL); assert(local->s == in->s); assert(local->level == in->level); assert(local->optname == in->optname); assert(compare_mem(local->optval, in->optval, in->optlen)); assert(local->optlen == in->optlen); free_filled_setsockopt_request(in, 0); free_filled_setsockopt_request(local, 0); } void server_test_setsockopt(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct setsockopt_req *input = fill_setsockopt_request(FALSE); struct setsockopt_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_setsockopt_exec(req_hd, client_arch); req = (struct setsockopt_req *) req_hd; /* I test the content of the request */ assert(req->s == input->s); assert(req->level == input->level); assert(req->optname == input->optname); assert(compare_mem(req->optval, input->optval, input->optlen)); assert(req->optlen == input->optlen); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_setsockopt_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_setsockopt_request(input, 0); } void client_test_settimeofday(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct settimeofday_req *in = fill_settimeofday_request(FALSE, FALSE); struct settimeofday_req *local = fill_settimeofday_request(FALSE, FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_settimeofday_request(&nbytes, &iov_count, in->tv, in->tz); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_settimeofday_response(&resp_hd, &iov_count, &nbytes, in->tv, in->tz); assert(resp_iov == NULL); assert(compare_struct_timeval(local->tv, in->tv)); assert(compare_struct_timezone(local->tz, in->tz)); free_filled_settimeofday_request(in, 0); free_filled_settimeofday_request(local, 0); } void server_test_settimeofday(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct settimeofday_req *input = fill_settimeofday_request(FALSE, FALSE); struct settimeofday_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_settimeofday_exec(req_hd, client_arch); req = (struct settimeofday_req *) req_hd; /* I test the content of the request */ assert(compare_struct_timeval(req->tv, input->tv)); assert(compare_struct_timezone(req->tz, input->tz)); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_settimeofday_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_settimeofday_request(input, 0); } void client_test_shutdown(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct shutdown_req *in = fill_shutdown_request(); struct shutdown_req *local = fill_shutdown_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_shutdown_request(&nbytes, &iov_count, in->s, in->how); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_shutdown_response(&resp_hd, &iov_count, &nbytes, in->s, in->how); assert(resp_iov == NULL); assert(local->s == in->s); assert(local->how == in->how); free_filled_shutdown_request(in, 0); free_filled_shutdown_request(local, 0); } void server_test_shutdown(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct shutdown_req *input = fill_shutdown_request(); struct shutdown_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_shutdown_exec(req_hd, client_arch); req = (struct shutdown_req *) req_hd; /* I test the content of the request */ assert(req->s == input->s); assert(req->how == input->how); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_shutdown_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_shutdown_request(input, 0); } void client_test_socket(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct socket_req *in = fill_socket_request(); struct socket_req *local = fill_socket_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_socket_request(&nbytes, &iov_count, in->domain, in->type, in->protocol); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_socket_response(&resp_hd, &iov_count, &nbytes, in->domain, in->type, in->protocol); assert(resp_iov == NULL); assert(local->domain == in->domain); assert(local->type == in->type); assert(local->protocol == in->protocol); free_filled_socket_request(in, 0); free_filled_socket_request(local, 0); } void server_test_socket(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct socket_req *input = fill_socket_request(); struct socket_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_socket_exec(req_hd, client_arch); req = (struct socket_req *) req_hd; /* I test the content of the request */ assert(req->domain == input->domain); assert(req->type == input->type); assert(req->protocol == input->protocol); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_socket_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_socket_request(input, 0); } void client_test_stat64(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct stat64_req *in = fill_stat64_request(FALSE); struct stat64_req *local = fill_stat64_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_stat64_request(&nbytes, &iov_count, in->path, in->buf); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_stat64_response(&resp_hd, &iov_count, &nbytes, in->path, in->buf); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ stat64_fill_write_pointers(local->path, local->buf); assert(compare_string(local->path, in->path)); assert(compare_struct_stat64(local->buf, in->buf)); free_filled_stat64_request(in, 0); free_filled_stat64_request(local, 0); } void server_test_stat64(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct stat64_req *input = fill_stat64_request(FALSE); struct stat64_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_stat64_exec(req_hd, client_arch); req = (struct stat64_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = stat64_fill_write_pointers(req->path, req->buf); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_stat64_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_stat64_request(input, 0); } void client_test_statfs64(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct statfs64_req *in = fill_statfs64_request(FALSE); struct statfs64_req *local = fill_statfs64_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_statfs64_request(&nbytes, &iov_count, in->path, in->buf); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_statfs64_response(&resp_hd, &iov_count, &nbytes, in->path, in->buf); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ statfs64_fill_write_pointers(local->path, local->buf); assert(compare_string(local->path, in->path)); assert(compare_struct_statfs64(local->buf, in->buf)); free_filled_statfs64_request(in, 0); free_filled_statfs64_request(local, 0); } void server_test_statfs64(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct statfs64_req *input = fill_statfs64_request(FALSE); struct statfs64_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_statfs64_exec(req_hd, client_arch); req = (struct statfs64_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = statfs64_fill_write_pointers(req->path, req->buf); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_statfs64_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_statfs64_request(input, 0); } void client_test_symlink(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct symlink_req *in = fill_symlink_request(FALSE, FALSE); struct symlink_req *local = fill_symlink_request(FALSE, FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_symlink_request(&nbytes, &iov_count, in->oldpath, in->newpath); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_symlink_response(&resp_hd, &iov_count, &nbytes, in->oldpath, in->newpath); assert(resp_iov == NULL); assert(compare_string(local->oldpath, in->oldpath)); assert(compare_string(local->newpath, in->newpath)); free_filled_symlink_request(in, 0); free_filled_symlink_request(local, 0); } void server_test_symlink(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct symlink_req *input = fill_symlink_request(FALSE, FALSE); struct symlink_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_symlink_exec(req_hd, client_arch); req = (struct symlink_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->oldpath, input->oldpath)); assert(compare_string(req->newpath, input->newpath)); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_symlink_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_symlink_request(input, 0); } void client_test_truncate64(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct truncate64_req *in = fill_truncate64_request(FALSE); struct truncate64_req *local = fill_truncate64_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_truncate64_request(&nbytes, &iov_count, in->path, in->length); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_truncate64_response(&resp_hd, &iov_count, &nbytes, in->path, in->length); assert(resp_iov == NULL); assert(compare_string(local->path, in->path)); assert(local->length == in->length); free_filled_truncate64_request(in, 0); free_filled_truncate64_request(local, 0); } void server_test_truncate64(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct truncate64_req *input = fill_truncate64_request(FALSE); struct truncate64_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_truncate64_exec(req_hd, client_arch); req = (struct truncate64_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->path, input->path)); assert(req->length == input->length); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_truncate64_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_truncate64_request(input, 0); } void client_test_umount2(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct umount2_req *in = fill_umount2_request(FALSE); struct umount2_req *local = fill_umount2_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_umount2_request(&nbytes, &iov_count, in->target, in->flags); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_umount2_response(&resp_hd, &iov_count, &nbytes, in->target, in->flags); assert(resp_iov == NULL); assert(compare_string(local->target, in->target)); assert(local->flags == in->flags); free_filled_umount2_request(in, 0); free_filled_umount2_request(local, 0); } void server_test_umount2(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct umount2_req *input = fill_umount2_request(FALSE); struct umount2_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_umount2_exec(req_hd, client_arch); req = (struct umount2_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->target, input->target)); assert(req->flags == input->flags); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_umount2_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_umount2_request(input, 0); } void client_test_uname(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct uname_req *in = fill_uname_request(); struct uname_req *local = fill_uname_request(); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_uname_request(&nbytes, &iov_count, in->buf); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_uname_response(&resp_hd, &iov_count, &nbytes, in->buf); assert(resp_iov != NULL); ret = readv(fd, resp_iov, iov_count); assert(ret == nbytes); free(resp_iov); /* I fill the 'local' request, in this way I can compare this local copy with * the remote one 'in' */ uname_fill_write_pointers(local->buf); assert(compare_struct_utsname(local->buf, in->buf)); free_filled_uname_request(in, 0); free_filled_uname_request(local, 0); } void server_test_uname(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct uname_req *input = fill_uname_request(); struct uname_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_uname_exec(req_hd, client_arch); req = (struct uname_req *) req_hd; /* I test the content of the request */ /* I simulate the execution of the system call, calling * a function that fills the write pointer of the request. */ ret = uname_fill_write_pointers(req->buf); /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_uname_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_uname_request(input, 0); } void client_test_unlink(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct unlink_req *in = fill_unlink_request(FALSE); struct unlink_req *local = fill_unlink_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_unlink_request(&nbytes, &iov_count, in->pathname); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_unlink_response(&resp_hd, &iov_count, &nbytes, in->pathname); assert(resp_iov == NULL); assert(compare_string(local->pathname, in->pathname)); free_filled_unlink_request(in, 0); free_filled_unlink_request(local, 0); } void server_test_unlink(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct unlink_req *input = fill_unlink_request(FALSE); struct unlink_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_unlink_exec(req_hd, client_arch); req = (struct unlink_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->pathname, input->pathname)); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_unlink_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_unlink_request(input, 0); } void client_test_utime(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct utime_req *in = fill_utime_request(FALSE, FALSE); struct utime_req *local = fill_utime_request(FALSE, FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_utime_request(&nbytes, &iov_count, in->filename, in->buf); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_utime_response(&resp_hd, &iov_count, &nbytes, in->filename, in->buf); assert(resp_iov == NULL); assert(compare_string(local->filename, in->filename)); assert(compare_struct_utimbuf(local->buf, in->buf)); free_filled_utime_request(in, 0); free_filled_utime_request(local, 0); } void server_test_utime(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct utime_req *input = fill_utime_request(FALSE, FALSE); struct utime_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_utime_exec(req_hd, client_arch); req = (struct utime_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->filename, input->filename)); assert(compare_struct_utimbuf(req->buf, input->buf)); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_utime_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_utime_request(input, 0); } void client_test_utimes(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct utimes_req *in = fill_utimes_request(FALSE); struct utimes_req *local = fill_utimes_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_utimes_request(&nbytes, &iov_count, in->filename, in->tv); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_utimes_response(&resp_hd, &iov_count, &nbytes, in->filename, in->tv); assert(resp_iov == NULL); assert(compare_string(local->filename, in->filename)); assert(compare_struct_timeval(&local->tv[0], &in->tv[0])); assert(compare_struct_timeval(&local->tv[1], &in->tv[1])); free_filled_utimes_request(in, 0); free_filled_utimes_request(local, 0); } void server_test_utimes(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct utimes_req *input = fill_utimes_request(FALSE); struct utimes_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_utimes_exec(req_hd, client_arch); req = (struct utimes_req *) req_hd; /* I test the content of the request */ assert(compare_string(req->filename, input->filename)); assert(compare_struct_timeval(&req->tv[0], &input->tv[0])); assert(compare_struct_timeval(&req->tv[1], &input->tv[1])); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_utimes_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_utimes_request(input, 0); } void client_test_write(int fd) { struct iovec *iov, *resp_iov; int nbytes, iov_count, ret; struct write_req *in = fill_write_request(FALSE); struct write_req *local = fill_write_request(FALSE); struct sys_resp_header resp_hd; /* I create the request with the data returned by fill_read_request() */ iov = rscc_create_write_request(&nbytes, &iov_count, in->fd, in->buf, in->count); ret = writev(fd, iov, iov_count); assert(ret == nbytes); free(iov[0].iov_base); free(iov); ret = read(fd, &resp_hd, sizeof(struct sys_resp_header)); assert(ret == sizeof(struct sys_resp_header)); /* Now I call the manage response function */ resp_iov = rscc_manage_write_response(&resp_hd, &iov_count, &nbytes, in->fd, in->buf, in->count); assert(resp_iov == NULL); assert(local->fd == in->fd); assert(compare_mem(local->buf, in->buf, in->count)); assert(local->count == in->count); free_filled_write_request(in, 0); free_filled_write_request(local, 0); } void server_test_write(int fd, enum arch server_arch, enum arch client_arch) { int ret, req_size; struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; struct write_req *input = fill_write_request(FALSE); struct write_req * req; req_hd = calloc(1, sizeof(struct sys_req_header)); assert(req_hd != NULL); ret = read(fd, req_hd, sizeof(struct sys_req_header)); assert(ret == sizeof(struct sys_req_header)); req_size = rsc_req_msg_size(req_hd); req_hd = realloc(req_hd, req_size); assert(req_hd != NULL); ret = read(fd, (void *)req_hd + sizeof(struct sys_req_header), req_size - sizeof(struct sys_req_header)); assert(ret == req_size - sizeof(struct sys_req_header)); req_hd->req_size = ntohl(req_hd->req_size); req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); resp_hd = rscs_pre_write_exec(req_hd, client_arch); req = (struct write_req *) req_hd; /* I test the content of the request */ assert(req->fd == input->fd); assert(compare_mem(req->buf, input->buf, input->count)); assert(req->count == input->count); /* The syscall doesn't have write pointers, so I do nothing */ /* I call the post-execution function and then I send back the * response. */ resp_hd = rscs_post_write_exec(req, resp_hd, ret, errno, client_arch); resp_hd->resp_rsc_const = htons(resp_hd->resp_rsc_const); resp_hd->resp_size = htonl(resp_hd->resp_size); resp_hd->resp_retval = htonl(resp_hd->resp_retval); resp_hd->resp_errno = htonl(resp_hd->resp_errno); ret = write(fd, resp_hd, ntohl(resp_hd->resp_size)); assert(ret == ntohl(resp_hd->resp_size)); free(req); free(resp_hd); free_filled_write_request(input, 0); } /*******************************************************************/ /* Public test functions */ /*******************************************************************/ void test_syscall_exec_client(int fd, enum arch myarch, enum arch sarch) { if(sarch != ACONV_X86_64) client_test__llseek(fd); client_test_accept(fd); client_test_access(fd); client_test_adjtimex(fd); client_test_bind(fd); client_test_chdir(fd); client_test_chmod(fd); client_test_chown(fd); if(sarch != ACONV_PPC && sarch != ACONV_X86_64) client_test_chown32(fd); client_test_clock_getres(fd); client_test_clock_gettime(fd); client_test_clock_settime(fd); client_test_close(fd); client_test_connect(fd); client_test_dup(fd); client_test_dup2(fd); client_test_fchdir(fd); client_test_fchmod(fd); client_test_fchown(fd); if(sarch != ACONV_PPC && sarch != ACONV_X86_64) client_test_fchown32(fd); client_test_fdatasync(fd); client_test_fgetxattr(fd); client_test_fstat64(fd); client_test_fstatfs64(fd); client_test_fsync(fd); client_test_ftruncate64(fd); client_test_getdents64(fd); client_test_getpeername(fd); client_test_getsockname(fd); client_test_getsockopt(fd); client_test_gettimeofday(fd); client_test_getxattr(fd); client_test_lchown(fd); if(sarch != ACONV_PPC && sarch != ACONV_X86_64) client_test_lchown32(fd); client_test_lgetxattr(fd); client_test_link(fd); client_test_listen(fd); client_test_lseek(fd); client_test_lstat64(fd); client_test_mkdir(fd); client_test_mount(fd); client_test_open(fd); client_test_pread64(fd); client_test_pwrite64(fd); client_test_read(fd); client_test_readlink(fd); if(sarch != ACONV_X86_64) client_test_recv(fd); client_test_recvfrom(fd); client_test_rename(fd); client_test_rmdir(fd); if(sarch != ACONV_X86_64) client_test_send(fd); client_test_sendto(fd); client_test_setdomainname(fd); client_test_sethostname(fd); client_test_setsockopt(fd); client_test_settimeofday(fd); client_test_shutdown(fd); client_test_socket(fd); client_test_stat64(fd); client_test_statfs64(fd); client_test_symlink(fd); client_test_truncate64(fd); client_test_umount2(fd); client_test_uname(fd); client_test_unlink(fd); client_test_utime(fd); client_test_utimes(fd); client_test_write(fd); } void test_syscall_exec_server(int fd, enum arch carch, enum arch myarch) { server_test__llseek(fd, myarch, carch); server_test_accept(fd, myarch, carch); server_test_access(fd, myarch, carch); server_test_adjtimex(fd, myarch, carch); server_test_bind(fd, myarch, carch); server_test_chdir(fd, myarch, carch); server_test_chmod(fd, myarch, carch); server_test_chown(fd, myarch, carch); server_test_chown32(fd, myarch, carch); server_test_clock_getres(fd, myarch, carch); server_test_clock_gettime(fd, myarch, carch); server_test_clock_settime(fd, myarch, carch); server_test_close(fd, myarch, carch); server_test_connect(fd, myarch, carch); server_test_dup(fd, myarch, carch); server_test_dup2(fd, myarch, carch); server_test_fchdir(fd, myarch, carch); server_test_fchmod(fd, myarch, carch); server_test_fchown(fd, myarch, carch); server_test_fchown32(fd, myarch, carch); server_test_fdatasync(fd, myarch, carch); server_test_fgetxattr(fd, myarch, carch); server_test_fstat64(fd, myarch, carch); server_test_fstatfs64(fd, myarch, carch); server_test_fsync(fd, myarch, carch); server_test_ftruncate64(fd, myarch, carch); server_test_getdents64(fd, myarch, carch); server_test_getpeername(fd, myarch, carch); server_test_getsockname(fd, myarch, carch); server_test_getsockopt(fd, myarch, carch); server_test_gettimeofday(fd, myarch, carch); server_test_getxattr(fd, myarch, carch); server_test_lchown(fd, myarch, carch); server_test_lchown32(fd, myarch, carch); server_test_lgetxattr(fd, myarch, carch); server_test_link(fd, myarch, carch); server_test_listen(fd, myarch, carch); server_test_lseek(fd, myarch, carch); server_test_lstat64(fd, myarch, carch); server_test_mkdir(fd, myarch, carch); server_test_mount(fd, myarch, carch); server_test_open(fd, myarch, carch); server_test_pread64(fd, myarch, carch); server_test_pwrite64(fd, myarch, carch); server_test_read(fd, myarch, carch); server_test_readlink(fd, myarch, carch); server_test_recv(fd, myarch, carch); server_test_recvfrom(fd, myarch, carch); server_test_rename(fd, myarch, carch); server_test_rmdir(fd, myarch, carch); server_test_send(fd, myarch, carch); server_test_sendto(fd, myarch, carch); server_test_setdomainname(fd, myarch, carch); server_test_sethostname(fd, myarch, carch); server_test_setsockopt(fd, myarch, carch); server_test_settimeofday(fd, myarch, carch); server_test_shutdown(fd, myarch, carch); server_test_socket(fd, myarch, carch); server_test_stat64(fd, myarch, carch); server_test_statfs64(fd, myarch, carch); server_test_symlink(fd, myarch, carch); server_test_truncate64(fd, myarch, carch); server_test_umount2(fd, myarch, carch); server_test_uname(fd, myarch, carch); server_test_unlink(fd, myarch, carch); server_test_utime(fd, myarch, carch); server_test_utimes(fd, myarch, carch); server_test_write(fd, myarch, carch); } umview-0.8.2/um_rsc/librsc/tests/test_type_equality.c0000644000175000017500000004423411753517212022135 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * test_type_equality.c: tests of type equality functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include "type_equality.h" static void test_compare_simple_types(void) { int *av, *bv; int ai, bi; loff_t aloff, bloff; socklen_t aslen, bslen; time_t at, bt; av = bv = NULL; assert(compare_simple_type(av, bv)); ai = bi = 10; assert(compare_simple_type(&ai, &bi)); bi = 11; assert(!compare_simple_type(&ai, &bi)); aloff = bloff = 10; assert(compare_simple_type(&aloff, &bloff)); bloff = 2; assert(!compare_simple_type(&aloff, &bloff)); aslen = bslen = 10; assert(compare_simple_type(&aslen, &bslen)); bslen = 3; assert(!compare_simple_type(&aslen, &bslen)); at = bt = 10; assert(compare_simple_type(&at, &bt)); bt = 4; assert(!compare_simple_type(&at, &bt)); } static void test_compare_mem(void) { int a[5] = {1,2,3,4,5}; int b[5] = {1,2,3,4,5}; int c[5] = {1,2,3,4,10}; assert(compare_mem(a,b,(sizeof(int) * 5))); assert(!compare_mem(a,c,(sizeof(int) * 5))); } static void test_compare_string(void) { char *s1 = "Hello world!"; char *s2 = "Hello world!"; char *s3 = "Hello WORLD!"; char *s4 = "Goodbye world!"; assert(compare_string(s1,s2)); assert(!compare_string(s1,s3)); assert(!compare_string(s1,s4)); } static void test_compare_struct_sockaddr(void) { struct sockaddr_in a, b, c; struct sockaddr_un d; bzero(&a, sizeof(struct sockaddr)); bzero(&b, sizeof(struct sockaddr)); a.sin_family = AF_INET; a.sin_addr.s_addr = htonl(INADDR_ANY); a.sin_port = htons(9000); b.sin_family = AF_INET; b.sin_addr.s_addr = htonl(INADDR_ANY); b.sin_port = htons(9000); assert(compare_struct_sockaddr((struct sockaddr*)&a, (struct sockaddr*)&b)); assert(compare_struct_sockaddr(NULL, NULL)); assert(!compare_struct_sockaddr((struct sockaddr*)&a, NULL)); assert(!compare_struct_sockaddr(NULL, (struct sockaddr*)&b)); bzero(&c, sizeof(struct sockaddr)); c.sin_family = AF_INET; c.sin_addr.s_addr = htonl(INADDR_ANY); c.sin_port = htons(6543); assert(!compare_struct_sockaddr((struct sockaddr*)&a, (struct sockaddr*)&c)); bzero(&d, sizeof(struct sockaddr)); d.sun_family = AF_UNIX; strcpy(d.sun_path, "/tmp/"); assert(!compare_struct_sockaddr((struct sockaddr*)&a, (struct sockaddr*)&d)); c.sin_family = AF_INET; c.sin_addr.s_addr = htonl(INADDR_LOOPBACK); c.sin_port = htons(9000); assert(!compare_struct_sockaddr((struct sockaddr*)&a, (struct sockaddr*)&c)); } static void test_compare_struct_timespec(void) { struct timespec a, b, c; a.tv_sec = b.tv_sec = 10; a.tv_nsec = b.tv_nsec = 20; assert(compare_struct_timespec(&a, &b)); assert(compare_struct_timespec(NULL, NULL)); assert(!compare_struct_timespec(&a, NULL)); assert(!compare_struct_timespec(NULL, &b)); c.tv_sec = 10; c.tv_nsec = 444; assert(!compare_struct_timespec(&a, &c)); c.tv_sec = 33; c.tv_nsec = 20; assert(!compare_struct_timespec(&a, &c)); c.tv_sec = 33; c.tv_nsec = 444; assert(!compare_struct_timespec(&a, &c)); } static void test_compare_struct_timeval(void) { struct timeval a, b, c; a.tv_sec = b.tv_sec = 10; a.tv_usec = b.tv_usec = 20; assert(compare_struct_timeval(&a, &b)); assert(compare_struct_timeval(NULL, NULL)); assert(!compare_struct_timeval(&a, NULL)); assert(!compare_struct_timeval(NULL, &b)); c.tv_sec = 10; c.tv_usec = 44; assert(!compare_struct_timeval(&a, &c)); c.tv_sec = 33; c.tv_usec = 20; assert(!compare_struct_timeval(&a, &c)); c.tv_sec = 33; c.tv_usec = 44; assert(!compare_struct_timeval(&a, &c)); } static void test_compare_struct_timex(void) { struct timex a, b, c; a.modes = b.modes = 0; a.offset = b.offset = 1; a.freq = b.freq = 2; a.maxerror = b.maxerror = 3; a.esterror = b.esterror = 4; a.status = b.status = 5; a.constant = b.constant = 6; a.precision = b.precision = 7; a.tolerance = b.tolerance = 8; a.time.tv_sec = b.time.tv_sec = 50; a.time.tv_usec = b.time.tv_usec = 60; a.tick = b.tick = 10; assert(compare_struct_timex(&a, &b)); assert(compare_struct_timex(NULL, NULL)); assert(!compare_struct_timex(&a, NULL)); assert(!compare_struct_timex(NULL, &b)); c.modes = 100; c.offset = 1; c.freq = 2; c.maxerror = 3; c.esterror = 4; c.status = 5; c.constant = 6; c.precision = 7; c.tolerance = 8; c.time.tv_sec = 50; c.time.tv_usec = 60; c.tick = 10; assert(!compare_struct_timex(&a, &c)); c.modes = 0; c.offset = 100; c.freq = 2; c.maxerror = 3; c.esterror = 4; c.status = 5; c.constant = 6; c.precision = 7; c.tolerance = 8; c.time.tv_sec = 50; c.time.tv_usec = 60; c.tick = 10; assert(!compare_struct_timex(&a, &c)); c.modes = 0; c.offset = 1; c.freq = 200; c.maxerror = 3; c.esterror = 4; c.status = 5; c.constant = 6; c.precision = 7; c.tolerance = 8; c.time.tv_sec = 50; c.time.tv_usec = 60; c.tick = 10; assert(!compare_struct_timex(&a, &c)); c.modes = 0; c.offset = 1; c.freq = 2; c.maxerror = 300; c.esterror = 4; c.status = 5; c.constant = 6; c.precision = 7; c.tolerance = 8; c.time.tv_sec = 50; c.time.tv_usec = 60; c.tick = 10; assert(!compare_struct_timex(&a, &c)); c.modes = 0; c.offset = 1; c.freq = 2; c.maxerror = 3; c.esterror = 400; c.status = 5; c.constant = 6; c.precision = 7; c.tolerance = 8; c.time.tv_sec = 50; c.time.tv_usec = 60; c.tick = 10; assert(!compare_struct_timex(&a, &c)); c.modes = 0; c.offset = 1; c.freq = 2; c.maxerror = 3; c.esterror = 4; c.status = 500; c.constant = 6; c.precision = 7; c.tolerance = 8; c.time.tv_sec = 50; c.time.tv_usec = 60; c.tick = 10; assert(!compare_struct_timex(&a, &c)); c.modes = 0; c.offset = 1; c.freq = 2; c.maxerror = 3; c.esterror = 4; c.status = 5; c.constant = 600; c.precision = 7; c.tolerance = 8; c.time.tv_sec = 50; c.time.tv_usec = 60; c.tick = 10; assert(!compare_struct_timex(&a, &c)); c.modes = 0; c.offset = 1; c.freq = 2; c.maxerror = 3; c.esterror = 4; c.status = 5; c.constant = 6; c.precision = 700; c.tolerance = 8; c.time.tv_sec = 50; c.time.tv_usec = 60; c.tick = 10; assert(!compare_struct_timex(&a, &c)); c.modes = 0; c.offset = 1; c.freq = 2; c.maxerror = 3; c.esterror = 4; c.status = 5; c.constant = 6; c.precision = 7; c.tolerance = 800; c.time.tv_sec = 50; c.time.tv_usec = 60; c.tick = 10; assert(!compare_struct_timex(&a, &c)); c.modes = 0; c.offset = 1; c.freq = 2; c.maxerror = 3; c.esterror = 4; c.status = 5; c.constant = 6; c.precision = 7; c.tolerance = 8; c.time.tv_sec = 999; c.time.tv_usec = 60; c.tick = 10; assert(!compare_struct_timex(&a, &c)); c.modes = 0; c.offset = 1; c.freq = 2; c.maxerror = 3; c.esterror = 4; c.status = 5; c.constant = 6; c.precision = 7; c.tolerance = 8; c.time.tv_sec = 50; c.time.tv_usec = 60; c.tick = 999; assert(!compare_struct_timex(&a, &c)); } static void test_compare_struct_timezone(void) { struct timezone a, b, c; a.tz_minuteswest = b.tz_minuteswest = 2; a.tz_dsttime = b.tz_dsttime = 3; assert(compare_struct_timezone(&a, &b)); assert(compare_struct_timezone(NULL, NULL)); assert(!compare_struct_timezone(&a, NULL)); assert(!compare_struct_timezone(NULL, &b)); c.tz_minuteswest = 2; c.tz_dsttime = 55; assert(!compare_struct_timezone(&a, &c)); c.tz_minuteswest = 11; c.tz_dsttime = 3; assert(!compare_struct_timezone(&a, &c)); c.tz_minuteswest = 11; c.tz_dsttime = 55; assert(!compare_struct_timezone(&a, &c)); } static void test_compare_struct_utimbuf(void) { struct utimbuf a, b, c; a.actime = b.actime = 10; a.modtime = b.modtime = 20; assert(compare_struct_utimbuf(&a, &b)); assert(compare_struct_utimbuf(NULL, NULL)); assert(!compare_struct_utimbuf(&a, NULL)); assert(!compare_struct_utimbuf(NULL, &b)); c.actime = 10; c.modtime = 33; assert(!compare_struct_utimbuf(&a, &c)); c.actime = 44; c.modtime = 20; assert(!compare_struct_utimbuf(&a, &c)); c.actime = 44; c.modtime = 33; assert(!compare_struct_utimbuf(&a, &c)); } static void test_compare_struct_stat64(void) { struct stat64 a, b; a.st_dev = b.st_dev = 1; a.st_ino = b.st_ino = 2; a.st_mode = b.st_mode = 3; a.st_nlink = b.st_nlink = 4; a.st_uid = b.st_uid = 5; a.st_gid = b.st_gid = 6; a.st_rdev = b.st_rdev = 7; a.st_size = b.st_size = 8; a.st_atime = b.st_atime = 9; a.st_mtime = b.st_mtime = 10; a.st_ctime = b.st_ctime = 11; a.st_blksize = b.st_blksize = 12; a.st_blocks = b.st_blocks = 13; assert(compare_struct_stat64(&a, &b)); assert(compare_struct_stat64(NULL, NULL)); assert(!compare_struct_stat64(&a, NULL)); assert(!compare_struct_stat64(NULL, &b)); b.st_dev = 100; b.st_ino = 2; b.st_mode = 3; b.st_nlink = 4; b.st_uid = 5; b.st_gid = 6; b.st_rdev = 7; b.st_size = 8; b.st_atime = 9; b.st_mtime = 10; b.st_ctime = 11; b.st_blksize = 12; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 200; b.st_mode = 3; b.st_nlink = 4; b.st_uid = 5; b.st_gid = 6; b.st_rdev = 7; b.st_size = 8; b.st_atime = 9; b.st_mtime = 10; b.st_ctime = 11; b.st_blksize = 12; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 2; b.st_mode = 300; b.st_nlink = 4; b.st_uid = 5; b.st_gid = 6; b.st_rdev = 7; b.st_size = 8; b.st_atime = 9; b.st_mtime = 10; b.st_ctime = 11; b.st_blksize = 12; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 2; b.st_mode = 3; b.st_nlink = 400; b.st_uid = 5; b.st_gid = 6; b.st_rdev = 7; b.st_size = 8; b.st_atime = 9; b.st_mtime = 10; b.st_ctime = 11; b.st_blksize = 12; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 2; b.st_mode = 3; b.st_nlink = 4; b.st_uid = 500; b.st_gid = 6; b.st_rdev = 7; b.st_size = 8; b.st_atime = 9; b.st_mtime = 10; b.st_ctime = 11; b.st_blksize = 12; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 2; b.st_mode = 3; b.st_nlink = 4; b.st_uid = 5; b.st_gid = 600; b.st_rdev = 7; b.st_size = 8; b.st_atime = 9; b.st_mtime = 10; b.st_ctime = 11; b.st_blksize = 12; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 2; b.st_mode = 3; b.st_nlink = 4; b.st_uid = 5; b.st_gid = 6; b.st_rdev = 700; b.st_size = 8; b.st_atime = 9; b.st_mtime = 10; b.st_ctime = 11; b.st_blksize = 12; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 2; b.st_mode = 3; b.st_nlink = 4; b.st_uid = 5; b.st_gid = 6; b.st_rdev = 7; b.st_size = 800; b.st_atime = 9; b.st_mtime = 10; b.st_ctime = 11; b.st_blksize = 12; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 2; b.st_mode = 3; b.st_nlink = 4; b.st_uid = 5; b.st_gid = 6; b.st_rdev = 7; b.st_size = 8; b.st_atime = 900; b.st_mtime = 10; b.st_ctime = 11; b.st_blksize = 12; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 2; b.st_mode = 3; b.st_nlink = 4; b.st_uid = 5; b.st_gid = 6; b.st_rdev = 7; b.st_size = 8; b.st_atime = 9; b.st_mtime = 1000; b.st_ctime = 11; b.st_blksize = 12; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 2; b.st_mode = 3; b.st_nlink = 4; b.st_uid = 5; b.st_gid = 6; b.st_rdev = 7; b.st_size = 8; b.st_atime = 9; b.st_mtime = 10; b.st_ctime = 1100; b.st_blksize = 12; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 2; b.st_mode = 3; b.st_nlink = 4; b.st_uid = 5; b.st_gid = 6; b.st_rdev = 7; b.st_size = 8; b.st_atime = 9; b.st_mtime = 10; b.st_ctime = 11; b.st_blksize = 1200; b.st_blocks = 13; assert(!compare_struct_stat64(&a, &b)); b.st_dev = 1; b.st_ino = 2; b.st_mode = 3; b.st_nlink = 4; b.st_uid = 5; b.st_gid = 6; b.st_rdev = 7; b.st_size = 8; b.st_atime = 9; b.st_mtime = 10; b.st_ctime = 11; b.st_blksize = 12; b.st_blocks = 1300; assert(!compare_struct_stat64(&a, &b)); } static void test_compare_struct_dirent64(void) { struct dirent64 a, b; a.d_ino = b.d_ino = 1; a.d_off = b.d_off = 2; a.d_reclen = b.d_reclen = 3; a.d_type = b.d_type = 4; a.d_name[0] = b.d_name[0] = '/'; a.d_name[1] = b.d_name[1] = 't'; a.d_name[2] = b.d_name[2] = 'm'; a.d_name[3] = b.d_name[3] = 'p'; a.d_name[4] = b.d_name[4] = '/'; a.d_name[5] = b.d_name[5] = '\0'; assert(compare_struct_dirent64(&a, &b)); assert(compare_struct_dirent64(NULL, NULL)); assert(!compare_struct_dirent64(&a, NULL)); assert(!compare_struct_dirent64(NULL, &b)); b.d_ino = 10; b.d_off = 2; b.d_reclen = 3; b.d_type = 4; b.d_name[0] = '/'; b.d_name[1] = 't'; b.d_name[2] = 'm'; b.d_name[3] = 'p'; b.d_name[4] = '/'; b.d_name[5] = '\0'; assert(!compare_struct_dirent64(&a, &b)); b.d_ino = 1; b.d_off = 20; b.d_reclen = 3; b.d_type = 4; b.d_name[0] = '/'; b.d_name[1] = 't'; b.d_name[2] = 'm'; b.d_name[3] = 'p'; b.d_name[4] = '/'; b.d_name[5] = '\0'; assert(!compare_struct_dirent64(&a, &b)); b.d_ino = 1; b.d_off = 2; b.d_reclen = 30; b.d_type = 4; b.d_name[0] = '/'; b.d_name[1] = 't'; b.d_name[2] = 'm'; b.d_name[3] = 'p'; b.d_name[4] = '/'; b.d_name[5] = '\0'; assert(!compare_struct_dirent64(&a, &b)); b.d_ino = 1; b.d_off = 2; b.d_reclen = 3; b.d_type = 40; b.d_name[0] = '/'; b.d_name[1] = 't'; b.d_name[2] = 'm'; b.d_name[3] = 'p'; b.d_name[4] = '/'; b.d_name[5] = '\0'; assert(!compare_struct_dirent64(&a, &b)); b.d_ino = 1; b.d_off = 2; b.d_reclen = 3; b.d_type = 4; b.d_name[0] = '/'; b.d_name[1] = 's'; b.d_name[2] = 'r'; b.d_name[3] = 'c'; b.d_name[4] = '/'; b.d_name[5] = '\0'; assert(!compare_struct_dirent64(&a, &b)); } static void test_compare_struct_utsname(void) { struct utsname a, b; strcpy(a.sysname, "sysname"); strcpy(a.nodename, "nodename"); strcpy(a.release, "release"); strcpy(a.version, "1"); strcpy(a.machine, "x86"); strcpy(b.sysname, "sysname"); strcpy(b.nodename, "nodename"); strcpy(b.release, "release"); strcpy(b.version, "1"); strcpy(b.machine, "x86"); assert(compare_struct_utsname(&a, &b)); assert(compare_struct_utsname(NULL, NULL)); assert(!compare_struct_utsname(&a, NULL)); assert(!compare_struct_utsname(NULL, &b)); { struct utsname c; strcpy(c.sysname, "different"); strcpy(c.nodename, "nodename"); strcpy(c.release, "release"); strcpy(c.version, "1"); strcpy(c.machine, "x86"); assert(!compare_struct_utsname(&a, &c)); } { struct utsname c; strcpy(c.sysname, "sysname"); strcpy(c.nodename, "different"); strcpy(c.release, "release"); strcpy(c.version, "1"); strcpy(c.machine, "x86"); assert(!compare_struct_utsname(&a, &c)); } { struct utsname c; strcpy(c.sysname, "sysname"); strcpy(c.nodename, "nodename"); strcpy(c.release, "different"); strcpy(c.version, "1"); strcpy(c.machine, "x86"); assert(!compare_struct_utsname(&a, &c)); } { struct utsname c; strcpy(c.sysname, "sysname"); strcpy(c.nodename, "nodename"); strcpy(c.release, "release"); strcpy(c.version, "100"); strcpy(c.machine, "x86"); assert(!compare_struct_utsname(&a, &c)); } { struct utsname c; strcpy(c.sysname, "sysname"); strcpy(c.nodename, "nodename"); strcpy(c.release, "release"); strcpy(c.version, "1"); strcpy(c.machine, "x86_64"); assert(!compare_struct_utsname(&a, &c)); } } static void test_compare_struct_flock(void) { struct flock f1, f2; f1.l_type = f2.l_type = 1; f1.l_whence = f2.l_whence = 2; f1.l_start = f2.l_start = 3; f1.l_len = f2.l_len = 4; f1.l_pid = f2.l_pid = 5; assert(compare_struct_flock(NULL, NULL)); assert(compare_struct_flock(&f1, &f2)); assert(!compare_struct_flock(&f1, NULL)); assert(!compare_struct_flock(NULL, &f2)); f2.l_type = 111; f2.l_whence = 2; f2.l_start = 3; f2.l_len = 4; f2.l_pid = 5; assert(!compare_struct_flock(&f1, &f2)); f2.l_type = 1; f2.l_whence = 222; f2.l_start = 3; f2.l_len = 4; f2.l_pid = 5; assert(!compare_struct_flock(&f1, &f2)); f2.l_type = 1; f2.l_whence = 2; f2.l_start = 333; f2.l_len = 4; f2.l_pid = 5; assert(!compare_struct_flock(&f1, &f2)); f2.l_type = 1; f2.l_whence = 2; f2.l_start = 3; f2.l_len = 444; f2.l_pid = 5; assert(!compare_struct_flock(&f1, &f2)); f2.l_type = 1; f2.l_whence = 2; f2.l_start = 3; f2.l_len = 4; f2.l_pid = 555; assert(!compare_struct_flock(&f1, &f2)); } /****************************************************************/ /* AUXILIARY FUNCTIONS */ /****************************************************************/ void test_type_equality(void) { test_compare_simple_types(); test_compare_mem(); test_compare_string(); test_compare_struct_sockaddr(); test_compare_struct_timespec(); test_compare_struct_timeval(); test_compare_struct_timex(); test_compare_struct_timezone(); test_compare_struct_utimbuf(); test_compare_struct_stat64(); test_compare_struct_dirent64(); test_compare_struct_utsname(); test_compare_struct_flock(); } umview-0.8.2/um_rsc/librsc/include/0000755000175000017500000000000011753517351016312 5ustar renzorenzoumview-0.8.2/um_rsc/librsc/include/rsc_server.h0000644000175000017500000000337311753517212020642 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * rsc_server.h: server side functions header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_SERVER_REQ_RESP_H__ #define __RSC_SERVER_REQ_RESP_H__ #ifndef __USE_LARGEFILE64 #define __USE_LARGEFILE64 #endif #include "aconv.h" #include "rsc_messages.h" #include "rsc_consts.h" #define CONN_OK 0 #define CONN_ERROR -1 #define CONN_CLOSED -2 #define CONN_HANDLER_NOT_FOUND -3 #define CONN_BAD_REQ_TYPE -4 int rscs_init(enum arch server_arch); void rsc_server_teardown(); struct iovec*rscs_manage_request(int client_arch, void *request); /* Ioctl request registration */ void rscs_ioctl_register_request(int request, u_int32_t rw, u_int32_t size); /*************************************************/ /* EVENT SUBSCRIPTION */ /*************************************************/ struct rsc_es_ack *rscs_es_manage_msg(int esfd, void *data); struct rsc_es_resp *rscs_es_event_occured(int esfd, int mfd, int event); #endif /* __RSC_SERVER_REQ_RESP_H__ */ umview-0.8.2/um_rsc/librsc/include/rsc_messages.h0000644000175000017500000004103011753517212021133 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * rsc_messages.h: messages structure header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_MESSAGE_H__ #define __RSC_MESSAGE_H__ #include #include #include #include #include #include /*########################################################################*/ /*## ##*/ /*## REQUESTS/RESPONSE HEADERS ##*/ /*## ##*/ /*########################################################################*/ /* Define the common headers used by all request and response messages */ /* The following constant are the values admitted for 'req_type' and * 'resp_type' fields and they are used to multiplex the contents of * the message. */ #define RSC_SYS_REQ 1 #define RSC_IOCTL_REQ 2 #define RSC_SYS_RESP 3 #define RSC_IOCTL_RESP 4 #define NO_SYS_CONST 0 /**************************************************************************/ /*** REQUEST ***/ /**************************************************************************/ /* Used to get the size of a request message */ #define rsc_req_msg_size(req_hdr) (ntohl((req_hdr)->req_size)) /* The request fields shared by all kind of requests */ #define REQ_HEADER u_int32_t req_size; int8_t req_type; /* The request header structure. It contains only the fields defined by * REQ_HEADER constant. */ struct req_header { REQ_HEADER } __attribute__((packed)); /**************************************************************************/ /*** RESPONSE ***/ /**************************************************************************/ /* Used to get the size of a response message */ #define rsc_resp_msg_size(resp_hdr) (ntohl((resp_hdr)->resp_size)) /* The response fields shared by all kind of requests */ #define RESP_HEADER u_int32_t resp_size; int8_t resp_type; /* The response header structure. It contains only the fields defined by * RESP_HEADER constant. */ struct resp_header { RESP_HEADER; } __attribute__((packed)); /*########################################################################*/ /*## ##*/ /*## IOCTL REQUEST MANAGEMENT ##*/ /*## ##*/ /*########################################################################*/ /**************************************************************************/ /*** REQUEST ***/ /**************************************************************************/ /* The ioctl request is used by the client to ask the client if * 'req_ioctl_request' is managed. */ struct ioctl_req_header { REQ_HEADER int32_t req_ioctl_request; } __attribute__((packed)); /**************************************************************************/ /*** RESPONSE ***/ /**************************************************************************/ /* This message is sent by the server in response to a 'ioctl_req_header'. * It contains a single fields ('resp_size_type'), which is a bitmask of * two values. * The 4 most significant bits inform if the argument is a read, * write or read/write argument, the other bits tell the length of that * argument. */ #define IOCTL_R 0x10000000 #define IOCTL_W 0x20000000 #define IOCTL_RW (IOCTL_R | IOCTL_W) #define IOCTL_LENMASK 0x0fffffff #define IOCTL_UNMANAGED 0x40000000 struct ioctl_resp_header { RESP_HEADER u_int32_t resp_size_type; } __attribute__((packed)); /*########################################################################*/ /*## ##*/ /*## SYSCALL EXECUTION REQUEST/RESPONSE ##*/ /*## ##*/ /*########################################################################*/ /**************************************************************************/ /*** REQUEST ***/ /**************************************************************************/ /* Define a syscall execution request message for each system call. * Each message has a common field called 'req_rsc_const' that contains * the __RSC_* constant to identify the system call. */ #define SYS_REQ_HEADER REQ_HEADER u_int16_t req_rsc_const; /* This is a structure representing the common header of all the requests. */ struct sys_req_header { SYS_REQ_HEADER } __attribute__((packed)); /* Now there is the list of all syscall messages */ struct ioctl_req { SYS_REQ_HEADER int d; int request; void *arg; } __attribute__((packed)); /* The fcntl syscall can have 2 or 3 arguments and the third argument can have two different types, * base on the value of the second argument ('cmd'). The fcntl request use the filed 'cmd_type' * to comunicate if the third argument is present and which is its type. */ #define FCNTL_NO_3RD_ARG 0x01 #define FCNTL_3RD_LONG 0x02 #define FCNTL_3RD_FLOCK 0x04 #define FCNTL_3RD_FLOCK_R (0x10 | FCNTL_3RD_FLOCK) /* 0x14 0001 0100 */ #define FCNTL_3RD_FLOCK_W (0x20 | FCNTL_3RD_FLOCK) /* 0x24 0010 0100 */ #define FCNTL_3RD_FLOCK_RW (FCNTL_3RD_FLOCK_R | FCNTL_3RD_FLOCK_W) /* 0x34 0011 0100 */ struct fcntl_req { SYS_REQ_HEADER int8_t cmd_type; int fd; int cmd; union { long arg; struct flock *lock; } third; } __attribute__((packed)); struct _llseek_req { SYS_REQ_HEADER unsigned int fd; unsigned long int offset_high; unsigned long int offset_low; loff_t *result; unsigned int whence; } __attribute__((packed)); struct accept_req { SYS_REQ_HEADER int sockfd; struct sockaddr *addr; socklen_t *addrlen; } __attribute__((packed)); struct access_req { SYS_REQ_HEADER char *pathname; int mode; } __attribute__((packed)); struct adjtimex_req { SYS_REQ_HEADER struct timex *buf; } __attribute__((packed)); struct bind_req { SYS_REQ_HEADER int sockfd; struct sockaddr *my_addr; socklen_t addrlen; } __attribute__((packed)); struct chdir_req { SYS_REQ_HEADER char *path; } __attribute__((packed)); struct chmod_req { SYS_REQ_HEADER char *path; mode_t mode; } __attribute__((packed)); struct chown_req { SYS_REQ_HEADER char *path; uid_t owner; gid_t group; } __attribute__((packed)); struct chown32_req { SYS_REQ_HEADER char *path; uid_t owner; gid_t group; } __attribute__((packed)); struct clock_getres_req { SYS_REQ_HEADER clockid_t clk_id; struct timespec *res; } __attribute__((packed)); struct clock_gettime_req { SYS_REQ_HEADER clockid_t clk_id; struct timespec *tp; } __attribute__((packed)); struct clock_settime_req { SYS_REQ_HEADER clockid_t clk_id; struct timespec *tp; } __attribute__((packed)); struct close_req { SYS_REQ_HEADER int fd; } __attribute__((packed)); struct connect_req { SYS_REQ_HEADER int sockfd; struct sockaddr *serv_addr; socklen_t addrlen; } __attribute__((packed)); struct dup_req { SYS_REQ_HEADER int oldfd; } __attribute__((packed)); struct dup2_req { SYS_REQ_HEADER int oldfd; int newfd; } __attribute__((packed)); struct fchdir_req { SYS_REQ_HEADER int fd; } __attribute__((packed)); struct fchmod_req { SYS_REQ_HEADER int fildes; mode_t mode; } __attribute__((packed)); struct fchown_req { SYS_REQ_HEADER int fd; uid_t owner; gid_t group; } __attribute__((packed)); struct fchown32_req { SYS_REQ_HEADER int fd; uid_t owner; gid_t group; } __attribute__((packed)); struct fdatasync_req { SYS_REQ_HEADER int fd; } __attribute__((packed)); struct fgetxattr_req { SYS_REQ_HEADER int filedes; char *name; void *value; size_t size; } __attribute__((packed)); struct fstat64_req { SYS_REQ_HEADER int filedes; struct stat64 *buf; } __attribute__((packed)); struct fstatfs64_req { SYS_REQ_HEADER unsigned int fd; struct statfs64 *buf; } __attribute__((packed)); struct fsync_req { SYS_REQ_HEADER int fd; } __attribute__((packed)); struct ftruncate64_req { SYS_REQ_HEADER int fd; __off64_t length; } __attribute__((packed)); struct getdents64_req { SYS_REQ_HEADER unsigned int fd; struct dirent64 *dirp; unsigned int count; } __attribute__((packed)); struct getpeername_req { SYS_REQ_HEADER int s; struct sockaddr *name; socklen_t *namelen; } __attribute__((packed)); struct getsockname_req { SYS_REQ_HEADER int s; struct sockaddr *name; socklen_t *namelen; } __attribute__((packed)); struct getsockopt_req { SYS_REQ_HEADER int s; int level; int optname; void *optval; socklen_t *optlen; } __attribute__((packed)); struct gettimeofday_req { SYS_REQ_HEADER struct timeval *tv; struct timezone *tz; } __attribute__((packed)); struct getxattr_req { SYS_REQ_HEADER char *path; char *name; void *value; size_t size; } __attribute__((packed)); struct lchown_req { SYS_REQ_HEADER char *path; uid_t owner; gid_t group; } __attribute__((packed)); struct lchown32_req { SYS_REQ_HEADER char *path; uid_t owner; gid_t group; } __attribute__((packed)); struct lgetxattr_req { SYS_REQ_HEADER char *path; char *name; void *value; size_t size; } __attribute__((packed)); struct link_req { SYS_REQ_HEADER char *oldpath; char *newpath; } __attribute__((packed)); struct listen_req { SYS_REQ_HEADER int sockfd; int backlog; } __attribute__((packed)); struct lseek_req { SYS_REQ_HEADER int fildes; off_t offset; int whence; } __attribute__((packed)); struct lstat64_req { SYS_REQ_HEADER char *path; struct stat64 *buf; } __attribute__((packed)); struct mkdir_req { SYS_REQ_HEADER char *pathname; mode_t mode; } __attribute__((packed)); struct mount_req { SYS_REQ_HEADER char *source; char *target; char *filesystemtype; unsigned long int mountflags; void *data; } __attribute__((packed)); struct open_req { SYS_REQ_HEADER char *pathname; int flags; } __attribute__((packed)); struct pread64_req { SYS_REQ_HEADER int fd; void *buf; size_t count; off_t offset; } __attribute__((packed)); struct pwrite64_req { SYS_REQ_HEADER int fd; void *buf; size_t count; off_t offset; } __attribute__((packed)); struct read_req { SYS_REQ_HEADER int fd; void *buf; size_t count; } __attribute__((packed)); struct readlink_req { SYS_REQ_HEADER char *path; char *buf; size_t bufsiz; } __attribute__((packed)); struct recv_req { SYS_REQ_HEADER int s; void *buf; size_t len; int flags; } __attribute__((packed)); struct recvfrom_req { SYS_REQ_HEADER int s; void *buf; size_t len; int flags; struct sockaddr *from; socklen_t *fromlen; } __attribute__((packed)); struct rename_req { SYS_REQ_HEADER char *oldpath; char *newpath; } __attribute__((packed)); struct rmdir_req { SYS_REQ_HEADER char *pathname; } __attribute__((packed)); struct send_req { SYS_REQ_HEADER int s; void *buf; size_t len; int flags; } __attribute__((packed)); struct sendto_req { SYS_REQ_HEADER int s; void *buf; size_t len; int flags; struct sockaddr *to; socklen_t tolen; } __attribute__((packed)); struct setdomainname_req { SYS_REQ_HEADER char *name; size_t len; } __attribute__((packed)); struct sethostname_req { SYS_REQ_HEADER char *name; size_t len; } __attribute__((packed)); struct setsockopt_req { SYS_REQ_HEADER int s; int level; int optname; void *optval; socklen_t optlen; } __attribute__((packed)); struct settimeofday_req { SYS_REQ_HEADER struct timeval *tv; struct timezone *tz; } __attribute__((packed)); struct shutdown_req { SYS_REQ_HEADER int s; int how; } __attribute__((packed)); struct socket_req { SYS_REQ_HEADER int domain; int type; int protocol; } __attribute__((packed)); struct stat64_req { SYS_REQ_HEADER char *path; struct stat64 *buf; } __attribute__((packed)); struct statfs64_req { SYS_REQ_HEADER char *path; struct statfs64 *buf; } __attribute__((packed)); struct symlink_req { SYS_REQ_HEADER char *oldpath; char *newpath; } __attribute__((packed)); struct truncate64_req { SYS_REQ_HEADER char *path; __off64_t length; } __attribute__((packed)); struct umount2_req { SYS_REQ_HEADER char *target; int flags; } __attribute__((packed)); struct uname_req { SYS_REQ_HEADER struct utsname *buf; } __attribute__((packed)); struct unlink_req { SYS_REQ_HEADER char *pathname; } __attribute__((packed)); struct utime_req { SYS_REQ_HEADER char *filename; struct utimbuf *buf; } __attribute__((packed)); struct utimes_req { SYS_REQ_HEADER char *filename; struct timeval tv[2]; } __attribute__((packed)); struct write_req { SYS_REQ_HEADER int fd; void *buf; size_t count; } __attribute__((packed)); /**************************************************************************/ /*** REQUEST ***/ /**************************************************************************/ /* There is a unique syscall execution response for all the syscalls. * The informations are: * - 'resp_rsc_const': the __RSC_* constant identifying the syscall. * - 'resp_retval': the value returned by the syscall * - 'resp_errno': the errno value after the execution of the syscall. */ #define SYS_RESP_HEADER RESP_HEADER u_int16_t resp_rsc_const; int32_t resp_retval; int32_t resp_errno; struct sys_resp_header { RESP_HEADER u_int16_t resp_rsc_const; int32_t resp_retval; int32_t resp_errno; } __attribute__((packed)); /*########################################################################*/ /*## ##*/ /*## EVENT SUBSCRIPTION ##*/ /*## ##*/ /*########################################################################*/ /* The following request are use by the event subscription module, they * differ from the other message because they don't share the same * REQ_HEADER/RESP_HEADER fields */ /* Returns the size of the event subscription message based on the * "event_sub_type" given in input. */ int rsc_es_msg_size(u_int8_t type); /* The following constant are used to demultiplex the content of this * kind of messages */ enum event_sub_type { EVENT_SUB_REQ = 1, EVENT_SUB_ACK, EVENT_SUB_RESP, EVENT_SUB_DEREG }; /* These constants are used by the ACK messages */ enum event_sub_ack { ACK_NOT_INIT = -1, ACK_FD_READY = 1, /* The fd is ready */ ACK_FD_REG, /* The fd was not ready, so is monitored by the server */ ACK_FD_DEREG_READY, /* The fd was ready and it has been deregistered */ ACK_FD_DEREG_NOT_READY /* The fd wasn't ready and has been deregistered */ }; /* The request header consists of one field, the 'event_sub_type' constant */ #define RSC_ES_COMMON_FIELDS u_int8_t type; struct rsc_es_hdr { RSC_ES_COMMON_FIELDS } __attribute__((packed)); /* Used by the client to register a new event at server-side */ struct rsc_es_req { RSC_ES_COMMON_FIELDS int fd; int how; }__attribute__((packed)); /* Used by the server to ACK a 'rsc_es_req' message. */ struct rsc_es_ack { RSC_ES_COMMON_FIELDS u_int8_t response; int fd; int how; }__attribute__((packed)); /* Used by the server to inform that the event 'how', registered for * fd 'fd', was occurred. */ struct rsc_es_resp { RSC_ES_COMMON_FIELDS int fd; int how; }__attribute__((packed)); /* Used by the client to ask the server to deregister the event 'how' * for fd 'fd'. */ struct rsc_es_dereg { RSC_ES_COMMON_FIELDS int fd; int how; }__attribute__((packed)); #endif /* __RSC_MESSAGE_H__ */ umview-0.8.2/um_rsc/librsc/include/rsc_consts.h0000644000175000017500000002104111753517212020635 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * rsc_consts.h: __RSC_* constants definition and management functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_CONSTS_HEADER__ #define __RSC_CONSTS_HEADER__ #include #include "aconv.h" /* A struct nr_and_sys that doesn't contain a .sys value has the .sys * field equal to "NO_VALUE". * A empty struct nr_and_sys has the .nr field equal to "NO_VALUE", * the .sys field could have any value. */ #define NO_VALUE (-1) struct nr_and_sys { int32_t nr; int32_t sys; }; /*########################################################################*/ /*## __RSC_* CONSTANTS ##*/ /*########################################################################*/ enum rsc_constant { __RSC_ERROR = -1, /* Used when there isn't a valid __RSC_ constant */ __RSC_FIRST = 0, __RSC__exit = __RSC_FIRST, __RSC__llseek, __RSC__newselect, __RSC__sysctl, __RSC_accept, __RSC_access, __RSC_acct, __RSC_add_key, __RSC_adjtimex, __RSC_afs_syscall, __RSC_alarm, __RSC_arch_prctl, __RSC_bdflush, __RSC_bind, __RSC_break, __RSC_brk, __RSC_capget, __RSC_capset, __RSC_chdir, __RSC_chmod, __RSC_chown, __RSC_chown32, __RSC_chroot, __RSC_clock_getres, __RSC_clock_gettime, __RSC_clock_nanosleep, __RSC_clock_settime, __RSC_clone, __RSC_close, __RSC_connect, __RSC_creat, __RSC_create_module, __RSC_delete_module, __RSC_dup, __RSC_dup2, __RSC_epoll_create, __RSC_epoll_ctl, __RSC_epoll_ctl_old, __RSC_epoll_wait, __RSC_epoll_wait_old, __RSC_execve, __RSC_exit, __RSC_exit_group, __RSC_fadvise64, __RSC_fadvise64_64, __RSC_fchdir, __RSC_fchmod, __RSC_fchown, __RSC_fchown32, __RSC_fcntl, __RSC_fcntl64, __RSC_fdatasync, __RSC_fgetxattr, __RSC_flistxattr, __RSC_flock, __RSC_fork, __RSC_fremovexattr, __RSC_fsetxattr, __RSC_fstat, __RSC_fstat64, __RSC_fstatfs, __RSC_fstatfs64, __RSC_fsync, __RSC_ftime, __RSC_ftruncate, __RSC_ftruncate64, __RSC_futex, __RSC_get_kernel_syms, __RSC_get_mempolicy, __RSC_get_thread_area, __RSC_getcwd, __RSC_getdents, __RSC_getdents64, __RSC_getegid, __RSC_getegid32, __RSC_geteuid, __RSC_geteuid32, __RSC_getgid, __RSC_getgid32, __RSC_getgroups, __RSC_getgroups32, __RSC_getitimer, __RSC_getpeername, __RSC_getpgid, __RSC_getpgrp, __RSC_getpid, __RSC_getpmsg, __RSC_getppid, __RSC_getpriority, __RSC_getresgid, __RSC_getresgid32, __RSC_getresuid, __RSC_getresuid32, __RSC_getrlimit, __RSC_getrusage, __RSC_getsid, __RSC_getsockname, __RSC_getsockopt, __RSC_gettid, __RSC_gettimeofday, __RSC_getuid, __RSC_getuid32, __RSC_getxattr, __RSC_gtty, __RSC_idle, __RSC_init_module, __RSC_io_cancel, __RSC_io_destroy, __RSC_io_getevents, __RSC_io_setup, __RSC_io_submit, __RSC_ioctl, __RSC_ioperm, __RSC_iopl, __RSC_ipc, __RSC_kexec_load, __RSC_keyctl, __RSC_kill, __RSC_lchown, __RSC_lchown32, __RSC_lgetxattr, __RSC_link, __RSC_listen, __RSC_listxattr, __RSC_llistxattr, __RSC_lock, __RSC_lookup_dcookie, __RSC_lremovexattr, __RSC_lseek, __RSC_lsetxattr, __RSC_lstat, __RSC_lstat64, __RSC_madvise, __RSC_madvise1, __RSC_mbind, __RSC_mincore, __RSC_mkdir, __RSC_mknod, __RSC_mlock, __RSC_mlockall, __RSC_mmap, __RSC_mmap2, __RSC_modify_ldt, __RSC_mount, __RSC_mprotect, __RSC_mpx, __RSC_mq_getsetattr, __RSC_mq_notify, __RSC_mq_open, __RSC_mq_timedreceive, __RSC_mq_timedsend, __RSC_mq_unlink, __RSC_mremap, __RSC_msgctl, __RSC_msgget, __RSC_msgrcv, __RSC_msgsnd, __RSC_msync, __RSC_multiplexer, __RSC_munlock, __RSC_munlockall, __RSC_munmap, __RSC_nanosleep, __RSC_nfsservctl, __RSC_nice, __RSC_oldfstat, __RSC_oldlstat, __RSC_oldolduname, __RSC_oldstat, __RSC_olduname, __RSC_open, __RSC_pause, __RSC_pciconfig_iobase, __RSC_pciconfig_read, __RSC_pciconfig_write, __RSC_personality, __RSC_pipe, __RSC_pivot_root, __RSC_poll, __RSC_prctl, __RSC_pread64, __RSC_prof, __RSC_profil, __RSC_ptrace, __RSC_putpmsg, __RSC_pwrite64, __RSC_query_module, __RSC_quotactl, __RSC_read, __RSC_readahead, __RSC_readdir, __RSC_readlink, __RSC_readv, __RSC_reboot, __RSC_recv, __RSC_recvfrom, __RSC_recvmsg, __RSC_remap_file_pages, __RSC_removexattr, __RSC_rename, __RSC_request_key, __RSC_restart_syscall, __RSC_rmdir, __RSC_rt_sigaction, __RSC_rt_sigpending, __RSC_rt_sigprocmask, __RSC_rt_sigqueueinfo, __RSC_rt_sigreturn, __RSC_rt_sigsuspend, __RSC_rt_sigtimedwait, __RSC_sched_get_priority_max, __RSC_sched_get_priority_min, __RSC_sched_getaffinity, __RSC_sched_getparam, __RSC_sched_getscheduler, __RSC_sched_rr_get_interval, __RSC_sched_setaffinity, __RSC_sched_setparam, __RSC_sched_setscheduler, __RSC_sched_yield, __RSC_security, __RSC_select, __RSC_semctl, __RSC_semget, __RSC_semop, __RSC_semtimedop, __RSC_send, __RSC_sendfile, __RSC_sendfile64, __RSC_sendmsg, __RSC_sendto, __RSC_set_mempolicy, __RSC_set_thread_area, __RSC_set_tid_address, __RSC_setdomainname, __RSC_setfsgid, __RSC_setfsgid32, __RSC_setfsuid, __RSC_setfsuid32, __RSC_setgid, __RSC_setgid32, __RSC_setgroups, __RSC_setgroups32, __RSC_sethostname, __RSC_setitimer, __RSC_setpgid, __RSC_setpriority, __RSC_setregid, __RSC_setregid32, __RSC_setresgid, __RSC_setresgid32, __RSC_setresuid, __RSC_setresuid32, __RSC_setreuid, __RSC_setreuid32, __RSC_setrlimit, __RSC_setsid, __RSC_setsockopt, __RSC_settimeofday, __RSC_setuid, __RSC_setuid32, __RSC_setxattr, __RSC_sgetmask, __RSC_shmat, __RSC_shmctl, __RSC_shmdt, __RSC_shmget, __RSC_shutdown, __RSC_sigaction, __RSC_sigaltstack, __RSC_signal, __RSC_sigpending, __RSC_sigprocmask, __RSC_sigreturn, __RSC_sigsuspend, __RSC_socket, __RSC_socketcall, __RSC_socketpair, __RSC_ssetmask, __RSC_stat, __RSC_stat64, __RSC_statfs, __RSC_statfs64, __RSC_stime, __RSC_stty, __RSC_swapcontext, __RSC_swapoff, __RSC_swapon, __RSC_symlink, __RSC_sync, __RSC_sys_kexec_load, __RSC_sysfs, __RSC_sysinfo, __RSC_syslog, __RSC_tgkill, __RSC_time, __RSC_timer_create, __RSC_timer_delete, __RSC_timer_getoverrun, __RSC_timer_gettime, __RSC_timer_settime, __RSC_times, __RSC_tkill, __RSC_truncate, __RSC_truncate64, __RSC_tuxcall, __RSC_ugetrlimit, __RSC_ulimit, __RSC_umask, __RSC_umount, __RSC_umount2, __RSC_uname, __RSC_unlink, __RSC_uselib, __RSC_ustat, __RSC_utime, __RSC_utimes, __RSC_vfork, __RSC_vhangup, __RSC_vm86, __RSC_vm86old, __RSC_vserver, __RSC_wait4, __RSC_waitid, __RSC_waitpid, __RSC_write, __RSC_writev, __RSC_LAST = __RSC_writev }; /* From __RSC_* to __NR_* constants and vice versa */ struct nr_and_sys *rsc2nr(enum rsc_constant rsc_const, enum arch arch); enum rsc_constant nr2rsc(int32_t nr_const, int32_t sys, enum arch arch); /*########################################################################*/ /*## CONSTANTS to STRINGS ##*/ /*########################################################################*/ /* Strings returned when is required a string for a __RSC_* or __NR_* * constant that doesn't exist. */ extern char *rsc_not_existing; extern char *nr_not_existing; extern char *rsc_to_str[]; /* The following tables are used to convert to string a __NR_* or * __RSC_* constant. */ #define X86_TO_STR_SIZE 289 extern char * x86_to_str[]; #define X86_64_TO_STR_SIZE 251 extern char * x86_64_to_str[]; #define PPC_TO_STR_SIZE 255 extern char * ppc_to_str[]; /* SYS_ values are equal in each architecture, so a single table is * sufficient. */ #define SYS_TO_STR_SIZE 18 extern char *sys_to_str[]; #endif /* __RSC_CONSTANT_HEADER__ */ umview-0.8.2/um_rsc/librsc/include/rsc_client.h0000644000175000017500000006151511753517212020614 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * rsc_client.h: client side functions header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_CLIENT_HEADER__ #define __RSC_CLIENT_HEADER__ #ifndef __USE_LARGEFILE64 #define __USE_LARGEFILE64 #endif #include "aconv.h" #include "rsc_messages.h" #include "rsc_consts.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*************************************************/ /* CALLBACK REGISTRATION STRUCTURES */ /*************************************************/ struct reg_cbs { struct reg_cb *v; int size; int nentry; }; struct reg_cb { int fd; int how; void (* cb)(); void *arg; /* Added to patch the event subscribe loop problem */ int ack; /* Is the value of the ACK received. It's initialized to -1 */ int cb_executed; /* True if the callback has been already executed, false otherwise */ }; /*************************************************/ /* INIT FUNCTION */ /*************************************************/ int rscc_init(int client_fd, int event_sub_fd, struct reg_cbs **rc, enum arch c_arch, enum arch s_arch); /*************************************************/ /* EVENT SUBSCRIPTION */ /*************************************************/ int rscc_es_send_req(struct reg_cbs *reg_cbs, int server_fd, int event_sub_fd, int how, void (* cb)(), void *arg); /*************************************************/ /* INTERFACE 1: rscc functions */ /*************************************************/ int rscc__llseek(unsigned int fd, unsigned long int offset_high, unsigned long int offset_low, loff_t *result, unsigned int whence); int rscc_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); int rscc_access(char *pathname, int mode); int rscc_adjtimex(struct timex *buf); int rscc_bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); int rscc_chdir(char *path); int rscc_chmod(char *path, mode_t mode); int rscc_chown(char *path, uid_t owner, gid_t group); int rscc_chown32(char *path, uid_t owner, gid_t group); int rscc_clock_getres(clockid_t clk_id, struct timespec *res); int rscc_clock_gettime(clockid_t clk_id, struct timespec *tp); int rscc_clock_settime(clockid_t clk_id, struct timespec *tp); int rscc_close(int fd); int rscc_connect(int sockfd, struct sockaddr *serv_addr, socklen_t addrlen); int rscc_dup(int oldfd); int rscc_dup2(int oldfd, int newfd); int rscc_fchdir(int fd); int rscc_fchmod(int fildes, mode_t mode); int rscc_fchown(int fd, uid_t owner, gid_t group); int rscc_fchown32(int fd, uid_t owner, gid_t group); int rscc_fdatasync(int fd); int rscc_fgetxattr(int filedes, char *name, void *value, size_t size); int rscc_fstat64(int filedes, struct stat64 *buf); int rscc_fstatfs64(unsigned int fd, struct statfs64 *buf); int rscc_fsync(int fd); int rscc_ftruncate64(int fd, __off64_t length); int rscc_getdents64(unsigned int fd, struct dirent64 *dirp, unsigned int count); int rscc_getpeername(int s, struct sockaddr *name, socklen_t *namelen); int rscc_getsockname(int s, struct sockaddr *name, socklen_t *namelen); int rscc_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen); int rscc_gettimeofday(struct timeval *tv, struct timezone *tz); int rscc_getxattr(char *path, char *name, void *value, size_t size); int rscc_lchown(char *path, uid_t owner, gid_t group); int rscc_lchown32(char *path, uid_t owner, gid_t group); int rscc_lgetxattr(char *path, char *name, void *value, size_t size); int rscc_link(char *oldpath, char *newpath); int rscc_listen(int sockfd, int backlog); int rscc_lseek(int fildes, off_t offset, int whence); int rscc_lstat64(char *path, struct stat64 *buf); int rscc_mkdir(char *pathname, mode_t mode); int rscc_mount(char *source, char *target, char *filesystemtype, unsigned long int mountflags, void *data); int rscc_open(char *pathname, int flags); int rscc_pread64(int fd, void *buf, size_t count, off_t offset); int rscc_pwrite64(int fd, void *buf, size_t count, off_t offset); int rscc_read(int fd, void *buf, size_t count); int rscc_readlink(char *path, char *buf, size_t bufsiz); int rscc_recv(int s, void *buf, size_t len, int flags); int rscc_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); int rscc_rename(char *oldpath, char *newpath); int rscc_rmdir(char *pathname); int rscc_send(int s, void *buf, size_t len, int flags); int rscc_sendto(int s, void *buf, size_t len, int flags, struct sockaddr *to, socklen_t tolen); int rscc_setdomainname(char *name, size_t len); int rscc_sethostname(char *name, size_t len); int rscc_setsockopt(int s, int level, int optname, void *optval, socklen_t optlen); int rscc_settimeofday(struct timeval *tv, struct timezone *tz); int rscc_shutdown(int s, int how); int rscc_socket(int domain, int type, int protocol); int rscc_stat64(char *path, struct stat64 *buf); int rscc_statfs64(char *path, struct statfs64 *buf); int rscc_symlink(char *oldpath, char *newpath); int rscc_truncate64(char *path, __off64_t length); int rscc_umount2(char *target, int flags); int rscc_uname(struct utsname *buf); int rscc_unlink(char *pathname); int rscc_utime(char *filename, struct utimbuf *buf); int rscc_utimes(char *filename, struct timeval tv[2]); int rscc_write(int fd, void *buf, size_t count); int rscc_ioctl(int d, int request, void *arg); int rscc_fcntl(int fd, int cmd, ...); /*************************************************************/ /* INTERFACE 2: create_request/manage_response functions */ /*************************************************************/ struct iovec *rscc_create__llseek_request(int *total_size, int *iovec_count, unsigned int fd, unsigned long int offset_high, unsigned long int offset_low, loff_t *result, unsigned int whence); struct iovec *rscc_manage__llseek_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, unsigned int fd, unsigned long int offset_high, unsigned long int offset_low, loff_t *result, unsigned int whence); struct iovec *rscc_create_accept_request(int *total_size, int *iovec_count, int sockfd, struct sockaddr *addr, socklen_t *addrlen); struct iovec *rscc_manage_accept_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int sockfd, struct sockaddr *addr, socklen_t *addrlen); struct iovec *rscc_create_access_request(int *total_size, int *iovec_count, char *pathname, int mode); struct iovec *rscc_manage_access_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *pathname, int mode); struct iovec *rscc_create_adjtimex_request(int *total_size, int *iovec_count, struct timex *buf); struct iovec *rscc_manage_adjtimex_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, struct timex *buf); struct iovec *rscc_create_bind_request(int *total_size, int *iovec_count, int sockfd, struct sockaddr *my_addr, socklen_t addrlen); struct iovec *rscc_manage_bind_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int sockfd, struct sockaddr *my_addr, socklen_t addrlen); struct iovec *rscc_create_chdir_request(int *total_size, int *iovec_count, char *path); struct iovec *rscc_manage_chdir_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path); struct iovec *rscc_create_chmod_request(int *total_size, int *iovec_count, char *path, mode_t mode); struct iovec *rscc_manage_chmod_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, mode_t mode); struct iovec *rscc_create_chown_request(int *total_size, int *iovec_count, char *path, uid_t owner, gid_t group); struct iovec *rscc_manage_chown_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, uid_t owner, gid_t group); struct iovec *rscc_create_chown32_request(int *total_size, int *iovec_count, char *path, uid_t owner, gid_t group); struct iovec *rscc_manage_chown32_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, uid_t owner, gid_t group); struct iovec *rscc_create_clock_getres_request(int *total_size, int *iovec_count, clockid_t clk_id, struct timespec *res); struct iovec *rscc_manage_clock_getres_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, clockid_t clk_id, struct timespec *res); struct iovec *rscc_create_clock_gettime_request(int *total_size, int *iovec_count, clockid_t clk_id, struct timespec *tp); struct iovec *rscc_manage_clock_gettime_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, clockid_t clk_id, struct timespec *tp); struct iovec *rscc_create_clock_settime_request(int *total_size, int *iovec_count, clockid_t clk_id, struct timespec *tp); struct iovec *rscc_manage_clock_settime_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, clockid_t clk_id, struct timespec *tp); struct iovec *rscc_create_close_request(int *total_size, int *iovec_count, int fd); struct iovec *rscc_manage_close_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd); struct iovec *rscc_create_connect_request(int *total_size, int *iovec_count, int sockfd, struct sockaddr *serv_addr, socklen_t addrlen); struct iovec *rscc_manage_connect_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int sockfd, struct sockaddr *serv_addr, socklen_t addrlen); struct iovec *rscc_create_dup_request(int *total_size, int *iovec_count, int oldfd); struct iovec *rscc_manage_dup_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int oldfd); struct iovec *rscc_create_dup2_request(int *total_size, int *iovec_count, int oldfd, int newfd); struct iovec *rscc_manage_dup2_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int oldfd, int newfd); struct iovec *rscc_create_fchdir_request(int *total_size, int *iovec_count, int fd); struct iovec *rscc_manage_fchdir_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd); struct iovec *rscc_create_fchmod_request(int *total_size, int *iovec_count, int fildes, mode_t mode); struct iovec *rscc_manage_fchmod_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fildes, mode_t mode); struct iovec *rscc_create_fchown_request(int *total_size, int *iovec_count, int fd, uid_t owner, gid_t group); struct iovec *rscc_manage_fchown_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, uid_t owner, gid_t group); struct iovec *rscc_create_fchown32_request(int *total_size, int *iovec_count, int fd, uid_t owner, gid_t group); struct iovec *rscc_manage_fchown32_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, uid_t owner, gid_t group); struct iovec *rscc_create_fdatasync_request(int *total_size, int *iovec_count, int fd); struct iovec *rscc_manage_fdatasync_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd); struct iovec *rscc_create_fgetxattr_request(int *total_size, int *iovec_count, int filedes, char *name, void *value, size_t size); struct iovec *rscc_manage_fgetxattr_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int filedes, char *name, void *value, size_t size); struct iovec *rscc_create_fstat64_request(int *total_size, int *iovec_count, int filedes, struct stat64 *buf); struct iovec *rscc_manage_fstat64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int filedes, struct stat64 *buf); struct iovec *rscc_create_fstatfs64_request(int *total_size, int *iovec_count, unsigned int fd, struct statfs64 *buf); struct iovec *rscc_manage_fstatfs64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, unsigned int fd, struct statfs64 *buf); struct iovec *rscc_create_fsync_request(int *total_size, int *iovec_count, int fd); struct iovec *rscc_manage_fsync_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd); struct iovec *rscc_create_ftruncate64_request(int *total_size, int *iovec_count, int fd, __off64_t length); struct iovec *rscc_manage_ftruncate64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, __off64_t length); struct iovec *rscc_create_getdents64_request(int *total_size, int *iovec_count, unsigned int fd, struct dirent64 *dirp, unsigned int count); struct iovec *rscc_manage_getdents64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, unsigned int fd, struct dirent64 *dirp, unsigned int count); struct iovec *rscc_create_getpeername_request(int *total_size, int *iovec_count, int s, struct sockaddr *name, socklen_t *namelen); struct iovec *rscc_manage_getpeername_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, struct sockaddr *name, socklen_t *namelen); struct iovec *rscc_create_getsockname_request(int *total_size, int *iovec_count, int s, struct sockaddr *name, socklen_t *namelen); struct iovec *rscc_manage_getsockname_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, struct sockaddr *name, socklen_t *namelen); struct iovec *rscc_create_getsockopt_request(int *total_size, int *iovec_count, int s, int level, int optname, void *optval, socklen_t *optlen); struct iovec *rscc_manage_getsockopt_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, int level, int optname, void *optval, socklen_t *optlen); struct iovec *rscc_create_gettimeofday_request(int *total_size, int *iovec_count, struct timeval *tv, struct timezone *tz); struct iovec *rscc_manage_gettimeofday_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, struct timeval *tv, struct timezone *tz); struct iovec *rscc_create_getxattr_request(int *total_size, int *iovec_count, char *path, char *name, void *value, size_t size); struct iovec *rscc_manage_getxattr_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, char *name, void *value, size_t size); struct iovec *rscc_create_lchown_request(int *total_size, int *iovec_count, char *path, uid_t owner, gid_t group); struct iovec *rscc_manage_lchown_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, uid_t owner, gid_t group); struct iovec *rscc_create_lchown32_request(int *total_size, int *iovec_count, char *path, uid_t owner, gid_t group); struct iovec *rscc_manage_lchown32_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, uid_t owner, gid_t group); struct iovec *rscc_create_lgetxattr_request(int *total_size, int *iovec_count, char *path, char *name, void *value, size_t size); struct iovec *rscc_manage_lgetxattr_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, char *name, void *value, size_t size); struct iovec *rscc_create_link_request(int *total_size, int *iovec_count, char *oldpath, char *newpath); struct iovec *rscc_manage_link_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *oldpath, char *newpath); struct iovec *rscc_create_listen_request(int *total_size, int *iovec_count, int sockfd, int backlog); struct iovec *rscc_manage_listen_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int sockfd, int backlog); struct iovec *rscc_create_lseek_request(int *total_size, int *iovec_count, int fildes, off_t offset, int whence); struct iovec *rscc_manage_lseek_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fildes, off_t offset, int whence); struct iovec *rscc_create_lstat64_request(int *total_size, int *iovec_count, char *path, struct stat64 *buf); struct iovec *rscc_manage_lstat64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, struct stat64 *buf); struct iovec *rscc_create_mkdir_request(int *total_size, int *iovec_count, char *pathname, mode_t mode); struct iovec *rscc_manage_mkdir_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *pathname, mode_t mode); struct iovec *rscc_create_mount_request(int *total_size, int *iovec_count, char *source, char *target, char *filesystemtype, unsigned long int mountflags, void *data); struct iovec *rscc_manage_mount_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *source, char *target, char *filesystemtype, unsigned long int mountflags, void *data); struct iovec *rscc_create_open_request(int *total_size, int *iovec_count, char *pathname, int flags); struct iovec *rscc_manage_open_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *pathname, int flags); struct iovec *rscc_create_pread64_request(int *total_size, int *iovec_count, int fd, void *buf, size_t count, off_t offset); struct iovec *rscc_manage_pread64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, void *buf, size_t count, off_t offset); struct iovec *rscc_create_pwrite64_request(int *total_size, int *iovec_count, int fd, void *buf, size_t count, off_t offset); struct iovec *rscc_manage_pwrite64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, void *buf, size_t count, off_t offset); struct iovec *rscc_create_read_request(int *total_size, int *iovec_count, int fd, void *buf, size_t count); struct iovec *rscc_manage_read_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, void *buf, size_t count); struct iovec *rscc_create_readlink_request(int *total_size, int *iovec_count, char *path, char *buf, size_t bufsiz); struct iovec *rscc_manage_readlink_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, char *buf, size_t bufsiz); struct iovec *rscc_create_recv_request(int *total_size, int *iovec_count, int s, void *buf, size_t len, int flags); struct iovec *rscc_manage_recv_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, void *buf, size_t len, int flags); struct iovec *rscc_create_recvfrom_request(int *total_size, int *iovec_count, int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); struct iovec *rscc_manage_recvfrom_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); struct iovec *rscc_create_rename_request(int *total_size, int *iovec_count, char *oldpath, char *newpath); struct iovec *rscc_manage_rename_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *oldpath, char *newpath); struct iovec *rscc_create_rmdir_request(int *total_size, int *iovec_count, char *pathname); struct iovec *rscc_manage_rmdir_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *pathname); struct iovec *rscc_create_send_request(int *total_size, int *iovec_count, int s, void *buf, size_t len, int flags); struct iovec *rscc_manage_send_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, void *buf, size_t len, int flags); struct iovec *rscc_create_sendto_request(int *total_size, int *iovec_count, int s, void *buf, size_t len, int flags, struct sockaddr *to, socklen_t tolen); struct iovec *rscc_manage_sendto_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, void *buf, size_t len, int flags, struct sockaddr *to, socklen_t tolen); struct iovec *rscc_create_setdomainname_request(int *total_size, int *iovec_count, char *name, size_t len); struct iovec *rscc_manage_setdomainname_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *name, size_t len); struct iovec *rscc_create_sethostname_request(int *total_size, int *iovec_count, char *name, size_t len); struct iovec *rscc_manage_sethostname_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *name, size_t len); struct iovec *rscc_create_setsockopt_request(int *total_size, int *iovec_count, int s, int level, int optname, void *optval, socklen_t optlen); struct iovec *rscc_manage_setsockopt_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, int level, int optname, void *optval, socklen_t optlen); struct iovec *rscc_create_settimeofday_request(int *total_size, int *iovec_count, struct timeval *tv, struct timezone *tz); struct iovec *rscc_manage_settimeofday_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, struct timeval *tv, struct timezone *tz); struct iovec *rscc_create_shutdown_request(int *total_size, int *iovec_count, int s, int how); struct iovec *rscc_manage_shutdown_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, int how); struct iovec *rscc_create_socket_request(int *total_size, int *iovec_count, int domain, int type, int protocol); struct iovec *rscc_manage_socket_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int domain, int type, int protocol); struct iovec *rscc_create_stat64_request(int *total_size, int *iovec_count, char *path, struct stat64 *buf); struct iovec *rscc_manage_stat64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, struct stat64 *buf); struct iovec *rscc_create_statfs64_request(int *total_size, int *iovec_count, char *path, struct statfs64 *buf); struct iovec *rscc_manage_statfs64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, struct statfs64 *buf); struct iovec *rscc_create_symlink_request(int *total_size, int *iovec_count, char *oldpath, char *newpath); struct iovec *rscc_manage_symlink_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *oldpath, char *newpath); struct iovec *rscc_create_truncate64_request(int *total_size, int *iovec_count, char *path, __off64_t length); struct iovec *rscc_manage_truncate64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, __off64_t length); struct iovec *rscc_create_umount2_request(int *total_size, int *iovec_count, char *target, int flags); struct iovec *rscc_manage_umount2_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *target, int flags); struct iovec *rscc_create_uname_request(int *total_size, int *iovec_count, struct utsname *buf); struct iovec *rscc_manage_uname_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, struct utsname *buf); struct iovec *rscc_create_unlink_request(int *total_size, int *iovec_count, char *pathname); struct iovec *rscc_manage_unlink_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *pathname); struct iovec *rscc_create_utime_request(int *total_size, int *iovec_count, char *filename, struct utimbuf *buf); struct iovec *rscc_manage_utime_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *filename, struct utimbuf *buf); struct iovec *rscc_create_utimes_request(int *total_size, int *iovec_count, char *filename, struct timeval tv[2]); struct iovec *rscc_manage_utimes_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *filename, struct timeval tv[2]); struct iovec *rscc_create_write_request(int *total_size, int *iovec_count, int fd, void *buf, size_t count); struct iovec *rscc_manage_write_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, void *buf, size_t count); struct iovec *rscc_create_fcntl_request(int *total_size, int *iovec_count, u_int16_t cmd_type, int fd, int cmd, long third_arg); struct iovec *rscc_manage_fcntl_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, u_int16_t cmd_type, long third_arg); u_int32_t rscc_check_ioctl_request(int request); struct iovec *rscc_create_ioctl_request(int *total_size, int *iovec_count, u_int32_t size_type, int d, int request, void *arg); struct iovec *rscc_manage_ioctl_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, u_int32_t size_type, void *arg); #endif /* __RSC_CLIENT_HEADER__ */ umview-0.8.2/um_rsc/librsc/include/aconv.h0000644000175000017500000002075211753517212017573 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * aconv.h: Architecture conversion header file * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __ACONV_HEADER__ #define __ACONV_HEADER__ #include #include #ifndef __USE_LARGEFILE64 #define __USE_LARGEFILE64 #endif #include #include #include #include #include #include #include #include #include #define ACONV_32BIT 0x20 #define ACONV_64BIT 0x40 #define ACONV_BITNUM_MASK 0xF0 #define ACONV_LITTLEE 0x01 #define ACONV_BIGE 0x02 #define ACONV_ENDIENESS_MASK 0x0F enum arch { ACONV_ARCH_ERROR = -1, ARCH_FIRST = (ACONV_32BIT | ACONV_LITTLEE), ACONV_X86 = ARCH_FIRST, ACONV_X86_64 = (ACONV_64BIT | ACONV_LITTLEE), ACONV_PPC = (ACONV_32BIT | ACONV_BIGE), ACONV_PPC_64 = (ACONV_64BIT | ACONV_BIGE), ARCH_LAST = ACONV_PPC_64 }; /* Return values */ #define ACONV_OK 1 #define ACONV_UNNEC 3 #define ACONV_ERROR -2 typedef int (* aconv_size_fun)(enum arch from, enum arch to); /* typedef int (* aconv_fun)(void *d, enum arch from, enum arch to, void *p); */ typedef int (* aconv_fun)(); char *aconv_arch2str(enum arch arch); enum arch aconv_get_host_arch(); /* Only long and pointers change from 32 to 64bit architectures */ int aconv_char_size(enum arch from, enum arch to); int aconv_u_char_size(enum arch from, enum arch to); int aconv_short_size(enum arch from, enum arch to); int aconv_u_short_size(enum arch from, enum arch to); int aconv_int_size(enum arch from, enum arch to); int aconv_u_int_size(enum arch from, enum arch to); int aconv_long_size(enum arch from, enum arch to); int aconv_u_long_size(enum arch from, enum arch to); int aconv_longlong_size(enum arch from, enum arch to); int aconv_u_longlong_size(enum arch from, enum arch to); int aconv_pointer_size(enum arch from, enum arch to); int aconv_string_size(char *s, enum arch from, enum arch to); int aconv_mode_t_size(enum arch from, enum arch to); int aconv_loff_t_size(enum arch from, enum arch to); int aconv_uid_t_size(enum arch from, enum arch to); #define aconv___uid_t_size(from, to) aconv_uid_t_size((from), (to)) int aconv_gid_t_size(enum arch from, enum arch to); #define aconv___gid_t_size(from, to) aconv_gid_t_size((from), (to)) int aconv_clockid_t_size(enum arch from, enum arch to); int aconv___off64_t_size(enum arch from, enum arch to); int aconv_socklen_t_size(enum arch from, enum arch to); int aconv_size_t_size(enum arch from, enum arch to); int aconv_off_t_size(enum arch from, enum arch to); #define aconv___off_t_size(from, to) aconv_off_t_size((from), (to)) int aconv___ino64_t_size(enum arch from, enum arch to); int aconv_sa_family_t_size(enum arch from, enum arch to); int aconv_time_t_size(enum arch from, enum arch to); #define aconv___time_t_size(from, to) aconv_time_t_size((from), (to)) int aconv_suseconds_t_size(enum arch from, enum arch to); int aconv_array_size(enum arch from, enum arch to, int elnum, aconv_size_fun size_fun); int aconv_struct_dirent64_size(enum arch from, enum arch to); int aconv_struct_sockaddr_size(enum arch from, enum arch to); int aconv_struct_timespec_size(enum arch from, enum arch to); int aconv_struct_timeval_size(enum arch from, enum arch to); int aconv_struct_timezone_size(enum arch from, enum arch to); int aconv_struct_utimbuf_size(enum arch from, enum arch to); int aconv_struct_utsname_size(enum arch from, enum arch to); int aconv_struct_timex_size(enum arch from, enum arch to); int aconv_struct_statfs64_size(enum arch from, enum arch to); int aconv_struct_stat64_size(enum arch from, enum arch to); #define aconv___dev_t_size(from, to) aconv_u_longlong_size((from), (to)) #define aconv___ino_t_size(from, to) aconv_u_long_size((from), (to)) #define aconv___mode_t_size(from, to) aconv_u_int_size((from), (to)) #define aconv___nlink_t_size(from, to) aconv_u_long_size((from), (to)) #define aconv___blksize_t_size(from, to) aconv_long_size((from), (to)) #define aconv___blkcnt64_t_size(from, to) aconv_longlong_size((from), (to)) int aconv_bytes_size(int bytenum, enum arch from, enum arch to); /************************/ /* Conversion functions */ /************************/ int aconv_char(char *c, enum arch from, enum arch to, void *p); int aconv_u_char(unsigned char *c, enum arch from, enum arch to, void *p); int aconv_int(int *i, enum arch from, enum arch to, void *p); int aconv_u_int(unsigned int *i, enum arch from, enum arch to, void *p); int aconv_short(short *i, enum arch from, enum arch to, void *p); int aconv_u_short(unsigned short *i, enum arch from, enum arch to, void *p); int aconv_long(long *l, enum arch from, enum arch to, void *p); int aconv_u_long(unsigned long *l, enum arch from, enum arch to, void *p); int aconv_longlong(long long* l, enum arch from, enum arch to, void *p); int aconv_u_longlong(unsigned long long *l, enum arch from, enum arch to, void *p); int aconv_pointer(void *p, enum arch from, enum arch to, void *dest); int aconv_string(char *s, enum arch from, enum arch to, void *p); int aconv_mode_t(mode_t *n, enum arch from, enum arch to, void *p); int aconv_loff_t(loff_t *n, enum arch from, enum arch to, void *p); int aconv_uid_t(uid_t *n, enum arch from, enum arch to, void *p); #define aconv___uid_t(n, from, to, p) aconv_uid_t((uid_t *)(n), (from), (to), (p)) int aconv_gid_t(gid_t *n, enum arch from, enum arch to, void *p); #define aconv___gid_t(n, from, to, p) aconv_gid_t((gid_t *)(n), (from), (to), (p)) int aconv___ino64_t(__ino64_t *n, enum arch from, enum arch to, void *p); int aconv_sa_family_t(sa_family_t *n, enum arch from, enum arch to, void *p); int aconv_time_t(time_t *n, enum arch from, enum arch to, void *p); #define aconv___time_t(n, from, to, p) aconv_time_t((time_t *)(n), (from), (to), (p)) int aconv_suseconds_t(suseconds_t *n, enum arch from, enum arch to, void *p); int aconv_clockid_t(clockid_t *n, enum arch from, enum arch to, void *p); int aconv___off64_t(__off64_t *n, enum arch from, enum arch to, void *p); int aconv_socklen_t(socklen_t *n, enum arch from, enum arch to, void *p); int aconv_size_t(size_t *n, enum arch from, enum arch to, void *p); int aconv_off_t(off_t *n, enum arch from, enum arch to, void *p); #define aconv___off_t(n, from, to, p) aconv_off_t((off_t)(n), (from), (to), (p)) int aconv_array(void *a, enum arch from, enum arch to, int elnum, void *p, aconv_size_fun size_fun, aconv_fun aconv_fun); #define aconv___dev_t(n, from, to, p) aconv_u_longlong((n), (from), (to), (p)) #define aconv___ino_t(n, from, to, p) aconv_u_long((n), (from), (to), (p)) #define aconv___mode_t(n, from, to, p) aconv_u_int((n), (from), (to), (p)) #define aconv___nlink_t(n, from, to, p) aconv_u_long((n), (from), (to), (p)) #define aconv___blksize_t(n, from, to, p) aconv_long((n), (from), (to), (p)) #define aconv___blkcnt64_t(n, from, to, p) aconv_longlong((n), (from), (to), (p)) int aconv_struct_dirent64(struct dirent64 *d, enum arch from, enum arch to, void *p); int aconv_struct_sockaddr(struct sockaddr *s, enum arch from, enum arch to, void *p); int aconv_struct_timespec(struct timespec *t, enum arch from, enum arch to, void *p); int aconv_struct_timeval(struct timeval *t, enum arch from, enum arch to, void *p); int aconv_struct_timezone(struct timezone *t, enum arch from, enum arch to, void *p); int aconv_struct_utimbuf(struct utimbuf *t, enum arch from, enum arch to, void *p); int aconv_struct_utsname(struct utsname *t, enum arch from, enum arch to, void *p); int aconv_struct_timex(struct timex *t, enum arch from, enum arch to, void *p); int aconv_struct_statfs64(struct statfs64 *s, enum arch from, enum arch to, void *p); int aconv_struct_stat64(struct stat64 *s, enum arch from, enum arch to, void *p); int aconv_bytes(void *b, enum arch from, enum arch to, void *p, int bytenum); #endif /* __ACONV_HEADER__ */ umview-0.8.2/um_rsc/librsc/src/0000755000175000017500000000000011753517351015456 5ustar renzorenzoumview-0.8.2/um_rsc/librsc/src/include/0000755000175000017500000000000011753517351017101 5ustar renzorenzoumview-0.8.2/um_rsc/librsc/src/include/event_sub.h0000644000175000017500000000176411753517212021250 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * event_sub.c: client and server local functions for event subscription * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __EVENT_SUB_H__ #define __EVENT_SUB_H__ struct reg_cbs *rscc_es_init(int event_sub_fd); void rscs_es_init(); #endif /* __EVENT_SUB_H__ */ umview-0.8.2/um_rsc/librsc/src/include/registered_callbacks.h0000644000175000017500000000301711753517212023403 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * registered_callbacks.h: header of registered callback * data structure management * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __REGISTERED_CALLBACKS_HEADER__ #define __REGISTERED_CALLBACKS_HEADER__ #include "rsc_messages.h" #define REG_CB_INITIAL_SIZE 10 struct reg_cbs *init_reg_cb(); int reg_cb_add(struct reg_cbs *p, void (* cb)(), void *arg, int fd, int how); void reg_cb_del(struct reg_cbs *p, int i); #ifdef RSCDEBUG # define PRINT_REGCB(reg_cbs, i) print_regcb_entry(reg_cbs, i) # define PRINT_REGCBS(reg_cbs) print_regcbs(reg_cbs) void print_regcb_entry(struct reg_cbs *rc, int i); void print_regcbs(struct reg_cbs *rc); #else # define PRINT_REGCB(reg_cbs, i) # define PRINT_REGCBS(reg_cbs) #endif #endif /* __REGISTERED_CALLBACKS_HEADER__ */ umview-0.8.2/um_rsc/librsc/src/include/test_rsc_server.h0000644000175000017500000006122311753517212022466 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * test_rsc_server.h: header containing private server side functions to be tested * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_SERVER_TESTS_H__ #define __RSC_SERVER_TESTS_H__ #ifdef RSCDEBUG #include "rsc_messages.h" struct ioctl_resp_header *rscs_manage_ioctl_request(struct ioctl_req_header *ioctl_req); void accept_adjust_read_pointers(struct accept_req *accept_req); void access_adjust_read_pointers(struct access_req *access_req); void adjtimex_adjust_read_pointers(struct adjtimex_req *adjtimex_req); void bind_adjust_read_pointers(struct bind_req *bind_req); void chdir_adjust_read_pointers(struct chdir_req *chdir_req); void chmod_adjust_read_pointers(struct chmod_req *chmod_req); void chown_adjust_read_pointers(struct chown_req *chown_req); void chown32_adjust_read_pointers(struct chown32_req *chown32_req); void clock_settime_adjust_read_pointers(struct clock_settime_req *clock_settime_req); void connect_adjust_read_pointers(struct connect_req *connect_req); void fgetxattr_adjust_read_pointers(struct fgetxattr_req *fgetxattr_req); void getpeername_adjust_read_pointers(struct getpeername_req *getpeername_req); void getsockname_adjust_read_pointers(struct getsockname_req *getsockname_req); void getsockopt_adjust_read_pointers(struct getsockopt_req *getsockopt_req); void getxattr_adjust_read_pointers(struct getxattr_req *getxattr_req); void lchown_adjust_read_pointers(struct lchown_req *lchown_req); void lchown32_adjust_read_pointers(struct lchown32_req *lchown32_req); void lgetxattr_adjust_read_pointers(struct lgetxattr_req *lgetxattr_req); void link_adjust_read_pointers(struct link_req *link_req); void lstat64_adjust_read_pointers(struct lstat64_req *lstat64_req); void mkdir_adjust_read_pointers(struct mkdir_req *mkdir_req); void mount_adjust_read_pointers(struct mount_req *mount_req); void open_adjust_read_pointers(struct open_req *open_req); void pwrite64_adjust_read_pointers(struct pwrite64_req *pwrite64_req); void readlink_adjust_read_pointers(struct readlink_req *readlink_req); void recvfrom_adjust_read_pointers(struct recvfrom_req *recvfrom_req); void rename_adjust_read_pointers(struct rename_req *rename_req); void rmdir_adjust_read_pointers(struct rmdir_req *rmdir_req); void send_adjust_read_pointers(struct send_req *send_req); void sendto_adjust_read_pointers(struct sendto_req *sendto_req); void setdomainname_adjust_read_pointers(struct setdomainname_req *setdomainname_req); void sethostname_adjust_read_pointers(struct sethostname_req *sethostname_req); void setsockopt_adjust_read_pointers(struct setsockopt_req *setsockopt_req); void settimeofday_adjust_read_pointers(struct settimeofday_req *settimeofday_req); void stat64_adjust_read_pointers(struct stat64_req *stat64_req); void statfs64_adjust_read_pointers(struct statfs64_req *statfs64_req); void symlink_adjust_read_pointers(struct symlink_req *symlink_req); void truncate64_adjust_read_pointers(struct truncate64_req *truncate64_req); void umount2_adjust_read_pointers(struct umount2_req *umount2_req); void unlink_adjust_read_pointers(struct unlink_req *unlink_req); void utime_adjust_read_pointers(struct utime_req *utime_req); void utimes_adjust_read_pointers(struct utimes_req *utimes_req); void write_adjust_read_pointers(struct write_req *write_req); void _llseek_adjust_write_pointers(struct _llseek_req *_llseek_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void accept_adjust_write_pointers(struct accept_req *accept_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void adjtimex_adjust_write_pointers(struct adjtimex_req *adjtimex_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void clock_getres_adjust_write_pointers(struct clock_getres_req *clock_getres_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void clock_gettime_adjust_write_pointers(struct clock_gettime_req *clock_gettime_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void fgetxattr_adjust_write_pointers(struct fgetxattr_req *fgetxattr_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void fstat64_adjust_write_pointers(struct fstat64_req *fstat64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void fstatfs64_adjust_write_pointers(struct fstatfs64_req *fstatfs64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void getdents64_adjust_write_pointers(struct getdents64_req *getdents64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void getpeername_adjust_write_pointers(struct getpeername_req *getpeername_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void getsockname_adjust_write_pointers(struct getsockname_req *getsockname_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void getsockopt_adjust_write_pointers(struct getsockopt_req *getsockopt_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void gettimeofday_adjust_write_pointers(struct gettimeofday_req *gettimeofday_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void getxattr_adjust_write_pointers(struct getxattr_req *getxattr_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void lgetxattr_adjust_write_pointers(struct lgetxattr_req *lgetxattr_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void lstat64_adjust_write_pointers(struct lstat64_req *lstat64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void pread64_adjust_write_pointers(struct pread64_req *pread64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void read_adjust_write_pointers(struct read_req *read_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void readlink_adjust_write_pointers(struct readlink_req *readlink_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void recv_adjust_write_pointers(struct recv_req *recv_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void recvfrom_adjust_write_pointers(struct recvfrom_req *recvfrom_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void stat64_adjust_write_pointers(struct stat64_req *stat64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void statfs64_adjust_write_pointers(struct statfs64_req *statfs64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); void uname_adjust_write_pointers(struct uname_req *uname_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch); struct sys_resp_header *rscs_pre__llseek_exec(void *req, enum arch client_arch); int rscs_exec__llseek(void *request); struct sys_resp_header *rscs_post__llseek_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_accept_exec(void *req, enum arch client_arch); int rscs_exec_accept(void *request); struct sys_resp_header *rscs_post_accept_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_access_exec(void *req, enum arch client_arch); int rscs_exec_access(void *request); struct sys_resp_header *rscs_post_access_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_adjtimex_exec(void *req, enum arch client_arch); int rscs_exec_adjtimex(void *request); struct sys_resp_header *rscs_post_adjtimex_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_bind_exec(void *req, enum arch client_arch); int rscs_exec_bind(void *request); struct sys_resp_header *rscs_post_bind_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_chdir_exec(void *req, enum arch client_arch); int rscs_exec_chdir(void *request); struct sys_resp_header *rscs_post_chdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_chmod_exec(void *req, enum arch client_arch); int rscs_exec_chmod(void *request); struct sys_resp_header *rscs_post_chmod_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_chown_exec(void *req, enum arch client_arch); int rscs_exec_chown(void *request); struct sys_resp_header *rscs_post_chown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_chown32_exec(void *req, enum arch client_arch); int rscs_exec_chown32(void *request); struct sys_resp_header *rscs_post_chown32_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_clock_getres_exec(void *req, enum arch client_arch); int rscs_exec_clock_getres(void *request); struct sys_resp_header *rscs_post_clock_getres_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_clock_gettime_exec(void *req, enum arch client_arch); int rscs_exec_clock_gettime(void *request); struct sys_resp_header *rscs_post_clock_gettime_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_clock_settime_exec(void *req, enum arch client_arch); int rscs_exec_clock_settime(void *request); struct sys_resp_header *rscs_post_clock_settime_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_close_exec(void *req, enum arch client_arch); int rscs_exec_close(void *request); struct sys_resp_header *rscs_post_close_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_connect_exec(void *req, enum arch client_arch); int rscs_exec_connect(void *request); struct sys_resp_header *rscs_post_connect_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_dup_exec(void *req, enum arch client_arch); int rscs_exec_dup(void *request); struct sys_resp_header *rscs_post_dup_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_dup2_exec(void *req, enum arch client_arch); int rscs_exec_dup2(void *request); struct sys_resp_header *rscs_post_dup2_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fchdir_exec(void *req, enum arch client_arch); int rscs_exec_fchdir(void *request); struct sys_resp_header *rscs_post_fchdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fchmod_exec(void *req, enum arch client_arch); int rscs_exec_fchmod(void *request); struct sys_resp_header *rscs_post_fchmod_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fchown_exec(void *req, enum arch client_arch); int rscs_exec_fchown(void *request); struct sys_resp_header *rscs_post_fchown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fchown32_exec(void *req, enum arch client_arch); int rscs_exec_fchown32(void *request); struct sys_resp_header *rscs_post_fchown32_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fdatasync_exec(void *req, enum arch client_arch); int rscs_exec_fdatasync(void *request); struct sys_resp_header *rscs_post_fdatasync_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fgetxattr_exec(void *req, enum arch client_arch); int rscs_exec_fgetxattr(void *request); struct sys_resp_header *rscs_post_fgetxattr_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fstat64_exec(void *req, enum arch client_arch); int rscs_exec_fstat64(void *request); struct sys_resp_header *rscs_post_fstat64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fstatfs64_exec(void *req, enum arch client_arch); int rscs_exec_fstatfs64(void *request); struct sys_resp_header *rscs_post_fstatfs64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fsync_exec(void *req, enum arch client_arch); int rscs_exec_fsync(void *request); struct sys_resp_header *rscs_post_fsync_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_ftruncate64_exec(void *req, enum arch client_arch); int rscs_exec_ftruncate64(void *request); struct sys_resp_header *rscs_post_ftruncate64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_getdents64_exec(void *req, enum arch client_arch); int rscs_exec_getdents64(void *request); struct sys_resp_header *rscs_post_getdents64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_getpeername_exec(void *req, enum arch client_arch); int rscs_exec_getpeername(void *request); struct sys_resp_header *rscs_post_getpeername_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_getsockname_exec(void *req, enum arch client_arch); int rscs_exec_getsockname(void *request); struct sys_resp_header *rscs_post_getsockname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_getsockopt_exec(void *req, enum arch client_arch); int rscs_exec_getsockopt(void *request); struct sys_resp_header *rscs_post_getsockopt_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_gettimeofday_exec(void *req, enum arch client_arch); int rscs_exec_gettimeofday(void *request); struct sys_resp_header *rscs_post_gettimeofday_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_getxattr_exec(void *req, enum arch client_arch); int rscs_exec_getxattr(void *request); struct sys_resp_header *rscs_post_getxattr_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_lchown_exec(void *req, enum arch client_arch); int rscs_exec_lchown(void *request); struct sys_resp_header *rscs_post_lchown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_lchown32_exec(void *req, enum arch client_arch); int rscs_exec_lchown32(void *request); struct sys_resp_header *rscs_post_lchown32_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_lgetxattr_exec(void *req, enum arch client_arch); int rscs_exec_lgetxattr(void *request); struct sys_resp_header *rscs_post_lgetxattr_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_link_exec(void *req, enum arch client_arch); int rscs_exec_link(void *request); struct sys_resp_header *rscs_post_link_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_listen_exec(void *req, enum arch client_arch); int rscs_exec_listen(void *request); struct sys_resp_header *rscs_post_listen_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_lseek_exec(void *req, enum arch client_arch); int rscs_exec_lseek(void *request); struct sys_resp_header *rscs_post_lseek_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_lstat64_exec(void *req, enum arch client_arch); int rscs_exec_lstat64(void *request); struct sys_resp_header *rscs_post_lstat64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_mkdir_exec(void *req, enum arch client_arch); int rscs_exec_mkdir(void *request); struct sys_resp_header *rscs_post_mkdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_mount_exec(void *req, enum arch client_arch); int rscs_exec_mount(void *request); struct sys_resp_header *rscs_post_mount_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_open_exec(void *req, enum arch client_arch); int rscs_exec_open(void *request); struct sys_resp_header *rscs_post_open_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_pread64_exec(void *req, enum arch client_arch); int rscs_exec_pread64(void *request); struct sys_resp_header *rscs_post_pread64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_pwrite64_exec(void *req, enum arch client_arch); int rscs_exec_pwrite64(void *request); struct sys_resp_header *rscs_post_pwrite64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_read_exec(void *req, enum arch client_arch); int rscs_exec_read(void *request); struct sys_resp_header *rscs_post_read_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_readlink_exec(void *req, enum arch client_arch); int rscs_exec_readlink(void *request); struct sys_resp_header *rscs_post_readlink_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_recv_exec(void *req, enum arch client_arch); int rscs_exec_recv(void *request); struct sys_resp_header *rscs_post_recv_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_recvfrom_exec(void *req, enum arch client_arch); int rscs_exec_recvfrom(void *request); struct sys_resp_header *rscs_post_recvfrom_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_rename_exec(void *req, enum arch client_arch); int rscs_exec_rename(void *request); struct sys_resp_header *rscs_post_rename_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_rmdir_exec(void *req, enum arch client_arch); int rscs_exec_rmdir(void *request); struct sys_resp_header *rscs_post_rmdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_send_exec(void *req, enum arch client_arch); int rscs_exec_send(void *request); struct sys_resp_header *rscs_post_send_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_sendto_exec(void *req, enum arch client_arch); int rscs_exec_sendto(void *request); struct sys_resp_header *rscs_post_sendto_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_setdomainname_exec(void *req, enum arch client_arch); int rscs_exec_setdomainname(void *request); struct sys_resp_header *rscs_post_setdomainname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_sethostname_exec(void *req, enum arch client_arch); int rscs_exec_sethostname(void *request); struct sys_resp_header *rscs_post_sethostname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_setsockopt_exec(void *req, enum arch client_arch); int rscs_exec_setsockopt(void *request); struct sys_resp_header *rscs_post_setsockopt_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_settimeofday_exec(void *req, enum arch client_arch); int rscs_exec_settimeofday(void *request); struct sys_resp_header *rscs_post_settimeofday_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_shutdown_exec(void *req, enum arch client_arch); int rscs_exec_shutdown(void *request); struct sys_resp_header *rscs_post_shutdown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_socket_exec(void *req, enum arch client_arch); int rscs_exec_socket(void *request); struct sys_resp_header *rscs_post_socket_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_stat64_exec(void *req, enum arch client_arch); int rscs_exec_stat64(void *request); struct sys_resp_header *rscs_post_stat64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_statfs64_exec(void *req, enum arch client_arch); int rscs_exec_statfs64(void *request); struct sys_resp_header *rscs_post_statfs64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_symlink_exec(void *req, enum arch client_arch); int rscs_exec_symlink(void *request); struct sys_resp_header *rscs_post_symlink_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_truncate64_exec(void *req, enum arch client_arch); int rscs_exec_truncate64(void *request); struct sys_resp_header *rscs_post_truncate64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_umount2_exec(void *req, enum arch client_arch); int rscs_exec_umount2(void *request); struct sys_resp_header *rscs_post_umount2_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_uname_exec(void *req, enum arch client_arch); int rscs_exec_uname(void *request); struct sys_resp_header *rscs_post_uname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_unlink_exec(void *req, enum arch client_arch); int rscs_exec_unlink(void *request); struct sys_resp_header *rscs_post_unlink_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_utime_exec(void *req, enum arch client_arch); int rscs_exec_utime(void *request); struct sys_resp_header *rscs_post_utime_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_utimes_exec(void *req, enum arch client_arch); int rscs_exec_utimes(void *request); struct sys_resp_header *rscs_post_utimes_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_write_exec(void *req, enum arch client_arch); int rscs_exec_write(void *request); struct sys_resp_header *rscs_post_write_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); #endif /* RSCDEBUG */ #endif /* __RSC_SERVER_TESTS_H__ */ umview-0.8.2/um_rsc/librsc/src/include/utils.h0000644000175000017500000000261211753517212020407 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * utils.h: utility functions header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __UTILS_HEADER__ #define __UTILS_HEADER__ #include int write_n_bytes(int fd, void *buffer, int nbytes); int read_n_bytes(int fd, void *buffer, int nbytes); typedef int (*rwv_fun )(int filedes, const struct iovec *vector, size_t count); int rwv_n_bytes(rwv_fun fun, int fd, struct iovec *vector, size_t count, int nbytes); #define readv_n_bytes(fd, vector, count, nbytes) rwv_n_bytes((rwv_fun)readv, fd, vector, count, nbytes) #define writev_n_bytes(fd, vector, count, nbytes) rwv_n_bytes((rwv_fun)writev, fd, vector, count, nbytes) #endif /* __UTILS_HEADER__ */ umview-0.8.2/um_rsc/librsc/src/include/test_rsc_client.h0000644000175000017500000000310611753517212022432 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * test_rsc_client.h: header containing private client side functions to be tested * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __TEST_RSC_CLIENT_HEADER__ #define __TEST_RSC_CLIENT_HEADER__ #ifndef __USE_LARGEFILE64 #define __USE_LARGEFILE64 #endif #include "rsc_client.h" #ifdef RSCDEBUG struct ioctl_cache_el { int request; u_int32_t size_type; struct ioctl_cache_el *prev; struct ioctl_cache_el *next; }; struct ioctl_cache { struct ioctl_cache_el *first; struct ioctl_cache_el *last; int size; int nentry; }; struct ioctl_cache *ioctl_cache; struct ioctl_cache *ioctl_cache_init(int size); void ioctl_cache_add(struct ioctl_cache *cache, int request, u_int32_t size_type); u_int32_t ioctl_cache_search(struct ioctl_cache *cache, int request); u_int16_t fcntl_cmd_type(int cmd); #endif #endif /* __TEST_RSC_CLIENT_HEADER__ */ umview-0.8.2/um_rsc/librsc/src/include/debug.h0000644000175000017500000000412311753517212020334 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * debug.h: debug header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __DEBUG_HEADER__ #define __DEBUG_HEADER__ #include #include #include #include "aconv.h" #include "rsc_consts.h" /* Debug levels */ #define RSCD_ERROR 0 #define RSCD_MINIMAL 1 #define RSCD_REQ_RESP 2 #define RSCD_MARSHALING 3 #define RSCD_EVENT_SUB 4 #define RSCD_RW 5 char *rsc2str(enum rsc_constant rsc_const); char *nr2str(int32_t nr_const, int32_t sys, enum arch arch); #ifdef RSCDEBUG # ifndef RSC_DEBUG_LEVEL # error "RSC_DEBUG enabled but RSC_DEBUG_LEVEL undefined." # endif # define RSC_DEBUG(level, args...) rsc_debug(level, RSC_DEBUG_LEVEL, __FILE__, __LINE__, __func__, args) # define RSC_EXDUMP(level, text, len) rsc_exdump(level, RSC_DEBUG_LEVEL, __FILE__, __LINE__, __func__, text, len) # define RSC_PRINT_MSGHDR(level, msg) rsc_print_msghdr(level, msg) void rsc_debug(int level, int rscdebug_level, const char *file, const int line, const char *func, const char *fmt, ...); void rsc_exdump(int level, int rscdebug_level, const char *file, const int line, const char *func, const void* text, int len); void rsc_print_msghdr(int level, struct msghdr *msg); #else # define RSC_DEBUG(level, args...) # define RSC_EXDUMP(level, text, len) # define RSC_PRINT_MSGHDR(level, msg) #endif #endif /* __DEBUG_HEADER__ */ umview-0.8.2/um_rsc/librsc/src/include/generic_list.h0000644000175000017500000000312611753517212021717 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * generic_list.h: list data structure header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __GENERIC_LIST_HEADER__ #define __GENERIC_LIST_HEADER__ struct list { void **v; int size; int nentry; }; struct list *init_list(int initial_size); void teardown_list(struct list *l, void (free_el)(void *element) ); void list_add(struct list *l, void *element); void *list_del(struct list *l, int i); int list_search(struct list *l, int (compare)(void *element, void *arg), void *arg); #define list_getel(list, index) ( ((index) < 0 || (index) > (list)->size )? NULL : ((list)->v[(index)]) ) #ifdef RSCDEBUG # define PRINT_LIST(list, print_list_element) print_list(list, print_list_element) void print_list(struct list *l, void (* print_list_element)(void *element)); #else # define PRINT_LIST(list, print_list_element) #endif #endif /* __GENERIC_LIST_HEADER__ */ umview-0.8.2/um_rsc/librsc/src/include/nr_to_rsc.h0000644000175000017500000010560311753517212021243 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * nr_to_rsc.h: __NR_* to __RSC_* constants conversion header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __NR_TO_RSC_HEADER__ #define __NR_TO_RSC_HEADER__ #include #include "rsc_consts.h" /* SYS_ values are equal in each architecture, * so a single table is sufficent. */ #define SYS_TO_RSC_SIZE ((sizeof(sys_to_rsc))/(sizeof(int32_t))) int32_t sys_to_rsc[] = { /* 0. Isn't used */ __RSC_ERROR, /* 1. SYS_SOCKET */ __RSC_socket, /* 2. SYS_BIND */ __RSC_bind, /* 3. SYS_CONNECT */ __RSC_connect, /* 4. SYS_LISTEN */ __RSC_listen, /* 5. SYS_ACCEPT */ __RSC_accept, /* 6. SYS_GETSOCKNAME */ __RSC_getsockname, /* 7. SYS_GETPEERNAME */ __RSC_getpeername, /* 8. SYS_SOCKETPAIR */ __RSC_socketpair, /* 9. SYS_SEND */ __RSC_send, /* 10. SYS_RECV */ __RSC_recv, /* 11. SYS_SENDTO */ __RSC_sendto, /* 12. SYS_RECVFROM */ __RSC_recvfrom, /* 13. SYS_SHUTDOWN */ __RSC_shutdown, /* 14. SYS_SETSOCKOPT */ __RSC_setsockopt, /* 15. SYS_GETSOCKOPT */ __RSC_getsockopt, /* 16. SYS_SENDMSG */ __RSC_sendmsg, /* 17 SYS_RECVMSG */ __RSC_recvmsg }; #define X86_TO_RSC_SIZE ((sizeof(x86_to_rsc))/(sizeof(enum rsc_constant))) enum rsc_constant x86_to_rsc[] = { /* 0. __NR_restart_syscall */ __RSC_restart_syscall, /* 1. __NR_exit */ __RSC_exit, /* 2. __NR_fork */ __RSC_fork, /* 3. __NR_read */ __RSC_read, /* 4. __NR_write */ __RSC_write, /* 5. __NR_open */ __RSC_open, /* 6. __NR_close */ __RSC_close, /* 7. __NR_waitpid */ __RSC_waitpid, /* 8. __NR_creat */ __RSC_creat, /* 9. __NR_link */ __RSC_link, /* 10. __NR_unlink */ __RSC_unlink, /* 11. __NR_execve */ __RSC_execve, /* 12. __NR_chdir */ __RSC_chdir, /* 13. __NR_time */ __RSC_time, /* 14. __NR_mknod */ __RSC_mknod, /* 15. __NR_chmod */ __RSC_chmod, /* 16. __NR_lchown */ __RSC_lchown, /* 17. __NR_break */ __RSC_break, /* 18. __NR_oldstat */ __RSC_oldstat, /* 19. __NR_lseek */ __RSC_lseek, /* 20. __NR_getpid */ __RSC_getpid, /* 21. __NR_mount */ __RSC_mount, /* 22. __NR_umount */ __RSC_umount, /* 23. __NR_setuid */ __RSC_setuid, /* 24. __NR_getuid */ __RSC_getuid, /* 25. __NR_stime */ __RSC_stime, /* 26. __NR_ptrace */ __RSC_ptrace, /* 27. __NR_alarm */ __RSC_alarm, /* 28. __NR_oldfstat */ __RSC_oldfstat, /* 29. __NR_pause */ __RSC_pause, /* 30. __NR_utime */ __RSC_utime, /* 31. __NR_stty */ __RSC_stty, /* 32. __NR_gtty */ __RSC_gtty, /* 33. __NR_access */ __RSC_access, /* 34. __NR_nice */ __RSC_nice, /* 35. __NR_ftime */ __RSC_ftime, /* 36. __NR_sync */ __RSC_sync, /* 37. __NR_kill */ __RSC_kill, /* 38. __NR_rename */ __RSC_rename, /* 39. __NR_mkdir */ __RSC_mkdir, /* 40. __NR_rmdir */ __RSC_rmdir, /* 41. __NR_dup */ __RSC_dup, /* 42. __NR_pipe */ __RSC_pipe, /* 43. __NR_times */ __RSC_times, /* 44. __NR_prof */ __RSC_prof, /* 45. __NR_brk */ __RSC_brk, /* 46. __NR_setgid */ __RSC_setgid, /* 47. __NR_getgid */ __RSC_getgid, /* 48. __NR_signal */ __RSC_signal, /* 49. __NR_geteuid */ __RSC_geteuid, /* 50. __NR_getegid */ __RSC_getegid, /* 51. __NR_acct */ __RSC_acct, /* 52. __NR_umount2 */ __RSC_umount2, /* 53. __NR_lock */ __RSC_lock, /* 54. __NR_ioctl */ __RSC_ioctl, /* 55. __NR_fcntl */ __RSC_fcntl, /* 56. __NR_mpx */ __RSC_mpx, /* 57. __NR_setpgid */ __RSC_setpgid, /* 58. __NR_ulimit */ __RSC_ulimit, /* 59. __NR_oldolduname */ __RSC_oldolduname, /* 60. __NR_umask */ __RSC_umask, /* 61. __NR_chroot */ __RSC_chroot, /* 62. __NR_ustat */ __RSC_ustat, /* 63. __NR_dup2 */ __RSC_dup2, /* 64. __NR_getppid */ __RSC_getppid, /* 65. __NR_getpgrp */ __RSC_getpgrp, /* 66. __NR_setsid */ __RSC_setsid, /* 67. __NR_sigaction */ __RSC_sigaction, /* 68. __NR_sgetmask */ __RSC_sgetmask, /* 69. __NR_ssetmask */ __RSC_ssetmask, /* 70. __NR_setreuid */ __RSC_setreuid, /* 71. __NR_setregid */ __RSC_setregid, /* 72. __NR_sigsuspend */ __RSC_sigsuspend, /* 73. __NR_sigpending */ __RSC_sigpending, /* 74. __NR_sethostname */ __RSC_sethostname, /* 75. __NR_setrlimit */ __RSC_setrlimit, /* 76. __NR_getrlimit */ __RSC_getrlimit, /* 77. __NR_getrusage */ __RSC_getrusage, /* 78. __NR_gettimeofday */ __RSC_gettimeofday, /* 79. __NR_settimeofday */ __RSC_settimeofday, /* 80. __NR_getgroups */ __RSC_getgroups, /* 81. __NR_setgroups */ __RSC_setgroups, /* 82. __NR_select */ __RSC_select, /* 83. __NR_symlink */ __RSC_symlink, /* 84. __NR_oldlstat */ __RSC_oldlstat, /* 85. __NR_readlink */ __RSC_readlink, /* 86. __NR_uselib */ __RSC_uselib, /* 87. __NR_swapon */ __RSC_swapon, /* 88. __NR_reboot */ __RSC_reboot, /* 89. __NR_readdir */ __RSC_readdir, /* 90. __NR_mmap */ __RSC_mmap, /* 91. __NR_munmap */ __RSC_munmap, /* 92. __NR_truncate */ __RSC_truncate, /* 93. __NR_ftruncate */ __RSC_ftruncate, /* 94. __NR_fchmod */ __RSC_fchmod, /* 95. __NR_fchown */ __RSC_fchown, /* 96. __NR_getpriority */ __RSC_getpriority, /* 97. __NR_setpriority */ __RSC_setpriority, /* 98. __NR_profil */ __RSC_profil, /* 99. __NR_statfs */ __RSC_statfs, /* 100. __NR_fstatfs */ __RSC_fstatfs, /* 101. __NR_ioperm */ __RSC_ioperm, /* 102. __NR_socketcall */ __RSC_socketcall, /* 103. __NR_syslog */ __RSC_syslog, /* 104. __NR_setitimer */ __RSC_setitimer, /* 105. __NR_getitimer */ __RSC_getitimer, /* 106. __NR_stat */ __RSC_stat, /* 107. __NR_lstat */ __RSC_lstat, /* 108. __NR_fstat */ __RSC_fstat, /* 109. __NR_olduname */ __RSC_olduname, /* 110. __NR_iopl */ __RSC_iopl, /* 111. __NR_vhangup */ __RSC_vhangup, /* 112. __NR_idle */ __RSC_idle, /* 113. __NR_vm86old */ __RSC_vm86old, /* 114. __NR_wait4 */ __RSC_wait4, /* 115. __NR_swapoff */ __RSC_swapoff, /* 116. __NR_sysinfo */ __RSC_sysinfo, /* 117. __NR_ipc */ __RSC_ipc, /* 118. __NR_fsync */ __RSC_fsync, /* 119. __NR_sigreturn */ __RSC_sigreturn, /* 120. __NR_clone */ __RSC_clone, /* 121. __NR_setdomainname */ __RSC_setdomainname, /* 122. __NR_uname */ __RSC_uname, /* 123. __NR_modify_ldt */ __RSC_modify_ldt, /* 124. __NR_adjtimex */ __RSC_adjtimex, /* 125. __NR_mprotect */ __RSC_mprotect, /* 126. __NR_sigprocmask */ __RSC_sigprocmask, /* 127. __NR_create_module */ __RSC_create_module, /* 128. __NR_init_module */ __RSC_init_module, /* 129. __NR_delete_module */ __RSC_delete_module, /* 130. __NR_get_kernel_syms */ __RSC_get_kernel_syms, /* 131. __NR_quotactl */ __RSC_quotactl, /* 132. __NR_getpgid */ __RSC_getpgid, /* 133. __NR_fchdir */ __RSC_fchdir, /* 134. __NR_bdflush */ __RSC_bdflush, /* 135. __NR_sysfs */ __RSC_sysfs, /* 136. __NR_personality */ __RSC_personality, /* 137. __NR_afs_syscall */ __RSC_afs_syscall, /* 138. __NR_setfsuid */ __RSC_setfsuid, /* 139. __NR_setfsgid */ __RSC_setfsgid, /* 140. __NR__llseek */ __RSC__llseek, /* 141. __NR_getdents */ __RSC_getdents, /* 142. __NR__newselect */ __RSC__newselect, /* 143. __NR_flock */ __RSC_flock, /* 144. __NR_msync */ __RSC_msync, /* 145. __NR_readv */ __RSC_readv, /* 146. __NR_writev */ __RSC_writev, /* 147. __NR_getsid */ __RSC_getsid, /* 148. __NR_fdatasync */ __RSC_fdatasync, /* 149. __NR__sysctl */ __RSC__sysctl, /* 150. __NR_mlock */ __RSC_mlock, /* 151. __NR_munlock */ __RSC_munlock, /* 152. __NR_mlockall */ __RSC_mlockall, /* 153. __NR_munlockall */ __RSC_munlockall, /* 154. __NR_sched_setparam */ __RSC_sched_setparam, /* 155. __NR_sched_getparam */ __RSC_sched_getparam, /* 156. __NR_sched_setscheduler */ __RSC_sched_setscheduler, /* 157. __NR_sched_getscheduler */ __RSC_sched_getscheduler, /* 158. __NR_sched_yield */ __RSC_sched_yield, /* 159. __NR_sched_get_priority_max */ __RSC_sched_get_priority_max, /* 160. __NR_sched_get_priority_min */ __RSC_sched_get_priority_min, /* 161. __NR_sched_rr_get_interval */ __RSC_sched_rr_get_interval, /* 162. __NR_nanosleep */ __RSC_nanosleep, /* 163. __NR_mremap */ __RSC_mremap, /* 164. __NR_setresuid */ __RSC_setresuid, /* 165. __NR_getresuid */ __RSC_getresuid, /* 166. __NR_vm86 */ __RSC_vm86, /* 167. __NR_query_module */ __RSC_query_module, /* 168. __NR_poll */ __RSC_poll, /* 169. __NR_nfsservctl */ __RSC_nfsservctl, /* 170. __NR_setresgid */ __RSC_setresgid, /* 171. __NR_getresgid */ __RSC_getresgid, /* 172. __NR_prctl */ __RSC_prctl, /* 173. __NR_rt_sigreturn */ __RSC_rt_sigreturn, /* 174. __NR_rt_sigaction */ __RSC_rt_sigaction, /* 175. __NR_rt_sigprocmask */ __RSC_rt_sigprocmask, /* 176. __NR_rt_sigpending */ __RSC_rt_sigpending, /* 177. __NR_rt_sigtimedwait */ __RSC_rt_sigtimedwait, /* 178. __NR_rt_sigqueueinfo */ __RSC_rt_sigqueueinfo, /* 179. __NR_rt_sigsuspend */ __RSC_rt_sigsuspend, /* 180. __NR_pread64 */ __RSC_pread64, /* 181. __NR_pwrite64 */ __RSC_pwrite64, /* 182. __NR_chown */ __RSC_chown, /* 183. __NR_getcwd */ __RSC_getcwd, /* 184. __NR_capget */ __RSC_capget, /* 185. __NR_capset */ __RSC_capset, /* 186. __NR_sigaltstack */ __RSC_sigaltstack, /* 187. __NR_sendfile */ __RSC_sendfile, /* 188. __NR_getpmsg */ __RSC_getpmsg, /* 189. __NR_putpmsg */ __RSC_putpmsg, /* 190. __NR_vfork */ __RSC_vfork, /* 191. __NR_ugetrlimit */ __RSC_ugetrlimit, /* 192. __NR_mmap2 */ __RSC_mmap2, /* 193. __NR_truncate64 */ __RSC_truncate64, /* 194. __NR_ftruncate64 */ __RSC_ftruncate64, /* 195. __NR_stat64 */ __RSC_stat64, /* 196. __NR_lstat64 */ __RSC_lstat64, /* 197. __NR_fstat64 */ __RSC_fstat64, /* 198. __NR_lchown32 */ __RSC_lchown32, /* 199. __NR_getuid32 */ __RSC_getuid32, /* 200. __NR_getgid32 */ __RSC_getgid32, /* 201. __NR_geteuid32 */ __RSC_geteuid32, /* 202. __NR_getegid32 */ __RSC_getegid32, /* 203. __NR_setreuid32 */ __RSC_setreuid32, /* 204. __NR_setregid32 */ __RSC_setregid32, /* 205. __NR_getgroups32 */ __RSC_getgroups32, /* 206. __NR_setgroups32 */ __RSC_setgroups32, /* 207. __NR_fchown32 */ __RSC_fchown32, /* 208. __NR_setresuid32 */ __RSC_setresuid32, /* 209. __NR_getresuid32 */ __RSC_getresuid32, /* 210. __NR_setresgid32 */ __RSC_setresgid32, /* 211. __NR_getresgid32 */ __RSC_getresgid32, /* 212. __NR_chown32 */ __RSC_chown32, /* 213. __NR_setuid32 */ __RSC_setuid32, /* 214. __NR_setgid32 */ __RSC_setgid32, /* 215. __NR_setfsuid32 */ __RSC_setfsuid32, /* 216. __NR_setfsgid32 */ __RSC_setfsgid32, /* 217. __NR_pivot_root */ __RSC_pivot_root, /* 218. __NR_mincore */ __RSC_mincore, /* 219. __NR_madvise1 */ __RSC_madvise1, /* 220. __NR_getdents64 */ __RSC_getdents64, /* 221. __NR_fcntl64 */ __RSC_fcntl64, /* 222. NOT USED */ __RSC_ERROR, /* 223. NOT USED */ __RSC_ERROR, /* 224. __NR_gettid */ __RSC_gettid, /* 225. __NR_readahead */ __RSC_readahead, /* 226. __NR_setxattr */ __RSC_setxattr, /* 227. __NR_lsetxattr */ __RSC_lsetxattr, /* 228. __NR_fsetxattr */ __RSC_fsetxattr, /* 229. __NR_getxattr */ __RSC_getxattr, /* 230. __NR_lgetxattr */ __RSC_lgetxattr, /* 231. __NR_fgetxattr */ __RSC_fgetxattr, /* 232. __NR_listxattr */ __RSC_listxattr, /* 233. __NR_llistxattr */ __RSC_llistxattr, /* 234. __NR_flistxattr */ __RSC_flistxattr, /* 235. __NR_removexattr */ __RSC_removexattr, /* 236. __NR_lremovexattr */ __RSC_lremovexattr, /* 237. __NR_fremovexattr */ __RSC_fremovexattr, /* 238. __NR_tkill */ __RSC_tkill, /* 239. __NR_sendfile64 */ __RSC_sendfile64, /* 240. __NR_futex */ __RSC_futex, /* 241. __NR_sched_setaffinity */ __RSC_sched_setaffinity, /* 242. __NR_sched_getaffinity */ __RSC_sched_getaffinity, /* 243. __NR_set_thread_area */ __RSC_set_thread_area, /* 244. __NR_get_thread_area */ __RSC_get_thread_area, /* 245. __NR_io_setup */ __RSC_io_setup, /* 246. __NR_io_destroy */ __RSC_io_destroy, /* 247. __NR_io_getevents */ __RSC_io_getevents, /* 248. __NR_io_submit */ __RSC_io_submit, /* 249. __NR_io_cancel */ __RSC_io_cancel, /* 250. __NR_fadvise64 */ __RSC_fadvise64, /* 251. NOT USED */ __RSC_ERROR, /* 252. __NR_exit_group */ __RSC_exit_group, /* 253. __NR_lookup_dcookie */ __RSC_lookup_dcookie, /* 254. __NR_epoll_create */ __RSC_epoll_create, /* 255. __NR_epoll_ctl */ __RSC_epoll_ctl, /* 256. __NR_epoll_wait */ __RSC_epoll_wait, /* 257. __NR_remap_file_pages */ __RSC_remap_file_pages, /* 258. __NR_set_tid_address */ __RSC_set_tid_address, /* 259. __NR_timer_create */ __RSC_timer_create, /* 260. __NR_timer_settime */ __RSC_timer_settime, /* 261. __NR_timer_gettime */ __RSC_timer_gettime, /* 262. __NR_timer_getoverrun */ __RSC_timer_getoverrun, /* 263. __NR_timer_delete */ __RSC_timer_delete, /* 264. __NR_clock_settime */ __RSC_clock_settime, /* 265. __NR_clock_gettime */ __RSC_clock_gettime, /* 266. __NR_clock_getres */ __RSC_clock_getres, /* 267. __NR_clock_nanosleep */ __RSC_clock_nanosleep, /* 268. __NR_statfs64 */ __RSC_statfs64, /* 269. __NR_fstatfs64 */ __RSC_fstatfs64, /* 270. __NR_tgkill */ __RSC_tgkill, /* 271. __NR_utimes */ __RSC_utimes, /* 272. __NR_fadvise64_64 */ __RSC_fadvise64_64, /* 273. __NR_vserver */ __RSC_vserver, /* 274. __NR_mbind */ __RSC_mbind, /* 275. __NR_get_mempolicy */ __RSC_get_mempolicy, /* 276. __NR_set_mempolicy */ __RSC_set_mempolicy, /* 277. __NR_mq_open */ __RSC_mq_open, /* 278. __NR_mq_unlink */ __RSC_mq_unlink, /* 279. __NR_mq_timedsend */ __RSC_mq_timedsend, /* 280. __NR_mq_timedreceive */ __RSC_mq_timedreceive, /* 281. __NR_mq_notify */ __RSC_mq_notify, /* 282. __NR_mq_getsetattr */ __RSC_mq_getsetattr, /* 283. __NR_sys_kexec_load */ __RSC_sys_kexec_load, /* 284. __NR_waitid */ __RSC_waitid, /* 285. NOT USED */ __RSC_ERROR, /* 286. __NR_add_key */ __RSC_add_key, /* 287. __NR_request_key */ __RSC_request_key, /* 288. __NR_keyctl */ __RSC_keyctl }; #define X86_64_TO_RSC_SIZE ((sizeof(x86_64_to_rsc))/(sizeof(enum rsc_constant))) enum rsc_constant x86_64_to_rsc[] = { /* 0. __NR_read */ __RSC_read, /* 1. __NR_write */ __RSC_write, /* 2. __NR_open */ __RSC_open, /* 3. __NR_close */ __RSC_close, /* 4. __NR_stat */ __RSC_stat, /* 5. __NR_fstat */ __RSC_fstat, /* 6. __NR_lstat */ __RSC_lstat, /* 7. __NR_poll */ __RSC_poll, /* 8. __NR_lseek */ __RSC_lseek, /* 9. __NR_mmap */ __RSC_mmap, /* 10. __NR_mprotect */ __RSC_mprotect, /* 11. __NR_munmap */ __RSC_munmap, /* 12. __NR_brk */ __RSC_brk, /* 13. __NR_rt_sigaction */ __RSC_rt_sigaction, /* 14. __NR_rt_sigprocmask */ __RSC_rt_sigprocmask, /* 15. __NR_rt_sigreturn */ __RSC_rt_sigreturn, /* 16. __NR_ioctl */ __RSC_ioctl, /* 17. __NR_pread64 */ __RSC_pread64, /* 18. __NR_pwrite64 */ __RSC_pwrite64, /* 19. __NR_readv */ __RSC_readv, /* 20. __NR_writev */ __RSC_writev, /* 21. __NR_access */ __RSC_access, /* 22. __NR_pipe */ __RSC_pipe, /* 23. __NR_select */ __RSC_select, /* 24. __NR_sched_yield */ __RSC_sched_yield, /* 25. __NR_mremap */ __RSC_mremap, /* 26. __NR_msync */ __RSC_msync, /* 27. __NR_mincore */ __RSC_mincore, /* 28. __NR_madvise */ __RSC_madvise, /* 29. __NR_shmget */ __RSC_shmget, /* 30. __NR_shmat */ __RSC_shmat, /* 31. __NR_shmctl */ __RSC_shmctl, /* 32. __NR_dup */ __RSC_dup, /* 33. __NR_dup2 */ __RSC_dup2, /* 34. __NR_pause */ __RSC_pause, /* 35. __NR_nanosleep */ __RSC_nanosleep, /* 36. __NR_getitimer */ __RSC_getitimer, /* 37. __NR_alarm */ __RSC_alarm, /* 38. __NR_setitimer */ __RSC_setitimer, /* 39. __NR_getpid */ __RSC_getpid, /* 40. __NR_sendfile */ __RSC_sendfile, /* 41. __NR_socket */ __RSC_socket, /* 42. __NR_connect */ __RSC_connect, /* 43. __NR_accept */ __RSC_accept, /* 44. __NR_sendto */ __RSC_sendto, /* 45. __NR_recvfrom */ __RSC_recvfrom, /* 46. __NR_sendmsg */ __RSC_sendmsg, /* 47. __NR_recvmsg */ __RSC_recvmsg, /* 48. __NR_shutdown */ __RSC_shutdown, /* 49. __NR_bind */ __RSC_bind, /* 50. __NR_listen */ __RSC_listen, /* 51. __NR_getsockname */ __RSC_getsockname, /* 52. __NR_getpeername */ __RSC_getpeername, /* 53. __NR_socketpair */ __RSC_socketpair, /* 54. __NR_setsockopt */ __RSC_setsockopt, /* 55. __NR_getsockopt */ __RSC_getsockopt, /* 56. __NR_clone */ __RSC_clone, /* 57. __NR_fork */ __RSC_fork, /* 58. __NR_vfork */ __RSC_vfork, /* 59. __NR_execve */ __RSC_execve, /* 60. __NR_exit */ __RSC_exit, /* 61. __NR_wait4 */ __RSC_wait4, /* 62. __NR_kill */ __RSC_kill, /* 63. __NR_uname */ __RSC_uname, /* 64. __NR_semget */ __RSC_semget, /* 65. __NR_semop */ __RSC_semop, /* 66. __NR_semctl */ __RSC_semctl, /* 67. __NR_shmdt */ __RSC_shmdt, /* 68. __NR_msgget */ __RSC_msgget, /* 69. __NR_msgsnd */ __RSC_msgsnd, /* 70. __NR_msgrcv */ __RSC_msgrcv, /* 71. __NR_msgctl */ __RSC_msgctl, /* 72. __NR_fcntl */ __RSC_fcntl, /* 73. __NR_flock */ __RSC_flock, /* 74. __NR_fsync */ __RSC_fsync, /* 75. __NR_fdatasync */ __RSC_fdatasync, /* 76. __NR_truncate */ __RSC_truncate, /* 77. __NR_ftruncate */ __RSC_ftruncate, /* 78. __NR_getdents */ __RSC_getdents, /* 79. __NR_getcwd */ __RSC_getcwd, /* 80. __NR_chdir */ __RSC_chdir, /* 81. __NR_fchdir */ __RSC_fchdir, /* 82. __NR_rename */ __RSC_rename, /* 83. __NR_mkdir */ __RSC_mkdir, /* 84. __NR_rmdir */ __RSC_rmdir, /* 85. __NR_creat */ __RSC_creat, /* 86. __NR_link */ __RSC_link, /* 87. __NR_unlink */ __RSC_unlink, /* 88. __NR_symlink */ __RSC_symlink, /* 89. __NR_readlink */ __RSC_readlink, /* 90. __NR_chmod */ __RSC_chmod, /* 91. __NR_fchmod */ __RSC_fchmod, /* 92. __NR_chown */ __RSC_chown, /* 93. __NR_fchown */ __RSC_fchown, /* 94. __NR_lchown */ __RSC_lchown, /* 95. __NR_umask */ __RSC_umask, /* 96. __NR_gettimeofday */ __RSC_gettimeofday, /* 97. __NR_getrlimit */ __RSC_getrlimit, /* 98. __NR_getrusage */ __RSC_getrusage, /* 99. __NR_sysinfo */ __RSC_sysinfo, /* 100. __NR_times */ __RSC_times, /* 101. __NR_ptrace */ __RSC_ptrace, /* 102. __NR_getuid */ __RSC_getuid, /* 103. __NR_syslog */ __RSC_syslog, /* 104. __NR_getgid */ __RSC_getgid, /* 105. __NR_setuid */ __RSC_setuid, /* 106. __NR_setgid */ __RSC_setgid, /* 107. __NR_geteuid */ __RSC_geteuid, /* 108. __NR_getegid */ __RSC_getegid, /* 109. __NR_setpgid */ __RSC_setpgid, /* 110. __NR_getppid */ __RSC_getppid, /* 111. __NR_getpgrp */ __RSC_getpgrp, /* 112. __NR_setsid */ __RSC_setsid, /* 113. __NR_setreuid */ __RSC_setreuid, /* 114. __NR_setregid */ __RSC_setregid, /* 115. __NR_getgroups */ __RSC_getgroups, /* 116. __NR_setgroups */ __RSC_setgroups, /* 117. __NR_setresuid */ __RSC_setresuid, /* 118. __NR_getresuid */ __RSC_getresuid, /* 119. __NR_setresgid */ __RSC_setresgid, /* 120. __NR_getresgid */ __RSC_getresgid, /* 121. __NR_getpgid */ __RSC_getpgid, /* 122. __NR_setfsuid */ __RSC_setfsuid, /* 123. __NR_setfsgid */ __RSC_setfsgid, /* 124. __NR_getsid */ __RSC_getsid, /* 125. __NR_capget */ __RSC_capget, /* 126. __NR_capset */ __RSC_capset, /* 127. __NR_rt_sigpending */ __RSC_rt_sigpending, /* 128. __NR_rt_sigtimedwait */ __RSC_rt_sigtimedwait, /* 129. __NR_rt_sigqueueinfo */ __RSC_rt_sigqueueinfo, /* 130. __NR_rt_sigsuspend */ __RSC_rt_sigsuspend, /* 131. __NR_sigaltstack */ __RSC_sigaltstack, /* 132. __NR_utime */ __RSC_utime, /* 133. __NR_mknod */ __RSC_mknod, /* 134. __NR_uselib */ __RSC_uselib, /* 135. __NR_personality */ __RSC_personality, /* 136. __NR_ustat */ __RSC_ustat, /* 137. __NR_statfs */ __RSC_statfs, /* 138. __NR_fstatfs */ __RSC_fstatfs, /* 139. __NR_sysfs */ __RSC_sysfs, /* 140. __NR_getpriority */ __RSC_getpriority, /* 141. __NR_setpriority */ __RSC_setpriority, /* 142. __NR_sched_setparam */ __RSC_sched_setparam, /* 143. __NR_sched_getparam */ __RSC_sched_getparam, /* 144. __NR_sched_setscheduler */ __RSC_sched_setscheduler, /* 145. __NR_sched_getscheduler */ __RSC_sched_getscheduler, /* 146. __NR_sched_get_priority_max */ __RSC_sched_get_priority_max, /* 147. __NR_sched_get_priority_min */ __RSC_sched_get_priority_min, /* 148. __NR_sched_rr_get_interval */ __RSC_sched_rr_get_interval, /* 149. __NR_mlock */ __RSC_mlock, /* 150. __NR_munlock */ __RSC_munlock, /* 151. __NR_mlockall */ __RSC_mlockall, /* 152. __NR_munlockall */ __RSC_munlockall, /* 153. __NR_vhangup */ __RSC_vhangup, /* 154. __NR_modify_ldt */ __RSC_modify_ldt, /* 155. __NR_pivot_root */ __RSC_pivot_root, /* 156. __NR__sysctl */ __RSC__sysctl, /* 157. __NR_prctl */ __RSC_prctl, /* 158. __NR_arch_prctl */ __RSC_arch_prctl, /* 159. __NR_adjtimex */ __RSC_adjtimex, /* 160. __NR_setrlimit */ __RSC_setrlimit, /* 161. __NR_chroot */ __RSC_chroot, /* 162. __NR_sync */ __RSC_sync, /* 163. __NR_acct */ __RSC_acct, /* 164. __NR_settimeofday */ __RSC_settimeofday, /* 165. __NR_mount */ __RSC_mount, /* 166. __NR_umount2 */ __RSC_umount2, /* 167. __NR_swapon */ __RSC_swapon, /* 168. __NR_swapoff */ __RSC_swapoff, /* 169. __NR_reboot */ __RSC_reboot, /* 170. __NR_sethostname */ __RSC_sethostname, /* 171. __NR_setdomainname */ __RSC_setdomainname, /* 172. __NR_iopl */ __RSC_iopl, /* 173. __NR_ioperm */ __RSC_ioperm, /* 174. __NR_create_module */ __RSC_create_module, /* 175. __NR_init_module */ __RSC_init_module, /* 176. __NR_delete_module */ __RSC_delete_module, /* 177. __NR_get_kernel_syms */ __RSC_get_kernel_syms, /* 178. __NR_query_module */ __RSC_query_module, /* 179. __NR_quotactl */ __RSC_quotactl, /* 180. __NR_nfsservctl */ __RSC_nfsservctl, /* 181. __NR_getpmsg */ __RSC_getpmsg, /* 182. __NR_putpmsg */ __RSC_putpmsg, /* 183. __NR_afs_syscall */ __RSC_afs_syscall, /* 184. __NR_tuxcall */ __RSC_tuxcall, /* 185. __NR_security */ __RSC_security, /* 186. __NR_gettid */ __RSC_gettid, /* 187. __NR_readahead */ __RSC_readahead, /* 188. __NR_setxattr */ __RSC_setxattr, /* 189. __NR_lsetxattr */ __RSC_lsetxattr, /* 190. __NR_fsetxattr */ __RSC_fsetxattr, /* 191. __NR_getxattr */ __RSC_getxattr, /* 192. __NR_lgetxattr */ __RSC_lgetxattr, /* 193. __NR_fgetxattr */ __RSC_fgetxattr, /* 194. __NR_listxattr */ __RSC_listxattr, /* 195. __NR_llistxattr */ __RSC_llistxattr, /* 196. __NR_flistxattr */ __RSC_flistxattr, /* 197. __NR_removexattr */ __RSC_removexattr, /* 198. __NR_lremovexattr */ __RSC_lremovexattr, /* 199. __NR_fremovexattr */ __RSC_fremovexattr, /* 200. __NR_tkill */ __RSC_tkill, /* 201. __NR_time */ __RSC_time, /* 202. __NR_futex */ __RSC_futex, /* 203. __NR_sched_setaffinity */ __RSC_sched_setaffinity, /* 204. __NR_sched_getaffinity */ __RSC_sched_getaffinity, /* 205. __NR_set_thread_area */ __RSC_set_thread_area, /* 206. __NR_io_setup */ __RSC_io_setup, /* 207. __NR_io_destroy */ __RSC_io_destroy, /* 208. __NR_io_getevents */ __RSC_io_getevents, /* 209. __NR_io_submit */ __RSC_io_submit, /* 210. __NR_io_cancel */ __RSC_io_cancel, /* 211. __NR_get_thread_area */ __RSC_get_thread_area, /* 212. __NR_lookup_dcookie */ __RSC_lookup_dcookie, /* 213. __NR_epoll_create */ __RSC_epoll_create, /* 214. __NR_epoll_ctl_old */ __RSC_epoll_ctl_old, /* 215. __NR_epoll_wait_old */ __RSC_epoll_wait_old, /* 216. __NR_remap_file_pages */ __RSC_remap_file_pages, /* 217. __NR_getdents64 */ __RSC_getdents64, /* 218. __NR_set_tid_address */ __RSC_set_tid_address, /* 219. __NR_restart_syscall */ __RSC_restart_syscall, /* 220. __NR_semtimedop */ __RSC_semtimedop, /* 221. __NR_fadvise64 */ __RSC_fadvise64, /* 222. __NR_timer_create */ __RSC_timer_create, /* 223. __NR_timer_settime */ __RSC_timer_settime, /* 224. __NR_timer_gettime */ __RSC_timer_gettime, /* 225. __NR_timer_getoverrun */ __RSC_timer_getoverrun, /* 226. __NR_timer_delete */ __RSC_timer_delete, /* 227. __NR_clock_settime */ __RSC_clock_settime, /* 228. __NR_clock_gettime */ __RSC_clock_gettime, /* 229. __NR_clock_getres */ __RSC_clock_getres, /* 230. __NR_clock_nanosleep */ __RSC_clock_nanosleep, /* 231. __NR_exit_group */ __RSC_exit_group, /* 232. __NR_epoll_wait */ __RSC_epoll_wait, /* 233. __NR_epoll_ctl */ __RSC_epoll_ctl, /* 234. __NR_tgkill */ __RSC_tgkill, /* 235. __NR_utimes */ __RSC_utimes, /* 236. __NR_vserver */ __RSC_vserver, /* 237. __NR_mbind */ __RSC_mbind, /* 238. __NR_set_mempolicy */ __RSC_set_mempolicy, /* 239. __NR_get_mempolicy */ __RSC_get_mempolicy, /* 240. __NR_mq_open */ __RSC_mq_open, /* 241. __NR_mq_unlink */ __RSC_mq_unlink, /* 242. __NR_mq_timedsend */ __RSC_mq_timedsend, /* 243. __NR_mq_timedreceive */ __RSC_mq_timedreceive, /* 244. __NR_mq_notify */ __RSC_mq_notify, /* 245. __NR_mq_getsetattr */ __RSC_mq_getsetattr, /* 246. __NR_kexec_load */ __RSC_kexec_load, /* 247. __NR_waitid */ __RSC_waitid, /* 248. __NR_add_key */ __RSC_add_key, /* 249. __NR_request_key */ __RSC_request_key, /* 250. __NR_keyctl */ __RSC_keyctl }; #define PPC_TO_RSC_SIZE ((sizeof(ppc_to_rsc))/(sizeof(enum rsc_constant))) enum rsc_constant ppc_to_rsc[] = { /* 0. __NR_restart_syscall */ __RSC_restart_syscall, /* 1. __NR_exit */ __RSC_exit, /* 2. __NR_fork */ __RSC_fork, /* 3. __NR_read */ __RSC_read, /* 4. __NR_write */ __RSC_write, /* 5. __NR_open */ __RSC_open, /* 6. __NR_close */ __RSC_close, /* 7. __NR_waitpid */ __RSC_waitpid, /* 8. __NR_creat */ __RSC_creat, /* 9. __NR_link */ __RSC_link, /* 10. __NR_unlink */ __RSC_unlink, /* 11. __NR_execve */ __RSC_execve, /* 12. __NR_chdir */ __RSC_chdir, /* 13. __NR_time */ __RSC_time, /* 14. __NR_mknod */ __RSC_mknod, /* 15. __NR_chmod */ __RSC_chmod, /* 16. __NR_lchown */ __RSC_lchown, /* 17. __NR_break */ __RSC_break, /* 18. __NR_oldstat */ __RSC_oldstat, /* 19. __NR_lseek */ __RSC_lseek, /* 20. __NR_getpid */ __RSC_getpid, /* 21. __NR_mount */ __RSC_mount, /* 22. __NR_umount */ __RSC_umount, /* 23. __NR_setuid */ __RSC_setuid, /* 24. __NR_getuid */ __RSC_getuid, /* 25. __NR_stime */ __RSC_stime, /* 26. __NR_ptrace */ __RSC_ptrace, /* 27. __NR_alarm */ __RSC_alarm, /* 28. __NR_oldfstat */ __RSC_oldfstat, /* 29. __NR_pause */ __RSC_pause, /* 30. __NR_utime */ __RSC_utime, /* 31. __NR_stty */ __RSC_stty, /* 32. __NR_gtty */ __RSC_gtty, /* 33. __NR_access */ __RSC_access, /* 34. __NR_nice */ __RSC_nice, /* 35. __NR_ftime */ __RSC_ftime, /* 36. __NR_sync */ __RSC_sync, /* 37. __NR_kill */ __RSC_kill, /* 38. __NR_rename */ __RSC_rename, /* 39. __NR_mkdir */ __RSC_mkdir, /* 40. __NR_rmdir */ __RSC_rmdir, /* 41. __NR_dup */ __RSC_dup, /* 42. __NR_pipe */ __RSC_pipe, /* 43. __NR_times */ __RSC_times, /* 44. __NR_prof */ __RSC_prof, /* 45. __NR_brk */ __RSC_brk, /* 46. __NR_setgid */ __RSC_setgid, /* 47. __NR_getgid */ __RSC_getgid, /* 48. __NR_signal */ __RSC_signal, /* 49. __NR_geteuid */ __RSC_geteuid, /* 50. __NR_getegid */ __RSC_getegid, /* 51. __NR_acct */ __RSC_acct, /* 52. __NR_umount2 */ __RSC_umount2, /* 53. __NR_lock */ __RSC_lock, /* 54. __NR_ioctl */ __RSC_ioctl, /* 55. __NR_fcntl */ __RSC_fcntl, /* 56. __NR_mpx */ __RSC_mpx, /* 57. __NR_setpgid */ __RSC_setpgid, /* 58. __NR_ulimit */ __RSC_ulimit, /* 59. __NR_oldolduname */ __RSC_oldolduname, /* 60. __NR_umask */ __RSC_umask, /* 61. __NR_chroot */ __RSC_chroot, /* 62. __NR_ustat */ __RSC_ustat, /* 63. __NR_dup2 */ __RSC_dup2, /* 64. __NR_getppid */ __RSC_getppid, /* 65. __NR_getpgrp */ __RSC_getpgrp, /* 66. __NR_setsid */ __RSC_setsid, /* 67. __NR_sigaction */ __RSC_sigaction, /* 68. __NR_sgetmask */ __RSC_sgetmask, /* 69. __NR_ssetmask */ __RSC_ssetmask, /* 70. __NR_setreuid */ __RSC_setreuid, /* 71. __NR_setregid */ __RSC_setregid, /* 72. __NR_sigsuspend */ __RSC_sigsuspend, /* 73. __NR_sigpending */ __RSC_sigpending, /* 74. __NR_sethostname */ __RSC_sethostname, /* 75. __NR_setrlimit */ __RSC_setrlimit, /* 76. __NR_getrlimit */ __RSC_getrlimit, /* 77. __NR_getrusage */ __RSC_getrusage, /* 78. __NR_gettimeofday */ __RSC_gettimeofday, /* 79. __NR_settimeofday */ __RSC_settimeofday, /* 80. __NR_getgroups */ __RSC_getgroups, /* 81. __NR_setgroups */ __RSC_setgroups, /* 82. __NR_select */ __RSC_select, /* 83. __NR_symlink */ __RSC_symlink, /* 84. __NR_oldlstat */ __RSC_oldlstat, /* 85. __NR_readlink */ __RSC_readlink, /* 86. __NR_uselib */ __RSC_uselib, /* 87. __NR_swapon */ __RSC_swapon, /* 88. __NR_reboot */ __RSC_reboot, /* 89. __NR_readdir */ __RSC_readdir, /* 90. __NR_mmap */ __RSC_mmap, /* 91. __NR_munmap */ __RSC_munmap, /* 92. __NR_truncate */ __RSC_truncate, /* 93. __NR_ftruncate */ __RSC_ftruncate, /* 94. __NR_fchmod */ __RSC_fchmod, /* 95. __NR_fchown */ __RSC_fchown, /* 96. __NR_getpriority */ __RSC_getpriority, /* 97. __NR_setpriority */ __RSC_setpriority, /* 98. __NR_profil */ __RSC_profil, /* 99. __NR_statfs */ __RSC_statfs, /* 100. __NR_fstatfs */ __RSC_fstatfs, /* 101. __NR_ioperm */ __RSC_ioperm, /* 102. __NR_socketcall */ __RSC_socketcall, /* 103. __NR_syslog */ __RSC_syslog, /* 104. __NR_setitimer */ __RSC_setitimer, /* 105. __NR_getitimer */ __RSC_getitimer, /* 106. __NR_stat */ __RSC_stat, /* 107. __NR_lstat */ __RSC_lstat, /* 108. __NR_fstat */ __RSC_fstat, /* 109. __NR_olduname */ __RSC_olduname, /* 110. __NR_iopl */ __RSC_iopl, /* 111. __NR_vhangup */ __RSC_vhangup, /* 112. __NR_idle */ __RSC_idle, /* 113. __NR_vm86 */ __RSC_vm86, /* 114. __NR_wait4 */ __RSC_wait4, /* 115. __NR_swapoff */ __RSC_swapoff, /* 116. __NR_sysinfo */ __RSC_sysinfo, /* 117. __NR_ipc */ __RSC_ipc, /* 118. __NR_fsync */ __RSC_fsync, /* 119. __NR_sigreturn */ __RSC_sigreturn, /* 120. __NR_clone */ __RSC_clone, /* 121. __NR_setdomainname */ __RSC_setdomainname, /* 122. __NR_uname */ __RSC_uname, /* 123. __NR_modify_ldt */ __RSC_modify_ldt, /* 124. __NR_adjtimex */ __RSC_adjtimex, /* 125. __NR_mprotect */ __RSC_mprotect, /* 126. __NR_sigprocmask */ __RSC_sigprocmask, /* 127. __NR_create_module */ __RSC_create_module, /* 128. __NR_init_module */ __RSC_init_module, /* 129. __NR_delete_module */ __RSC_delete_module, /* 130. __NR_get_kernel_syms */ __RSC_get_kernel_syms, /* 131. __NR_quotactl */ __RSC_quotactl, /* 132. __NR_getpgid */ __RSC_getpgid, /* 133. __NR_fchdir */ __RSC_fchdir, /* 134. __NR_bdflush */ __RSC_bdflush, /* 135. __NR_sysfs */ __RSC_sysfs, /* 136. __NR_personality */ __RSC_personality, /* 137. __NR_afs_syscall */ __RSC_afs_syscall, /* 138. __NR_setfsuid */ __RSC_setfsuid, /* 139. __NR_setfsgid */ __RSC_setfsgid, /* 140. __NR__llseek */ __RSC__llseek, /* 141. __NR_getdents */ __RSC_getdents, /* 142. __NR__newselect */ __RSC__newselect, /* 143. __NR_flock */ __RSC_flock, /* 144. __NR_msync */ __RSC_msync, /* 145. __NR_readv */ __RSC_readv, /* 146. __NR_writev */ __RSC_writev, /* 147. __NR_getsid */ __RSC_getsid, /* 148. __NR_fdatasync */ __RSC_fdatasync, /* 149. __NR__sysctl */ __RSC__sysctl, /* 150. __NR_mlock */ __RSC_mlock, /* 151. __NR_munlock */ __RSC_munlock, /* 152. __NR_mlockall */ __RSC_mlockall, /* 153. __NR_munlockall */ __RSC_munlockall, /* 154. __NR_sched_setparam */ __RSC_sched_setparam, /* 155. __NR_sched_getparam */ __RSC_sched_getparam, /* 156. __NR_sched_setscheduler */ __RSC_sched_setscheduler, /* 157. __NR_sched_getscheduler */ __RSC_sched_getscheduler, /* 158. __NR_sched_yield */ __RSC_sched_yield, /* 159. __NR_sched_get_priority_max */ __RSC_sched_get_priority_max, /* 160. __NR_sched_get_priority_min */ __RSC_sched_get_priority_min, /* 161. __NR_sched_rr_get_interval */ __RSC_sched_rr_get_interval, /* 162. __NR_nanosleep */ __RSC_nanosleep, /* 163. __NR_mremap */ __RSC_mremap, /* 164. __NR_setresuid */ __RSC_setresuid, /* 165. __NR_getresuid */ __RSC_getresuid, /* 166. __NR_query_module */ __RSC_query_module, /* 167. __NR_poll */ __RSC_poll, /* 168. __NR_nfsservctl */ __RSC_nfsservctl, /* 169. __NR_setresgid */ __RSC_setresgid, /* 170. __NR_getresgid */ __RSC_getresgid, /* 171. __NR_prctl */ __RSC_prctl, /* 172. __NR_rt_sigreturn */ __RSC_rt_sigreturn, /* 173. __NR_rt_sigaction */ __RSC_rt_sigaction, /* 174. __NR_rt_sigprocmask */ __RSC_rt_sigprocmask, /* 175. __NR_rt_sigpending */ __RSC_rt_sigpending, /* 176. __NR_rt_sigtimedwait */ __RSC_rt_sigtimedwait, /* 177. __NR_rt_sigqueueinfo */ __RSC_rt_sigqueueinfo, /* 178. __NR_rt_sigsuspend */ __RSC_rt_sigsuspend, /* 179. __NR_pread64 */ __RSC_pread64, /* 180. __NR_pwrite64 */ __RSC_pwrite64, /* 181. __NR_chown */ __RSC_chown, /* 182. __NR_getcwd */ __RSC_getcwd, /* 183. __NR_capget */ __RSC_capget, /* 184. __NR_capset */ __RSC_capset, /* 185. __NR_sigaltstack */ __RSC_sigaltstack, /* 186. __NR_sendfile */ __RSC_sendfile, /* 187. __NR_getpmsg */ __RSC_getpmsg, /* 188. __NR_putpmsg */ __RSC_putpmsg, /* 189. __NR_vfork */ __RSC_vfork, /* 190. __NR_ugetrlimit */ __RSC_ugetrlimit, /* 191. __NR_readahead */ __RSC_readahead, /* 192. __NR_mmap2 */ __RSC_mmap2, /* 193. __NR_truncate64 */ __RSC_truncate64, /* 194. __NR_ftruncate64 */ __RSC_ftruncate64, /* 195. __NR_stat64 */ __RSC_stat64, /* 196. __NR_lstat64 */ __RSC_lstat64, /* 197. __NR_fstat64 */ __RSC_fstat64, /* 198. __NR_pciconfig_read */ __RSC_pciconfig_read, /* 199. __NR_pciconfig_write */ __RSC_pciconfig_write, /* 200. __NR_pciconfig_iobase */ __RSC_pciconfig_iobase, /* 201. __NR_multiplexer */ __RSC_multiplexer, /* 202. __NR_getdents64 */ __RSC_getdents64, /* 203. __NR_pivot_root */ __RSC_pivot_root, /* 204. __NR_fcntl64 */ __RSC_fcntl64, /* 205. __NR_madvise */ __RSC_madvise, /* 206. __NR_mincore */ __RSC_mincore, /* 207. __NR_gettid */ __RSC_gettid, /* 208. __NR_tkill */ __RSC_tkill, /* 209. __NR_setxattr */ __RSC_setxattr, /* 210. __NR_lsetxattr */ __RSC_lsetxattr, /* 211. __NR_fsetxattr */ __RSC_fsetxattr, /* 212. __NR_getxattr */ __RSC_getxattr, /* 213. __NR_lgetxattr */ __RSC_lgetxattr, /* 214. __NR_fgetxattr */ __RSC_fgetxattr, /* 215. __NR_listxattr */ __RSC_listxattr, /* 216. __NR_llistxattr */ __RSC_llistxattr, /* 217. __NR_flistxattr */ __RSC_flistxattr, /* 218. __NR_removexattr */ __RSC_removexattr, /* 219. __NR_lremovexattr */ __RSC_lremovexattr, /* 220. __NR_fremovexattr */ __RSC_fremovexattr, /* 221. __NR_futex */ __RSC_futex, /* 222. __NR_sched_setaffinity */ __RSC_sched_setaffinity, /* 223. __NR_sched_getaffinity */ __RSC_sched_getaffinity, /* 224. NOT USED */ __RSC_ERROR, /* 225. __NR_tuxcall */ __RSC_tuxcall, /* 226. __NR_sendfile64 */ __RSC_sendfile64, /* 227. __NR_io_setup */ __RSC_io_setup, /* 228. __NR_io_destroy */ __RSC_io_destroy, /* 229. __NR_io_getevents */ __RSC_io_getevents, /* 230. __NR_io_submit */ __RSC_io_submit, /* 231. __NR_io_cancel */ __RSC_io_cancel, /* 232. __NR_set_tid_address */ __RSC_set_tid_address, /* 233. __NR_fadvise64 */ __RSC_fadvise64, /* 234. __NR_exit_group */ __RSC_exit_group, /* 235. __NR_lookup_dcookie */ __RSC_lookup_dcookie, /* 236. __NR_epoll_create */ __RSC_epoll_create, /* 237. __NR_epoll_ctl */ __RSC_epoll_ctl, /* 238. __NR_epoll_wait */ __RSC_epoll_wait, /* 239. __NR_remap_file_pages */ __RSC_remap_file_pages, /* 240. __NR_timer_create */ __RSC_timer_create, /* 241. __NR_timer_settime */ __RSC_timer_settime, /* 242. __NR_timer_gettime */ __RSC_timer_gettime, /* 243. __NR_timer_getoverrun */ __RSC_timer_getoverrun, /* 244. __NR_timer_delete */ __RSC_timer_delete, /* 245. __NR_clock_settime */ __RSC_clock_settime, /* 246. __NR_clock_gettime */ __RSC_clock_gettime, /* 247. __NR_clock_getres */ __RSC_clock_getres, /* 248. __NR_clock_nanosleep */ __RSC_clock_nanosleep, /* 249. __NR_swapcontext */ __RSC_swapcontext, /* 250. __NR_tgkill */ __RSC_tgkill, /* 251. __NR_utimes */ __RSC_utimes, /* 252. __NR_statfs64 */ __RSC_statfs64, /* 253. __NR_fstatfs64 */ __RSC_fstatfs64, /* 254. __NR_fadvise64_64 */ __RSC_fadvise64_64 }; #endif /* __NR_TO_RSC_HEADER__ */ umview-0.8.2/um_rsc/librsc/src/include/rsc_to_nr.h0000644000175000017500000012736111753517212021250 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * rsc_to_nr.h: __RSC_* to __NR_* constants conversion header * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RSC_TO_NR_HEADER__ #define __RSC_TO_NR_HEADER__ #include #include #include "rsc_consts.h" struct nr_and_sys rsc_to_x86[] = { /* 0. __RSC__exit */ {NO_VALUE, NO_VALUE}, /* 1. __RSC__llseek */ {140, NO_VALUE}, /* 2. __RSC__newselect */ {142, NO_VALUE}, /* 3. __RSC__sysctl */ {149, NO_VALUE}, /* 4. __RSC_accept */ {102, SYS_ACCEPT}, /* 5. __RSC_access */ {33, NO_VALUE}, /* 6. __RSC_acct */ {51, NO_VALUE}, /* 7. __RSC_add_key */ {286, NO_VALUE}, /* 8. __RSC_adjtimex */ {124, NO_VALUE}, /* 9. __RSC_afs_syscall */ {137, NO_VALUE}, /* 10. __RSC_alarm */ {27, NO_VALUE}, /* 11. __RSC_arch_prctl */ {NO_VALUE, NO_VALUE}, /* 12. __RSC_bdflush */ {134, NO_VALUE}, /* 13. __RSC_bind */ {102, SYS_BIND}, /* 14. __RSC_break */ {17, NO_VALUE}, /* 15. __RSC_brk */ {45, NO_VALUE}, /* 16. __RSC_capget */ {184, NO_VALUE}, /* 17. __RSC_capset */ {185, NO_VALUE}, /* 18. __RSC_chdir */ {12, NO_VALUE}, /* 19. __RSC_chmod */ {15, NO_VALUE}, /* 20. __RSC_chown */ {182, NO_VALUE}, /* 21. __RSC_chown32 */ {212, NO_VALUE}, /* 22. __RSC_chroot */ {61, NO_VALUE}, /* 23. __RSC_clock_getres */ {266, NO_VALUE}, /* 24. __RSC_clock_gettime */ {265, NO_VALUE}, /* 25. __RSC_clock_nanosleep */ {267, NO_VALUE}, /* 26. __RSC_clock_settime */ {264, NO_VALUE}, /* 27. __RSC_clone */ {120, NO_VALUE}, /* 28. __RSC_close */ {6, NO_VALUE}, /* 29. __RSC_connect */ {102, SYS_CONNECT}, /* 30. __RSC_creat */ {8, NO_VALUE}, /* 31. __RSC_create_module */ {127, NO_VALUE}, /* 32. __RSC_delete_module */ {129, NO_VALUE}, /* 33. __RSC_dup */ {41, NO_VALUE}, /* 34. __RSC_dup2 */ {63, NO_VALUE}, /* 35. __RSC_epoll_create */ {254, NO_VALUE}, /* 36. __RSC_epoll_ctl */ {255, NO_VALUE}, /* 37. __RSC_epoll_ctl_old */ {NO_VALUE, NO_VALUE}, /* 38. __RSC_epoll_wait */ {256, NO_VALUE}, /* 39. __RSC_epoll_wait_old */ {NO_VALUE, NO_VALUE}, /* 40. __RSC_execve */ {11, NO_VALUE}, /* 41. __RSC_exit */ {1, NO_VALUE}, /* 42. __RSC_exit_group */ {252, NO_VALUE}, /* 43. __RSC_fadvise64 */ {250, NO_VALUE}, /* 44. __RSC_fadvise64_64 */ {272, NO_VALUE}, /* 45. __RSC_fchdir */ {133, NO_VALUE}, /* 46. __RSC_fchmod */ {94, NO_VALUE}, /* 47. __RSC_fchown */ {95, NO_VALUE}, /* 48. __RSC_fchown32 */ {207, NO_VALUE}, /* 49. __RSC_fcntl */ {55, NO_VALUE}, /* 50. __RSC_fcntl64 */ {221, NO_VALUE}, /* 51. __RSC_fdatasync */ {148, NO_VALUE}, /* 52. __RSC_fgetxattr */ {231, NO_VALUE}, /* 53. __RSC_flistxattr */ {234, NO_VALUE}, /* 54. __RSC_flock */ {143, NO_VALUE}, /* 55. __RSC_fork */ {2, NO_VALUE}, /* 56. __RSC_fremovexattr */ {237, NO_VALUE}, /* 57. __RSC_fsetxattr */ {228, NO_VALUE}, /* 58. __RSC_fstat */ {108, NO_VALUE}, /* 59. __RSC_fstat64 */ {197, NO_VALUE}, /* 60. __RSC_fstatfs */ {100, NO_VALUE}, /* 61. __RSC_fstatfs64 */ {269, NO_VALUE}, /* 62. __RSC_fsync */ {118, NO_VALUE}, /* 63. __RSC_ftime */ {35, NO_VALUE}, /* 64. __RSC_ftruncate */ {93, NO_VALUE}, /* 65. __RSC_ftruncate64 */ {194, NO_VALUE}, /* 66. __RSC_futex */ {240, NO_VALUE}, /* 67. __RSC_get_kernel_syms */ {130, NO_VALUE}, /* 68. __RSC_get_mempolicy */ {275, NO_VALUE}, /* 69. __RSC_get_thread_area */ {244, NO_VALUE}, /* 70. __RSC_getcwd */ {183, NO_VALUE}, /* 71. __RSC_getdents */ {141, NO_VALUE}, /* 72. __RSC_getdents64 */ {220, NO_VALUE}, /* 73. __RSC_getegid */ {50, NO_VALUE}, /* 74. __RSC_getegid32 */ {202, NO_VALUE}, /* 75. __RSC_geteuid */ {49, NO_VALUE}, /* 76. __RSC_geteuid32 */ {201, NO_VALUE}, /* 77. __RSC_getgid */ {47, NO_VALUE}, /* 78. __RSC_getgid32 */ {200, NO_VALUE}, /* 79. __RSC_getgroups */ {80, NO_VALUE}, /* 80. __RSC_getgroups32 */ {205, NO_VALUE}, /* 81. __RSC_getitimer */ {105, NO_VALUE}, /* 82. __RSC_getpeername */ {102, SYS_GETPEERNAME}, /* 83. __RSC_getpgid */ {132, NO_VALUE}, /* 84. __RSC_getpgrp */ {65, NO_VALUE}, /* 85. __RSC_getpid */ {20, NO_VALUE}, /* 86. __RSC_getpmsg */ {188, NO_VALUE}, /* 87. __RSC_getppid */ {64, NO_VALUE}, /* 88. __RSC_getpriority */ {96, NO_VALUE}, /* 89. __RSC_getresgid */ {171, NO_VALUE}, /* 90. __RSC_getresgid32 */ {211, NO_VALUE}, /* 91. __RSC_getresuid */ {165, NO_VALUE}, /* 92. __RSC_getresuid32 */ {209, NO_VALUE}, /* 93. __RSC_getrlimit */ {76, NO_VALUE}, /* 94. __RSC_getrusage */ {77, NO_VALUE}, /* 95. __RSC_getsid */ {147, NO_VALUE}, /* 96. __RSC_getsockname */ {102, SYS_GETSOCKNAME}, /* 97. __RSC_getsockopt */ {102, SYS_GETSOCKOPT}, /* 98. __RSC_gettid */ {224, NO_VALUE}, /* 99. __RSC_gettimeofday */ {78, NO_VALUE}, /* 100. __RSC_getuid */ {24, NO_VALUE}, /* 101. __RSC_getuid32 */ {199, NO_VALUE}, /* 102. __RSC_getxattr */ {229, NO_VALUE}, /* 103. __RSC_gtty */ {32, NO_VALUE}, /* 104. __RSC_idle */ {112, NO_VALUE}, /* 105. __RSC_init_module */ {128, NO_VALUE}, /* 106. __RSC_io_cancel */ {249, NO_VALUE}, /* 107. __RSC_io_destroy */ {246, NO_VALUE}, /* 108. __RSC_io_getevents */ {247, NO_VALUE}, /* 109. __RSC_io_setup */ {245, NO_VALUE}, /* 110. __RSC_io_submit */ {248, NO_VALUE}, /* 111. __RSC_ioctl */ {54, NO_VALUE}, /* 112. __RSC_ioperm */ {101, NO_VALUE}, /* 113. __RSC_iopl */ {110, NO_VALUE}, /* 114. __RSC_ipc */ {117, NO_VALUE}, /* 115. __RSC_kexec_load */ {NO_VALUE, NO_VALUE}, /* 116. __RSC_keyctl */ {288, NO_VALUE}, /* 117. __RSC_kill */ {37, NO_VALUE}, /* 118. __RSC_lchown */ {16, NO_VALUE}, /* 119. __RSC_lchown32 */ {198, NO_VALUE}, /* 120. __RSC_lgetxattr */ {230, NO_VALUE}, /* 121. __RSC_link */ {9, NO_VALUE}, /* 122. __RSC_listen */ {102, SYS_LISTEN}, /* 123. __RSC_listxattr */ {232, NO_VALUE}, /* 124. __RSC_llistxattr */ {233, NO_VALUE}, /* 125. __RSC_lock */ {53, NO_VALUE}, /* 126. __RSC_lookup_dcookie */ {253, NO_VALUE}, /* 127. __RSC_lremovexattr */ {236, NO_VALUE}, /* 128. __RSC_lseek */ {19, NO_VALUE}, /* 129. __RSC_lsetxattr */ {227, NO_VALUE}, /* 130. __RSC_lstat */ {107, NO_VALUE}, /* 131. __RSC_lstat64 */ {196, NO_VALUE}, /* 132. __RSC_madvise */ {219, NO_VALUE}, /* 133. __RSC_madvise1 */ {219, NO_VALUE}, /* 134. __RSC_mbind */ {274, NO_VALUE}, /* 135. __RSC_mincore */ {218, NO_VALUE}, /* 136. __RSC_mkdir */ {39, NO_VALUE}, /* 137. __RSC_mknod */ {14, NO_VALUE}, /* 138. __RSC_mlock */ {150, NO_VALUE}, /* 139. __RSC_mlockall */ {152, NO_VALUE}, /* 140. __RSC_mmap */ {90, NO_VALUE}, /* 141. __RSC_mmap2 */ {192, NO_VALUE}, /* 142. __RSC_modify_ldt */ {123, NO_VALUE}, /* 143. __RSC_mount */ {21, NO_VALUE}, /* 144. __RSC_mprotect */ {125, NO_VALUE}, /* 145. __RSC_mpx */ {56, NO_VALUE}, /* 146. __RSC_mq_getsetattr */ {282, NO_VALUE}, /* 147. __RSC_mq_notify */ {281, NO_VALUE}, /* 148. __RSC_mq_open */ {277, NO_VALUE}, /* 149. __RSC_mq_timedreceive */ {280, NO_VALUE}, /* 150. __RSC_mq_timedsend */ {279, NO_VALUE}, /* 151. __RSC_mq_unlink */ {278, NO_VALUE}, /* 152. __RSC_mremap */ {163, NO_VALUE}, /* 153. __RSC_msgctl */ {NO_VALUE, NO_VALUE}, /* 154. __RSC_msgget */ {NO_VALUE, NO_VALUE}, /* 155. __RSC_msgrcv */ {NO_VALUE, NO_VALUE}, /* 156. __RSC_msgsnd */ {NO_VALUE, NO_VALUE}, /* 157. __RSC_msync */ {144, NO_VALUE}, /* 158. __RSC_multiplexer */ {NO_VALUE, NO_VALUE}, /* 159. __RSC_munlock */ {151, NO_VALUE}, /* 160. __RSC_munlockall */ {153, NO_VALUE}, /* 161. __RSC_munmap */ {91, NO_VALUE}, /* 162. __RSC_nanosleep */ {162, NO_VALUE}, /* 163. __RSC_nfsservctl */ {169, NO_VALUE}, /* 164. __RSC_nice */ {34, NO_VALUE}, /* 165. __RSC_oldfstat */ {28, NO_VALUE}, /* 166. __RSC_oldlstat */ {84, NO_VALUE}, /* 167. __RSC_oldolduname */ {59, NO_VALUE}, /* 168. __RSC_oldstat */ {18, NO_VALUE}, /* 169. __RSC_olduname */ {109, NO_VALUE}, /* 170. __RSC_open */ {5, NO_VALUE}, /* 171. __RSC_pause */ {29, NO_VALUE}, /* 172. __RSC_pciconfig_iobase */ {NO_VALUE, NO_VALUE}, /* 173. __RSC_pciconfig_read */ {NO_VALUE, NO_VALUE}, /* 174. __RSC_pciconfig_write */ {NO_VALUE, NO_VALUE}, /* 175. __RSC_personality */ {136, NO_VALUE}, /* 176. __RSC_pipe */ {42, NO_VALUE}, /* 177. __RSC_pivot_root */ {217, NO_VALUE}, /* 178. __RSC_poll */ {168, NO_VALUE}, /* 179. __RSC_prctl */ {172, NO_VALUE}, /* 180. __RSC_pread64 */ {180, NO_VALUE}, /* 181. __RSC_prof */ {44, NO_VALUE}, /* 182. __RSC_profil */ {98, NO_VALUE}, /* 183. __RSC_ptrace */ {26, NO_VALUE}, /* 184. __RSC_putpmsg */ {189, NO_VALUE}, /* 185. __RSC_pwrite64 */ {181, NO_VALUE}, /* 186. __RSC_query_module */ {167, NO_VALUE}, /* 187. __RSC_quotactl */ {131, NO_VALUE}, /* 188. __RSC_read */ {3, NO_VALUE}, /* 189. __RSC_readahead */ {225, NO_VALUE}, /* 190. __RSC_readdir */ {89, NO_VALUE}, /* 191. __RSC_readlink */ {85, NO_VALUE}, /* 192. __RSC_readv */ {145, NO_VALUE}, /* 193. __RSC_reboot */ {88, NO_VALUE}, /* 194. __RSC_recv */ {102, SYS_RECV}, /* 195. __RSC_recvfrom */ {102, SYS_RECVFROM}, /* 196. __RSC_recvmsg */ {102, SYS_RECVMSG}, /* 197. __RSC_remap_file_pages */ {257, NO_VALUE}, /* 198. __RSC_removexattr */ {235, NO_VALUE}, /* 199. __RSC_rename */ {38, NO_VALUE}, /* 200. __RSC_request_key */ {287, NO_VALUE}, /* 201. __RSC_restart_syscall */ {0, NO_VALUE}, /* 202. __RSC_rmdir */ {40, NO_VALUE}, /* 203. __RSC_rt_sigaction */ {174, NO_VALUE}, /* 204. __RSC_rt_sigpending */ {176, NO_VALUE}, /* 205. __RSC_rt_sigprocmask */ {175, NO_VALUE}, /* 206. __RSC_rt_sigqueueinfo */ {178, NO_VALUE}, /* 207. __RSC_rt_sigreturn */ {173, NO_VALUE}, /* 208. __RSC_rt_sigsuspend */ {179, NO_VALUE}, /* 209. __RSC_rt_sigtimedwait */ {177, NO_VALUE}, /* 210. __RSC_sched_get_priority_max */ {159, NO_VALUE}, /* 211. __RSC_sched_get_priority_min */ {160, NO_VALUE}, /* 212. __RSC_sched_getaffinity */ {242, NO_VALUE}, /* 213. __RSC_sched_getparam */ {155, NO_VALUE}, /* 214. __RSC_sched_getscheduler */ {157, NO_VALUE}, /* 215. __RSC_sched_rr_get_interval */ {161, NO_VALUE}, /* 216. __RSC_sched_setaffinity */ {241, NO_VALUE}, /* 217. __RSC_sched_setparam */ {154, NO_VALUE}, /* 218. __RSC_sched_setscheduler */ {156, NO_VALUE}, /* 219. __RSC_sched_yield */ {158, NO_VALUE}, /* 220. __RSC_security */ {NO_VALUE, NO_VALUE}, /* 221. __RSC_select */ {82, NO_VALUE}, /* 222. __RSC_semctl */ {NO_VALUE, NO_VALUE}, /* 223. __RSC_semget */ {NO_VALUE, NO_VALUE}, /* 224. __RSC_semop */ {NO_VALUE, NO_VALUE}, /* 225. __RSC_semtimedop */ {NO_VALUE, NO_VALUE}, /* 226. __RSC_send */ {102, SYS_SEND}, /* 227. __RSC_sendfile */ {187, NO_VALUE}, /* 228. __RSC_sendfile64 */ {239, NO_VALUE}, /* 229. __RSC_sendmsg */ {102, SYS_SENDMSG}, /* 230. __RSC_sendto */ {102, SYS_SENDTO}, /* 231. __RSC_set_mempolicy */ {276, NO_VALUE}, /* 232. __RSC_set_thread_area */ {243, NO_VALUE}, /* 233. __RSC_set_tid_address */ {258, NO_VALUE}, /* 234. __RSC_setdomainname */ {121, NO_VALUE}, /* 235. __RSC_setfsgid */ {139, NO_VALUE}, /* 236. __RSC_setfsgid32 */ {216, NO_VALUE}, /* 237. __RSC_setfsuid */ {138, NO_VALUE}, /* 238. __RSC_setfsuid32 */ {215, NO_VALUE}, /* 239. __RSC_setgid */ {46, NO_VALUE}, /* 240. __RSC_setgid32 */ {214, NO_VALUE}, /* 241. __RSC_setgroups */ {81, NO_VALUE}, /* 242. __RSC_setgroups32 */ {206, NO_VALUE}, /* 243. __RSC_sethostname */ {74, NO_VALUE}, /* 244. __RSC_setitimer */ {104, NO_VALUE}, /* 245. __RSC_setpgid */ {57, NO_VALUE}, /* 246. __RSC_setpriority */ {97, NO_VALUE}, /* 247. __RSC_setregid */ {71, NO_VALUE}, /* 248. __RSC_setregid32 */ {204, NO_VALUE}, /* 249. __RSC_setresgid */ {170, NO_VALUE}, /* 250. __RSC_setresgid32 */ {210, NO_VALUE}, /* 251. __RSC_setresuid */ {164, NO_VALUE}, /* 252. __RSC_setresuid32 */ {208, NO_VALUE}, /* 253. __RSC_setreuid */ {70, NO_VALUE}, /* 254. __RSC_setreuid32 */ {203, NO_VALUE}, /* 255. __RSC_setrlimit */ {75, NO_VALUE}, /* 256. __RSC_setsid */ {66, NO_VALUE}, /* 257. __RSC_setsockopt */ {102, SYS_SETSOCKOPT}, /* 258. __RSC_settimeofday */ {79, NO_VALUE}, /* 259. __RSC_setuid */ {23, NO_VALUE}, /* 260. __RSC_setuid32 */ {213, NO_VALUE}, /* 261. __RSC_setxattr */ {226, NO_VALUE}, /* 262. __RSC_sgetmask */ {68, NO_VALUE}, /* 263. __RSC_shmat */ {NO_VALUE, NO_VALUE}, /* 264. __RSC_shmctl */ {NO_VALUE, NO_VALUE}, /* 265. __RSC_shmdt */ {NO_VALUE, NO_VALUE}, /* 266. __RSC_shmget */ {NO_VALUE, NO_VALUE}, /* 267. __RSC_shutdown */ {102, SYS_SHUTDOWN}, /* 268. __RSC_sigaction */ {67, NO_VALUE}, /* 269. __RSC_sigaltstack */ {186, NO_VALUE}, /* 270. __RSC_signal */ {48, NO_VALUE}, /* 271. __RSC_sigpending */ {73, NO_VALUE}, /* 272. __RSC_sigprocmask */ {126, NO_VALUE}, /* 273. __RSC_sigreturn */ {119, NO_VALUE}, /* 274. __RSC_sigsuspend */ {72, NO_VALUE}, /* 275. __RSC_socket */ {102, SYS_SOCKET}, /* 276. __RSC_socketcall */ {102, NO_VALUE}, /* 277. __RSC_socketpair */ {102, SYS_SOCKETPAIR}, /* 278. __RSC_ssetmask */ {69, NO_VALUE}, /* 279. __RSC_stat */ {106, NO_VALUE}, /* 280. __RSC_stat64 */ {195, NO_VALUE}, /* 281. __RSC_statfs */ {99, NO_VALUE}, /* 282. __RSC_statfs64 */ {268, NO_VALUE}, /* 283. __RSC_stime */ {25, NO_VALUE}, /* 284. __RSC_stty */ {31, NO_VALUE}, /* 285. __RSC_swapcontext */ {NO_VALUE, NO_VALUE}, /* 286. __RSC_swapoff */ {115, NO_VALUE}, /* 287. __RSC_swapon */ {87, NO_VALUE}, /* 288. __RSC_symlink */ {83, NO_VALUE}, /* 289. __RSC_sync */ {36, NO_VALUE}, /* 290. __RSC_sys_kexec_load */ {283, NO_VALUE}, /* 291. __RSC_sysfs */ {135, NO_VALUE}, /* 292. __RSC_sysinfo */ {116, NO_VALUE}, /* 293. __RSC_syslog */ {103, NO_VALUE}, /* 294. __RSC_tgkill */ {270, NO_VALUE}, /* 295. __RSC_time */ {13, NO_VALUE}, /* 296. __RSC_timer_create */ {259, NO_VALUE}, /* 297. __RSC_timer_delete */ {263, NO_VALUE}, /* 298. __RSC_timer_getoverrun */ {262, NO_VALUE}, /* 299. __RSC_timer_gettime */ {261, NO_VALUE}, /* 300. __RSC_timer_settime */ {260, NO_VALUE}, /* 301. __RSC_times */ {43, NO_VALUE}, /* 302. __RSC_tkill */ {238, NO_VALUE}, /* 303. __RSC_truncate */ {92, NO_VALUE}, /* 304. __RSC_truncate64 */ {193, NO_VALUE}, /* 305. __RSC_tuxcall */ {NO_VALUE, NO_VALUE}, /* 306. __RSC_ugetrlimit */ {191, NO_VALUE}, /* 307. __RSC_ulimit */ {58, NO_VALUE}, /* 308. __RSC_umask */ {60, NO_VALUE}, /* 309. __RSC_umount */ {22, NO_VALUE}, /* 310. __RSC_umount2 */ {52, NO_VALUE}, /* 311. __RSC_uname */ {122, NO_VALUE}, /* 312. __RSC_unlink */ {10, NO_VALUE}, /* 313. __RSC_uselib */ {86, NO_VALUE}, /* 314. __RSC_ustat */ {62, NO_VALUE}, /* 315. __RSC_utime */ {30, NO_VALUE}, /* 316. __RSC_utimes */ {271, NO_VALUE}, /* 317. __RSC_vfork */ {190, NO_VALUE}, /* 318. __RSC_vhangup */ {111, NO_VALUE}, /* 319. __RSC_vm86 */ {166, NO_VALUE}, /* 320. __RSC_vm86old */ {113, NO_VALUE}, /* 321. __RSC_vserver */ {273, NO_VALUE}, /* 322. __RSC_wait4 */ {114, NO_VALUE}, /* 323. __RSC_waitid */ {284, NO_VALUE}, /* 324. __RSC_waitpid */ {7, NO_VALUE}, /* 325. __RSC_write */ {4, NO_VALUE}, /* 326. __RSC_writev */ {146, NO_VALUE} }; struct nr_and_sys rsc_to_x86_64[] = { /* 0. __RSC__exit */ {NO_VALUE, NO_VALUE}, /* 1. __RSC__llseek */ {NO_VALUE, NO_VALUE}, /* 2. __RSC__newselect */ {NO_VALUE, NO_VALUE}, /* 3. __RSC__sysctl */ {156, NO_VALUE}, /* 4. __RSC_accept */ {43, NO_VALUE}, /* 5. __RSC_access */ {21, NO_VALUE}, /* 6. __RSC_acct */ {163, NO_VALUE}, /* 7. __RSC_add_key */ {248, NO_VALUE}, /* 8. __RSC_adjtimex */ {159, NO_VALUE}, /* 9. __RSC_afs_syscall */ {183, NO_VALUE}, /* 10. __RSC_alarm */ {37, NO_VALUE}, /* 11. __RSC_arch_prctl */ {158, NO_VALUE}, /* 12. __RSC_bdflush */ {NO_VALUE, NO_VALUE}, /* 13. __RSC_bind */ {49, NO_VALUE}, /* 14. __RSC_break */ {NO_VALUE, NO_VALUE}, /* 15. __RSC_brk */ {12, NO_VALUE}, /* 16. __RSC_capget */ {125, NO_VALUE}, /* 17. __RSC_capset */ {126, NO_VALUE}, /* 18. __RSC_chdir */ {80, NO_VALUE}, /* 19. __RSC_chmod */ {90, NO_VALUE}, /* 20. __RSC_chown */ {92, NO_VALUE}, /* 21. __RSC_chown32 */ {NO_VALUE, NO_VALUE}, /* 22. __RSC_chroot */ {161, NO_VALUE}, /* 23. __RSC_clock_getres */ {229, NO_VALUE}, /* 24. __RSC_clock_gettime */ {228, NO_VALUE}, /* 25. __RSC_clock_nanosleep */ {230, NO_VALUE}, /* 26. __RSC_clock_settime */ {227, NO_VALUE}, /* 27. __RSC_clone */ {56, NO_VALUE}, /* 28. __RSC_close */ {3, NO_VALUE}, /* 29. __RSC_connect */ {42, NO_VALUE}, /* 30. __RSC_creat */ {85, NO_VALUE}, /* 31. __RSC_create_module */ {174, NO_VALUE}, /* 32. __RSC_delete_module */ {176, NO_VALUE}, /* 33. __RSC_dup */ {32, NO_VALUE}, /* 34. __RSC_dup2 */ {33, NO_VALUE}, /* 35. __RSC_epoll_create */ {213, NO_VALUE}, /* 36. __RSC_epoll_ctl */ {233, NO_VALUE}, /* 37. __RSC_epoll_ctl_old */ {214, NO_VALUE}, /* 38. __RSC_epoll_wait */ {232, NO_VALUE}, /* 39. __RSC_epoll_wait_old */ {215, NO_VALUE}, /* 40. __RSC_execve */ {59, NO_VALUE}, /* 41. __RSC_exit */ {60, NO_VALUE}, /* 42. __RSC_exit_group */ {231, NO_VALUE}, /* 43. __RSC_fadvise64 */ {221, NO_VALUE}, /* 44. __RSC_fadvise64_64 */ {NO_VALUE, NO_VALUE}, /* 45. __RSC_fchdir */ {81, NO_VALUE}, /* 46. __RSC_fchmod */ {91, NO_VALUE}, /* 47. __RSC_fchown */ {93, NO_VALUE}, /* 48. __RSC_fchown32 */ {NO_VALUE, NO_VALUE}, /* 49. __RSC_fcntl */ {72, NO_VALUE}, /* 50. __RSC_fcntl64 */ {NO_VALUE, NO_VALUE}, /* 51. __RSC_fdatasync */ {75, NO_VALUE}, /* 52. __RSC_fgetxattr */ {193, NO_VALUE}, /* 53. __RSC_flistxattr */ {196, NO_VALUE}, /* 54. __RSC_flock */ {73, NO_VALUE}, /* 55. __RSC_fork */ {57, NO_VALUE}, /* 56. __RSC_fremovexattr */ {199, NO_VALUE}, /* 57. __RSC_fsetxattr */ {190, NO_VALUE}, /* 58. __RSC_fstat */ {5, NO_VALUE}, /* 59. __RSC_fstat64 */ {5, NO_VALUE}, /* 60. __RSC_fstatfs */ {138, NO_VALUE}, /* 61. __RSC_fstatfs64 */ {138, NO_VALUE}, /* 62. __RSC_fsync */ {74, NO_VALUE}, /* 63. __RSC_ftime */ {NO_VALUE, NO_VALUE}, /* 64. __RSC_ftruncate */ {77, NO_VALUE}, /* 65. __RSC_ftruncate64 */ {77, NO_VALUE}, /* 66. __RSC_futex */ {202, NO_VALUE}, /* 67. __RSC_get_kernel_syms */ {177, NO_VALUE}, /* 68. __RSC_get_mempolicy */ {239, NO_VALUE}, /* 69. __RSC_get_thread_area */ {211, NO_VALUE}, /* 70. __RSC_getcwd */ {79, NO_VALUE}, /* 71. __RSC_getdents */ {78, NO_VALUE}, /* 72. __RSC_getdents64 */ {217, NO_VALUE}, /* 73. __RSC_getegid */ {108, NO_VALUE}, /* 74. __RSC_getegid32 */ {NO_VALUE, NO_VALUE}, /* 75. __RSC_geteuid */ {107, NO_VALUE}, /* 76. __RSC_geteuid32 */ {NO_VALUE, NO_VALUE}, /* 77. __RSC_getgid */ {104, NO_VALUE}, /* 78. __RSC_getgid32 */ {NO_VALUE, NO_VALUE}, /* 79. __RSC_getgroups */ {115, NO_VALUE}, /* 80. __RSC_getgroups32 */ {NO_VALUE, NO_VALUE}, /* 81. __RSC_getitimer */ {36, NO_VALUE}, /* 82. __RSC_getpeername */ {52, NO_VALUE}, /* 83. __RSC_getpgid */ {121, NO_VALUE}, /* 84. __RSC_getpgrp */ {111, NO_VALUE}, /* 85. __RSC_getpid */ {39, NO_VALUE}, /* 86. __RSC_getpmsg */ {181, NO_VALUE}, /* 87. __RSC_getppid */ {110, NO_VALUE}, /* 88. __RSC_getpriority */ {140, NO_VALUE}, /* 89. __RSC_getresgid */ {120, NO_VALUE}, /* 90. __RSC_getresgid32 */ {NO_VALUE, NO_VALUE}, /* 91. __RSC_getresuid */ {118, NO_VALUE}, /* 92. __RSC_getresuid32 */ {NO_VALUE, NO_VALUE}, /* 93. __RSC_getrlimit */ {97, NO_VALUE}, /* 94. __RSC_getrusage */ {98, NO_VALUE}, /* 95. __RSC_getsid */ {124, NO_VALUE}, /* 96. __RSC_getsockname */ {51, NO_VALUE}, /* 97. __RSC_getsockopt */ {55, NO_VALUE}, /* 98. __RSC_gettid */ {186, NO_VALUE}, /* 99. __RSC_gettimeofday */ {96, NO_VALUE}, /* 100. __RSC_getuid */ {102, NO_VALUE}, /* 101. __RSC_getuid32 */ {NO_VALUE, NO_VALUE}, /* 102. __RSC_getxattr */ {191, NO_VALUE}, /* 103. __RSC_gtty */ {NO_VALUE, NO_VALUE}, /* 104. __RSC_idle */ {NO_VALUE, NO_VALUE}, /* 105. __RSC_init_module */ {175, NO_VALUE}, /* 106. __RSC_io_cancel */ {210, NO_VALUE}, /* 107. __RSC_io_destroy */ {207, NO_VALUE}, /* 108. __RSC_io_getevents */ {208, NO_VALUE}, /* 109. __RSC_io_setup */ {206, NO_VALUE}, /* 110. __RSC_io_submit */ {209, NO_VALUE}, /* 111. __RSC_ioctl */ {16, NO_VALUE}, /* 112. __RSC_ioperm */ {173, NO_VALUE}, /* 113. __RSC_iopl */ {172, NO_VALUE}, /* 114. __RSC_ipc */ {NO_VALUE, NO_VALUE}, /* 115. __RSC_kexec_load */ {246, NO_VALUE}, /* 116. __RSC_keyctl */ {250, NO_VALUE}, /* 117. __RSC_kill */ {62, NO_VALUE}, /* 118. __RSC_lchown */ {94, NO_VALUE}, /* 119. __RSC_lchown32 */ {NO_VALUE, NO_VALUE}, /* 120. __RSC_lgetxattr */ {192, NO_VALUE}, /* 121. __RSC_link */ {86, NO_VALUE}, /* 122. __RSC_listen */ {50, NO_VALUE}, /* 123. __RSC_listxattr */ {194, NO_VALUE}, /* 124. __RSC_llistxattr */ {195, NO_VALUE}, /* 125. __RSC_lock */ {NO_VALUE, NO_VALUE}, /* 126. __RSC_lookup_dcookie */ {212, NO_VALUE}, /* 127. __RSC_lremovexattr */ {198, NO_VALUE}, /* 128. __RSC_lseek */ {8, NO_VALUE}, /* 129. __RSC_lsetxattr */ {189, NO_VALUE}, /* 130. __RSC_lstat */ {6, NO_VALUE}, /* 131. __RSC_lstat64 */ {6, NO_VALUE}, /* 132. __RSC_madvise */ {28, NO_VALUE}, /* 133. __RSC_madvise1 */ {NO_VALUE, NO_VALUE}, /* 134. __RSC_mbind */ {237, NO_VALUE}, /* 135. __RSC_mincore */ {27, NO_VALUE}, /* 136. __RSC_mkdir */ {83, NO_VALUE}, /* 137. __RSC_mknod */ {133, NO_VALUE}, /* 138. __RSC_mlock */ {149, NO_VALUE}, /* 139. __RSC_mlockall */ {151, NO_VALUE}, /* 140. __RSC_mmap */ {9, NO_VALUE}, /* 141. __RSC_mmap2 */ {NO_VALUE, NO_VALUE}, /* 142. __RSC_modify_ldt */ {154, NO_VALUE}, /* 143. __RSC_mount */ {165, NO_VALUE}, /* 144. __RSC_mprotect */ {10, NO_VALUE}, /* 145. __RSC_mpx */ {NO_VALUE, NO_VALUE}, /* 146. __RSC_mq_getsetattr */ {245, NO_VALUE}, /* 147. __RSC_mq_notify */ {244, NO_VALUE}, /* 148. __RSC_mq_open */ {240, NO_VALUE}, /* 149. __RSC_mq_timedreceive */ {243, NO_VALUE}, /* 150. __RSC_mq_timedsend */ {242, NO_VALUE}, /* 151. __RSC_mq_unlink */ {241, NO_VALUE}, /* 152. __RSC_mremap */ {25, NO_VALUE}, /* 153. __RSC_msgctl */ {71, NO_VALUE}, /* 154. __RSC_msgget */ {68, NO_VALUE}, /* 155. __RSC_msgrcv */ {70, NO_VALUE}, /* 156. __RSC_msgsnd */ {69, NO_VALUE}, /* 157. __RSC_msync */ {26, NO_VALUE}, /* 158. __RSC_multiplexer */ {NO_VALUE, NO_VALUE}, /* 159. __RSC_munlock */ {150, NO_VALUE}, /* 160. __RSC_munlockall */ {152, NO_VALUE}, /* 161. __RSC_munmap */ {11, NO_VALUE}, /* 162. __RSC_nanosleep */ {35, NO_VALUE}, /* 163. __RSC_nfsservctl */ {180, NO_VALUE}, /* 164. __RSC_nice */ {NO_VALUE, NO_VALUE}, /* 165. __RSC_oldfstat */ {NO_VALUE, NO_VALUE}, /* 166. __RSC_oldlstat */ {NO_VALUE, NO_VALUE}, /* 167. __RSC_oldolduname */ {NO_VALUE, NO_VALUE}, /* 168. __RSC_oldstat */ {NO_VALUE, NO_VALUE}, /* 169. __RSC_olduname */ {NO_VALUE, NO_VALUE}, /* 170. __RSC_open */ {2, NO_VALUE}, /* 171. __RSC_pause */ {34, NO_VALUE}, /* 172. __RSC_pciconfig_iobase */ {NO_VALUE, NO_VALUE}, /* 173. __RSC_pciconfig_read */ {NO_VALUE, NO_VALUE}, /* 174. __RSC_pciconfig_write */ {NO_VALUE, NO_VALUE}, /* 175. __RSC_personality */ {135, NO_VALUE}, /* 176. __RSC_pipe */ {22, NO_VALUE}, /* 177. __RSC_pivot_root */ {155, NO_VALUE}, /* 178. __RSC_poll */ {7, NO_VALUE}, /* 179. __RSC_prctl */ {157, NO_VALUE}, /* 180. __RSC_pread64 */ {17, NO_VALUE}, /* 181. __RSC_prof */ {NO_VALUE, NO_VALUE}, /* 182. __RSC_profil */ {NO_VALUE, NO_VALUE}, /* 183. __RSC_ptrace */ {101, NO_VALUE}, /* 184. __RSC_putpmsg */ {182, NO_VALUE}, /* 185. __RSC_pwrite64 */ {18, NO_VALUE}, /* 186. __RSC_query_module */ {178, NO_VALUE}, /* 187. __RSC_quotactl */ {179, NO_VALUE}, /* 188. __RSC_read */ {0, NO_VALUE}, /* 189. __RSC_readahead */ {187, NO_VALUE}, /* 190. __RSC_readdir */ {NO_VALUE, NO_VALUE}, /* 191. __RSC_readlink */ {89, NO_VALUE}, /* 192. __RSC_readv */ {19, NO_VALUE}, /* 193. __RSC_reboot */ {169, NO_VALUE}, /* 194. __RSC_recv */ {NO_VALUE, NO_VALUE}, /* 195. __RSC_recvfrom */ {45, NO_VALUE}, /* 196. __RSC_recvmsg */ {47, NO_VALUE}, /* 197. __RSC_remap_file_pages */ {216, NO_VALUE}, /* 198. __RSC_removexattr */ {197, NO_VALUE}, /* 199. __RSC_rename */ {82, NO_VALUE}, /* 200. __RSC_request_key */ {249, NO_VALUE}, /* 201. __RSC_restart_syscall */ {219, NO_VALUE}, /* 202. __RSC_rmdir */ {84, NO_VALUE}, /* 203. __RSC_rt_sigaction */ {13, NO_VALUE}, /* 204. __RSC_rt_sigpending */ {127, NO_VALUE}, /* 205. __RSC_rt_sigprocmask */ {14, NO_VALUE}, /* 206. __RSC_rt_sigqueueinfo */ {129, NO_VALUE}, /* 207. __RSC_rt_sigreturn */ {15, NO_VALUE}, /* 208. __RSC_rt_sigsuspend */ {130, NO_VALUE}, /* 209. __RSC_rt_sigtimedwait */ {128, NO_VALUE}, /* 210. __RSC_sched_get_priority_max */ {146, NO_VALUE}, /* 211. __RSC_sched_get_priority_min */ {147, NO_VALUE}, /* 212. __RSC_sched_getaffinity */ {204, NO_VALUE}, /* 213. __RSC_sched_getparam */ {143, NO_VALUE}, /* 214. __RSC_sched_getscheduler */ {145, NO_VALUE}, /* 215. __RSC_sched_rr_get_interval */ {148, NO_VALUE}, /* 216. __RSC_sched_setaffinity */ {203, NO_VALUE}, /* 217. __RSC_sched_setparam */ {142, NO_VALUE}, /* 218. __RSC_sched_setscheduler */ {144, NO_VALUE}, /* 219. __RSC_sched_yield */ {24, NO_VALUE}, /* 220. __RSC_security */ {185, NO_VALUE}, /* 221. __RSC_select */ {23, NO_VALUE}, /* 222. __RSC_semctl */ {66, NO_VALUE}, /* 223. __RSC_semget */ {64, NO_VALUE}, /* 224. __RSC_semop */ {65, NO_VALUE}, /* 225. __RSC_semtimedop */ {220, NO_VALUE}, /* 226. __RSC_send */ {NO_VALUE, NO_VALUE}, /* 227. __RSC_sendfile */ {40, NO_VALUE}, /* 228. __RSC_sendfile64 */ {NO_VALUE, NO_VALUE}, /* 229. __RSC_sendmsg */ {46, NO_VALUE}, /* 230. __RSC_sendto */ {44, NO_VALUE}, /* 231. __RSC_set_mempolicy */ {238, NO_VALUE}, /* 232. __RSC_set_thread_area */ {205, NO_VALUE}, /* 233. __RSC_set_tid_address */ {218, NO_VALUE}, /* 234. __RSC_setdomainname */ {171, NO_VALUE}, /* 235. __RSC_setfsgid */ {123, NO_VALUE}, /* 236. __RSC_setfsgid32 */ {NO_VALUE, NO_VALUE}, /* 237. __RSC_setfsuid */ {122, NO_VALUE}, /* 238. __RSC_setfsuid32 */ {NO_VALUE, NO_VALUE}, /* 239. __RSC_setgid */ {106, NO_VALUE}, /* 240. __RSC_setgid32 */ {NO_VALUE, NO_VALUE}, /* 241. __RSC_setgroups */ {116, NO_VALUE}, /* 242. __RSC_setgroups32 */ {NO_VALUE, NO_VALUE}, /* 243. __RSC_sethostname */ {170, NO_VALUE}, /* 244. __RSC_setitimer */ {38, NO_VALUE}, /* 245. __RSC_setpgid */ {109, NO_VALUE}, /* 246. __RSC_setpriority */ {141, NO_VALUE}, /* 247. __RSC_setregid */ {114, NO_VALUE}, /* 248. __RSC_setregid32 */ {NO_VALUE, NO_VALUE}, /* 249. __RSC_setresgid */ {119, NO_VALUE}, /* 250. __RSC_setresgid32 */ {NO_VALUE, NO_VALUE}, /* 251. __RSC_setresuid */ {117, NO_VALUE}, /* 252. __RSC_setresuid32 */ {NO_VALUE, NO_VALUE}, /* 253. __RSC_setreuid */ {113, NO_VALUE}, /* 254. __RSC_setreuid32 */ {NO_VALUE, NO_VALUE}, /* 255. __RSC_setrlimit */ {160, NO_VALUE}, /* 256. __RSC_setsid */ {112, NO_VALUE}, /* 257. __RSC_setsockopt */ {54, NO_VALUE}, /* 258. __RSC_settimeofday */ {164, NO_VALUE}, /* 259. __RSC_setuid */ {105, NO_VALUE}, /* 260. __RSC_setuid32 */ {NO_VALUE, NO_VALUE}, /* 261. __RSC_setxattr */ {188, NO_VALUE}, /* 262. __RSC_sgetmask */ {NO_VALUE, NO_VALUE}, /* 263. __RSC_shmat */ {30, NO_VALUE}, /* 264. __RSC_shmctl */ {31, NO_VALUE}, /* 265. __RSC_shmdt */ {67, NO_VALUE}, /* 266. __RSC_shmget */ {29, NO_VALUE}, /* 267. __RSC_shutdown */ {48, NO_VALUE}, /* 268. __RSC_sigaction */ {NO_VALUE, NO_VALUE}, /* 269. __RSC_sigaltstack */ {131, NO_VALUE}, /* 270. __RSC_signal */ {NO_VALUE, NO_VALUE}, /* 271. __RSC_sigpending */ {NO_VALUE, NO_VALUE}, /* 272. __RSC_sigprocmask */ {NO_VALUE, NO_VALUE}, /* 273. __RSC_sigreturn */ {NO_VALUE, NO_VALUE}, /* 274. __RSC_sigsuspend */ {NO_VALUE, NO_VALUE}, /* 275. __RSC_socket */ {41, NO_VALUE}, /* 276. __RSC_socketcall */ {NO_VALUE, NO_VALUE}, /* 277. __RSC_socketpair */ {53, NO_VALUE}, /* 278. __RSC_ssetmask */ {NO_VALUE, NO_VALUE}, /* 279. __RSC_stat */ {4, NO_VALUE}, /* 280. __RSC_stat64 */ {4, NO_VALUE}, /* 281. __RSC_statfs */ {137, NO_VALUE}, /* 282. __RSC_statfs64 */ {137, NO_VALUE}, /* 283. __RSC_stime */ {NO_VALUE, NO_VALUE}, /* 284. __RSC_stty */ {NO_VALUE, NO_VALUE}, /* 285. __RSC_swapcontext */ {NO_VALUE, NO_VALUE}, /* 286. __RSC_swapoff */ {168, NO_VALUE}, /* 287. __RSC_swapon */ {167, NO_VALUE}, /* 288. __RSC_symlink */ {88, NO_VALUE}, /* 289. __RSC_sync */ {162, NO_VALUE}, /* 290. __RSC_sys_kexec_load */ {NO_VALUE, NO_VALUE}, /* 291. __RSC_sysfs */ {139, NO_VALUE}, /* 292. __RSC_sysinfo */ {99, NO_VALUE}, /* 293. __RSC_syslog */ {103, NO_VALUE}, /* 294. __RSC_tgkill */ {234, NO_VALUE}, /* 295. __RSC_time */ {201, NO_VALUE}, /* 296. __RSC_timer_create */ {222, NO_VALUE}, /* 297. __RSC_timer_delete */ {226, NO_VALUE}, /* 298. __RSC_timer_getoverrun */ {225, NO_VALUE}, /* 299. __RSC_timer_gettime */ {224, NO_VALUE}, /* 300. __RSC_timer_settime */ {223, NO_VALUE}, /* 301. __RSC_times */ {100, NO_VALUE}, /* 302. __RSC_tkill */ {200, NO_VALUE}, /* 303. __RSC_truncate */ {76, NO_VALUE}, /* 304. __RSC_truncate64 */ {76, NO_VALUE}, /* 305. __RSC_tuxcall */ {184, NO_VALUE}, /* 306. __RSC_ugetrlimit */ {NO_VALUE, NO_VALUE}, /* 307. __RSC_ulimit */ {NO_VALUE, NO_VALUE}, /* 308. __RSC_umask */ {95, NO_VALUE}, /* 309. __RSC_umount */ {NO_VALUE, NO_VALUE}, /* 310. __RSC_umount2 */ {166, NO_VALUE}, /* 311. __RSC_uname */ {63, NO_VALUE}, /* 312. __RSC_unlink */ {87, NO_VALUE}, /* 313. __RSC_uselib */ {134, NO_VALUE}, /* 314. __RSC_ustat */ {136, NO_VALUE}, /* 315. __RSC_utime */ {132, NO_VALUE}, /* 316. __RSC_utimes */ {235, NO_VALUE}, /* 317. __RSC_vfork */ {58, NO_VALUE}, /* 318. __RSC_vhangup */ {153, NO_VALUE}, /* 319. __RSC_vm86 */ {NO_VALUE, NO_VALUE}, /* 320. __RSC_vm86old */ {NO_VALUE, NO_VALUE}, /* 321. __RSC_vserver */ {236, NO_VALUE}, /* 322. __RSC_wait4 */ {61, NO_VALUE}, /* 323. __RSC_waitid */ {247, NO_VALUE}, /* 324. __RSC_waitpid */ {NO_VALUE, NO_VALUE}, /* 325. __RSC_write */ {1, NO_VALUE}, /* 326. __RSC_writev */ {20, NO_VALUE} }; struct nr_and_sys rsc_to_ppc[] = { /* 0. __RSC__exit */ {1, NO_VALUE}, /* 1. __RSC__llseek */ {140, NO_VALUE}, /* 2. __RSC__newselect */ {142, NO_VALUE}, /* 3. __RSC__sysctl */ {149, NO_VALUE}, /* 4. __RSC_accept */ {102, SYS_ACCEPT}, /* 5. __RSC_access */ {33, NO_VALUE}, /* 6. __RSC_acct */ {51, NO_VALUE}, /* 7. __RSC_add_key */ {NO_VALUE, NO_VALUE}, /* 8. __RSC_adjtimex */ {124, NO_VALUE}, /* 9. __RSC_afs_syscall */ {137, NO_VALUE}, /* 10. __RSC_alarm */ {27, NO_VALUE}, /* 11. __RSC_arch_prctl */ {NO_VALUE, NO_VALUE}, /* 12. __RSC_bdflush */ {134, NO_VALUE}, /* 13. __RSC_bind */ {102, SYS_BIND}, /* 14. __RSC_break */ {17, NO_VALUE}, /* 15. __RSC_brk */ {45, NO_VALUE}, /* 16. __RSC_capget */ {183, NO_VALUE}, /* 17. __RSC_capset */ {184, NO_VALUE}, /* 18. __RSC_chdir */ {12, NO_VALUE}, /* 19. __RSC_chmod */ {15, NO_VALUE}, /* 20. __RSC_chown */ {181, NO_VALUE}, /* 21. __RSC_chown32 */ {NO_VALUE, NO_VALUE}, /* 22. __RSC_chroot */ {61, NO_VALUE}, /* 23. __RSC_clock_getres */ {247, NO_VALUE}, /* 24. __RSC_clock_gettime */ {246, NO_VALUE}, /* 25. __RSC_clock_nanosleep */ {248, NO_VALUE}, /* 26. __RSC_clock_settime */ {245, NO_VALUE}, /* 27. __RSC_clone */ {120, NO_VALUE}, /* 28. __RSC_close */ {6, NO_VALUE}, /* 29. __RSC_connect */ {102, SYS_CONNECT}, /* 30. __RSC_creat */ {8, NO_VALUE}, /* 31. __RSC_create_module */ {127, NO_VALUE}, /* 32. __RSC_delete_module */ {129, NO_VALUE}, /* 33. __RSC_dup */ {41, NO_VALUE}, /* 34. __RSC_dup2 */ {63, NO_VALUE}, /* 35. __RSC_epoll_create */ {236, NO_VALUE}, /* 36. __RSC_epoll_ctl */ {237, NO_VALUE}, /* 37. __RSC_epoll_ctl_old */ {NO_VALUE, NO_VALUE}, /* 38. __RSC_epoll_wait */ {238, NO_VALUE}, /* 39. __RSC_epoll_wait_old */ {NO_VALUE, NO_VALUE}, /* 40. __RSC_execve */ {11, NO_VALUE}, /* 41. __RSC_exit */ {1, NO_VALUE}, /* 42. __RSC_exit_group */ {234, NO_VALUE}, /* 43. __RSC_fadvise64 */ {233, NO_VALUE}, /* 44. __RSC_fadvise64_64 */ {254, NO_VALUE}, /* 45. __RSC_fchdir */ {133, NO_VALUE}, /* 46. __RSC_fchmod */ {94, NO_VALUE}, /* 47. __RSC_fchown */ {95, NO_VALUE}, /* 48. __RSC_fchown32 */ {NO_VALUE, NO_VALUE}, /* 49. __RSC_fcntl */ {55, NO_VALUE}, /* 50. __RSC_fcntl64 */ {204, NO_VALUE}, /* 51. __RSC_fdatasync */ {148, NO_VALUE}, /* 52. __RSC_fgetxattr */ {214, NO_VALUE}, /* 53. __RSC_flistxattr */ {217, NO_VALUE}, /* 54. __RSC_flock */ {143, NO_VALUE}, /* 55. __RSC_fork */ {2, NO_VALUE}, /* 56. __RSC_fremovexattr */ {220, NO_VALUE}, /* 57. __RSC_fsetxattr */ {211, NO_VALUE}, /* 58. __RSC_fstat */ {108, NO_VALUE}, /* 59. __RSC_fstat64 */ {197, NO_VALUE}, /* 60. __RSC_fstatfs */ {100, NO_VALUE}, /* 61. __RSC_fstatfs64 */ {253, NO_VALUE}, /* 62. __RSC_fsync */ {118, NO_VALUE}, /* 63. __RSC_ftime */ {35, NO_VALUE}, /* 64. __RSC_ftruncate */ {93, NO_VALUE}, /* 65. __RSC_ftruncate64 */ {194, NO_VALUE}, /* 66. __RSC_futex */ {221, NO_VALUE}, /* 67. __RSC_get_kernel_syms */ {130, NO_VALUE}, /* 68. __RSC_get_mempolicy */ {NO_VALUE, NO_VALUE}, /* 69. __RSC_get_thread_area */ {NO_VALUE, NO_VALUE}, /* 70. __RSC_getcwd */ {182, NO_VALUE}, /* 71. __RSC_getdents */ {141, NO_VALUE}, /* 72. __RSC_getdents64 */ {202, NO_VALUE}, /* 73. __RSC_getegid */ {50, NO_VALUE}, /* 74. __RSC_getegid32 */ {NO_VALUE, NO_VALUE}, /* 75. __RSC_geteuid */ {49, NO_VALUE}, /* 76. __RSC_geteuid32 */ {NO_VALUE, NO_VALUE}, /* 77. __RSC_getgid */ {47, NO_VALUE}, /* 78. __RSC_getgid32 */ {NO_VALUE, NO_VALUE}, /* 79. __RSC_getgroups */ {80, NO_VALUE}, /* 80. __RSC_getgroups32 */ {NO_VALUE, NO_VALUE}, /* 81. __RSC_getitimer */ {105, NO_VALUE}, /* 82. __RSC_getpeername */ {102, SYS_GETPEERNAME}, /* 83. __RSC_getpgid */ {132, NO_VALUE}, /* 84. __RSC_getpgrp */ {65, NO_VALUE}, /* 85. __RSC_getpid */ {20, NO_VALUE}, /* 86. __RSC_getpmsg */ {187, NO_VALUE}, /* 87. __RSC_getppid */ {64, NO_VALUE}, /* 88. __RSC_getpriority */ {96, NO_VALUE}, /* 89. __RSC_getresgid */ {170, NO_VALUE}, /* 90. __RSC_getresgid32 */ {NO_VALUE, NO_VALUE}, /* 91. __RSC_getresuid */ {165, NO_VALUE}, /* 92. __RSC_getresuid32 */ {NO_VALUE, NO_VALUE}, /* 93. __RSC_getrlimit */ {76, NO_VALUE}, /* 94. __RSC_getrusage */ {77, NO_VALUE}, /* 95. __RSC_getsid */ {147, NO_VALUE}, /* 96. __RSC_getsockname */ {102, SYS_GETSOCKNAME}, /* 97. __RSC_getsockopt */ {102, SYS_GETSOCKOPT}, /* 98. __RSC_gettid */ {207, NO_VALUE}, /* 99. __RSC_gettimeofday */ {78, NO_VALUE}, /* 100. __RSC_getuid */ {24, NO_VALUE}, /* 101. __RSC_getuid32 */ {NO_VALUE, NO_VALUE}, /* 102. __RSC_getxattr */ {212, NO_VALUE}, /* 103. __RSC_gtty */ {32, NO_VALUE}, /* 104. __RSC_idle */ {112, NO_VALUE}, /* 105. __RSC_init_module */ {128, NO_VALUE}, /* 106. __RSC_io_cancel */ {231, NO_VALUE}, /* 107. __RSC_io_destroy */ {228, NO_VALUE}, /* 108. __RSC_io_getevents */ {229, NO_VALUE}, /* 109. __RSC_io_setup */ {227, NO_VALUE}, /* 110. __RSC_io_submit */ {230, NO_VALUE}, /* 111. __RSC_ioctl */ {54, NO_VALUE}, /* 112. __RSC_ioperm */ {101, NO_VALUE}, /* 113. __RSC_iopl */ {110, NO_VALUE}, /* 114. __RSC_ipc */ {117, NO_VALUE}, /* 115. __RSC_kexec_load */ {NO_VALUE, NO_VALUE}, /* 116. __RSC_keyctl */ {NO_VALUE, NO_VALUE}, /* 117. __RSC_kill */ {37, NO_VALUE}, /* 118. __RSC_lchown */ {16, NO_VALUE}, /* 119. __RSC_lchown32 */ {NO_VALUE, NO_VALUE}, /* 120. __RSC_lgetxattr */ {213, NO_VALUE}, /* 121. __RSC_link */ {9, NO_VALUE}, /* 122. __RSC_listen */ {102, SYS_LISTEN}, /* 123. __RSC_listxattr */ {215, NO_VALUE}, /* 124. __RSC_llistxattr */ {216, NO_VALUE}, /* 125. __RSC_lock */ {53, NO_VALUE}, /* 126. __RSC_lookup_dcookie */ {235, NO_VALUE}, /* 127. __RSC_lremovexattr */ {219, NO_VALUE}, /* 128. __RSC_lseek */ {19, NO_VALUE}, /* 129. __RSC_lsetxattr */ {210, NO_VALUE}, /* 130. __RSC_lstat */ {107, NO_VALUE}, /* 131. __RSC_lstat64 */ {196, NO_VALUE}, /* 132. __RSC_madvise */ {205, NO_VALUE}, /* 133. __RSC_madvise1 */ {NO_VALUE, NO_VALUE}, /* 134. __RSC_mbind */ {NO_VALUE, NO_VALUE}, /* 135. __RSC_mincore */ {206, NO_VALUE}, /* 136. __RSC_mkdir */ {39, NO_VALUE}, /* 137. __RSC_mknod */ {14, NO_VALUE}, /* 138. __RSC_mlock */ {150, NO_VALUE}, /* 139. __RSC_mlockall */ {152, NO_VALUE}, /* 140. __RSC_mmap */ {90, NO_VALUE}, /* 141. __RSC_mmap2 */ {192, NO_VALUE}, /* 142. __RSC_modify_ldt */ {123, NO_VALUE}, /* 143. __RSC_mount */ {21, NO_VALUE}, /* 144. __RSC_mprotect */ {125, NO_VALUE}, /* 145. __RSC_mpx */ {56, NO_VALUE}, /* 146. __RSC_mq_getsetattr */ {NO_VALUE, NO_VALUE}, /* 147. __RSC_mq_notify */ {NO_VALUE, NO_VALUE}, /* 148. __RSC_mq_open */ {NO_VALUE, NO_VALUE}, /* 149. __RSC_mq_timedreceive */ {NO_VALUE, NO_VALUE}, /* 150. __RSC_mq_timedsend */ {NO_VALUE, NO_VALUE}, /* 151. __RSC_mq_unlink */ {NO_VALUE, NO_VALUE}, /* 152. __RSC_mremap */ {163, NO_VALUE}, /* 153. __RSC_msgctl */ {NO_VALUE, NO_VALUE}, /* 154. __RSC_msgget */ {NO_VALUE, NO_VALUE}, /* 155. __RSC_msgrcv */ {NO_VALUE, NO_VALUE}, /* 156. __RSC_msgsnd */ {NO_VALUE, NO_VALUE}, /* 157. __RSC_msync */ {144, NO_VALUE}, /* 158. __RSC_multiplexer */ {201, NO_VALUE}, /* 159. __RSC_munlock */ {151, NO_VALUE}, /* 160. __RSC_munlockall */ {153, NO_VALUE}, /* 161. __RSC_munmap */ {91, NO_VALUE}, /* 162. __RSC_nanosleep */ {162, NO_VALUE}, /* 163. __RSC_nfsservctl */ {168, NO_VALUE}, /* 164. __RSC_nice */ {34, NO_VALUE}, /* 165. __RSC_oldfstat */ {28, NO_VALUE}, /* 166. __RSC_oldlstat */ {84, NO_VALUE}, /* 167. __RSC_oldolduname */ {59, NO_VALUE}, /* 168. __RSC_oldstat */ {18, NO_VALUE}, /* 169. __RSC_olduname */ {109, NO_VALUE}, /* 170. __RSC_open */ {5, NO_VALUE}, /* 171. __RSC_pause */ {29, NO_VALUE}, /* 172. __RSC_pciconfig_iobase */ {200, NO_VALUE}, /* 173. __RSC_pciconfig_read */ {198, NO_VALUE}, /* 174. __RSC_pciconfig_write */ {199, NO_VALUE}, /* 175. __RSC_personality */ {136, NO_VALUE}, /* 176. __RSC_pipe */ {42, NO_VALUE}, /* 177. __RSC_pivot_root */ {203, NO_VALUE}, /* 178. __RSC_poll */ {167, NO_VALUE}, /* 179. __RSC_prctl */ {171, NO_VALUE}, /* 180. __RSC_pread64 */ {179, NO_VALUE}, /* 181. __RSC_prof */ {44, NO_VALUE}, /* 182. __RSC_profil */ {98, NO_VALUE}, /* 183. __RSC_ptrace */ {26, NO_VALUE}, /* 184. __RSC_putpmsg */ {188, NO_VALUE}, /* 185. __RSC_pwrite64 */ {180, NO_VALUE}, /* 186. __RSC_query_module */ {166, NO_VALUE}, /* 187. __RSC_quotactl */ {131, NO_VALUE}, /* 188. __RSC_read */ {3, NO_VALUE}, /* 189. __RSC_readahead */ {191, NO_VALUE}, /* 190. __RSC_readdir */ {89, NO_VALUE}, /* 191. __RSC_readlink */ {85, NO_VALUE}, /* 192. __RSC_readv */ {145, NO_VALUE}, /* 193. __RSC_reboot */ {88, NO_VALUE}, /* 194. __RSC_recv */ {102, SYS_RECV}, /* 195. __RSC_recvfrom */ {102, SYS_RECVFROM}, /* 196. __RSC_recvmsg */ {102, SYS_RECVMSG}, /* 197. __RSC_remap_file_pages */ {239, NO_VALUE}, /* 198. __RSC_removexattr */ {218, NO_VALUE}, /* 199. __RSC_rename */ {38, NO_VALUE}, /* 200. __RSC_request_key */ {NO_VALUE, NO_VALUE}, /* 201. __RSC_restart_syscall */ {0, NO_VALUE}, /* 202. __RSC_rmdir */ {40, NO_VALUE}, /* 203. __RSC_rt_sigaction */ {173, NO_VALUE}, /* 204. __RSC_rt_sigpending */ {175, NO_VALUE}, /* 205. __RSC_rt_sigprocmask */ {174, NO_VALUE}, /* 206. __RSC_rt_sigqueueinfo */ {177, NO_VALUE}, /* 207. __RSC_rt_sigreturn */ {172, NO_VALUE}, /* 208. __RSC_rt_sigsuspend */ {178, NO_VALUE}, /* 209. __RSC_rt_sigtimedwait */ {176, NO_VALUE}, /* 210. __RSC_sched_get_priority_max */ {159, NO_VALUE}, /* 211. __RSC_sched_get_priority_min */ {160, NO_VALUE}, /* 212. __RSC_sched_getaffinity */ {223, NO_VALUE}, /* 213. __RSC_sched_getparam */ {155, NO_VALUE}, /* 214. __RSC_sched_getscheduler */ {157, NO_VALUE}, /* 215. __RSC_sched_rr_get_interval */ {161, NO_VALUE}, /* 216. __RSC_sched_setaffinity */ {222, NO_VALUE}, /* 217. __RSC_sched_setparam */ {154, NO_VALUE}, /* 218. __RSC_sched_setscheduler */ {156, NO_VALUE}, /* 219. __RSC_sched_yield */ {158, NO_VALUE}, /* 220. __RSC_security */ {NO_VALUE, NO_VALUE}, /* 221. __RSC_select */ {82, NO_VALUE}, /* 222. __RSC_semctl */ {NO_VALUE, NO_VALUE}, /* 223. __RSC_semget */ {NO_VALUE, NO_VALUE}, /* 224. __RSC_semop */ {NO_VALUE, NO_VALUE}, /* 225. __RSC_semtimedop */ {NO_VALUE, NO_VALUE}, /* 226. __RSC_send */ {102, SYS_SEND}, /* 227. __RSC_sendfile */ {186, NO_VALUE}, /* 228. __RSC_sendfile64 */ {226, NO_VALUE}, /* 229. __RSC_sendmsg */ {102, SYS_SENDMSG}, /* 230. __RSC_sendto */ {102, SYS_SENDTO}, /* 231. __RSC_set_mempolicy */ {NO_VALUE, NO_VALUE}, /* 232. __RSC_set_thread_area */ {NO_VALUE, NO_VALUE}, /* 233. __RSC_set_tid_address */ {232, NO_VALUE}, /* 234. __RSC_setdomainname */ {121, NO_VALUE}, /* 235. __RSC_setfsgid */ {139, NO_VALUE}, /* 236. __RSC_setfsgid32 */ {NO_VALUE, NO_VALUE}, /* 237. __RSC_setfsuid */ {138, NO_VALUE}, /* 238. __RSC_setfsuid32 */ {NO_VALUE, NO_VALUE}, /* 239. __RSC_setgid */ {46, NO_VALUE}, /* 240. __RSC_setgid32 */ {NO_VALUE, NO_VALUE}, /* 241. __RSC_setgroups */ {81, NO_VALUE}, /* 242. __RSC_setgroups32 */ {NO_VALUE, NO_VALUE}, /* 243. __RSC_sethostname */ {74, NO_VALUE}, /* 244. __RSC_setitimer */ {104, NO_VALUE}, /* 245. __RSC_setpgid */ {57, NO_VALUE}, /* 246. __RSC_setpriority */ {97, NO_VALUE}, /* 247. __RSC_setregid */ {71, NO_VALUE}, /* 248. __RSC_setregid32 */ {NO_VALUE, NO_VALUE}, /* 249. __RSC_setresgid */ {169, NO_VALUE}, /* 250. __RSC_setresgid32 */ {NO_VALUE, NO_VALUE}, /* 251. __RSC_setresuid */ {164, NO_VALUE}, /* 252. __RSC_setresuid32 */ {NO_VALUE, NO_VALUE}, /* 253. __RSC_setreuid */ {70, NO_VALUE}, /* 254. __RSC_setreuid32 */ {NO_VALUE, NO_VALUE}, /* 255. __RSC_setrlimit */ {75, NO_VALUE}, /* 256. __RSC_setsid */ {66, NO_VALUE}, /* 257. __RSC_setsockopt */ {102, SYS_SETSOCKOPT}, /* 258. __RSC_settimeofday */ {79, NO_VALUE}, /* 259. __RSC_setuid */ {23, NO_VALUE}, /* 260. __RSC_setuid32 */ {NO_VALUE, NO_VALUE}, /* 261. __RSC_setxattr */ {209, NO_VALUE}, /* 262. __RSC_sgetmask */ {68, NO_VALUE}, /* 263. __RSC_shmat */ {NO_VALUE, NO_VALUE}, /* 264. __RSC_shmctl */ {NO_VALUE, NO_VALUE}, /* 265. __RSC_shmdt */ {NO_VALUE, NO_VALUE}, /* 266. __RSC_shmget */ {NO_VALUE, NO_VALUE}, /* 267. __RSC_shutdown */ {102, SYS_SHUTDOWN}, /* 268. __RSC_sigaction */ {67, NO_VALUE}, /* 269. __RSC_sigaltstack */ {185, NO_VALUE}, /* 270. __RSC_signal */ {48, NO_VALUE}, /* 271. __RSC_sigpending */ {73, NO_VALUE}, /* 272. __RSC_sigprocmask */ {126, NO_VALUE}, /* 273. __RSC_sigreturn */ {119, NO_VALUE}, /* 274. __RSC_sigsuspend */ {72, NO_VALUE}, /* 275. __RSC_socket */ {102, SYS_SOCKET}, /* 276. __RSC_socketcall */ {102, NO_VALUE}, /* 277. __RSC_socketpair */ {102, SYS_SOCKETPAIR}, /* 278. __RSC_ssetmask */ {69, NO_VALUE}, /* 279. __RSC_stat */ {106, NO_VALUE}, /* 280. __RSC_stat64 */ {195, NO_VALUE}, /* 281. __RSC_statfs */ {99, NO_VALUE}, /* 282. __RSC_statfs64 */ {252, NO_VALUE}, /* 283. __RSC_stime */ {25, NO_VALUE}, /* 284. __RSC_stty */ {31, NO_VALUE}, /* 285. __RSC_swapcontext */ {249, NO_VALUE}, /* 286. __RSC_swapoff */ {115, NO_VALUE}, /* 287. __RSC_swapon */ {87, NO_VALUE}, /* 288. __RSC_symlink */ {83, NO_VALUE}, /* 289. __RSC_sync */ {36, NO_VALUE}, /* 290. __RSC_sys_kexec_load */ {NO_VALUE, NO_VALUE}, /* 291. __RSC_sysfs */ {135, NO_VALUE}, /* 292. __RSC_sysinfo */ {116, NO_VALUE}, /* 293. __RSC_syslog */ {103, NO_VALUE}, /* 294. __RSC_tgkill */ {250, NO_VALUE}, /* 295. __RSC_time */ {13, NO_VALUE}, /* 296. __RSC_timer_create */ {240, NO_VALUE}, /* 297. __RSC_timer_delete */ {244, NO_VALUE}, /* 298. __RSC_timer_getoverrun */ {243, NO_VALUE}, /* 299. __RSC_timer_gettime */ {242, NO_VALUE}, /* 300. __RSC_timer_settime */ {241, NO_VALUE}, /* 301. __RSC_times */ {43, NO_VALUE}, /* 302. __RSC_tkill */ {208, NO_VALUE}, /* 303. __RSC_truncate */ {92, NO_VALUE}, /* 304. __RSC_truncate64 */ {193, NO_VALUE}, /* 305. __RSC_tuxcall */ {225, NO_VALUE}, /* 306. __RSC_ugetrlimit */ {190, NO_VALUE}, /* 307. __RSC_ulimit */ {58, NO_VALUE}, /* 308. __RSC_umask */ {60, NO_VALUE}, /* 309. __RSC_umount */ {22, NO_VALUE}, /* 310. __RSC_umount2 */ {52, NO_VALUE}, /* 311. __RSC_uname */ {122, NO_VALUE}, /* 312. __RSC_unlink */ {10, NO_VALUE}, /* 313. __RSC_uselib */ {86, NO_VALUE}, /* 314. __RSC_ustat */ {62, NO_VALUE}, /* 315. __RSC_utime */ {30, NO_VALUE}, /* 316. __RSC_utimes */ {251, NO_VALUE}, /* 317. __RSC_vfork */ {189, NO_VALUE}, /* 318. __RSC_vhangup */ {111, NO_VALUE}, /* 319. __RSC_vm86 */ {113, NO_VALUE}, /* 320. __RSC_vm86old */ {NO_VALUE, NO_VALUE}, /* 321. __RSC_vserver */ {NO_VALUE, NO_VALUE}, /* 322. __RSC_wait4 */ {114, NO_VALUE}, /* 323. __RSC_waitid */ {NO_VALUE, NO_VALUE}, /* 324. __RSC_waitpid */ {7, NO_VALUE}, /* 325. __RSC_write */ {4, NO_VALUE}, /* 326. __RSC_writev */ {146, NO_VALUE} }; #endif /* __RSC_TO_NR_HEADER__ */ umview-0.8.2/um_rsc/librsc/src/rsc_consts.c0000644000175000017500000015651111753517213020010 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * rsc_consts.c: RSC constants management * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include "aconv.h" #include "nr_to_rsc.h" #include "rsc_to_nr.h" #include "debug.h" /*########################################################################*/ /*## ##*/ /*## LOCAL VARIABLES ##*/ /*## ##*/ /*########################################################################*/ /* Strings returned when is required a string for a __RSC_* or __NR_* * constant that doesn't exist. */ char *rsc_not_existing = "__RSC_ CONSTANT DOESN'T EXIST!"; char *nr_not_existing = "__NR_ CONSTANT DOESN'T EXIST!"; /**************************************************************************/ /* The following tables are used to convert to string a __NR_* or */ /* __RSC_* constant. */ /**************************************************************************/ char *rsc_to_str[] = { /* 0. __RSC__exit */ "__RSC__exit", /* 1. __RSC__llseek */ "__RSC__llseek", /* 2. __RSC__newselect */ "__RSC__newselect", /* 3. __RSC__sysctl */ "__RSC__sysctl", /* 4. __RSC_accept */ "__RSC_accept", /* 5. __RSC_access */ "__RSC_access", /* 6. __RSC_acct */ "__RSC_acct", /* 7. __RSC_add_key */ "__RSC_add_key", /* 8. __RSC_adjtimex */ "__RSC_adjtimex", /* 9. __RSC_afs_syscall */ "__RSC_afs_syscall", /* 10. __RSC_alarm */ "__RSC_alarm", /* 11. __RSC_arch_prctl */ "__RSC_arch_prctl", /* 12. __RSC_bdflush */ "__RSC_bdflush", /* 13. __RSC_bind */ "__RSC_bind", /* 14. __RSC_break */ "__RSC_break", /* 15. __RSC_brk */ "__RSC_brk", /* 16. __RSC_capget */ "__RSC_capget", /* 17. __RSC_capset */ "__RSC_capset", /* 18. __RSC_chdir */ "__RSC_chdir", /* 19. __RSC_chmod */ "__RSC_chmod", /* 20. __RSC_chown */ "__RSC_chown", /* 21. __RSC_chown32 */ "__RSC_chown32", /* 22. __RSC_chroot */ "__RSC_chroot", /* 23. __RSC_clock_getres */ "__RSC_clock_getres", /* 24. __RSC_clock_gettime */ "__RSC_clock_gettime", /* 25. __RSC_clock_nanosleep */ "__RSC_clock_nanosleep", /* 26. __RSC_clock_settime */ "__RSC_clock_settime", /* 27. __RSC_clone */ "__RSC_clone", /* 28. __RSC_close */ "__RSC_close", /* 29. __RSC_connect */ "__RSC_connect", /* 30. __RSC_creat */ "__RSC_creat", /* 31. __RSC_create_module */ "__RSC_create_module", /* 32. __RSC_delete_module */ "__RSC_delete_module", /* 33. __RSC_dup */ "__RSC_dup", /* 34. __RSC_dup2 */ "__RSC_dup2", /* 35. __RSC_epoll_create */ "__RSC_epoll_create", /* 36. __RSC_epoll_ctl */ "__RSC_epoll_ctl", /* 37. __RSC_epoll_ctl_old */ "__RSC_epoll_ctl_old", /* 38. __RSC_epoll_wait */ "__RSC_epoll_wait", /* 39. __RSC_epoll_wait_old */ "__RSC_epoll_wait_old", /* 40. __RSC_execve */ "__RSC_execve", /* 41. __RSC_exit */ "__RSC_exit", /* 42. __RSC_exit_group */ "__RSC_exit_group", /* 43. __RSC_fadvise64 */ "__RSC_fadvise64", /* 44. __RSC_fadvise64_64 */ "__RSC_fadvise64_64", /* 45. __RSC_fchdir */ "__RSC_fchdir", /* 46. __RSC_fchmod */ "__RSC_fchmod", /* 47. __RSC_fchown */ "__RSC_fchown", /* 48. __RSC_fchown32 */ "__RSC_fchown32", /* 49. __RSC_fcntl */ "__RSC_fcntl", /* 50. __RSC_fcntl64 */ "__RSC_fcntl64", /* 51. __RSC_fdatasync */ "__RSC_fdatasync", /* 52. __RSC_fgetxattr */ "__RSC_fgetxattr", /* 53. __RSC_flistxattr */ "__RSC_flistxattr", /* 54. __RSC_flock */ "__RSC_flock", /* 55. __RSC_fork */ "__RSC_fork", /* 56. __RSC_fremovexattr */ "__RSC_fremovexattr", /* 57. __RSC_fsetxattr */ "__RSC_fsetxattr", /* 58. __RSC_fstat */ "__RSC_fstat", /* 59. __RSC_fstat64 */ "__RSC_fstat64", /* 60. __RSC_fstatfs */ "__RSC_fstatfs", /* 61. __RSC_fstatfs64 */ "__RSC_fstatfs64", /* 62. __RSC_fsync */ "__RSC_fsync", /* 63. __RSC_ftime */ "__RSC_ftime", /* 64. __RSC_ftruncate */ "__RSC_ftruncate", /* 65. __RSC_ftruncate64 */ "__RSC_ftruncate64", /* 66. __RSC_futex */ "__RSC_futex", /* 67. __RSC_get_kernel_syms */ "__RSC_get_kernel_syms", /* 68. __RSC_get_mempolicy */ "__RSC_get_mempolicy", /* 69. __RSC_get_thread_area */ "__RSC_get_thread_area", /* 70. __RSC_getcwd */ "__RSC_getcwd", /* 71. __RSC_getdents */ "__RSC_getdents", /* 72. __RSC_getdents64 */ "__RSC_getdents64", /* 73. __RSC_getegid */ "__RSC_getegid", /* 74. __RSC_getegid32 */ "__RSC_getegid32", /* 75. __RSC_geteuid */ "__RSC_geteuid", /* 76. __RSC_geteuid32 */ "__RSC_geteuid32", /* 77. __RSC_getgid */ "__RSC_getgid", /* 78. __RSC_getgid32 */ "__RSC_getgid32", /* 79. __RSC_getgroups */ "__RSC_getgroups", /* 80. __RSC_getgroups32 */ "__RSC_getgroups32", /* 81. __RSC_getitimer */ "__RSC_getitimer", /* 82. __RSC_getpeername */ "__RSC_getpeername", /* 83. __RSC_getpgid */ "__RSC_getpgid", /* 84. __RSC_getpgrp */ "__RSC_getpgrp", /* 85. __RSC_getpid */ "__RSC_getpid", /* 86. __RSC_getpmsg */ "__RSC_getpmsg", /* 87. __RSC_getppid */ "__RSC_getppid", /* 88. __RSC_getpriority */ "__RSC_getpriority", /* 89. __RSC_getresgid */ "__RSC_getresgid", /* 90. __RSC_getresgid32 */ "__RSC_getresgid32", /* 91. __RSC_getresuid */ "__RSC_getresuid", /* 92. __RSC_getresuid32 */ "__RSC_getresuid32", /* 93. __RSC_getrlimit */ "__RSC_getrlimit", /* 94. __RSC_getrusage */ "__RSC_getrusage", /* 95. __RSC_getsid */ "__RSC_getsid", /* 96. __RSC_getsockname */ "__RSC_getsockname", /* 97. __RSC_getsockopt */ "__RSC_getsockopt", /* 98. __RSC_gettid */ "__RSC_gettid", /* 99. __RSC_gettimeofday */ "__RSC_gettimeofday", /* 100. __RSC_getuid */ "__RSC_getuid", /* 101. __RSC_getuid32 */ "__RSC_getuid32", /* 102. __RSC_getxattr */ "__RSC_getxattr", /* 103. __RSC_gtty */ "__RSC_gtty", /* 104. __RSC_idle */ "__RSC_idle", /* 105. __RSC_init_module */ "__RSC_init_module", /* 106. __RSC_io_cancel */ "__RSC_io_cancel", /* 107. __RSC_io_destroy */ "__RSC_io_destroy", /* 108. __RSC_io_getevents */ "__RSC_io_getevents", /* 109. __RSC_io_setup */ "__RSC_io_setup", /* 110. __RSC_io_submit */ "__RSC_io_submit", /* 111. __RSC_ioctl */ "__RSC_ioctl", /* 112. __RSC_ioperm */ "__RSC_ioperm", /* 113. __RSC_iopl */ "__RSC_iopl", /* 114. __RSC_ipc */ "__RSC_ipc", /* 115. __RSC_kexec_load */ "__RSC_kexec_load", /* 116. __RSC_keyctl */ "__RSC_keyctl", /* 117. __RSC_kill */ "__RSC_kill", /* 118. __RSC_lchown */ "__RSC_lchown", /* 119. __RSC_lchown32 */ "__RSC_lchown32", /* 120. __RSC_lgetxattr */ "__RSC_lgetxattr", /* 121. __RSC_link */ "__RSC_link", /* 122. __RSC_listen */ "__RSC_listen", /* 123. __RSC_listxattr */ "__RSC_listxattr", /* 124. __RSC_llistxattr */ "__RSC_llistxattr", /* 125. __RSC_lock */ "__RSC_lock", /* 126. __RSC_lookup_dcookie */ "__RSC_lookup_dcookie", /* 127. __RSC_lremovexattr */ "__RSC_lremovexattr", /* 128. __RSC_lseek */ "__RSC_lseek", /* 129. __RSC_lsetxattr */ "__RSC_lsetxattr", /* 130. __RSC_lstat */ "__RSC_lstat", /* 131. __RSC_lstat64 */ "__RSC_lstat64", /* 132. __RSC_madvise */ "__RSC_madvise", /* 133. __RSC_madvise1 */ "__RSC_madvise1", /* 134. __RSC_mbind */ "__RSC_mbind", /* 135. __RSC_mincore */ "__RSC_mincore", /* 136. __RSC_mkdir */ "__RSC_mkdir", /* 137. __RSC_mknod */ "__RSC_mknod", /* 138. __RSC_mlock */ "__RSC_mlock", /* 139. __RSC_mlockall */ "__RSC_mlockall", /* 140. __RSC_mmap */ "__RSC_mmap", /* 141. __RSC_mmap2 */ "__RSC_mmap2", /* 142. __RSC_modify_ldt */ "__RSC_modify_ldt", /* 143. __RSC_mount */ "__RSC_mount", /* 144. __RSC_mprotect */ "__RSC_mprotect", /* 145. __RSC_mpx */ "__RSC_mpx", /* 146. __RSC_mq_getsetattr */ "__RSC_mq_getsetattr", /* 147. __RSC_mq_notify */ "__RSC_mq_notify", /* 148. __RSC_mq_open */ "__RSC_mq_open", /* 149. __RSC_mq_timedreceive */ "__RSC_mq_timedreceive", /* 150. __RSC_mq_timedsend */ "__RSC_mq_timedsend", /* 151. __RSC_mq_unlink */ "__RSC_mq_unlink", /* 152. __RSC_mremap */ "__RSC_mremap", /* 153. __RSC_msgctl */ "__RSC_msgctl", /* 154. __RSC_msgget */ "__RSC_msgget", /* 155. __RSC_msgrcv */ "__RSC_msgrcv", /* 156. __RSC_msgsnd */ "__RSC_msgsnd", /* 157. __RSC_msync */ "__RSC_msync", /* 158. __RSC_multiplexer */ "__RSC_multiplexer", /* 159. __RSC_munlock */ "__RSC_munlock", /* 160. __RSC_munlockall */ "__RSC_munlockall", /* 161. __RSC_munmap */ "__RSC_munmap", /* 162. __RSC_nanosleep */ "__RSC_nanosleep", /* 163. __RSC_nfsservctl */ "__RSC_nfsservctl", /* 164. __RSC_nice */ "__RSC_nice", /* 165. __RSC_oldfstat */ "__RSC_oldfstat", /* 166. __RSC_oldlstat */ "__RSC_oldlstat", /* 167. __RSC_oldolduname */ "__RSC_oldolduname", /* 168. __RSC_oldstat */ "__RSC_oldstat", /* 169. __RSC_olduname */ "__RSC_olduname", /* 170. __RSC_open */ "__RSC_open", /* 171. __RSC_pause */ "__RSC_pause", /* 172. __RSC_pciconfig_iobase */ "__RSC_pciconfig_iobase", /* 173. __RSC_pciconfig_read */ "__RSC_pciconfig_read", /* 174. __RSC_pciconfig_write */ "__RSC_pciconfig_write", /* 175. __RSC_personality */ "__RSC_personality", /* 176. __RSC_pipe */ "__RSC_pipe", /* 177. __RSC_pivot_root */ "__RSC_pivot_root", /* 178. __RSC_poll */ "__RSC_poll", /* 179. __RSC_prctl */ "__RSC_prctl", /* 180. __RSC_pread64 */ "__RSC_pread64", /* 181. __RSC_prof */ "__RSC_prof", /* 182. __RSC_profil */ "__RSC_profil", /* 183. __RSC_ptrace */ "__RSC_ptrace", /* 184. __RSC_putpmsg */ "__RSC_putpmsg", /* 185. __RSC_pwrite64 */ "__RSC_pwrite64", /* 186. __RSC_query_module */ "__RSC_query_module", /* 187. __RSC_quotactl */ "__RSC_quotactl", /* 188. __RSC_read */ "__RSC_read", /* 189. __RSC_readahead */ "__RSC_readahead", /* 190. __RSC_readdir */ "__RSC_readdir", /* 191. __RSC_readlink */ "__RSC_readlink", /* 192. __RSC_readv */ "__RSC_readv", /* 193. __RSC_reboot */ "__RSC_reboot", /* 194. __RSC_recv */ "__RSC_recv", /* 195. __RSC_recvfrom */ "__RSC_recvfrom", /* 196. __RSC_recvmsg */ "__RSC_recvmsg", /* 197. __RSC_remap_file_pages */ "__RSC_remap_file_pages", /* 198. __RSC_removexattr */ "__RSC_removexattr", /* 199. __RSC_rename */ "__RSC_rename", /* 200. __RSC_request_key */ "__RSC_request_key", /* 201. __RSC_restart_syscall */ "__RSC_restart_syscall", /* 202. __RSC_rmdir */ "__RSC_rmdir", /* 203. __RSC_rt_sigaction */ "__RSC_rt_sigaction", /* 204. __RSC_rt_sigpending */ "__RSC_rt_sigpending", /* 205. __RSC_rt_sigprocmask */ "__RSC_rt_sigprocmask", /* 206. __RSC_rt_sigqueueinfo */ "__RSC_rt_sigqueueinfo", /* 207. __RSC_rt_sigreturn */ "__RSC_rt_sigreturn", /* 208. __RSC_rt_sigsuspend */ "__RSC_rt_sigsuspend", /* 209. __RSC_rt_sigtimedwait */ "__RSC_rt_sigtimedwait", /* 210. __RSC_sched_get_priority_max */ "__RSC_sched_get_priority_max", /* 211. __RSC_sched_get_priority_min */ "__RSC_sched_get_priority_min", /* 212. __RSC_sched_getaffinity */ "__RSC_sched_getaffinity", /* 213. __RSC_sched_getparam */ "__RSC_sched_getparam", /* 214. __RSC_sched_getscheduler */ "__RSC_sched_getscheduler", /* 215. __RSC_sched_rr_get_interval */ "__RSC_sched_rr_get_interval", /* 216. __RSC_sched_setaffinity */ "__RSC_sched_setaffinity", /* 217. __RSC_sched_setparam */ "__RSC_sched_setparam", /* 218. __RSC_sched_setscheduler */ "__RSC_sched_setscheduler", /* 219. __RSC_sched_yield */ "__RSC_sched_yield", /* 220. __RSC_security */ "__RSC_security", /* 221. __RSC_select */ "__RSC_select", /* 222. __RSC_semctl */ "__RSC_semctl", /* 223. __RSC_semget */ "__RSC_semget", /* 224. __RSC_semop */ "__RSC_semop", /* 225. __RSC_semtimedop */ "__RSC_semtimedop", /* 226. __RSC_send */ "__RSC_send", /* 227. __RSC_sendfile */ "__RSC_sendfile", /* 228. __RSC_sendfile64 */ "__RSC_sendfile64", /* 229. __RSC_sendmsg */ "__RSC_sendmsg", /* 230. __RSC_sendto */ "__RSC_sendto", /* 231. __RSC_set_mempolicy */ "__RSC_set_mempolicy", /* 232. __RSC_set_thread_area */ "__RSC_set_thread_area", /* 233. __RSC_set_tid_address */ "__RSC_set_tid_address", /* 234. __RSC_setdomainname */ "__RSC_setdomainname", /* 235. __RSC_setfsgid */ "__RSC_setfsgid", /* 236. __RSC_setfsgid32 */ "__RSC_setfsgid32", /* 237. __RSC_setfsuid */ "__RSC_setfsuid", /* 238. __RSC_setfsuid32 */ "__RSC_setfsuid32", /* 239. __RSC_setgid */ "__RSC_setgid", /* 240. __RSC_setgid32 */ "__RSC_setgid32", /* 241. __RSC_setgroups */ "__RSC_setgroups", /* 242. __RSC_setgroups32 */ "__RSC_setgroups32", /* 243. __RSC_sethostname */ "__RSC_sethostname", /* 244. __RSC_setitimer */ "__RSC_setitimer", /* 245. __RSC_setpgid */ "__RSC_setpgid", /* 246. __RSC_setpriority */ "__RSC_setpriority", /* 247. __RSC_setregid */ "__RSC_setregid", /* 248. __RSC_setregid32 */ "__RSC_setregid32", /* 249. __RSC_setresgid */ "__RSC_setresgid", /* 250. __RSC_setresgid32 */ "__RSC_setresgid32", /* 251. __RSC_setresuid */ "__RSC_setresuid", /* 252. __RSC_setresuid32 */ "__RSC_setresuid32", /* 253. __RSC_setreuid */ "__RSC_setreuid", /* 254. __RSC_setreuid32 */ "__RSC_setreuid32", /* 255. __RSC_setrlimit */ "__RSC_setrlimit", /* 256. __RSC_setsid */ "__RSC_setsid", /* 257. __RSC_setsockopt */ "__RSC_setsockopt", /* 258. __RSC_settimeofday */ "__RSC_settimeofday", /* 259. __RSC_setuid */ "__RSC_setuid", /* 260. __RSC_setuid32 */ "__RSC_setuid32", /* 261. __RSC_setxattr */ "__RSC_setxattr", /* 262. __RSC_sgetmask */ "__RSC_sgetmask", /* 263. __RSC_shmat */ "__RSC_shmat", /* 264. __RSC_shmctl */ "__RSC_shmctl", /* 265. __RSC_shmdt */ "__RSC_shmdt", /* 266. __RSC_shmget */ "__RSC_shmget", /* 267. __RSC_shutdown */ "__RSC_shutdown", /* 268. __RSC_sigaction */ "__RSC_sigaction", /* 269. __RSC_sigaltstack */ "__RSC_sigaltstack", /* 270. __RSC_signal */ "__RSC_signal", /* 271. __RSC_sigpending */ "__RSC_sigpending", /* 272. __RSC_sigprocmask */ "__RSC_sigprocmask", /* 273. __RSC_sigreturn */ "__RSC_sigreturn", /* 274. __RSC_sigsuspend */ "__RSC_sigsuspend", /* 275. __RSC_socket */ "__RSC_socket", /* 276. __RSC_socketcall */ "__RSC_socketcall", /* 277. __RSC_socketpair */ "__RSC_socketpair", /* 278. __RSC_ssetmask */ "__RSC_ssetmask", /* 279. __RSC_stat */ "__RSC_stat", /* 280. __RSC_stat64 */ "__RSC_stat64", /* 281. __RSC_statfs */ "__RSC_statfs", /* 282. __RSC_statfs64 */ "__RSC_statfs64", /* 283. __RSC_stime */ "__RSC_stime", /* 284. __RSC_stty */ "__RSC_stty", /* 285. __RSC_swapcontext */ "__RSC_swapcontext", /* 286. __RSC_swapoff */ "__RSC_swapoff", /* 287. __RSC_swapon */ "__RSC_swapon", /* 288. __RSC_symlink */ "__RSC_symlink", /* 289. __RSC_sync */ "__RSC_sync", /* 290. __RSC_sys_kexec_load */ "__RSC_sys_kexec_load", /* 291. __RSC_sysfs */ "__RSC_sysfs", /* 292. __RSC_sysinfo */ "__RSC_sysinfo", /* 293. __RSC_syslog */ "__RSC_syslog", /* 294. __RSC_tgkill */ "__RSC_tgkill", /* 295. __RSC_time */ "__RSC_time", /* 296. __RSC_timer_create */ "__RSC_timer_create", /* 297. __RSC_timer_delete */ "__RSC_timer_delete", /* 298. __RSC_timer_getoverrun */ "__RSC_timer_getoverrun", /* 299. __RSC_timer_gettime */ "__RSC_timer_gettime", /* 300. __RSC_timer_settime */ "__RSC_timer_settime", /* 301. __RSC_times */ "__RSC_times", /* 302. __RSC_tkill */ "__RSC_tkill", /* 303. __RSC_truncate */ "__RSC_truncate", /* 304. __RSC_truncate64 */ "__RSC_truncate64", /* 305. __RSC_tuxcall */ "__RSC_tuxcall", /* 306. __RSC_ugetrlimit */ "__RSC_ugetrlimit", /* 307. __RSC_ulimit */ "__RSC_ulimit", /* 308. __RSC_umask */ "__RSC_umask", /* 309. __RSC_umount */ "__RSC_umount", /* 310. __RSC_umount2 */ "__RSC_umount2", /* 311. __RSC_uname */ "__RSC_uname", /* 312. __RSC_unlink */ "__RSC_unlink", /* 313. __RSC_uselib */ "__RSC_uselib", /* 314. __RSC_ustat */ "__RSC_ustat", /* 315. __RSC_utime */ "__RSC_utime", /* 316. __RSC_utimes */ "__RSC_utimes", /* 317. __RSC_vfork */ "__RSC_vfork", /* 318. __RSC_vhangup */ "__RSC_vhangup", /* 319. __RSC_vm86 */ "__RSC_vm86", /* 320. __RSC_vm86old */ "__RSC_vm86old", /* 321. __RSC_vserver */ "__RSC_vserver", /* 322. __RSC_wait4 */ "__RSC_wait4", /* 323. __RSC_waitid */ "__RSC_waitid", /* 324. __RSC_waitpid */ "__RSC_waitpid", /* 325. __RSC_write */ "__RSC_write", /* 326. __RSC_writev */ "__RSC_writev", }; char * x86_to_str[] = { /* 0. __NR_restart_syscall */ "__NR_restart_syscall", /* 1. __NR_exit */ "__NR_exit", /* 2. __NR_fork */ "__NR_fork", /* 3. __NR_read */ "__NR_read", /* 4. __NR_write */ "__NR_write", /* 5. __NR_open */ "__NR_open", /* 6. __NR_close */ "__NR_close", /* 7. __NR_waitpid */ "__NR_waitpid", /* 8. __NR_creat */ "__NR_creat", /* 9. __NR_link */ "__NR_link", /* 10. __NR_unlink */ "__NR_unlink", /* 11. __NR_execve */ "__NR_execve", /* 12. __NR_chdir */ "__NR_chdir", /* 13. __NR_time */ "__NR_time", /* 14. __NR_mknod */ "__NR_mknod", /* 15. __NR_chmod */ "__NR_chmod", /* 16. __NR_lchown */ "__NR_lchown", /* 17. __NR_break */ "__NR_break", /* 18. __NR_oldstat */ "__NR_oldstat", /* 19. __NR_lseek */ "__NR_lseek", /* 20. __NR_getpid */ "__NR_getpid", /* 21. __NR_mount */ "__NR_mount", /* 22. __NR_umount */ "__NR_umount", /* 23. __NR_setuid */ "__NR_setuid", /* 24. __NR_getuid */ "__NR_getuid", /* 25. __NR_stime */ "__NR_stime", /* 26. __NR_ptrace */ "__NR_ptrace", /* 27. __NR_alarm */ "__NR_alarm", /* 28. __NR_oldfstat */ "__NR_oldfstat", /* 29. __NR_pause */ "__NR_pause", /* 30. __NR_utime */ "__NR_utime", /* 31. __NR_stty */ "__NR_stty", /* 32. __NR_gtty */ "__NR_gtty", /* 33. __NR_access */ "__NR_access", /* 34. __NR_nice */ "__NR_nice", /* 35. __NR_ftime */ "__NR_ftime", /* 36. __NR_sync */ "__NR_sync", /* 37. __NR_kill */ "__NR_kill", /* 38. __NR_rename */ "__NR_rename", /* 39. __NR_mkdir */ "__NR_mkdir", /* 40. __NR_rmdir */ "__NR_rmdir", /* 41. __NR_dup */ "__NR_dup", /* 42. __NR_pipe */ "__NR_pipe", /* 43. __NR_times */ "__NR_times", /* 44. __NR_prof */ "__NR_prof", /* 45. __NR_brk */ "__NR_brk", /* 46. __NR_setgid */ "__NR_setgid", /* 47. __NR_getgid */ "__NR_getgid", /* 48. __NR_signal */ "__NR_signal", /* 49. __NR_geteuid */ "__NR_geteuid", /* 50. __NR_getegid */ "__NR_getegid", /* 51. __NR_acct */ "__NR_acct", /* 52. __NR_umount2 */ "__NR_umount2", /* 53. __NR_lock */ "__NR_lock", /* 54. __NR_ioctl */ "__NR_ioctl", /* 55. __NR_fcntl */ "__NR_fcntl", /* 56. __NR_mpx */ "__NR_mpx", /* 57. __NR_setpgid */ "__NR_setpgid", /* 58. __NR_ulimit */ "__NR_ulimit", /* 59. __NR_oldolduname */ "__NR_oldolduname", /* 60. __NR_umask */ "__NR_umask", /* 61. __NR_chroot */ "__NR_chroot", /* 62. __NR_ustat */ "__NR_ustat", /* 63. __NR_dup2 */ "__NR_dup2", /* 64. __NR_getppid */ "__NR_getppid", /* 65. __NR_getpgrp */ "__NR_getpgrp", /* 66. __NR_setsid */ "__NR_setsid", /* 67. __NR_sigaction */ "__NR_sigaction", /* 68. __NR_sgetmask */ "__NR_sgetmask", /* 69. __NR_ssetmask */ "__NR_ssetmask", /* 70. __NR_setreuid */ "__NR_setreuid", /* 71. __NR_setregid */ "__NR_setregid", /* 72. __NR_sigsuspend */ "__NR_sigsuspend", /* 73. __NR_sigpending */ "__NR_sigpending", /* 74. __NR_sethostname */ "__NR_sethostname", /* 75. __NR_setrlimit */ "__NR_setrlimit", /* 76. __NR_getrlimit */ "__NR_getrlimit", /* 77. __NR_getrusage */ "__NR_getrusage", /* 78. __NR_gettimeofday */ "__NR_gettimeofday", /* 79. __NR_settimeofday */ "__NR_settimeofday", /* 80. __NR_getgroups */ "__NR_getgroups", /* 81. __NR_setgroups */ "__NR_setgroups", /* 82. __NR_select */ "__NR_select", /* 83. __NR_symlink */ "__NR_symlink", /* 84. __NR_oldlstat */ "__NR_oldlstat", /* 85. __NR_readlink */ "__NR_readlink", /* 86. __NR_uselib */ "__NR_uselib", /* 87. __NR_swapon */ "__NR_swapon", /* 88. __NR_reboot */ "__NR_reboot", /* 89. __NR_readdir */ "__NR_readdir", /* 90. __NR_mmap */ "__NR_mmap", /* 91. __NR_munmap */ "__NR_munmap", /* 92. __NR_truncate */ "__NR_truncate", /* 93. __NR_ftruncate */ "__NR_ftruncate", /* 94. __NR_fchmod */ "__NR_fchmod", /* 95. __NR_fchown */ "__NR_fchown", /* 96. __NR_getpriority */ "__NR_getpriority", /* 97. __NR_setpriority */ "__NR_setpriority", /* 98. __NR_profil */ "__NR_profil", /* 99. __NR_statfs */ "__NR_statfs", /* 100. __NR_fstatfs */ "__NR_fstatfs", /* 101. __NR_ioperm */ "__NR_ioperm", /* 102. __NR_socketcall */ "__NR_socketcall", /* 103. __NR_syslog */ "__NR_syslog", /* 104. __NR_setitimer */ "__NR_setitimer", /* 105. __NR_getitimer */ "__NR_getitimer", /* 106. __NR_stat */ "__NR_stat", /* 107. __NR_lstat */ "__NR_lstat", /* 108. __NR_fstat */ "__NR_fstat", /* 109. __NR_olduname */ "__NR_olduname", /* 110. __NR_iopl */ "__NR_iopl", /* 111. __NR_vhangup */ "__NR_vhangup", /* 112. __NR_idle */ "__NR_idle", /* 113. __NR_vm86old */ "__NR_vm86old", /* 114. __NR_wait4 */ "__NR_wait4", /* 115. __NR_swapoff */ "__NR_swapoff", /* 116. __NR_sysinfo */ "__NR_sysinfo", /* 117. __NR_ipc */ "__NR_ipc", /* 118. __NR_fsync */ "__NR_fsync", /* 119. __NR_sigreturn */ "__NR_sigreturn", /* 120. __NR_clone */ "__NR_clone", /* 121. __NR_setdomainname */ "__NR_setdomainname", /* 122. __NR_uname */ "__NR_uname", /* 123. __NR_modify_ldt */ "__NR_modify_ldt", /* 124. __NR_adjtimex */ "__NR_adjtimex", /* 125. __NR_mprotect */ "__NR_mprotect", /* 126. __NR_sigprocmask */ "__NR_sigprocmask", /* 127. __NR_create_module */ "__NR_create_module", /* 128. __NR_init_module */ "__NR_init_module", /* 129. __NR_delete_module */ "__NR_delete_module", /* 130. __NR_get_kernel_syms */ "__NR_get_kernel_syms", /* 131. __NR_quotactl */ "__NR_quotactl", /* 132. __NR_getpgid */ "__NR_getpgid", /* 133. __NR_fchdir */ "__NR_fchdir", /* 134. __NR_bdflush */ "__NR_bdflush", /* 135. __NR_sysfs */ "__NR_sysfs", /* 136. __NR_personality */ "__NR_personality", /* 137. __NR_afs_syscall */ "__NR_afs_syscall", /* 138. __NR_setfsuid */ "__NR_setfsuid", /* 139. __NR_setfsgid */ "__NR_setfsgid", /* 140. __NR__llseek */ "__NR__llseek", /* 141. __NR_getdents */ "__NR_getdents", /* 142. __NR__newselect */ "__NR__newselect", /* 143. __NR_flock */ "__NR_flock", /* 144. __NR_msync */ "__NR_msync", /* 145. __NR_readv */ "__NR_readv", /* 146. __NR_writev */ "__NR_writev", /* 147. __NR_getsid */ "__NR_getsid", /* 148. __NR_fdatasync */ "__NR_fdatasync", /* 149. __NR__sysctl */ "__NR__sysctl", /* 150. __NR_mlock */ "__NR_mlock", /* 151. __NR_munlock */ "__NR_munlock", /* 152. __NR_mlockall */ "__NR_mlockall", /* 153. __NR_munlockall */ "__NR_munlockall", /* 154. __NR_sched_setparam */ "__NR_sched_setparam", /* 155. __NR_sched_getparam */ "__NR_sched_getparam", /* 156. __NR_sched_setscheduler */ "__NR_sched_setscheduler", /* 157. __NR_sched_getscheduler */ "__NR_sched_getscheduler", /* 158. __NR_sched_yield */ "__NR_sched_yield", /* 159. __NR_sched_get_priority_max */ "__NR_sched_get_priority_max", /* 160. __NR_sched_get_priority_min */ "__NR_sched_get_priority_min", /* 161. __NR_sched_rr_get_interval */ "__NR_sched_rr_get_interval", /* 162. __NR_nanosleep */ "__NR_nanosleep", /* 163. __NR_mremap */ "__NR_mremap", /* 164. __NR_setresuid */ "__NR_setresuid", /* 165. __NR_getresuid */ "__NR_getresuid", /* 166. __NR_vm86 */ "__NR_vm86", /* 167. __NR_query_module */ "__NR_query_module", /* 168. __NR_poll */ "__NR_poll", /* 169. __NR_nfsservctl */ "__NR_nfsservctl", /* 170. __NR_setresgid */ "__NR_setresgid", /* 171. __NR_getresgid */ "__NR_getresgid", /* 172. __NR_prctl */ "__NR_prctl", /* 173. __NR_rt_sigreturn */ "__NR_rt_sigreturn", /* 174. __NR_rt_sigaction */ "__NR_rt_sigaction", /* 175. __NR_rt_sigprocmask */ "__NR_rt_sigprocmask", /* 176. __NR_rt_sigpending */ "__NR_rt_sigpending", /* 177. __NR_rt_sigtimedwait */ "__NR_rt_sigtimedwait", /* 178. __NR_rt_sigqueueinfo */ "__NR_rt_sigqueueinfo", /* 179. __NR_rt_sigsuspend */ "__NR_rt_sigsuspend", /* 180. __NR_pread64 */ "__NR_pread64", /* 181. __NR_pwrite64 */ "__NR_pwrite64", /* 182. __NR_chown */ "__NR_chown", /* 183. __NR_getcwd */ "__NR_getcwd", /* 184. __NR_capget */ "__NR_capget", /* 185. __NR_capset */ "__NR_capset", /* 186. __NR_sigaltstack */ "__NR_sigaltstack", /* 187. __NR_sendfile */ "__NR_sendfile", /* 188. __NR_getpmsg */ "__NR_getpmsg", /* 189. __NR_putpmsg */ "__NR_putpmsg", /* 190. __NR_vfork */ "__NR_vfork", /* 191. __NR_ugetrlimit */ "__NR_ugetrlimit", /* 192. __NR_mmap2 */ "__NR_mmap2", /* 193. __NR_truncate64 */ "__NR_truncate64", /* 194. __NR_ftruncate64 */ "__NR_ftruncate64", /* 195. __NR_stat64 */ "__NR_stat64", /* 196. __NR_lstat64 */ "__NR_lstat64", /* 197. __NR_fstat64 */ "__NR_fstat64", /* 198. __NR_lchown32 */ "__NR_lchown32", /* 199. __NR_getuid32 */ "__NR_getuid32", /* 200. __NR_getgid32 */ "__NR_getgid32", /* 201. __NR_geteuid32 */ "__NR_geteuid32", /* 202. __NR_getegid32 */ "__NR_getegid32", /* 203. __NR_setreuid32 */ "__NR_setreuid32", /* 204. __NR_setregid32 */ "__NR_setregid32", /* 205. __NR_getgroups32 */ "__NR_getgroups32", /* 206. __NR_setgroups32 */ "__NR_setgroups32", /* 207. __NR_fchown32 */ "__NR_fchown32", /* 208. __NR_setresuid32 */ "__NR_setresuid32", /* 209. __NR_getresuid32 */ "__NR_getresuid32", /* 210. __NR_setresgid32 */ "__NR_setresgid32", /* 211. __NR_getresgid32 */ "__NR_getresgid32", /* 212. __NR_chown32 */ "__NR_chown32", /* 213. __NR_setuid32 */ "__NR_setuid32", /* 214. __NR_setgid32 */ "__NR_setgid32", /* 215. __NR_setfsuid32 */ "__NR_setfsuid32", /* 216. __NR_setfsgid32 */ "__NR_setfsgid32", /* 217. __NR_pivot_root */ "__NR_pivot_root", /* 218. __NR_mincore */ "__NR_mincore", /* 219. __NR_madvise1 */ "__NR_madvise1", /* 220. __NR_getdents64 */ "__NR_getdents64", /* 221. __NR_fcntl64 */ "__NR_fcntl64", /* 222. NOT USED */ "UNDEFINED", /* 223. NOT USED */ "UNDEFINED", /* 224. __NR_gettid */ "__NR_gettid", /* 225. __NR_readahead */ "__NR_readahead", /* 226. __NR_setxattr */ "__NR_setxattr", /* 227. __NR_lsetxattr */ "__NR_lsetxattr", /* 228. __NR_fsetxattr */ "__NR_fsetxattr", /* 229. __NR_getxattr */ "__NR_getxattr", /* 230. __NR_lgetxattr */ "__NR_lgetxattr", /* 231. __NR_fgetxattr */ "__NR_fgetxattr", /* 232. __NR_listxattr */ "__NR_listxattr", /* 233. __NR_llistxattr */ "__NR_llistxattr", /* 234. __NR_flistxattr */ "__NR_flistxattr", /* 235. __NR_removexattr */ "__NR_removexattr", /* 236. __NR_lremovexattr */ "__NR_lremovexattr", /* 237. __NR_fremovexattr */ "__NR_fremovexattr", /* 238. __NR_tkill */ "__NR_tkill", /* 239. __NR_sendfile64 */ "__NR_sendfile64", /* 240. __NR_futex */ "__NR_futex", /* 241. __NR_sched_setaffinity */ "__NR_sched_setaffinity", /* 242. __NR_sched_getaffinity */ "__NR_sched_getaffinity", /* 243. __NR_set_thread_area */ "__NR_set_thread_area", /* 244. __NR_get_thread_area */ "__NR_get_thread_area", /* 245. __NR_io_setup */ "__NR_io_setup", /* 246. __NR_io_destroy */ "__NR_io_destroy", /* 247. __NR_io_getevents */ "__NR_io_getevents", /* 248. __NR_io_submit */ "__NR_io_submit", /* 249. __NR_io_cancel */ "__NR_io_cancel", /* 250. __NR_fadvise64 */ "__NR_fadvise64", /* 251. NOT USED */ "UNDEFINED", /* 252. __NR_exit_group */ "__NR_exit_group", /* 253. __NR_lookup_dcookie */ "__NR_lookup_dcookie", /* 254. __NR_epoll_create */ "__NR_epoll_create", /* 255. __NR_epoll_ctl */ "__NR_epoll_ctl", /* 256. __NR_epoll_wait */ "__NR_epoll_wait", /* 257. __NR_remap_file_pages */ "__NR_remap_file_pages", /* 258. __NR_set_tid_address */ "__NR_set_tid_address", /* 259. __NR_timer_create */ "__NR_timer_create", /* 260. __NR_timer_settime */ "__NR_timer_settime", /* 261. __NR_timer_gettime */ "__NR_timer_gettime", /* 262. __NR_timer_getoverrun */ "__NR_timer_getoverrun", /* 263. __NR_timer_delete */ "__NR_timer_delete", /* 264. __NR_clock_settime */ "__NR_clock_settime", /* 265. __NR_clock_gettime */ "__NR_clock_gettime", /* 266. __NR_clock_getres */ "__NR_clock_getres", /* 267. __NR_clock_nanosleep */ "__NR_clock_nanosleep", /* 268. __NR_statfs64 */ "__NR_statfs64", /* 269. __NR_fstatfs64 */ "__NR_fstatfs64", /* 270. __NR_tgkill */ "__NR_tgkill", /* 271. __NR_utimes */ "__NR_utimes", /* 272. __NR_fadvise64_64 */ "__NR_fadvise64_64", /* 273. __NR_vserver */ "__NR_vserver", /* 274. __NR_mbind */ "__NR_mbind", /* 275. __NR_get_mempolicy */ "__NR_get_mempolicy", /* 276. __NR_set_mempolicy */ "__NR_set_mempolicy", /* 277. __NR_mq_open */ "__NR_mq_open", /* 278. __NR_mq_unlink */ "__NR_mq_unlink", /* 279. __NR_mq_timedsend */ "__NR_mq_timedsend", /* 280. __NR_mq_timedreceive */ "__NR_mq_timedreceive", /* 281. __NR_mq_notify */ "__NR_mq_notify", /* 282. __NR_mq_getsetattr */ "__NR_mq_getsetattr", /* 283. __NR_sys_kexec_load */ "__NR_sys_kexec_load", /* 284. __NR_waitid */ "__NR_waitid", /* 285. NOT USED */ "UNDEFINED", /* 286. __NR_add_key */ "__NR_add_key", /* 287. __NR_request_key */ "__NR_request_key", /* 288. __NR_keyctl */ "__NR_keyctl" }; char * x86_64_to_str[] = { /* 0. __NR_read */ "__NR_read", /* 1. __NR_write */ "__NR_write", /* 2. __NR_open */ "__NR_open", /* 3. __NR_close */ "__NR_close", /* 4. __NR_stat */ "__NR_stat", /* 5. __NR_fstat */ "__NR_fstat", /* 6. __NR_lstat */ "__NR_lstat", /* 7. __NR_poll */ "__NR_poll", /* 8. __NR_lseek */ "__NR_lseek", /* 9. __NR_mmap */ "__NR_mmap", /* 10. __NR_mprotect */ "__NR_mprotect", /* 11. __NR_munmap */ "__NR_munmap", /* 12. __NR_brk */ "__NR_brk", /* 13. __NR_rt_sigaction */ "__NR_rt_sigaction", /* 14. __NR_rt_sigprocmask */ "__NR_rt_sigprocmask", /* 15. __NR_rt_sigreturn */ "__NR_rt_sigreturn", /* 16. __NR_ioctl */ "__NR_ioctl", /* 17. __NR_pread64 */ "__NR_pread64", /* 18. __NR_pwrite64 */ "__NR_pwrite64", /* 19. __NR_readv */ "__NR_readv", /* 20. __NR_writev */ "__NR_writev", /* 21. __NR_access */ "__NR_access", /* 22. __NR_pipe */ "__NR_pipe", /* 23. __NR_select */ "__NR_select", /* 24. __NR_sched_yield */ "__NR_sched_yield", /* 25. __NR_mremap */ "__NR_mremap", /* 26. __NR_msync */ "__NR_msync", /* 27. __NR_mincore */ "__NR_mincore", /* 28. __NR_madvise */ "__NR_madvise", /* 29. __NR_shmget */ "__NR_shmget", /* 30. __NR_shmat */ "__NR_shmat", /* 31. __NR_shmctl */ "__NR_shmctl", /* 32. __NR_dup */ "__NR_dup", /* 33. __NR_dup2 */ "__NR_dup2", /* 34. __NR_pause */ "__NR_pause", /* 35. __NR_nanosleep */ "__NR_nanosleep", /* 36. __NR_getitimer */ "__NR_getitimer", /* 37. __NR_alarm */ "__NR_alarm", /* 38. __NR_setitimer */ "__NR_setitimer", /* 39. __NR_getpid */ "__NR_getpid", /* 40. __NR_sendfile */ "__NR_sendfile", /* 41. __NR_socket */ "__NR_socket", /* 42. __NR_connect */ "__NR_connect", /* 43. __NR_accept */ "__NR_accept", /* 44. __NR_sendto */ "__NR_sendto", /* 45. __NR_recvfrom */ "__NR_recvfrom", /* 46. __NR_sendmsg */ "__NR_sendmsg", /* 47. __NR_recvmsg */ "__NR_recvmsg", /* 48. __NR_shutdown */ "__NR_shutdown", /* 49. __NR_bind */ "__NR_bind", /* 50. __NR_listen */ "__NR_listen", /* 51. __NR_getsockname */ "__NR_getsockname", /* 52. __NR_getpeername */ "__NR_getpeername", /* 53. __NR_socketpair */ "__NR_socketpair", /* 54. __NR_setsockopt */ "__NR_setsockopt", /* 55. __NR_getsockopt */ "__NR_getsockopt", /* 56. __NR_clone */ "__NR_clone", /* 57. __NR_fork */ "__NR_fork", /* 58. __NR_vfork */ "__NR_vfork", /* 59. __NR_execve */ "__NR_execve", /* 60. __NR_exit */ "__NR_exit", /* 61. __NR_wait4 */ "__NR_wait4", /* 62. __NR_kill */ "__NR_kill", /* 63. __NR_uname */ "__NR_uname", /* 64. __NR_semget */ "__NR_semget", /* 65. __NR_semop */ "__NR_semop", /* 66. __NR_semctl */ "__NR_semctl", /* 67. __NR_shmdt */ "__NR_shmdt", /* 68. __NR_msgget */ "__NR_msgget", /* 69. __NR_msgsnd */ "__NR_msgsnd", /* 70. __NR_msgrcv */ "__NR_msgrcv", /* 71. __NR_msgctl */ "__NR_msgctl", /* 72. __NR_fcntl */ "__NR_fcntl", /* 73. __NR_flock */ "__NR_flock", /* 74. __NR_fsync */ "__NR_fsync", /* 75. __NR_fdatasync */ "__NR_fdatasync", /* 76. __NR_truncate */ "__NR_truncate", /* 77. __NR_ftruncate */ "__NR_ftruncate", /* 78. __NR_getdents */ "__NR_getdents", /* 79. __NR_getcwd */ "__NR_getcwd", /* 80. __NR_chdir */ "__NR_chdir", /* 81. __NR_fchdir */ "__NR_fchdir", /* 82. __NR_rename */ "__NR_rename", /* 83. __NR_mkdir */ "__NR_mkdir", /* 84. __NR_rmdir */ "__NR_rmdir", /* 85. __NR_creat */ "__NR_creat", /* 86. __NR_link */ "__NR_link", /* 87. __NR_unlink */ "__NR_unlink", /* 88. __NR_symlink */ "__NR_symlink", /* 89. __NR_readlink */ "__NR_readlink", /* 90. __NR_chmod */ "__NR_chmod", /* 91. __NR_fchmod */ "__NR_fchmod", /* 92. __NR_chown */ "__NR_chown", /* 93. __NR_fchown */ "__NR_fchown", /* 94. __NR_lchown */ "__NR_lchown", /* 95. __NR_umask */ "__NR_umask", /* 96. __NR_gettimeofday */ "__NR_gettimeofday", /* 97. __NR_getrlimit */ "__NR_getrlimit", /* 98. __NR_getrusage */ "__NR_getrusage", /* 99. __NR_sysinfo */ "__NR_sysinfo", /* 100. __NR_times */ "__NR_times", /* 101. __NR_ptrace */ "__NR_ptrace", /* 102. __NR_getuid */ "__NR_getuid", /* 103. __NR_syslog */ "__NR_syslog", /* 104. __NR_getgid */ "__NR_getgid", /* 105. __NR_setuid */ "__NR_setuid", /* 106. __NR_setgid */ "__NR_setgid", /* 107. __NR_geteuid */ "__NR_geteuid", /* 108. __NR_getegid */ "__NR_getegid", /* 109. __NR_setpgid */ "__NR_setpgid", /* 110. __NR_getppid */ "__NR_getppid", /* 111. __NR_getpgrp */ "__NR_getpgrp", /* 112. __NR_setsid */ "__NR_setsid", /* 113. __NR_setreuid */ "__NR_setreuid", /* 114. __NR_setregid */ "__NR_setregid", /* 115. __NR_getgroups */ "__NR_getgroups", /* 116. __NR_setgroups */ "__NR_setgroups", /* 117. __NR_setresuid */ "__NR_setresuid", /* 118. __NR_getresuid */ "__NR_getresuid", /* 119. __NR_setresgid */ "__NR_setresgid", /* 120. __NR_getresgid */ "__NR_getresgid", /* 121. __NR_getpgid */ "__NR_getpgid", /* 122. __NR_setfsuid */ "__NR_setfsuid", /* 123. __NR_setfsgid */ "__NR_setfsgid", /* 124. __NR_getsid */ "__NR_getsid", /* 125. __NR_capget */ "__NR_capget", /* 126. __NR_capset */ "__NR_capset", /* 127. __NR_rt_sigpending */ "__NR_rt_sigpending", /* 128. __NR_rt_sigtimedwait */ "__NR_rt_sigtimedwait", /* 129. __NR_rt_sigqueueinfo */ "__NR_rt_sigqueueinfo", /* 130. __NR_rt_sigsuspend */ "__NR_rt_sigsuspend", /* 131. __NR_sigaltstack */ "__NR_sigaltstack", /* 132. __NR_utime */ "__NR_utime", /* 133. __NR_mknod */ "__NR_mknod", /* 134. __NR_uselib */ "__NR_uselib", /* 135. __NR_personality */ "__NR_personality", /* 136. __NR_ustat */ "__NR_ustat", /* 137. __NR_statfs */ "__NR_statfs", /* 138. __NR_fstatfs */ "__NR_fstatfs", /* 139. __NR_sysfs */ "__NR_sysfs", /* 140. __NR_getpriority */ "__NR_getpriority", /* 141. __NR_setpriority */ "__NR_setpriority", /* 142. __NR_sched_setparam */ "__NR_sched_setparam", /* 143. __NR_sched_getparam */ "__NR_sched_getparam", /* 144. __NR_sched_setscheduler */ "__NR_sched_setscheduler", /* 145. __NR_sched_getscheduler */ "__NR_sched_getscheduler", /* 146. __NR_sched_get_priority_max */ "__NR_sched_get_priority_max", /* 147. __NR_sched_get_priority_min */ "__NR_sched_get_priority_min", /* 148. __NR_sched_rr_get_interval */ "__NR_sched_rr_get_interval", /* 149. __NR_mlock */ "__NR_mlock", /* 150. __NR_munlock */ "__NR_munlock", /* 151. __NR_mlockall */ "__NR_mlockall", /* 152. __NR_munlockall */ "__NR_munlockall", /* 153. __NR_vhangup */ "__NR_vhangup", /* 154. __NR_modify_ldt */ "__NR_modify_ldt", /* 155. __NR_pivot_root */ "__NR_pivot_root", /* 156. __NR__sysctl */ "__NR__sysctl", /* 157. __NR_prctl */ "__NR_prctl", /* 158. __NR_arch_prctl */ "__NR_arch_prctl", /* 159. __NR_adjtimex */ "__NR_adjtimex", /* 160. __NR_setrlimit */ "__NR_setrlimit", /* 161. __NR_chroot */ "__NR_chroot", /* 162. __NR_sync */ "__NR_sync", /* 163. __NR_acct */ "__NR_acct", /* 164. __NR_settimeofday */ "__NR_settimeofday", /* 165. __NR_mount */ "__NR_mount", /* 166. __NR_umount2 */ "__NR_umount2", /* 167. __NR_swapon */ "__NR_swapon", /* 168. __NR_swapoff */ "__NR_swapoff", /* 169. __NR_reboot */ "__NR_reboot", /* 170. __NR_sethostname */ "__NR_sethostname", /* 171. __NR_setdomainname */ "__NR_setdomainname", /* 172. __NR_iopl */ "__NR_iopl", /* 173. __NR_ioperm */ "__NR_ioperm", /* 174. __NR_create_module */ "__NR_create_module", /* 175. __NR_init_module */ "__NR_init_module", /* 176. __NR_delete_module */ "__NR_delete_module", /* 177. __NR_get_kernel_syms */ "__NR_get_kernel_syms", /* 178. __NR_query_module */ "__NR_query_module", /* 179. __NR_quotactl */ "__NR_quotactl", /* 180. __NR_nfsservctl */ "__NR_nfsservctl", /* 181. __NR_getpmsg */ "__NR_getpmsg", /* 182. __NR_putpmsg */ "__NR_putpmsg", /* 183. __NR_afs_syscall */ "__NR_afs_syscall", /* 184. __NR_tuxcall */ "__NR_tuxcall", /* 185. __NR_security */ "__NR_security", /* 186. __NR_gettid */ "__NR_gettid", /* 187. __NR_readahead */ "__NR_readahead", /* 188. __NR_setxattr */ "__NR_setxattr", /* 189. __NR_lsetxattr */ "__NR_lsetxattr", /* 190. __NR_fsetxattr */ "__NR_fsetxattr", /* 191. __NR_getxattr */ "__NR_getxattr", /* 192. __NR_lgetxattr */ "__NR_lgetxattr", /* 193. __NR_fgetxattr */ "__NR_fgetxattr", /* 194. __NR_listxattr */ "__NR_listxattr", /* 195. __NR_llistxattr */ "__NR_llistxattr", /* 196. __NR_flistxattr */ "__NR_flistxattr", /* 197. __NR_removexattr */ "__NR_removexattr", /* 198. __NR_lremovexattr */ "__NR_lremovexattr", /* 199. __NR_fremovexattr */ "__NR_fremovexattr", /* 200. __NR_tkill */ "__NR_tkill", /* 201. __NR_time */ "__NR_time", /* 202. __NR_futex */ "__NR_futex", /* 203. __NR_sched_setaffinity */ "__NR_sched_setaffinity", /* 204. __NR_sched_getaffinity */ "__NR_sched_getaffinity", /* 205. __NR_set_thread_area */ "__NR_set_thread_area", /* 206. __NR_io_setup */ "__NR_io_setup", /* 207. __NR_io_destroy */ "__NR_io_destroy", /* 208. __NR_io_getevents */ "__NR_io_getevents", /* 209. __NR_io_submit */ "__NR_io_submit", /* 210. __NR_io_cancel */ "__NR_io_cancel", /* 211. __NR_get_thread_area */ "__NR_get_thread_area", /* 212. __NR_lookup_dcookie */ "__NR_lookup_dcookie", /* 213. __NR_epoll_create */ "__NR_epoll_create", /* 214. __NR_epoll_ctl_old */ "__NR_epoll_ctl_old", /* 215. __NR_epoll_wait_old */ "__NR_epoll_wait_old", /* 216. __NR_remap_file_pages */ "__NR_remap_file_pages", /* 217. __NR_getdents64 */ "__NR_getdents64", /* 218. __NR_set_tid_address */ "__NR_set_tid_address", /* 219. __NR_restart_syscall */ "__NR_restart_syscall", /* 220. __NR_semtimedop */ "__NR_semtimedop", /* 221. __NR_fadvise64 */ "__NR_fadvise64", /* 222. __NR_timer_create */ "__NR_timer_create", /* 223. __NR_timer_settime */ "__NR_timer_settime", /* 224. __NR_timer_gettime */ "__NR_timer_gettime", /* 225. __NR_timer_getoverrun */ "__NR_timer_getoverrun", /* 226. __NR_timer_delete */ "__NR_timer_delete", /* 227. __NR_clock_settime */ "__NR_clock_settime", /* 228. __NR_clock_gettime */ "__NR_clock_gettime", /* 229. __NR_clock_getres */ "__NR_clock_getres", /* 230. __NR_clock_nanosleep */ "__NR_clock_nanosleep", /* 231. __NR_exit_group */ "__NR_exit_group", /* 232. __NR_epoll_wait */ "__NR_epoll_wait", /* 233. __NR_epoll_ctl */ "__NR_epoll_ctl", /* 234. __NR_tgkill */ "__NR_tgkill", /* 235. __NR_utimes */ "__NR_utimes", /* 236. __NR_vserver */ "__NR_vserver", /* 237. __NR_mbind */ "__NR_mbind", /* 238. __NR_set_mempolicy */ "__NR_set_mempolicy", /* 239. __NR_get_mempolicy */ "__NR_get_mempolicy", /* 240. __NR_mq_open */ "__NR_mq_open", /* 241. __NR_mq_unlink */ "__NR_mq_unlink", /* 242. __NR_mq_timedsend */ "__NR_mq_timedsend", /* 243. __NR_mq_timedreceive */ "__NR_mq_timedreceive", /* 244. __NR_mq_notify */ "__NR_mq_notify", /* 245. __NR_mq_getsetattr */ "__NR_mq_getsetattr", /* 246. __NR_kexec_load */ "__NR_kexec_load", /* 247. __NR_waitid */ "__NR_waitid", /* 248. __NR_add_key */ "__NR_add_key", /* 249. __NR_request_key */ "__NR_request_key", /* 250. __NR_keyctl */ "__NR_keyctl" }; char * ppc_to_str[] = { /* 0. __NR_restart_syscall */ "__NR_restart_syscall", /* 1. __NR_exit */ "__NR_exit", /* 2. __NR_fork */ "__NR_fork", /* 3. __NR_read */ "__NR_read", /* 4. __NR_write */ "__NR_write", /* 5. __NR_open */ "__NR_open", /* 6. __NR_close */ "__NR_close", /* 7. __NR_waitpid */ "__NR_waitpid", /* 8. __NR_creat */ "__NR_creat", /* 9. __NR_link */ "__NR_link", /* 10. __NR_unlink */ "__NR_unlink", /* 11. __NR_execve */ "__NR_execve", /* 12. __NR_chdir */ "__NR_chdir", /* 13. __NR_time */ "__NR_time", /* 14. __NR_mknod */ "__NR_mknod", /* 15. __NR_chmod */ "__NR_chmod", /* 16. __NR_lchown */ "__NR_lchown", /* 17. __NR_break */ "__NR_break", /* 18. __NR_oldstat */ "__NR_oldstat", /* 19. __NR_lseek */ "__NR_lseek", /* 20. __NR_getpid */ "__NR_getpid", /* 21. __NR_mount */ "__NR_mount", /* 22. __NR_umount */ "__NR_umount", /* 23. __NR_setuid */ "__NR_setuid", /* 24. __NR_getuid */ "__NR_getuid", /* 25. __NR_stime */ "__NR_stime", /* 26. __NR_ptrace */ "__NR_ptrace", /* 27. __NR_alarm */ "__NR_alarm", /* 28. __NR_oldfstat */ "__NR_oldfstat", /* 29. __NR_pause */ "__NR_pause", /* 30. __NR_utime */ "__NR_utime", /* 31. __NR_stty */ "__NR_stty", /* 32. __NR_gtty */ "__NR_gtty", /* 33. __NR_access */ "__NR_access", /* 34. __NR_nice */ "__NR_nice", /* 35. __NR_ftime */ "__NR_ftime", /* 36. __NR_sync */ "__NR_sync", /* 37. __NR_kill */ "__NR_kill", /* 38. __NR_rename */ "__NR_rename", /* 39. __NR_mkdir */ "__NR_mkdir", /* 40. __NR_rmdir */ "__NR_rmdir", /* 41. __NR_dup */ "__NR_dup", /* 42. __NR_pipe */ "__NR_pipe", /* 43. __NR_times */ "__NR_times", /* 44. __NR_prof */ "__NR_prof", /* 45. __NR_brk */ "__NR_brk", /* 46. __NR_setgid */ "__NR_setgid", /* 47. __NR_getgid */ "__NR_getgid", /* 48. __NR_signal */ "__NR_signal", /* 49. __NR_geteuid */ "__NR_geteuid", /* 50. __NR_getegid */ "__NR_getegid", /* 51. __NR_acct */ "__NR_acct", /* 52. __NR_umount2 */ "__NR_umount2", /* 53. __NR_lock */ "__NR_lock", /* 54. __NR_ioctl */ "__NR_ioctl", /* 55. __NR_fcntl */ "__NR_fcntl", /* 56. __NR_mpx */ "__NR_mpx", /* 57. __NR_setpgid */ "__NR_setpgid", /* 58. __NR_ulimit */ "__NR_ulimit", /* 59. __NR_oldolduname */ "__NR_oldolduname", /* 60. __NR_umask */ "__NR_umask", /* 61. __NR_chroot */ "__NR_chroot", /* 62. __NR_ustat */ "__NR_ustat", /* 63. __NR_dup2 */ "__NR_dup2", /* 64. __NR_getppid */ "__NR_getppid", /* 65. __NR_getpgrp */ "__NR_getpgrp", /* 66. __NR_setsid */ "__NR_setsid", /* 67. __NR_sigaction */ "__NR_sigaction", /* 68. __NR_sgetmask */ "__NR_sgetmask", /* 69. __NR_ssetmask */ "__NR_ssetmask", /* 70. __NR_setreuid */ "__NR_setreuid", /* 71. __NR_setregid */ "__NR_setregid", /* 72. __NR_sigsuspend */ "__NR_sigsuspend", /* 73. __NR_sigpending */ "__NR_sigpending", /* 74. __NR_sethostname */ "__NR_sethostname", /* 75. __NR_setrlimit */ "__NR_setrlimit", /* 76. __NR_getrlimit */ "__NR_getrlimit", /* 77. __NR_getrusage */ "__NR_getrusage", /* 78. __NR_gettimeofday */ "__NR_gettimeofday", /* 79. __NR_settimeofday */ "__NR_settimeofday", /* 80. __NR_getgroups */ "__NR_getgroups", /* 81. __NR_setgroups */ "__NR_setgroups", /* 82. __NR_select */ "__NR_select", /* 83. __NR_symlink */ "__NR_symlink", /* 84. __NR_oldlstat */ "__NR_oldlstat", /* 85. __NR_readlink */ "__NR_readlink", /* 86. __NR_uselib */ "__NR_uselib", /* 87. __NR_swapon */ "__NR_swapon", /* 88. __NR_reboot */ "__NR_reboot", /* 89. __NR_readdir */ "__NR_readdir", /* 90. __NR_mmap */ "__NR_mmap", /* 91. __NR_munmap */ "__NR_munmap", /* 92. __NR_truncate */ "__NR_truncate", /* 93. __NR_ftruncate */ "__NR_ftruncate", /* 94. __NR_fchmod */ "__NR_fchmod", /* 95. __NR_fchown */ "__NR_fchown", /* 96. __NR_getpriority */ "__NR_getpriority", /* 97. __NR_setpriority */ "__NR_setpriority", /* 98. __NR_profil */ "__NR_profil", /* 99. __NR_statfs */ "__NR_statfs", /* 100. __NR_fstatfs */ "__NR_fstatfs", /* 101. __NR_ioperm */ "__NR_ioperm", /* 102. __NR_socketcall */ "__NR_socketcall", /* 103. __NR_syslog */ "__NR_syslog", /* 104. __NR_setitimer */ "__NR_setitimer", /* 105. __NR_getitimer */ "__NR_getitimer", /* 106. __NR_stat */ "__NR_stat", /* 107. __NR_lstat */ "__NR_lstat", /* 108. __NR_fstat */ "__NR_fstat", /* 109. __NR_olduname */ "__NR_olduname", /* 110. __NR_iopl */ "__NR_iopl", /* 111. __NR_vhangup */ "__NR_vhangup", /* 112. __NR_idle */ "__NR_idle", /* 113. __NR_vm86 */ "__NR_vm86", /* 114. __NR_wait4 */ "__NR_wait4", /* 115. __NR_swapoff */ "__NR_swapoff", /* 116. __NR_sysinfo */ "__NR_sysinfo", /* 117. __NR_ipc */ "__NR_ipc", /* 118. __NR_fsync */ "__NR_fsync", /* 119. __NR_sigreturn */ "__NR_sigreturn", /* 120. __NR_clone */ "__NR_clone", /* 121. __NR_setdomainname */ "__NR_setdomainname", /* 122. __NR_uname */ "__NR_uname", /* 123. __NR_modify_ldt */ "__NR_modify_ldt", /* 124. __NR_adjtimex */ "__NR_adjtimex", /* 125. __NR_mprotect */ "__NR_mprotect", /* 126. __NR_sigprocmask */ "__NR_sigprocmask", /* 127. __NR_create_module */ "__NR_create_module", /* 128. __NR_init_module */ "__NR_init_module", /* 129. __NR_delete_module */ "__NR_delete_module", /* 130. __NR_get_kernel_syms */ "__NR_get_kernel_syms", /* 131. __NR_quotactl */ "__NR_quotactl", /* 132. __NR_getpgid */ "__NR_getpgid", /* 133. __NR_fchdir */ "__NR_fchdir", /* 134. __NR_bdflush */ "__NR_bdflush", /* 135. __NR_sysfs */ "__NR_sysfs", /* 136. __NR_personality */ "__NR_personality", /* 137. __NR_afs_syscall */ "__NR_afs_syscall", /* 138. __NR_setfsuid */ "__NR_setfsuid", /* 139. __NR_setfsgid */ "__NR_setfsgid", /* 140. __NR__llseek */ "__NR__llseek", /* 141. __NR_getdents */ "__NR_getdents", /* 142. __NR__newselect */ "__NR__newselect", /* 143. __NR_flock */ "__NR_flock", /* 144. __NR_msync */ "__NR_msync", /* 145. __NR_readv */ "__NR_readv", /* 146. __NR_writev */ "__NR_writev", /* 147. __NR_getsid */ "__NR_getsid", /* 148. __NR_fdatasync */ "__NR_fdatasync", /* 149. __NR__sysctl */ "__NR__sysctl", /* 150. __NR_mlock */ "__NR_mlock", /* 151. __NR_munlock */ "__NR_munlock", /* 152. __NR_mlockall */ "__NR_mlockall", /* 153. __NR_munlockall */ "__NR_munlockall", /* 154. __NR_sched_setparam */ "__NR_sched_setparam", /* 155. __NR_sched_getparam */ "__NR_sched_getparam", /* 156. __NR_sched_setscheduler */ "__NR_sched_setscheduler", /* 157. __NR_sched_getscheduler */ "__NR_sched_getscheduler", /* 158. __NR_sched_yield */ "__NR_sched_yield", /* 159. __NR_sched_get_priority_max */ "__NR_sched_get_priority_max", /* 160. __NR_sched_get_priority_min */ "__NR_sched_get_priority_min", /* 161. __NR_sched_rr_get_interval */ "__NR_sched_rr_get_interval", /* 162. __NR_nanosleep */ "__NR_nanosleep", /* 163. __NR_mremap */ "__NR_mremap", /* 164. __NR_setresuid */ "__NR_setresuid", /* 165. __NR_getresuid */ "__NR_getresuid", /* 166. __NR_query_module */ "__NR_query_module", /* 167. __NR_poll */ "__NR_poll", /* 168. __NR_nfsservctl */ "__NR_nfsservctl", /* 169. __NR_setresgid */ "__NR_setresgid", /* 170. __NR_getresgid */ "__NR_getresgid", /* 171. __NR_prctl */ "__NR_prctl", /* 172. __NR_rt_sigreturn */ "__NR_rt_sigreturn", /* 173. __NR_rt_sigaction */ "__NR_rt_sigaction", /* 174. __NR_rt_sigprocmask */ "__NR_rt_sigprocmask", /* 175. __NR_rt_sigpending */ "__NR_rt_sigpending", /* 176. __NR_rt_sigtimedwait */ "__NR_rt_sigtimedwait", /* 177. __NR_rt_sigqueueinfo */ "__NR_rt_sigqueueinfo", /* 178. __NR_rt_sigsuspend */ "__NR_rt_sigsuspend", /* 179. __NR_pread64 */ "__NR_pread64", /* 180. __NR_pwrite64 */ "__NR_pwrite64", /* 181. __NR_chown */ "__NR_chown", /* 182. __NR_getcwd */ "__NR_getcwd", /* 183. __NR_capget */ "__NR_capget", /* 184. __NR_capset */ "__NR_capset", /* 185. __NR_sigaltstack */ "__NR_sigaltstack", /* 186. __NR_sendfile */ "__NR_sendfile", /* 187. __NR_getpmsg */ "__NR_getpmsg", /* 188. __NR_putpmsg */ "__NR_putpmsg", /* 189. __NR_vfork */ "__NR_vfork", /* 190. __NR_ugetrlimit */ "__NR_ugetrlimit", /* 191. __NR_readahead */ "__NR_readahead", /* 192. __NR_mmap2 */ "__NR_mmap2", /* 193. __NR_truncate64 */ "__NR_truncate64", /* 194. __NR_ftruncate64 */ "__NR_ftruncate64", /* 195. __NR_stat64 */ "__NR_stat64", /* 196. __NR_lstat64 */ "__NR_lstat64", /* 197. __NR_fstat64 */ "__NR_fstat64", /* 198. __NR_pciconfig_read */ "__NR_pciconfig_read", /* 199. __NR_pciconfig_write */ "__NR_pciconfig_write", /* 200. __NR_pciconfig_iobase */ "__NR_pciconfig_iobase", /* 201. __NR_multiplexer */ "__NR_multiplexer", /* 202. __NR_getdents64 */ "__NR_getdents64", /* 203. __NR_pivot_root */ "__NR_pivot_root", /* 204. __NR_fcntl64 */ "__NR_fcntl64", /* 205. __NR_madvise */ "__NR_madvise", /* 206. __NR_mincore */ "__NR_mincore", /* 207. __NR_gettid */ "__NR_gettid", /* 208. __NR_tkill */ "__NR_tkill", /* 209. __NR_setxattr */ "__NR_setxattr", /* 210. __NR_lsetxattr */ "__NR_lsetxattr", /* 211. __NR_fsetxattr */ "__NR_fsetxattr", /* 212. __NR_getxattr */ "__NR_getxattr", /* 213. __NR_lgetxattr */ "__NR_lgetxattr", /* 214. __NR_fgetxattr */ "__NR_fgetxattr", /* 215. __NR_listxattr */ "__NR_listxattr", /* 216. __NR_llistxattr */ "__NR_llistxattr", /* 217. __NR_flistxattr */ "__NR_flistxattr", /* 218. __NR_removexattr */ "__NR_removexattr", /* 219. __NR_lremovexattr */ "__NR_lremovexattr", /* 220. __NR_fremovexattr */ "__NR_fremovexattr", /* 221. __NR_futex */ "__NR_futex", /* 222. __NR_sched_setaffinity */ "__NR_sched_setaffinity", /* 223. __NR_sched_getaffinity */ "__NR_sched_getaffinity", /* 224. NOT USED */ "UNDEFINED", /* 225. __NR_tuxcall */ "__NR_tuxcall", /* 226. __NR_sendfile64 */ "__NR_sendfile64", /* 227. __NR_io_setup */ "__NR_io_setup", /* 228. __NR_io_destroy */ "__NR_io_destroy", /* 229. __NR_io_getevents */ "__NR_io_getevents", /* 230. __NR_io_submit */ "__NR_io_submit", /* 231. __NR_io_cancel */ "__NR_io_cancel", /* 232. __NR_set_tid_address */ "__NR_set_tid_address", /* 233. __NR_fadvise64 */ "__NR_fadvise64", /* 234. __NR_exit_group */ "__NR_exit_group", /* 235. __NR_lookup_dcookie */ "__NR_lookup_dcookie", /* 236. __NR_epoll_create */ "__NR_epoll_create", /* 237. __NR_epoll_ctl */ "__NR_epoll_ctl", /* 238. __NR_epoll_wait */ "__NR_epoll_wait", /* 239. __NR_remap_file_pages */ "__NR_remap_file_pages", /* 240. __NR_timer_create */ "__NR_timer_create", /* 241. __NR_timer_settime */ "__NR_timer_settime", /* 242. __NR_timer_gettime */ "__NR_timer_gettime", /* 243. __NR_timer_getoverrun */ "__NR_timer_getoverrun", /* 244. __NR_timer_delete */ "__NR_timer_delete", /* 245. __NR_clock_settime */ "__NR_clock_settime", /* 246. __NR_clock_gettime */ "__NR_clock_gettime", /* 247. __NR_clock_getres */ "__NR_clock_getres", /* 248. __NR_clock_nanosleep */ "__NR_clock_nanosleep", /* 249. __NR_swapcontext */ "__NR_swapcontext", /* 250. __NR_tgkill */ "__NR_tgkill", /* 251. __NR_utimes */ "__NR_utimes", /* 252. __NR_statfs64 */ "__NR_statfs64", /* 253. __NR_fstatfs64 */ "__NR_fstatfs64", /* 254. __NR_fadvise64_64 */ "__NR_fadvise64_64" }; /* SYS_ values are equal in each architecture, * so a single table is sufficent. */ char *sys_to_str[] = { /* 0. Isn't used */ "__NR_socketcall, UNDEFINED SYS_*", /* 1. SYS_SOCKET */ "__NR_socketcall, SYS_SOCKET", /* 2. SYS_BIND */ "__NR_socketcall, SYS_BIND", /* 3. SYS_CONNECT */ "__NR_socketcall, SYS_CONNECT", /* 4. SYS_LISTEN */ "__NR_socketcall, SYS_LISTEN", /* 5. SYS_ACCEPT */ "__NR_socketcall, SYS_ACCEPT", /* 6. SYS_GETSOCKNAME */ "__NR_socketcall, SYS_GETSOCKNAME", /* 7. SYS_GETPEERNAME */ "__NR_socketcall, SYS_GETPEERNAME", /* 8. SYS_SOCKETPAIR */ "__NR_socketcall, SYS_SOCKETPAIR", /* 9. SYS_SEND */ "__NR_socketcall, SYS_SEND", /* 10. SYS_RECV */ "__NR_socketcall, SYS_RECV", /* 11. SYS_SENDTO */ "__NR_socketcall, SYS_SENDTO", /* 12. SYS_RECVFROM */ "__NR_socketcall, SYS_RECVFROM", /* 13. SYS_SHUTDOWN */ "__NR_socketcall, SYS_SHUTDOWN", /* 14. SYS_SETSOCKOPT */ "__NR_socketcall, SYS_SETSOCKOPT", /* 15. SYS_GETSOCKOPT */ "__NR_socketcall, SYS_GETSOCKOPT", /* 16. SYS_SENDMSG */ "__NR_socketcall, SYS_SENDMSG", /* 17 SYS_RECVMSG */ "__NR_socketcall, SYS_RECVMSG" }; /*########################################################################*/ /*## ##*/ /*## LOCAL FUNCTIONS ##*/ /*## ##*/ /*########################################################################*/ static enum rsc_constant get_rsc(int32_t nr_const, int32_t sys, enum rsc_constant table[], int table_size) { enum rsc_constant res; if((nr_const < 0) || (nr_const >= table_size )) return __RSC_ERROR; res = table[nr_const]; /* If "nr_const" is __NR_socketcall, then I have to get the right * __RSC_* constant using the SYS_* one. */ if(res == __RSC_socketcall) { if( (sys != NO_VALUE) && (sys > 0) && (sys < SYS_TO_RSC_SIZE) ) res = sys_to_rsc[sys]; else /* I need the SYS_ value (and I need that is correct) if __NR_ is __NR_socketcall! */ res = __RSC_ERROR; } return res; } static struct nr_and_sys *get_nr(enum rsc_constant rsc_const, struct nr_and_sys table[]) { struct nr_and_sys *res; if((rsc_const < __RSC_FIRST) || (rsc_const > __RSC_LAST)) return NULL; res = &table[rsc_const]; /* If the resulting structure is empty (both fields defined as NO_VALUE) * I return NUUL */ if( (res->nr == NO_VALUE) && (res->sys == NO_VALUE) ) res = NULL; return res; } static char *get_str(int32_t nr_const, int32_t sys, char *table[], int table_size) { char *res; if((nr_const < 0) || (nr_const >= table_size )) return nr_not_existing; res = table[nr_const]; /* If "nr_const" is __NR_socketcall, then I have to get the right * __RSC_* constant using the SYS_* one. */ if(strcmp("__NR_socketcall", res) == 0) { if( (sys != NO_VALUE) && (sys > 0) && (sys < SYS_TO_STR_SIZE) ) { res = sys_to_str[sys]; } else { /* I need a correct SYS_ value __NR_ is __NR_socketcall! */ res = nr_not_existing; } } return res; } /*########################################################################*/ /*## ##*/ /*## LIBRARY FUNCTIONS ##*/ /*## ##*/ /*########################################################################*/ /* sys can be equal to NO_VALUE */ enum rsc_constant nr2rsc(int32_t nr_const, int32_t sys, enum arch arch) { enum rsc_constant res; switch(arch) { case ACONV_X86: res = get_rsc(nr_const, sys, x86_to_rsc, X86_TO_RSC_SIZE); break; case ACONV_PPC: res = get_rsc(nr_const, sys, ppc_to_rsc, PPC_TO_RSC_SIZE); break; case ACONV_X86_64: res = get_rsc(nr_const, sys, x86_64_to_rsc, X86_64_TO_RSC_SIZE); break; default: res = __RSC_ERROR; break; } RSC_DEBUG(RSCD_REQ_RESP, "nr2rsc: %s(# %d; sys = %d) => %s (# %d)", nr2str(nr_const, sys, arch), nr_const, sys, res == __RSC_ERROR ? rsc_not_existing : rsc2str(res), res); return res ; } struct nr_and_sys *rsc2nr(enum rsc_constant rsc_const, enum arch arch) { struct nr_and_sys *res; switch(arch) { case ACONV_X86: res = get_nr(rsc_const, rsc_to_x86); break; case ACONV_PPC: res = get_nr(rsc_const, rsc_to_ppc); break; case ACONV_X86_64: res = get_nr(rsc_const, rsc_to_x86_64); break; default: res = NULL; break; } RSC_DEBUG(RSCD_REQ_RESP, "rsc2nr: %s(# %d) => %s (# %d; sys = %d)", rsc2str(rsc_const), rsc_const, res == NULL ? nr_not_existing : nr2str(res->nr, res->sys, arch), res == NULL ? -1 : res->nr, res == NULL ? -1 : res->sys); return res; } char *rsc2str(enum rsc_constant rsc_const) { if((rsc_const < __RSC_FIRST) || (rsc_const > __RSC_LAST)) return rsc_not_existing; return rsc_to_str[rsc_const]; } char *nr2str(int32_t nr_const, int32_t sys, enum arch arch) { char *res; switch(arch) { case ACONV_X86: res = get_str(nr_const, sys, x86_to_str, X86_TO_STR_SIZE); break; case ACONV_PPC: res = get_str(nr_const, sys, ppc_to_str, PPC_TO_STR_SIZE); break; case ACONV_X86_64: res = get_str(nr_const, sys, x86_64_to_str, X86_64_TO_STR_SIZE); break; default: res = nr_not_existing; break; } return res; } umview-0.8.2/um_rsc/librsc/src/utils.c0000644000175000017500000000750011753517213016761 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * utils.c: some utility functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include "debug.h" #include "utils.h" int write_n_bytes(int fd, void *buffer, int nbytes) { int n, nwritten; char *buf = buffer; #ifdef RSCDEBUG int total_bytes = nbytes; #endif assert(fd >= 0); /* assert(buf != NULL); */ /* If the buffer is null, I return nbytes. * In this way, if the caller has made a mistake passing me a empty buffer, * It doesn't recevie an error. */ if(buf == NULL) return nbytes; assert(nbytes >= 0); nwritten = 0; while(nbytes > 0) { n = write(fd, buf, nbytes); if( (n == -1) || (n == 0) ) { if(n == -1) { RSC_DEBUG(RSCD_RW, "write error: '%s'", strerror(errno)); } break; } /* assert(n > 0); */ nwritten += n; nbytes -= n; buf += n; } RSC_DEBUG(RSCD_RW, "[fd = %d; buf = %p (len = %d bytes)] written %d/%d bytes.", fd, buffer, total_bytes, nwritten, total_bytes); return nwritten; } int read_n_bytes(int fd, void *buffer, int nbytes) { int n, nread; void *buf = buffer; #ifdef RSCDEBUG int total_bytes = nbytes; #endif assert(fd >= 0); assert(buf != NULL); assert(nbytes >= 0); nread = 0; while(nbytes > 0) { n = read(fd, buf, nbytes); if( (n == -1) || (n == 0) ) { if(n == -1) { RSC_DEBUG(RSCD_RW, "read error: '%s'", strerror(errno)); } if(n == 0 || (n == -1 && errno != EINTR)) { break; } n = 0; /* break; */ } /* assert(n > 0); */ nread += n; nbytes -= n; buf += n; } RSC_DEBUG(RSCD_RW, "[fd = %d; buf = %p (len = %d bytes)] read %d/%d bytes.", fd, buffer, total_bytes, nread, total_bytes); return nread; } int rwv_n_bytes(rwv_fun fun, int fd, struct iovec *vector, size_t count, int nbytes) { int i, n, nrw; struct iovec *v, *v_orig; int total_bytes; #ifdef RSCDEBUG int original_count = count; #endif assert(fd >= 0); assert(vector != NULL); assert(count > 0); /* I copy the vector, because I've to work on it */ v = calloc(count, sizeof(struct iovec)); assert(v != NULL); v_orig = v; int total = 0; for(i = 0; i < count; i ++) { v[i].iov_base = vector[i].iov_base; v[i].iov_len = vector[i].iov_len; total += v[i].iov_len; } total_bytes = nbytes; nrw = 0; while(nbytes > 0) { n = fun(fd, v, count); if( (n == -1) || (n == 0) ) { if(n == -1) { RSC_DEBUG(RSCD_RW, "function error: '%s'", strerror(errno)); } if(n == 0 || (n == -1 && errno != EINTR)) { break; } n = 0; } nrw += n; nbytes -= n; /* I've read/write all */ if(nrw == total_bytes) break; for(i = 0; i < count; i++) { if(v[i].iov_len <= n) n -= v[i].iov_len; else break; } v[i].iov_base = v[i].iov_base + n; v[i].iov_len -= n; v += i; count -= i; } RSC_DEBUG(RSCD_RW, "[fd = %d; vector = %p; count = %d] read/write %d/%d bytes.", fd, vector, original_count, nrw, total_bytes); free(v_orig); return nrw; } umview-0.8.2/um_rsc/librsc/src/event_sub_common.c0000644000175000017500000000252011753517213021160 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * event_sub_common.c: client and server common code for event subscription management * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include "rsc_messages.h" int rsc_es_msg_size(u_int8_t type) { int size; switch(type) { case EVENT_SUB_REQ: size = sizeof(struct rsc_es_req); break; case EVENT_SUB_ACK: size = sizeof(struct rsc_es_ack); break; case EVENT_SUB_RESP: size = sizeof(struct rsc_es_resp); break; case EVENT_SUB_DEREG: size = sizeof(struct rsc_es_dereg); break; default: size = -1; break; } return size; } umview-0.8.2/um_rsc/librsc/src/event_subscription.c0000644000175000017500000002502411753517213021547 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * event_subscription.c: client event subscription management * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include "utils.h" #include "debug.h" #include "rsc_client.h" #include "registered_callbacks.h" /******************************************/ /* Local functions and structures */ /******************************************/ static pthread_mutex_t reg_cbs_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t reg_cbs_cond = PTHREAD_COND_INITIALIZER; /* Structure with the arguments passed to the thread */ struct rscc_es_thread_args { struct reg_cbs *reg_cbs; int event_sub_fd; }; /* The thread wait to read a response, delete the entry * from 'reg_cbs' and execute the system call. */ static void *rscc_es_thread(void *thread_arg) { struct rscc_es_thread_args *args = (struct rscc_es_thread_args *)thread_arg; struct reg_cbs *reg_cbs = args->reg_cbs; int event_sub_fd = args->event_sub_fd; void (* cb)(); void *arg; struct rsc_es_resp resp; struct rsc_es_ack ack; struct rsc_es_hdr hdr; int ret, i; while(1) { RSC_DEBUG(RSCD_EVENT_SUB, "thread before read: reg_cbs = %p, event_sub_fd = %d", reg_cbs, event_sub_fd); ret = read_n_bytes(event_sub_fd, &hdr, sizeof(hdr)); RSC_DEBUG(RSCD_EVENT_SUB, "After read:"); pthread_mutex_lock(®_cbs_mutex); PRINT_REGCBS(reg_cbs); pthread_mutex_unlock(®_cbs_mutex); /* Connection closed, I return */ if(ret == 0) { RSC_DEBUG(RSCD_EVENT_SUB, "ret == 0, I close the thread"); return 0; } if(ret == sizeof(hdr)) { RSC_DEBUG(RSCD_EVENT_SUB, "hdr.type = %d", hdr.type); /* ACK or response management */ if(hdr.type == EVENT_SUB_ACK) { int size = sizeof(ack) - sizeof(hdr); int reg_cbs_size; ack.type = hdr.type; RSC_DEBUG(RSCD_EVENT_SUB, "It's an ACK"); ret = read_n_bytes(event_sub_fd, ((char *)&ack) + sizeof(hdr), size); if(ret == size) { ack.fd = ntohl(ack.fd); ack.how = ntohl(ack.how); RSC_DEBUG(RSCD_EVENT_SUB, "ACK fields: response = %d, fd = %d, how = %d", ack.response, ack.fd, ack.how); pthread_mutex_lock(®_cbs_mutex); for(i = 0; i < reg_cbs->size; i++) if(reg_cbs->v[i].fd == ack.fd && reg_cbs->v[i].how == ack.how) { reg_cbs->v[i].ack = ack.response; RSC_DEBUG(RSCD_EVENT_SUB, "Found entry: fd = %d, how = %d. I changed ack to %d", reg_cbs->v[i].fd, reg_cbs->v[i].how, reg_cbs->v[i].ack); break; } reg_cbs_size = reg_cbs->size; /* If I don't find the entry, I discard the ACK */ if(i < reg_cbs_size) { RSC_DEBUG(RSCD_EVENT_SUB, "The entry was found and changed, so I can inform the event_subscribe()"); if((ret = pthread_cond_signal(®_cbs_cond)) != 0) fprintf(stderr, "pthread_cond_signal error %d\n", ret); pthread_mutex_unlock(®_cbs_mutex); RSC_DEBUG(RSCD_EVENT_SUB, "Informed"); } else pthread_mutex_unlock(®_cbs_mutex); } } else if(hdr.type == EVENT_SUB_RESP) { int size = sizeof(resp) - sizeof(hdr); RSC_DEBUG(RSCD_EVENT_SUB, "It's an subscription response "); resp.type = hdr.type; ret = read_n_bytes(event_sub_fd, ((char *)&resp) + sizeof(hdr), size); if(ret == size) { resp.fd = ntohl(resp.fd); resp.how = ntohl(resp.how); cb = arg = NULL; /* I search the entry */ RSC_DEBUG(RSCD_EVENT_SUB, "searching entry for fd = %d, how = %d", resp.fd, resp.how); pthread_mutex_lock(®_cbs_mutex); PRINT_REGCBS(reg_cbs); for(i = 0; i < reg_cbs->size; i++) if(reg_cbs->v[i].fd == resp.fd && reg_cbs->v[i].how == resp.how) { /* found, I maintain the entry, but I set the flag to avoid the re-execution of the cb */ if(!reg_cbs->v[i].cb_executed) { cb = reg_cbs->v[i].cb; arg = reg_cbs->v[i].arg; reg_cbs->v[i].cb_executed = 1; } break; } pthread_mutex_unlock(®_cbs_mutex); /* I execute the callback */ if(cb != NULL) { RSC_DEBUG(RSCD_EVENT_SUB, "found entry for fd = %d. cb = %p, arg = %p. I execute the callback", resp.fd, cb, arg); PRINT_REGCBS(reg_cbs); cb(arg); } } } else { /* else: error, I do nothing */ printf("Error, hdr.type = %d\n", hdr.type); } } } return NULL; } /****************************/ /* Global functions */ /****************************/ struct reg_cbs *rscc_es_init(int event_sub_fd) { struct reg_cbs *reg_cbs; struct rscc_es_thread_args *args; pthread_t thread; /* I init the registered callbacks list */ if((reg_cbs = init_reg_cb()) == NULL) return NULL; RSC_DEBUG(RSCD_EVENT_SUB, "After init of reg_cbs: "); PRINT_REGCBS(reg_cbs); /* I create a thread that receives the server's * response and calls the right callback. */ args = calloc(1, sizeof(struct rscc_es_thread_args)); args->reg_cbs = reg_cbs; args->event_sub_fd = event_sub_fd; pthread_create(&thread, NULL, rscc_es_thread, args); return reg_cbs; } /* It sends the request to the 'server_fd' and it waits the answer. * If the ACK is positive, the informations are store into 'reg_cbs' */ int rscc_es_send_req(struct reg_cbs *reg_cbs, int server_fd, int event_sub_fd, int how, void (* cb)(), void *arg) { int i, ret = 0; RSC_DEBUG(RSCD_EVENT_SUB, "send_event_sub_req (fd = %d):", server_fd); /* If 'cb' == NULL the previous registration for the callback must be deleted */ if(cb == NULL) { struct rsc_es_dereg rmev; RSC_DEBUG(RSCD_EVENT_SUB, "cb == NULL. reg_cbs->nentry = %d", reg_cbs->nentry); if(reg_cbs->nentry > 0) { pthread_mutex_lock(®_cbs_mutex); for(i = 0; i < reg_cbs->size; i++) if(reg_cbs->v[i].fd == event_sub_fd && reg_cbs->v[i].how == how ) break; /* found? */ if( i < reg_cbs->size) { /* I send a request to se server to rm the registered event */ bzero(&rmev, sizeof(rmev)); rmev.type = EVENT_SUB_DEREG; rmev.fd = htonl(event_sub_fd); rmev.how = htonl(how); ret = write_n_bytes(server_fd, &rmev, sizeof(rmev)); RSC_DEBUG(RSCD_EVENT_SUB, "I've sent the remove request for fd = %d, how = %d", event_sub_fd, how); if(ret != sizeof(rmev)) return -1; RSC_DEBUG(RSCD_EVENT_SUB, "Now I wait the ACK read by the thread" ); if((ret = pthread_cond_wait(®_cbs_cond, ®_cbs_mutex)) != 0) fprintf(stderr, "pthread_cond_wait error %d\n", ret); RSC_DEBUG(RSCD_EVENT_SUB, "The thread unblocked me, maybe the ACK is arrived:"); PRINT_REGCBS(reg_cbs); switch(reg_cbs->v[i].ack) { case ACK_FD_DEREG_NOT_READY: /* the fd isn't ready so it was registered by the server, * I return a zero value */ RSC_DEBUG(RSCD_EVENT_SUB, "The FD wasn't ready and was de-registered"); ret = 0; break; case ACK_FD_DEREG_READY: /* the fd is ready, I remove the entry from the list and * I return a non-zero value */ RSC_DEBUG(RSCD_EVENT_SUB, "The FD was ready and was de-registered"); ret = reg_cbs->v[i].how; break; } reg_cb_del(reg_cbs, i); RSC_DEBUG(RSCD_EVENT_SUB, "I've removed the entry #%d", i); PRINT_REGCBS(reg_cbs); } pthread_mutex_unlock(®_cbs_mutex); return ret; } return 0; } else { struct rsc_es_req req; int index; /* I send the request */ pthread_mutex_lock(®_cbs_mutex); if(reg_cbs->nentry > 0) { for(i = 0; i < reg_cbs->size; i++) if(reg_cbs->v[i].fd == event_sub_fd && reg_cbs->v[i].how == how ) break; if(i < reg_cbs->size) { /* Found, don't do anything, I return */ RSC_DEBUG(RSCD_EVENT_SUB, "Already registered: fd = %d, how = %d", event_sub_fd, how); PRINT_REGCBS(reg_cbs); pthread_mutex_unlock(®_cbs_mutex); return 1; } } bzero(&req, sizeof(req)); req.type = EVENT_SUB_REQ; req.fd = htonl(event_sub_fd); req.how = htonl(how); /* I don't have an already registered fd */ RSC_DEBUG(RSCD_EVENT_SUB, "New request: type = %d, fd = %d, how = %d", req.type, ntohl(req.fd), ntohl(req.how)); ret = write_n_bytes(server_fd, &req, sizeof(struct rsc_es_req)); if(ret != sizeof(struct rsc_es_req)) return -1; index = reg_cb_add(reg_cbs, cb, arg, event_sub_fd, how); assert(index != -1); RSC_DEBUG(RSCD_EVENT_SUB, "Req sent, I've added a new entry to reg_cbs: "); PRINT_REGCBS(reg_cbs); RSC_DEBUG(RSCD_EVENT_SUB, "Now I wait the ACK read by the thread" ); if((ret = pthread_cond_wait(®_cbs_cond, ®_cbs_mutex)) != 0) fprintf(stderr, "pthread_cond_wait error %d\n", ret); RSC_DEBUG(RSCD_EVENT_SUB, "The thread unblocked me, maybe the ACK is arrived:"); PRINT_REGCBS(reg_cbs); switch(reg_cbs->v[index].ack) { case ACK_FD_REG: /* the fd isn't ready so it was registered by the server, * I return a zero value */ RSC_DEBUG(RSCD_EVENT_SUB, "The FD was registered"); ret = 0; break; case ACK_FD_READY: /* the fd is ready, I remove the entry from the list and * I return a non-zero value */ ret = reg_cbs->v[index].how; reg_cb_del(reg_cbs, index); RSC_DEBUG(RSCD_EVENT_SUB, "The FD is ready, I've deleted the entry:"); PRINT_REGCBS(reg_cbs); break; } pthread_mutex_unlock(®_cbs_mutex); return ret; } return ret; } umview-0.8.2/um_rsc/librsc/src/rsc_client.c0000644000175000017500000160052211753517213017752 0ustar renzorenzo /* * This is part of Remote System Call (RSC) Library. * * rsc_client.c: client side functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #define _GNU_SOURCE #include #include #include "registered_callbacks.h" #include "debug.h" #include "utils.h" #include "rsc_client.h" #include "rsc_consts.h" #include "event_sub.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef RSCDEBUG struct ioctl_cache_el { int request; u_int32_t size_type; struct ioctl_cache_el *prev; struct ioctl_cache_el *next; }; struct ioctl_cache { struct ioctl_cache_el *first; struct ioctl_cache_el *last; int size; int nentry; }; #else #include "test_rsc_client.h" #endif #ifndef RSCDEBUG static #endif struct ioctl_cache *ioctl_cache_init(int size); static enum arch my_arch; static enum arch server_arch; static int rsc_sockfd; static int rsc_event_sub_fd; #ifndef RSCDEBUG static #endif struct ioctl_cache *ioctl_cache; int rscc_init(int client_fd, int event_sub_fd, struct reg_cbs **rc, enum arch c_arch, enum arch s_arch) { if(c_arch < ARCH_FIRST || c_arch > ARCH_LAST) return -1; if(s_arch < ARCH_FIRST || s_arch > ARCH_LAST) return -1; rsc_sockfd = client_fd; my_arch = c_arch; server_arch = s_arch; rsc_event_sub_fd = event_sub_fd; /* I init the event subscribe sub-module if there is a valid fd */ if(event_sub_fd >= 0 && rc != NULL) { if((*rc = rscc_es_init(event_sub_fd)) == NULL) return -1; } /* I init the ioctl cache */ ioctl_cache = ioctl_cache_init(20); if(ioctl_cache == NULL) return -1; return 0; } /*########################################################################*/ /*## ##*/ /*## Remote System Call FUNCTIONS - Client side ##*/ /*## ##*/ /*########################################################################*/ /*##########################################################*/ /*## ##*/ /*## REQUEST CREATION FUNCTIONS ##*/ /*## ##*/ /*##########################################################*/ /* This function build the request for the system call '_llseek' */ struct iovec *rscc_create__llseek_request(int *total_size, int *iovec_count, unsigned int fd, unsigned long int offset_high, unsigned long int offset_low, loff_t *result, unsigned int whence) { struct _llseek_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; /* If the destination architecture doesn't support this syscall, I return immediately */ if(server_arch == ACONV_X86_64) return NULL; req_size = sizeof(struct _llseek_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_u_int_size(my_arch, server_arch); req_size += aconv_u_long_size(my_arch, server_arch); req_size += aconv_u_long_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_u_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; #ifdef __x86_64__ /* The system call is not defined in this architecture, so I return NULL */ return NULL; #else /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR__llseek, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } #endif req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; req->offset_high = offset_high; req->offset_low = offset_low; req->result = result; req->whence = whence; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_u_int(&fd, my_arch, server_arch, mem); mem += aconv_u_int_size(my_arch, server_arch); aconv_u_long(&offset_high, my_arch, server_arch, mem); mem += aconv_u_long_size(my_arch, server_arch); aconv_u_long(&offset_low, my_arch, server_arch, mem); mem += aconv_u_long_size(my_arch, server_arch); aconv_pointer(result, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_u_int(&whence, my_arch, server_arch, mem); mem += aconv_u_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct _llseek_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %u (0x%lX); offset_high = %lu (0x%lX); offset_low = %lu (0x%lX); result = %p (0x%lX); whence = %u (0x%lX)", req->fd, req->fd, req->offset_high, req->offset_high, req->offset_low, req->offset_low, req->result, req->result, req->whence, req->whence); return v; } /* This function build the request for the system call 'accept' */ struct iovec *rscc_create_accept_request(int *total_size, int *iovec_count, int sockfd, struct sockaddr *addr, socklen_t *addrlen) { struct accept_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int addrlen_size_value; /* The size of 'addr' is contained in the memory pointed by 'addrlen', * but if the latter is NULL I cannot know the size of 'addr'. */ if(addr != NULL && addrlen == NULL) return NULL; req_size = sizeof(struct accept_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_accept, SYS_ACCEPT, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_ACCEPT, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(addrlen == NULL) addrlen_size_value = 0; else addrlen_size_value = aconv_socklen_t_size(my_arch, server_arch); req->req_size += addrlen_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->sockfd = sockfd; req->addr = addr; req->addrlen = addrlen; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&sockfd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(addr, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(addrlen, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(addrlen == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(addrlen != NULL) { v[i].iov_len = addrlen_size_value; if(my_arch == server_arch) { v[i].iov_base = addrlen; } else { socklen_t addrlen_new = *addrlen; v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; if(*addrlen < aconv_struct_sockaddr_size(my_arch, server_arch)) addrlen_new = aconv_struct_sockaddr_size(my_arch, server_arch); aconv_socklen_t(&addrlen_new, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct accept_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: sockfd = %ld (0x%lX); addr = %p (0x%lX); addrlen = %p (0x%lX)", req->sockfd, req->sockfd, req->addr, req->addr, req->addrlen, req->addrlen); return v; } /* This function build the request for the system call 'access' */ struct iovec *rscc_create_access_request(int *total_size, int *iovec_count, char *pathname, int mode) { struct access_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int pathname_size_value; req_size = sizeof(struct access_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_access, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(pathname == NULL) pathname_size_value = 0; else pathname_size_value = aconv_string_size(pathname, my_arch, server_arch); req->req_size += pathname_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->pathname = pathname; req->mode = mode; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(pathname, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_int(&mode, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(pathname == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(pathname != NULL) { v[i].iov_len = pathname_size_value; if(my_arch == server_arch) { v[i].iov_base = pathname; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(pathname, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct access_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: pathname = %p (0x%lX); mode = %ld (0x%lX)", req->pathname, req->pathname, req->mode, req->mode); return v; } /* This function build the request for the system call 'adjtimex' */ struct iovec *rscc_create_adjtimex_request(int *total_size, int *iovec_count, struct timex *buf) { struct adjtimex_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int buf_size_value; req_size = sizeof(struct adjtimex_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_adjtimex, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(buf == NULL) buf_size_value = 0; else buf_size_value = aconv_struct_timex_size(my_arch, server_arch); req->req_size += buf_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->buf = buf; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(buf == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(buf != NULL) { v[i].iov_len = buf_size_value; if(my_arch == server_arch) { v[i].iov_base = buf; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_struct_timex(buf, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct adjtimex_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: buf = %p (0x%lX)", req->buf, req->buf); return v; } /* This function build the request for the system call 'bind' */ struct iovec *rscc_create_bind_request(int *total_size, int *iovec_count, int sockfd, struct sockaddr *my_addr, socklen_t addrlen) { struct bind_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; socklen_t addrlen_value; req_size = sizeof(struct bind_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_socklen_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_bind, SYS_BIND, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_BIND, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(my_addr == NULL) addrlen_value = 0; else addrlen_value = aconv_struct_sockaddr_size(my_arch, server_arch); req->req_size += addrlen_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->sockfd = sockfd; req->my_addr = my_addr; req->addrlen = addrlen; } else { void *mem = (void *)req + sizeof(struct sys_req_header); socklen_t addrlen_new = addrlen; aconv_int(&sockfd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(my_addr, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); if(addrlen < aconv_struct_sockaddr_size(my_arch, server_arch)) addrlen_new = aconv_struct_sockaddr_size(my_arch, server_arch); aconv_socklen_t(&addrlen_new, my_arch, server_arch, mem); mem += aconv_socklen_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(my_addr == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(my_addr != NULL) { v[i].iov_len = addrlen_value; if(my_arch == server_arch) { v[i].iov_base = my_addr; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_struct_sockaddr(my_addr, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct bind_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: sockfd = %ld (0x%lX); my_addr = %p (0x%lX); addrlen = %ld (0x%lX)", req->sockfd, req->sockfd, req->my_addr, req->my_addr, req->addrlen, req->addrlen); return v; } /* This function build the request for the system call 'chdir' */ struct iovec *rscc_create_chdir_request(int *total_size, int *iovec_count, char *path) { struct chdir_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int path_size_value; req_size = sizeof(struct chdir_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_chdir, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); req->req_size += path_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(path == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct chdir_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX)", req->path, req->path); return v; } /* This function build the request for the system call 'chmod' */ struct iovec *rscc_create_chmod_request(int *total_size, int *iovec_count, char *path, mode_t mode) { struct chmod_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int path_size_value; req_size = sizeof(struct chmod_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_mode_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_chmod, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); req->req_size += path_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->mode = mode; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_mode_t(&mode, my_arch, server_arch, mem); mem += aconv_mode_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(path == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct chmod_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); mode = %ld (0x%lX)", req->path, req->path, req->mode, req->mode); return v; } /* This function build the request for the system call 'chown' */ struct iovec *rscc_create_chown_request(int *total_size, int *iovec_count, char *path, uid_t owner, gid_t group) { struct chown_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int path_size_value; req_size = sizeof(struct chown_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_uid_t_size(my_arch, server_arch); req_size += aconv_gid_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_chown, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); req->req_size += path_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->owner = owner; req->group = group; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_uid_t(&owner, my_arch, server_arch, mem); mem += aconv_uid_t_size(my_arch, server_arch); aconv_gid_t(&group, my_arch, server_arch, mem); mem += aconv_gid_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(path == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct chown_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", req->path, req->path, req->owner, req->owner, req->group, req->group); return v; } /* This function build the request for the system call 'chown32' */ struct iovec *rscc_create_chown32_request(int *total_size, int *iovec_count, char *path, uid_t owner, gid_t group) { struct chown32_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; /* If the destination architecture doesn't support this syscall, I return immediately */ if(server_arch == ACONV_PPC || server_arch == ACONV_X86_64) return NULL; int path_size_value; req_size = sizeof(struct chown32_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_uid_t_size(my_arch, server_arch); req_size += aconv_gid_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; #ifdef __powerpc__ /* The system call is not defined in this architecture, so I return NULL */ return NULL; #elif defined __x86_64__ /* The system call is not defined in this architecture, so I return NULL */ return NULL; #else /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_chown32, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } #endif req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); req->req_size += path_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->owner = owner; req->group = group; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_uid_t(&owner, my_arch, server_arch, mem); mem += aconv_uid_t_size(my_arch, server_arch); aconv_gid_t(&group, my_arch, server_arch, mem); mem += aconv_gid_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(path == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct chown32_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", req->path, req->path, req->owner, req->owner, req->group, req->group); return v; } /* This function build the request for the system call 'clock_getres' */ struct iovec *rscc_create_clock_getres_request(int *total_size, int *iovec_count, clockid_t clk_id, struct timespec *res) { struct clock_getres_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct clock_getres_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_clockid_t_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_clock_getres, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->clk_id = clk_id; req->res = res; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_clockid_t(&clk_id, my_arch, server_arch, mem); mem += aconv_clockid_t_size(my_arch, server_arch); aconv_pointer(res, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct clock_getres_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: clk_id = %ld (0x%lX); res = %p (0x%lX)", req->clk_id, req->clk_id, req->res, req->res); return v; } /* This function build the request for the system call 'clock_gettime' */ struct iovec *rscc_create_clock_gettime_request(int *total_size, int *iovec_count, clockid_t clk_id, struct timespec *tp) { struct clock_gettime_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct clock_gettime_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_clockid_t_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_clock_gettime, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->clk_id = clk_id; req->tp = tp; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_clockid_t(&clk_id, my_arch, server_arch, mem); mem += aconv_clockid_t_size(my_arch, server_arch); aconv_pointer(tp, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct clock_gettime_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: clk_id = %ld (0x%lX); tp = %p (0x%lX)", req->clk_id, req->clk_id, req->tp, req->tp); return v; } /* This function build the request for the system call 'clock_settime' */ struct iovec *rscc_create_clock_settime_request(int *total_size, int *iovec_count, clockid_t clk_id, struct timespec *tp) { struct clock_settime_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int tp_size_value; req_size = sizeof(struct clock_settime_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_clockid_t_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_clock_settime, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(tp == NULL) tp_size_value = 0; else tp_size_value = aconv_struct_timespec_size(my_arch, server_arch); req->req_size += tp_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->clk_id = clk_id; req->tp = tp; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_clockid_t(&clk_id, my_arch, server_arch, mem); mem += aconv_clockid_t_size(my_arch, server_arch); aconv_pointer(tp, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(tp == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(tp != NULL) { v[i].iov_len = tp_size_value; if(my_arch == server_arch) { v[i].iov_base = tp; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_struct_timespec(tp, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct clock_settime_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: clk_id = %ld (0x%lX); tp = %p (0x%lX)", req->clk_id, req->clk_id, req->tp, req->tp); return v; } /* This function build the request for the system call 'close' */ struct iovec *rscc_create_close_request(int *total_size, int *iovec_count, int fd) { struct close_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct close_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_close, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct close_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX)", req->fd, req->fd); return v; } /* This function build the request for the system call 'connect' */ struct iovec *rscc_create_connect_request(int *total_size, int *iovec_count, int sockfd, struct sockaddr *serv_addr, socklen_t addrlen) { struct connect_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; socklen_t addrlen_value; req_size = sizeof(struct connect_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_socklen_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_connect, SYS_CONNECT, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_CONNECT, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(serv_addr == NULL) addrlen_value = 0; else addrlen_value = aconv_struct_sockaddr_size(my_arch, server_arch); req->req_size += addrlen_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->sockfd = sockfd; req->serv_addr = serv_addr; req->addrlen = addrlen; } else { void *mem = (void *)req + sizeof(struct sys_req_header); socklen_t addrlen_new = addrlen; aconv_int(&sockfd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(serv_addr, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); if(addrlen < aconv_struct_sockaddr_size(my_arch, server_arch)) addrlen_new = aconv_struct_sockaddr_size(my_arch, server_arch); aconv_socklen_t(&addrlen_new, my_arch, server_arch, mem); mem += aconv_socklen_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(serv_addr == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(serv_addr != NULL) { v[i].iov_len = addrlen_value; if(my_arch == server_arch) { v[i].iov_base = serv_addr; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_struct_sockaddr(serv_addr, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct connect_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: sockfd = %ld (0x%lX); serv_addr = %p (0x%lX); addrlen = %ld (0x%lX)", req->sockfd, req->sockfd, req->serv_addr, req->serv_addr, req->addrlen, req->addrlen); return v; } /* This function build the request for the system call 'dup' */ struct iovec *rscc_create_dup_request(int *total_size, int *iovec_count, int oldfd) { struct dup_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct dup_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_dup, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->oldfd = oldfd; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&oldfd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct dup_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: oldfd = %ld (0x%lX)", req->oldfd, req->oldfd); return v; } /* This function build the request for the system call 'dup2' */ struct iovec *rscc_create_dup2_request(int *total_size, int *iovec_count, int oldfd, int newfd) { struct dup2_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct dup2_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_dup2, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->oldfd = oldfd; req->newfd = newfd; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&oldfd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_int(&newfd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct dup2_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: oldfd = %ld (0x%lX); newfd = %ld (0x%lX)", req->oldfd, req->oldfd, req->newfd, req->newfd); return v; } /* This function build the request for the system call 'fchdir' */ struct iovec *rscc_create_fchdir_request(int *total_size, int *iovec_count, int fd) { struct fchdir_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct fchdir_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_fchdir, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct fchdir_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX)", req->fd, req->fd); return v; } /* This function build the request for the system call 'fchmod' */ struct iovec *rscc_create_fchmod_request(int *total_size, int *iovec_count, int fildes, mode_t mode) { struct fchmod_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct fchmod_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_mode_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_fchmod, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fildes = fildes; req->mode = mode; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fildes, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_mode_t(&mode, my_arch, server_arch, mem); mem += aconv_mode_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct fchmod_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fildes = %ld (0x%lX); mode = %ld (0x%lX)", req->fildes, req->fildes, req->mode, req->mode); return v; } /* This function build the request for the system call 'fchown' */ struct iovec *rscc_create_fchown_request(int *total_size, int *iovec_count, int fd, uid_t owner, gid_t group) { struct fchown_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct fchown_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_uid_t_size(my_arch, server_arch); req_size += aconv_gid_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_fchown, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; req->owner = owner; req->group = group; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_uid_t(&owner, my_arch, server_arch, mem); mem += aconv_uid_t_size(my_arch, server_arch); aconv_gid_t(&group, my_arch, server_arch, mem); mem += aconv_gid_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct fchown_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", req->fd, req->fd, req->owner, req->owner, req->group, req->group); return v; } /* This function build the request for the system call 'fchown32' */ struct iovec *rscc_create_fchown32_request(int *total_size, int *iovec_count, int fd, uid_t owner, gid_t group) { struct fchown32_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; /* If the destination architecture doesn't support this syscall, I return immediately */ if(server_arch == ACONV_PPC || server_arch == ACONV_X86_64) return NULL; req_size = sizeof(struct fchown32_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_uid_t_size(my_arch, server_arch); req_size += aconv_gid_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; #ifdef __powerpc__ /* The system call is not defined in this architecture, so I return NULL */ return NULL; #elif defined __x86_64__ /* The system call is not defined in this architecture, so I return NULL */ return NULL; #else /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_fchown32, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } #endif req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; req->owner = owner; req->group = group; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_uid_t(&owner, my_arch, server_arch, mem); mem += aconv_uid_t_size(my_arch, server_arch); aconv_gid_t(&group, my_arch, server_arch, mem); mem += aconv_gid_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct fchown32_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", req->fd, req->fd, req->owner, req->owner, req->group, req->group); return v; } /* This function build the request for the system call 'fdatasync' */ struct iovec *rscc_create_fdatasync_request(int *total_size, int *iovec_count, int fd) { struct fdatasync_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct fdatasync_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_fdatasync, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct fdatasync_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX)", req->fd, req->fd); return v; } /* This function build the request for the system call 'fgetxattr' */ struct iovec *rscc_create_fgetxattr_request(int *total_size, int *iovec_count, int filedes, char *name, void *value, size_t size) { struct fgetxattr_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int name_size_value; req_size = sizeof(struct fgetxattr_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_fgetxattr, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(name == NULL) name_size_value = 0; else name_size_value = aconv_string_size(name, my_arch, server_arch); req->req_size += name_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->filedes = filedes; req->name = name; req->value = value; req->size = size; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&filedes, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(name, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(value, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&size, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(name == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(name != NULL) { v[i].iov_len = name_size_value; if(my_arch == server_arch) { v[i].iov_base = name; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(name, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct fgetxattr_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: filedes = %ld (0x%lX); name = %p (0x%lX); value = %p (0x%lX); size = %ld (0x%lX)", req->filedes, req->filedes, req->name, req->name, req->value, req->value, req->size, req->size); return v; } /* This function build the request for the system call 'fstat64' */ struct iovec *rscc_create_fstat64_request(int *total_size, int *iovec_count, int filedes, struct stat64 *buf) { struct fstat64_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct fstat64_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_fstat, NO_VALUE, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_fstat64, NO_VALUE, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->filedes = filedes; req->buf = buf; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&filedes, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct fstat64_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: filedes = %ld (0x%lX); buf = %p (0x%lX)", req->filedes, req->filedes, req->buf, req->buf); return v; } /* This function build the request for the system call 'fstatfs64' */ struct iovec *rscc_create_fstatfs64_request(int *total_size, int *iovec_count, unsigned int fd, struct statfs64 *buf) { struct fstatfs64_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct fstatfs64_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_u_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_fstatfs, NO_VALUE, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_fstatfs64, NO_VALUE, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; req->buf = buf; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_u_int(&fd, my_arch, server_arch, mem); mem += aconv_u_int_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct fstatfs64_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %u (0x%lX); buf = %p (0x%lX)", req->fd, req->fd, req->buf, req->buf); return v; } /* This function build the request for the system call 'fsync' */ struct iovec *rscc_create_fsync_request(int *total_size, int *iovec_count, int fd) { struct fsync_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct fsync_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_fsync, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct fsync_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX)", req->fd, req->fd); return v; } /* This function build the request for the system call 'ftruncate64' */ struct iovec *rscc_create_ftruncate64_request(int *total_size, int *iovec_count, int fd, __off64_t length) { struct ftruncate64_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct ftruncate64_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv___off64_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_ftruncate, NO_VALUE, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_ftruncate64, NO_VALUE, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; req->length = length; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv___off64_t(&length, my_arch, server_arch, mem); mem += aconv___off64_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct ftruncate64_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX); length = %ld (0x%lX)", req->fd, req->fd, req->length, req->length); return v; } /* This function build the request for the system call 'getdents64' */ struct iovec *rscc_create_getdents64_request(int *total_size, int *iovec_count, unsigned int fd, struct dirent64 *dirp, unsigned int count) { struct getdents64_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct getdents64_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_u_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_u_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_getdents64, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; req->dirp = dirp; req->count = count; } else { void *mem = (void *)req + sizeof(struct sys_req_header); unsigned int count_new = count; aconv_u_int(&fd, my_arch, server_arch, mem); mem += aconv_u_int_size(my_arch, server_arch); aconv_pointer(dirp, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); if(count < aconv_struct_dirent64_size(my_arch, server_arch)) count_new = aconv_struct_dirent64_size(my_arch, server_arch); aconv_u_int(&count_new, my_arch, server_arch, mem); mem += aconv_u_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct getdents64_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %u (0x%lX); dirp = %p (0x%lX); count = %u (0x%lX)", req->fd, req->fd, req->dirp, req->dirp, req->count, req->count); return v; } /* This function build the request for the system call 'getpeername' */ struct iovec *rscc_create_getpeername_request(int *total_size, int *iovec_count, int s, struct sockaddr *name, socklen_t *namelen) { struct getpeername_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int namelen_size_value; /* The size of 'name' is contained in the memory pointed by 'namelen', * but if the latter is NULL I cannot know the size of 'name'. */ if(name != NULL && namelen == NULL) return NULL; req_size = sizeof(struct getpeername_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_getpeername, SYS_GETPEERNAME, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_GETPEERNAME, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(namelen == NULL) namelen_size_value = 0; else namelen_size_value = aconv_socklen_t_size(my_arch, server_arch); req->req_size += namelen_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->s = s; req->name = name; req->namelen = namelen; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&s, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(name, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(namelen, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(namelen == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(namelen != NULL) { v[i].iov_len = namelen_size_value; if(my_arch == server_arch) { v[i].iov_base = namelen; } else { socklen_t namelen_new = *namelen; v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; if(*namelen < aconv_struct_sockaddr_size(my_arch, server_arch)) namelen_new = aconv_struct_sockaddr_size(my_arch, server_arch); aconv_socklen_t(&namelen_new, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct getpeername_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: s = %ld (0x%lX); name = %p (0x%lX); namelen = %p (0x%lX)", req->s, req->s, req->name, req->name, req->namelen, req->namelen); return v; } /* This function build the request for the system call 'getsockname' */ struct iovec *rscc_create_getsockname_request(int *total_size, int *iovec_count, int s, struct sockaddr *name, socklen_t *namelen) { struct getsockname_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int namelen_size_value; /* The size of 'name' is contained in the memory pointed by 'namelen', * but if the latter is NULL I cannot know the size of 'name'. */ if(name != NULL && namelen == NULL) return NULL; req_size = sizeof(struct getsockname_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_getsockname, SYS_GETSOCKNAME, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_GETSOCKNAME, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(namelen == NULL) namelen_size_value = 0; else namelen_size_value = aconv_socklen_t_size(my_arch, server_arch); req->req_size += namelen_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->s = s; req->name = name; req->namelen = namelen; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&s, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(name, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(namelen, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(namelen == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(namelen != NULL) { v[i].iov_len = namelen_size_value; if(my_arch == server_arch) { v[i].iov_base = namelen; } else { socklen_t namelen_new = *namelen; v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; if(*namelen < aconv_struct_sockaddr_size(my_arch, server_arch)) namelen_new = aconv_struct_sockaddr_size(my_arch, server_arch); aconv_socklen_t(&namelen_new, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct getsockname_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: s = %ld (0x%lX); name = %p (0x%lX); namelen = %p (0x%lX)", req->s, req->s, req->name, req->name, req->namelen, req->namelen); return v; } /* This function build the request for the system call 'getsockopt' */ struct iovec *rscc_create_getsockopt_request(int *total_size, int *iovec_count, int s, int level, int optname, void *optval, socklen_t *optlen) { struct getsockopt_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int optlen_size_value; /* The size of 'optval' is contained in the memory pointed by 'optlen', * but if the latter is NULL I cannot know the size of 'optval'. */ if(optval != NULL && optlen == NULL) return NULL; req_size = sizeof(struct getsockopt_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_getsockopt, SYS_GETSOCKOPT, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_GETSOCKOPT, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(optlen == NULL) optlen_size_value = 0; else optlen_size_value = aconv_socklen_t_size(my_arch, server_arch); req->req_size += optlen_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->s = s; req->level = level; req->optname = optname; req->optval = optval; req->optlen = optlen; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&s, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_int(&level, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_int(&optname, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(optval, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(optlen, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(optlen == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(optlen != NULL) { v[i].iov_len = optlen_size_value; if(my_arch == server_arch) { v[i].iov_base = optlen; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_socklen_t(optlen, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct getsockopt_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: s = %ld (0x%lX); level = %ld (0x%lX); optname = %ld (0x%lX); optval = %p (0x%lX); optlen = %p (0x%lX)", req->s, req->s, req->level, req->level, req->optname, req->optname, req->optval, req->optval, req->optlen, req->optlen); return v; } /* This function build the request for the system call 'gettimeofday' */ struct iovec *rscc_create_gettimeofday_request(int *total_size, int *iovec_count, struct timeval *tv, struct timezone *tz) { struct gettimeofday_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct gettimeofday_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_gettimeofday, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->tv = tv; req->tz = tz; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(tv, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(tz, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct gettimeofday_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: tv = %p (0x%lX); tz = %p (0x%lX)", req->tv, req->tv, req->tz, req->tz); return v; } /* This function build the request for the system call 'getxattr' */ struct iovec *rscc_create_getxattr_request(int *total_size, int *iovec_count, char *path, char *name, void *value, size_t size) { struct getxattr_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int path_size_value; int name_size_value; req_size = sizeof(struct getxattr_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_getxattr, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(name == NULL) name_size_value = 0; else name_size_value = aconv_string_size(name, my_arch, server_arch); req->req_size += path_size_value + name_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->name = name; req->value = value; req->size = size; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(name, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(value, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&size, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 3; if(path == NULL) vcount--; if(name == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; i++; } if(name != NULL) { v[i].iov_len = name_size_value; if(my_arch == server_arch) { v[i].iov_base = name; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(name, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct getxattr_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); name = %p (0x%lX); value = %p (0x%lX); size = %ld (0x%lX)", req->path, req->path, req->name, req->name, req->value, req->value, req->size, req->size); return v; } /* This function build the request for the system call 'lchown' */ struct iovec *rscc_create_lchown_request(int *total_size, int *iovec_count, char *path, uid_t owner, gid_t group) { struct lchown_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int path_size_value; req_size = sizeof(struct lchown_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_uid_t_size(my_arch, server_arch); req_size += aconv_gid_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_lchown, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); req->req_size += path_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->owner = owner; req->group = group; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_uid_t(&owner, my_arch, server_arch, mem); mem += aconv_uid_t_size(my_arch, server_arch); aconv_gid_t(&group, my_arch, server_arch, mem); mem += aconv_gid_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(path == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct lchown_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", req->path, req->path, req->owner, req->owner, req->group, req->group); return v; } /* This function build the request for the system call 'lchown32' */ struct iovec *rscc_create_lchown32_request(int *total_size, int *iovec_count, char *path, uid_t owner, gid_t group) { struct lchown32_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; /* If the destination architecture doesn't support this syscall, I return immediately */ if(server_arch == ACONV_PPC || server_arch == ACONV_X86_64) return NULL; int path_size_value; req_size = sizeof(struct lchown32_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_uid_t_size(my_arch, server_arch); req_size += aconv_gid_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; #ifdef __powerpc__ /* The system call is not defined in this architecture, so I return NULL */ return NULL; #elif defined __x86_64__ /* The system call is not defined in this architecture, so I return NULL */ return NULL; #else /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_lchown32, NO_VALUE, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_lchown32, NO_VALUE, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } #endif req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); req->req_size += path_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->owner = owner; req->group = group; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_uid_t(&owner, my_arch, server_arch, mem); mem += aconv_uid_t_size(my_arch, server_arch); aconv_gid_t(&group, my_arch, server_arch, mem); mem += aconv_gid_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(path == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct lchown32_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", req->path, req->path, req->owner, req->owner, req->group, req->group); return v; } /* This function build the request for the system call 'lgetxattr' */ struct iovec *rscc_create_lgetxattr_request(int *total_size, int *iovec_count, char *path, char *name, void *value, size_t size) { struct lgetxattr_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int path_size_value; int name_size_value; req_size = sizeof(struct lgetxattr_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_lgetxattr, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(name == NULL) name_size_value = 0; else name_size_value = aconv_string_size(name, my_arch, server_arch); req->req_size += path_size_value + name_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->name = name; req->value = value; req->size = size; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(name, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(value, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&size, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 3; if(path == NULL) vcount--; if(name == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; i++; } if(name != NULL) { v[i].iov_len = name_size_value; if(my_arch == server_arch) { v[i].iov_base = name; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(name, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct lgetxattr_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); name = %p (0x%lX); value = %p (0x%lX); size = %ld (0x%lX)", req->path, req->path, req->name, req->name, req->value, req->value, req->size, req->size); return v; } /* This function build the request for the system call 'link' */ struct iovec *rscc_create_link_request(int *total_size, int *iovec_count, char *oldpath, char *newpath) { struct link_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int oldpath_size_value; int newpath_size_value; req_size = sizeof(struct link_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_link, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(oldpath == NULL) oldpath_size_value = 0; else oldpath_size_value = aconv_string_size(oldpath, my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(newpath == NULL) newpath_size_value = 0; else newpath_size_value = aconv_string_size(newpath, my_arch, server_arch); req->req_size += oldpath_size_value + newpath_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->oldpath = oldpath; req->newpath = newpath; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(oldpath, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(newpath, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 3; if(oldpath == NULL) vcount--; if(newpath == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(oldpath != NULL) { v[i].iov_len = oldpath_size_value; if(my_arch == server_arch) { v[i].iov_base = oldpath; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(oldpath, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; i++; } if(newpath != NULL) { v[i].iov_len = newpath_size_value; if(my_arch == server_arch) { v[i].iov_base = newpath; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(newpath, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct link_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: oldpath = %p (0x%lX); newpath = %p (0x%lX)", req->oldpath, req->oldpath, req->newpath, req->newpath); return v; } /* This function build the request for the system call 'listen' */ struct iovec *rscc_create_listen_request(int *total_size, int *iovec_count, int sockfd, int backlog) { struct listen_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct listen_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_listen, SYS_LISTEN, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_LISTEN, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->sockfd = sockfd; req->backlog = backlog; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&sockfd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_int(&backlog, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct listen_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: sockfd = %ld (0x%lX); backlog = %ld (0x%lX)", req->sockfd, req->sockfd, req->backlog, req->backlog); return v; } /* This function build the request for the system call 'lseek' */ struct iovec *rscc_create_lseek_request(int *total_size, int *iovec_count, int fildes, off_t offset, int whence) { struct lseek_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct lseek_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_off_t_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_lseek, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fildes = fildes; req->offset = offset; req->whence = whence; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fildes, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_off_t(&offset, my_arch, server_arch, mem); mem += aconv_off_t_size(my_arch, server_arch); aconv_int(&whence, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct lseek_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fildes = %ld (0x%lX); offset = %ld (0x%lX); whence = %ld (0x%lX)", req->fildes, req->fildes, req->offset, req->offset, req->whence, req->whence); return v; } /* This function build the request for the system call 'lstat64' */ struct iovec *rscc_create_lstat64_request(int *total_size, int *iovec_count, char *path, struct stat64 *buf) { struct lstat64_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int path_size_value; req_size = sizeof(struct lstat64_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_lstat, NO_VALUE, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_lstat64, NO_VALUE, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); req->req_size += path_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->buf = buf; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(path == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct lstat64_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); buf = %p (0x%lX)", req->path, req->path, req->buf, req->buf); return v; } /* This function build the request for the system call 'mkdir' */ struct iovec *rscc_create_mkdir_request(int *total_size, int *iovec_count, char *pathname, mode_t mode) { struct mkdir_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int pathname_size_value; req_size = sizeof(struct mkdir_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_mode_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_mkdir, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(pathname == NULL) pathname_size_value = 0; else pathname_size_value = aconv_string_size(pathname, my_arch, server_arch); req->req_size += pathname_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->pathname = pathname; req->mode = mode; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(pathname, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_mode_t(&mode, my_arch, server_arch, mem); mem += aconv_mode_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(pathname == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(pathname != NULL) { v[i].iov_len = pathname_size_value; if(my_arch == server_arch) { v[i].iov_base = pathname; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(pathname, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct mkdir_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: pathname = %p (0x%lX); mode = %ld (0x%lX)", req->pathname, req->pathname, req->mode, req->mode); return v; } /* This function build the request for the system call 'mount' */ struct iovec *rscc_create_mount_request(int *total_size, int *iovec_count, char *source, char *target, char *filesystemtype, unsigned long int mountflags, void *data) { struct mount_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int source_size_value; int target_size_value; int filesystemtype_size_value; int data_size_value; req_size = sizeof(struct mount_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_u_long_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_mount, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(source == NULL) source_size_value = 0; else source_size_value = aconv_string_size(source, my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(target == NULL) target_size_value = 0; else target_size_value = aconv_string_size(target, my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(filesystemtype == NULL) filesystemtype_size_value = 0; else filesystemtype_size_value = aconv_string_size(filesystemtype, my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(data == NULL) data_size_value = 0; else data_size_value = aconv_string_size(data, my_arch, server_arch); req->req_size += source_size_value + target_size_value + filesystemtype_size_value + data_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->source = source; req->target = target; req->filesystemtype = filesystemtype; req->mountflags = mountflags; req->data = data; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(source, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(target, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(filesystemtype, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_u_long(&mountflags, my_arch, server_arch, mem); mem += aconv_u_long_size(my_arch, server_arch); aconv_pointer(data, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 5; if(source == NULL) vcount--; if(target == NULL) vcount--; if(filesystemtype == NULL) vcount--; if(data == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(source != NULL) { v[i].iov_len = source_size_value; if(my_arch == server_arch) { v[i].iov_base = source; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(source, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; i++; } if(target != NULL) { v[i].iov_len = target_size_value; if(my_arch == server_arch) { v[i].iov_base = target; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(target, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; i++; } if(filesystemtype != NULL) { v[i].iov_len = filesystemtype_size_value; if(my_arch == server_arch) { v[i].iov_base = filesystemtype; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(filesystemtype, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; i++; } if(data != NULL) { v[i].iov_len = data_size_value; if(my_arch == server_arch) { v[i].iov_base = data; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(data, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct mount_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: source = %p (0x%lX); target = %p (0x%lX); filesystemtype = %p (0x%lX); mountflags = %lu (0x%lX); data = %p (0x%lX)", req->source, req->source, req->target, req->target, req->filesystemtype, req->filesystemtype, req->mountflags, req->mountflags, req->data, req->data); return v; } /* This function build the request for the system call 'open' */ struct iovec *rscc_create_open_request(int *total_size, int *iovec_count, char *pathname, int flags) { struct open_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int pathname_size_value; req_size = sizeof(struct open_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_open, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(pathname == NULL) pathname_size_value = 0; else pathname_size_value = aconv_string_size(pathname, my_arch, server_arch); req->req_size += pathname_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->pathname = pathname; req->flags = flags; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(pathname, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_int(&flags, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(pathname == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(pathname != NULL) { v[i].iov_len = pathname_size_value; if(my_arch == server_arch) { v[i].iov_base = pathname; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(pathname, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct open_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: pathname = %p (0x%lX); flags = %ld (0x%lX)", req->pathname, req->pathname, req->flags, req->flags); return v; } /* This function build the request for the system call 'pread64' */ struct iovec *rscc_create_pread64_request(int *total_size, int *iovec_count, int fd, void *buf, size_t count, off_t offset) { struct pread64_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct pread64_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); req_size += aconv_off_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_pread64, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; req->buf = buf; req->count = count; req->offset = offset; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&count, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); aconv_off_t(&offset, my_arch, server_arch, mem); mem += aconv_off_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct pread64_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX); buf = %p (0x%lX); count = %ld (0x%lX); offset = %ld (0x%lX)", req->fd, req->fd, req->buf, req->buf, req->count, req->count, req->offset, req->offset); return v; } /* This function build the request for the system call 'pwrite64' */ struct iovec *rscc_create_pwrite64_request(int *total_size, int *iovec_count, int fd, void *buf, size_t count, off_t offset) { struct pwrite64_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; size_t count_value; req_size = sizeof(struct pwrite64_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); req_size += aconv_off_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_pwrite64, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(buf == NULL) count_value = 0; else count_value = aconv_bytes_size(count, my_arch, server_arch); req->req_size += count_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; req->buf = buf; req->count = count; req->offset = offset; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&count, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); aconv_off_t(&offset, my_arch, server_arch, mem); mem += aconv_off_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(buf == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(buf != NULL) { v[i].iov_len = count_value; if(my_arch == server_arch) { v[i].iov_base = buf; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_bytes(buf, my_arch, server_arch, v[i].iov_base, count); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct pwrite64_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX); buf = %p (0x%lX); count = %ld (0x%lX); offset = %ld (0x%lX)", req->fd, req->fd, req->buf, req->buf, req->count, req->count, req->offset, req->offset); return v; } /* This function build the request for the system call 'read' */ struct iovec *rscc_create_read_request(int *total_size, int *iovec_count, int fd, void *buf, size_t count) { struct read_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct read_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_read, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; req->buf = buf; req->count = count; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&count, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct read_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX); buf = %p (0x%lX); count = %ld (0x%lX)", req->fd, req->fd, req->buf, req->buf, req->count, req->count); return v; } /* This function build the request for the system call 'readlink' */ struct iovec *rscc_create_readlink_request(int *total_size, int *iovec_count, char *path, char *buf, size_t bufsiz) { struct readlink_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int path_size_value; req_size = sizeof(struct readlink_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_readlink, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); req->req_size += path_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->buf = buf; req->bufsiz = bufsiz; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&bufsiz, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(path == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct readlink_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); buf = %p (0x%lX); bufsiz = %ld (0x%lX)", req->path, req->path, req->buf, req->buf, req->bufsiz, req->bufsiz); return v; } /* This function build the request for the system call 'recv' */ struct iovec *rscc_create_recv_request(int *total_size, int *iovec_count, int s, void *buf, size_t len, int flags) { struct recv_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; /* If the destination architecture doesn't support this syscall, I return immediately */ if(server_arch == ACONV_X86_64) return NULL; req_size = sizeof(struct recv_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; #ifdef __x86_64__ /* The system call is not defined in this architecture, so I return NULL */ return NULL; #else /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_recv, SYS_RECV, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_RECV, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } #endif req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->s = s; req->buf = buf; req->len = len; req->flags = flags; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&s, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&len, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); aconv_int(&flags, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct recv_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: s = %ld (0x%lX); buf = %p (0x%lX); len = %ld (0x%lX); flags = %ld (0x%lX)", req->s, req->s, req->buf, req->buf, req->len, req->len, req->flags, req->flags); return v; } /* This function build the request for the system call 'recvfrom' */ struct iovec *rscc_create_recvfrom_request(int *total_size, int *iovec_count, int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { struct recvfrom_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int fromlen_size_value; socklen_t fromlen_value; /* The size of 'from' is contained in the memory pointed by 'fromlen', * but if the latter is NULL I cannot know the size of 'from'. */ if(from != NULL && fromlen == NULL) return NULL; req_size = sizeof(struct recvfrom_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_recvfrom, SYS_RECVFROM, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_RECVFROM, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(fromlen == NULL) fromlen_size_value = 0; else fromlen_size_value = aconv_socklen_t_size(my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(from == NULL) fromlen_value = 0; else fromlen_value = *fromlen; req->req_size += fromlen_value + fromlen_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->s = s; req->buf = buf; req->len = len; req->flags = flags; req->from = from; req->fromlen = fromlen; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&s, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&len, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); aconv_int(&flags, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(from, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(fromlen, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 3; if(fromlen == NULL) vcount--; if(from == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(fromlen != NULL) { v[i].iov_len = fromlen_size_value; if(my_arch == server_arch) { v[i].iov_base = fromlen; } else { socklen_t fromlen_new = *fromlen; v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; if(*fromlen < aconv_struct_sockaddr_size(my_arch, server_arch)) fromlen_new = aconv_struct_sockaddr_size(my_arch, server_arch); aconv_socklen_t(&fromlen_new, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; i++; } if(from != NULL) { v[i].iov_len = fromlen_value; if(my_arch == server_arch) { v[i].iov_base = from; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_struct_sockaddr(from, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct recvfrom_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: s = %ld (0x%lX); buf = %p (0x%lX); len = %ld (0x%lX); flags = %ld (0x%lX); from = %p (0x%lX); fromlen = %p (0x%lX)", req->s, req->s, req->buf, req->buf, req->len, req->len, req->flags, req->flags, req->from, req->from, req->fromlen, req->fromlen); return v; } /* This function build the request for the system call 'rename' */ struct iovec *rscc_create_rename_request(int *total_size, int *iovec_count, char *oldpath, char *newpath) { struct rename_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int oldpath_size_value; int newpath_size_value; req_size = sizeof(struct rename_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_rename, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(oldpath == NULL) oldpath_size_value = 0; else oldpath_size_value = aconv_string_size(oldpath, my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(newpath == NULL) newpath_size_value = 0; else newpath_size_value = aconv_string_size(newpath, my_arch, server_arch); req->req_size += oldpath_size_value + newpath_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->oldpath = oldpath; req->newpath = newpath; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(oldpath, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(newpath, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 3; if(oldpath == NULL) vcount--; if(newpath == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(oldpath != NULL) { v[i].iov_len = oldpath_size_value; if(my_arch == server_arch) { v[i].iov_base = oldpath; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(oldpath, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; i++; } if(newpath != NULL) { v[i].iov_len = newpath_size_value; if(my_arch == server_arch) { v[i].iov_base = newpath; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(newpath, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct rename_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: oldpath = %p (0x%lX); newpath = %p (0x%lX)", req->oldpath, req->oldpath, req->newpath, req->newpath); return v; } /* This function build the request for the system call 'rmdir' */ struct iovec *rscc_create_rmdir_request(int *total_size, int *iovec_count, char *pathname) { struct rmdir_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int pathname_size_value; req_size = sizeof(struct rmdir_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_rmdir, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(pathname == NULL) pathname_size_value = 0; else pathname_size_value = aconv_string_size(pathname, my_arch, server_arch); req->req_size += pathname_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->pathname = pathname; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(pathname, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(pathname == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(pathname != NULL) { v[i].iov_len = pathname_size_value; if(my_arch == server_arch) { v[i].iov_base = pathname; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(pathname, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct rmdir_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: pathname = %p (0x%lX)", req->pathname, req->pathname); return v; } /* This function build the request for the system call 'send' */ struct iovec *rscc_create_send_request(int *total_size, int *iovec_count, int s, void *buf, size_t len, int flags) { struct send_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; /* If the destination architecture doesn't support this syscall, I return immediately */ if(server_arch == ACONV_X86_64) return NULL; size_t len_value; req_size = sizeof(struct send_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; #ifdef __x86_64__ /* The system call is not defined in this architecture, so I return NULL */ return NULL; #else /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_send, SYS_SEND, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_SEND, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } #endif req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(buf == NULL) len_value = 0; else len_value = aconv_bytes_size(len, my_arch, server_arch); req->req_size += len_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->s = s; req->buf = buf; req->len = len; req->flags = flags; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&s, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&len, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); aconv_int(&flags, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(buf == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(buf != NULL) { v[i].iov_len = len_value; if(my_arch == server_arch) { v[i].iov_base = buf; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_bytes(buf, my_arch, server_arch, v[i].iov_base, len); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct send_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: s = %ld (0x%lX); buf = %p (0x%lX); len = %ld (0x%lX); flags = %ld (0x%lX)", req->s, req->s, req->buf, req->buf, req->len, req->len, req->flags, req->flags); return v; } /* This function build the request for the system call 'sendto' */ struct iovec *rscc_create_sendto_request(int *total_size, int *iovec_count, int s, void *buf, size_t len, int flags, struct sockaddr *to, socklen_t tolen) { struct sendto_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; size_t len_value; socklen_t tolen_value; req_size = sizeof(struct sendto_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_socklen_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_sendto, SYS_SENDTO, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_SENDTO, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(buf == NULL) len_value = 0; else len_value = aconv_bytes_size(len, my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(to == NULL) tolen_value = 0; else tolen_value = aconv_struct_sockaddr_size(my_arch, server_arch); req->req_size += len_value + tolen_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->s = s; req->buf = buf; req->len = len; req->flags = flags; req->to = to; req->tolen = tolen; } else { void *mem = (void *)req + sizeof(struct sys_req_header); socklen_t tolen_new = tolen; aconv_int(&s, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&len, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); aconv_int(&flags, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(to, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); if(tolen < aconv_struct_sockaddr_size(my_arch, server_arch)) tolen_new = aconv_struct_sockaddr_size(my_arch, server_arch); aconv_socklen_t(&tolen_new, my_arch, server_arch, mem); mem += aconv_socklen_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 3; if(buf == NULL) vcount--; if(to == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(buf != NULL) { v[i].iov_len = len_value; if(my_arch == server_arch) { v[i].iov_base = buf; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_bytes(buf, my_arch, server_arch, v[i].iov_base, len); } *total_size += v[i].iov_len; i++; } if(to != NULL) { v[i].iov_len = tolen_value; if(my_arch == server_arch) { v[i].iov_base = to; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_struct_sockaddr(to, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct sendto_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: s = %ld (0x%lX); buf = %p (0x%lX); len = %ld (0x%lX); flags = %ld (0x%lX); to = %p (0x%lX); tolen = %ld (0x%lX)", req->s, req->s, req->buf, req->buf, req->len, req->len, req->flags, req->flags, req->to, req->to, req->tolen, req->tolen); return v; } /* This function build the request for the system call 'setdomainname' */ struct iovec *rscc_create_setdomainname_request(int *total_size, int *iovec_count, char *name, size_t len) { struct setdomainname_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; size_t len_value; req_size = sizeof(struct setdomainname_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_setdomainname, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(name == NULL) len_value = 0; else len_value = len; req->req_size += len_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->name = name; req->len = len; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(name, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&len, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(name == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(name != NULL) { v[i].iov_len = len_value; if(my_arch == server_arch) { v[i].iov_base = name; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(name, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct setdomainname_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: name = %p (0x%lX); len = %ld (0x%lX)", req->name, req->name, req->len, req->len); return v; } /* This function build the request for the system call 'sethostname' */ struct iovec *rscc_create_sethostname_request(int *total_size, int *iovec_count, char *name, size_t len) { struct sethostname_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; size_t len_value; req_size = sizeof(struct sethostname_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_sethostname, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(name == NULL) len_value = 0; else len_value = len; req->req_size += len_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->name = name; req->len = len; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(name, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&len, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(name == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(name != NULL) { v[i].iov_len = len_value; if(my_arch == server_arch) { v[i].iov_base = name; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(name, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct sethostname_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: name = %p (0x%lX); len = %ld (0x%lX)", req->name, req->name, req->len, req->len); return v; } /* This function build the request for the system call 'setsockopt' */ struct iovec *rscc_create_setsockopt_request(int *total_size, int *iovec_count, int s, int level, int optname, void *optval, socklen_t optlen) { struct setsockopt_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; socklen_t optlen_value; req_size = sizeof(struct setsockopt_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_socklen_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_setsockopt, SYS_SETSOCKOPT, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_SETSOCKOPT, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(optval == NULL) optlen_value = 0; else optlen_value = aconv_bytes_size(optlen, my_arch, server_arch); req->req_size += optlen_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->s = s; req->level = level; req->optname = optname; req->optval = optval; req->optlen = optlen; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&s, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_int(&level, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_int(&optname, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(optval, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_socklen_t(&optlen, my_arch, server_arch, mem); mem += aconv_socklen_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(optval == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(optval != NULL) { v[i].iov_len = optlen_value; if(my_arch == server_arch) { v[i].iov_base = optval; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_bytes(optval, my_arch, server_arch, v[i].iov_base, optlen); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct setsockopt_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: s = %ld (0x%lX); level = %ld (0x%lX); optname = %ld (0x%lX); optval = %p (0x%lX); optlen = %ld (0x%lX)", req->s, req->s, req->level, req->level, req->optname, req->optname, req->optval, req->optval, req->optlen, req->optlen); return v; } /* This function build the request for the system call 'settimeofday' */ struct iovec *rscc_create_settimeofday_request(int *total_size, int *iovec_count, struct timeval *tv, struct timezone *tz) { struct settimeofday_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int tv_size_value; int tz_size_value; req_size = sizeof(struct settimeofday_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_settimeofday, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(tv == NULL) tv_size_value = 0; else tv_size_value = aconv_struct_timeval_size(my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(tz == NULL) tz_size_value = 0; else tz_size_value = aconv_struct_timezone_size(my_arch, server_arch); req->req_size += tv_size_value + tz_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->tv = tv; req->tz = tz; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(tv, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(tz, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 3; if(tv == NULL) vcount--; if(tz == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(tv != NULL) { v[i].iov_len = tv_size_value; if(my_arch == server_arch) { v[i].iov_base = tv; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_struct_timeval(tv, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; i++; } if(tz != NULL) { v[i].iov_len = tz_size_value; if(my_arch == server_arch) { v[i].iov_base = tz; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_struct_timezone(tz, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct settimeofday_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: tv = %p (0x%lX); tz = %p (0x%lX)", req->tv, req->tv, req->tz, req->tz); return v; } /* This function build the request for the system call 'shutdown' */ struct iovec *rscc_create_shutdown_request(int *total_size, int *iovec_count, int s, int how) { struct shutdown_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct shutdown_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_shutdown, SYS_SHUTDOWN, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_SHUTDOWN, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->s = s; req->how = how; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&s, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_int(&how, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct shutdown_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: s = %ld (0x%lX); how = %ld (0x%lX)", req->s, req->s, req->how, req->how); return v; } /* This function build the request for the system call 'socket' */ struct iovec *rscc_create_socket_request(int *total_size, int *iovec_count, int domain, int type, int protocol) { struct socket_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct socket_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_socket, SYS_SOCKET, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_socketcall, SYS_SOCKET, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->domain = domain; req->type = type; req->protocol = protocol; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&domain, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_int(&type, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_int(&protocol, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct socket_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: domain = %ld (0x%lX); type = %ld (0x%lX); protocol = %ld (0x%lX)", req->domain, req->domain, req->type, req->type, req->protocol, req->protocol); return v; } /* This function build the request for the system call 'stat64' */ struct iovec *rscc_create_stat64_request(int *total_size, int *iovec_count, char *path, struct stat64 *buf) { struct stat64_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int path_size_value; req_size = sizeof(struct stat64_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_stat, NO_VALUE, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_stat64, NO_VALUE, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); req->req_size += path_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->buf = buf; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(path == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct stat64_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); buf = %p (0x%lX)", req->path, req->path, req->buf, req->buf); return v; } /* This function build the request for the system call 'statfs64' */ struct iovec *rscc_create_statfs64_request(int *total_size, int *iovec_count, char *path, struct statfs64 *buf) { struct statfs64_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int path_size_value; req_size = sizeof(struct statfs64_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_statfs, NO_VALUE, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_statfs64, NO_VALUE, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); req->req_size += path_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->buf = buf; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(path == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct statfs64_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); buf = %p (0x%lX)", req->path, req->path, req->buf, req->buf); return v; } /* This function build the request for the system call 'symlink' */ struct iovec *rscc_create_symlink_request(int *total_size, int *iovec_count, char *oldpath, char *newpath) { struct symlink_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int oldpath_size_value; int newpath_size_value; req_size = sizeof(struct symlink_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_symlink, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(oldpath == NULL) oldpath_size_value = 0; else oldpath_size_value = aconv_string_size(oldpath, my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(newpath == NULL) newpath_size_value = 0; else newpath_size_value = aconv_string_size(newpath, my_arch, server_arch); req->req_size += oldpath_size_value + newpath_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->oldpath = oldpath; req->newpath = newpath; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(oldpath, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(newpath, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 3; if(oldpath == NULL) vcount--; if(newpath == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(oldpath != NULL) { v[i].iov_len = oldpath_size_value; if(my_arch == server_arch) { v[i].iov_base = oldpath; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(oldpath, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; i++; } if(newpath != NULL) { v[i].iov_len = newpath_size_value; if(my_arch == server_arch) { v[i].iov_base = newpath; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(newpath, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct symlink_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: oldpath = %p (0x%lX); newpath = %p (0x%lX)", req->oldpath, req->oldpath, req->newpath, req->newpath); return v; } /* This function build the request for the system call 'truncate64' */ struct iovec *rscc_create_truncate64_request(int *total_size, int *iovec_count, char *path, __off64_t length) { struct truncate64_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int path_size_value; req_size = sizeof(struct truncate64_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv___off64_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ #ifdef __x86_64__ if( (rsc_const = nr2rsc(__NR_truncate, NO_VALUE, my_arch)) == __RSC_ERROR ) { #else if( (rsc_const = nr2rsc(__NR_truncate64, NO_VALUE, my_arch)) == __RSC_ERROR ) { #endif free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(path == NULL) path_size_value = 0; else path_size_value = aconv_string_size(path, my_arch, server_arch); req->req_size += path_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->path = path; req->length = length; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(path, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv___off64_t(&length, my_arch, server_arch, mem); mem += aconv___off64_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(path == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(path != NULL) { v[i].iov_len = path_size_value; if(my_arch == server_arch) { v[i].iov_base = path; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(path, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct truncate64_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: path = %p (0x%lX); length = %ld (0x%lX)", req->path, req->path, req->length, req->length); return v; } /* This function build the request for the system call 'umount2' */ struct iovec *rscc_create_umount2_request(int *total_size, int *iovec_count, char *target, int flags) { struct umount2_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int target_size_value; req_size = sizeof(struct umount2_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_int_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_umount2, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(target == NULL) target_size_value = 0; else target_size_value = aconv_string_size(target, my_arch, server_arch); req->req_size += target_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->target = target; req->flags = flags; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(target, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_int(&flags, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(target == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(target != NULL) { v[i].iov_len = target_size_value; if(my_arch == server_arch) { v[i].iov_base = target; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(target, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct umount2_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: target = %p (0x%lX); flags = %ld (0x%lX)", req->target, req->target, req->flags, req->flags); return v; } /* This function build the request for the system call 'uname' */ struct iovec *rscc_create_uname_request(int *total_size, int *iovec_count, struct utsname *buf) { struct uname_req *req; enum rsc_constant rsc_const; int req_size; struct iovec *v; size_t vcount; req_size = sizeof(struct uname_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_uname, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->buf = buf; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct uname_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: buf = %p (0x%lX)", req->buf, req->buf); return v; } /* This function build the request for the system call 'unlink' */ struct iovec *rscc_create_unlink_request(int *total_size, int *iovec_count, char *pathname) { struct unlink_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int pathname_size_value; req_size = sizeof(struct unlink_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_unlink, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(pathname == NULL) pathname_size_value = 0; else pathname_size_value = aconv_string_size(pathname, my_arch, server_arch); req->req_size += pathname_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->pathname = pathname; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(pathname, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(pathname == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(pathname != NULL) { v[i].iov_len = pathname_size_value; if(my_arch == server_arch) { v[i].iov_base = pathname; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(pathname, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct unlink_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: pathname = %p (0x%lX)", req->pathname, req->pathname); return v; } /* This function build the request for the system call 'utime' */ struct iovec *rscc_create_utime_request(int *total_size, int *iovec_count, char *filename, struct utimbuf *buf) { struct utime_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int filename_size_value; int buf_size_value; req_size = sizeof(struct utime_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_utime, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(filename == NULL) filename_size_value = 0; else filename_size_value = aconv_string_size(filename, my_arch, server_arch); /* I manage the case in which the read pointer is NULL*/ if(buf == NULL) buf_size_value = 0; else buf_size_value = aconv_struct_utimbuf_size(my_arch, server_arch); req->req_size += filename_size_value + buf_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->filename = filename; req->buf = buf; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(filename, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 3; if(filename == NULL) vcount--; if(buf == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(filename != NULL) { v[i].iov_len = filename_size_value; if(my_arch == server_arch) { v[i].iov_base = filename; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(filename, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; i++; } if(buf != NULL) { v[i].iov_len = buf_size_value; if(my_arch == server_arch) { v[i].iov_base = buf; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_struct_utimbuf(buf, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct utime_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: filename = %p (0x%lX); buf = %p (0x%lX)", req->filename, req->filename, req->buf, req->buf); return v; } /* This function build the request for the system call 'utimes' */ struct iovec *rscc_create_utimes_request(int *total_size, int *iovec_count, char *filename, struct timeval tv[2]) { struct utimes_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; int filename_size_value; req_size = sizeof(struct utimes_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_array_size(my_arch, server_arch, 2, aconv_struct_timeval_size); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_utimes, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(filename == NULL) filename_size_value = 0; else filename_size_value = aconv_string_size(filename, my_arch, server_arch); req->req_size += filename_size_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->filename = filename; if(tv != NULL) { (req->tv)[0] = tv[0]; (req->tv)[1] = tv[1]; } } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_pointer(filename, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); if(tv != NULL) { aconv_array(tv, my_arch, server_arch, 2, mem, aconv_struct_timeval_size, aconv_struct_timeval); } } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(filename == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(filename != NULL) { v[i].iov_len = filename_size_value; if(my_arch == server_arch) { v[i].iov_base = filename; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_string(filename, my_arch, server_arch, v[i].iov_base); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct utimes_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: filename = %p (0x%lX); tv = %p (0x%lX)", req->filename, req->filename, req->tv, req->tv); return v; } /* This function build the request for the system call 'write' */ struct iovec *rscc_create_write_request(int *total_size, int *iovec_count, int fd, void *buf, size_t count) { struct write_req *req; enum rsc_constant rsc_const; int req_size; int i; struct iovec *v; size_t vcount; size_t count_value; req_size = sizeof(struct write_req); /* If the server and mine architectures are different, I need to calculate the * total request size adding the size of each argument type in the server architecture. */ if(my_arch != server_arch) { req_size = sizeof(struct sys_req_header); req_size += aconv_int_size(my_arch, server_arch); req_size += aconv_pointer_size(my_arch, server_arch); req_size += aconv_size_t_size(my_arch, server_arch); } req = calloc(1, req_size); if(req == NULL) return NULL; /* I get the __RSC_* constant */ if( (rsc_const = nr2rsc(__NR_write, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(req); return NULL; } req->req_type = RSC_SYS_REQ; req->req_rsc_const = htons(rsc_const); req->req_size = req_size; /* I manage the case in which the read pointer is NULL*/ if(buf == NULL) count_value = 0; else count_value = aconv_bytes_size(count, my_arch, server_arch); req->req_size += count_value; /* I transform 'req_size' in network byte order and I save * the system call arguments into the request. * If the two architectures are different, the LibAConv functions are called*/ req->req_size = htonl(req->req_size); if(my_arch == server_arch) { req->fd = fd; req->buf = buf; req->count = count; } else { void *mem = (void *)req + sizeof(struct sys_req_header); aconv_int(&fd, my_arch, server_arch, mem); mem += aconv_int_size(my_arch, server_arch); aconv_pointer(buf, my_arch, server_arch, mem); mem += aconv_pointer_size(my_arch, server_arch); aconv_size_t(&count, my_arch, server_arch, mem); mem += aconv_size_t_size(my_arch, server_arch); } /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 2; if(buf == NULL) vcount--; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = req; v[0].iov_len = req_size; *total_size = v[0].iov_len; i = 1; if(buf != NULL) { v[i].iov_len = count_value; if(my_arch == server_arch) { v[i].iov_base = buf; } else { v[i].iov_base = malloc(v[i].iov_len); if(v[i].iov_base == NULL) return NULL; aconv_bytes(buf, my_arch, server_arch, v[i].iov_base, count); } *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct write_req), rsc2str(ntohs(req->req_rsc_const)), ntohs(req->req_rsc_const), ntohl(req->req_size), ntohl(req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX); buf = %p (0x%lX); count = %ld (0x%lX)", req->fd, req->fd, req->buf, req->buf, req->count, req->count); return v; } /*##########################################################*/ /*## ##*/ /*## RESPONSE MANAGEMENT FUNCTIONS ##*/ /*## ##*/ /*##########################################################*/ struct iovec *rscc_manage__llseek_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, unsigned int fd, unsigned long int offset_high, unsigned long int offset_low, loff_t *result, unsigned int whence) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(result == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(result != NULL) { v[i].iov_base = result; v[i].iov_len = sizeof(loff_t); *nbytes += sizeof(loff_t); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_accept_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int sockfd, struct sockaddr *addr, socklen_t *addrlen) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 2; if(addrlen == NULL) vcount--; if(addr == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(addrlen != NULL) { v[i].iov_base = addrlen; v[i].iov_len = sizeof(socklen_t); *nbytes += sizeof(socklen_t); i++; } if(addr != NULL) { v[i].iov_base = addr; v[i].iov_len = *addrlen; *nbytes += *addrlen; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_access_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *pathname, int mode) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_adjtimex_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, struct timex *buf) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(buf == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL) { v[i].iov_base = buf; v[i].iov_len = sizeof(struct timex); *nbytes += sizeof(struct timex); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_bind_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int sockfd, struct sockaddr *my_addr, socklen_t addrlen) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_chdir_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_chmod_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, mode_t mode) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_chown_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, uid_t owner, gid_t group) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_chown32_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, uid_t owner, gid_t group) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_clock_getres_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, clockid_t clk_id, struct timespec *res) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(res == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(res != NULL) { v[i].iov_base = res; v[i].iov_len = sizeof(struct timespec); *nbytes += sizeof(struct timespec); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_clock_gettime_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, clockid_t clk_id, struct timespec *tp) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(tp == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(tp != NULL) { v[i].iov_base = tp; v[i].iov_len = sizeof(struct timespec); *nbytes += sizeof(struct timespec); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_clock_settime_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, clockid_t clk_id, struct timespec *tp) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_close_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_connect_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int sockfd, struct sockaddr *serv_addr, socklen_t addrlen) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_dup_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int oldfd) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_dup2_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int oldfd, int newfd) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_fchdir_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_fchmod_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fildes, mode_t mode) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_fchown_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, uid_t owner, gid_t group) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_fchown32_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, uid_t owner, gid_t group) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_fdatasync_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_fgetxattr_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int filedes, char *name, void *value, size_t size) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(value == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(value != NULL) { v[i].iov_base = value; v[i].iov_len = size; *nbytes += size; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_fstat64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int filedes, struct stat64 *buf) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(buf == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL) { v[i].iov_base = buf; v[i].iov_len = sizeof(struct stat64); *nbytes += sizeof(struct stat64); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_fstatfs64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, unsigned int fd, struct statfs64 *buf) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(buf == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL) { v[i].iov_base = buf; v[i].iov_len = sizeof(struct statfs64); *nbytes += sizeof(struct statfs64); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_fsync_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_ftruncate64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, __off64_t length) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_getdents64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, unsigned int fd, struct dirent64 *dirp, unsigned int count) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(dirp == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(dirp != NULL) { v[i].iov_base = dirp; v[i].iov_len = count; *nbytes += count; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_getpeername_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, struct sockaddr *name, socklen_t *namelen) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 2; if(namelen == NULL) vcount--; if(name == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(namelen != NULL) { v[i].iov_base = namelen; v[i].iov_len = sizeof(socklen_t); *nbytes += sizeof(socklen_t); i++; } if(name != NULL) { v[i].iov_base = name; v[i].iov_len = *namelen; *nbytes += *namelen; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_getsockname_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, struct sockaddr *name, socklen_t *namelen) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 2; if(namelen == NULL) vcount--; if(name == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(namelen != NULL) { v[i].iov_base = namelen; v[i].iov_len = sizeof(socklen_t); *nbytes += sizeof(socklen_t); i++; } if(name != NULL) { v[i].iov_base = name; v[i].iov_len = *namelen; *nbytes += *namelen; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_getsockopt_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, int level, int optname, void *optval, socklen_t *optlen) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 2; if(optlen == NULL) vcount--; if(optval == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(optlen != NULL) { v[i].iov_base = optlen; v[i].iov_len = sizeof(socklen_t); *nbytes += sizeof(socklen_t); i++; } if(optval != NULL) { v[i].iov_base = optval; v[i].iov_len = *optlen; *nbytes += *optlen; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_gettimeofday_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, struct timeval *tv, struct timezone *tz) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 2; if(tv == NULL) vcount--; if(tz == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(tv != NULL) { v[i].iov_base = tv; v[i].iov_len = sizeof(struct timeval); *nbytes += sizeof(struct timeval); i++; } if(tz != NULL) { v[i].iov_base = tz; v[i].iov_len = sizeof(struct timezone); *nbytes += sizeof(struct timezone); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_getxattr_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, char *name, void *value, size_t size) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(value == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(value != NULL) { v[i].iov_base = value; v[i].iov_len = size; *nbytes += size; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_lchown_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, uid_t owner, gid_t group) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_lchown32_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, uid_t owner, gid_t group) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_lgetxattr_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, char *name, void *value, size_t size) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(value == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(value != NULL) { v[i].iov_base = value; v[i].iov_len = size; *nbytes += size; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_link_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *oldpath, char *newpath) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_listen_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int sockfd, int backlog) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_lseek_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fildes, off_t offset, int whence) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_lstat64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, struct stat64 *buf) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(buf == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL) { v[i].iov_base = buf; v[i].iov_len = sizeof(struct stat64); *nbytes += sizeof(struct stat64); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_mkdir_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *pathname, mode_t mode) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_mount_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *source, char *target, char *filesystemtype, unsigned long int mountflags, void *data) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_open_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *pathname, int flags) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_pread64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, void *buf, size_t count, off_t offset) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(buf == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL) { v[i].iov_base = buf; v[i].iov_len = count; *nbytes += count; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_pwrite64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, void *buf, size_t count, off_t offset) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_read_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, void *buf, size_t count) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(buf == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL && resp_header->resp_retval > 0) { v[i].iov_base = buf; v[i].iov_len = resp_header->resp_retval; *nbytes += resp_header->resp_retval; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_readlink_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, char *buf, size_t bufsiz) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(buf == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL) { v[i].iov_base = buf; v[i].iov_len = bufsiz; *nbytes += bufsiz; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_recv_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, void *buf, size_t len, int flags) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(buf == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL) { v[i].iov_base = buf; v[i].iov_len = len; *nbytes += len; } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_recvfrom_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 2; if(buf == NULL) vcount--; if(fromlen == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL) { v[i].iov_base = buf; v[i].iov_len = len; *nbytes += len; i++; } if(fromlen != NULL) { v[i].iov_base = fromlen; v[i].iov_len = sizeof(socklen_t); *nbytes += sizeof(socklen_t); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_rename_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *oldpath, char *newpath) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_rmdir_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *pathname) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_send_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, void *buf, size_t len, int flags) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_sendto_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, void *buf, size_t len, int flags, struct sockaddr *to, socklen_t tolen) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_setdomainname_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *name, size_t len) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_sethostname_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *name, size_t len) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_setsockopt_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, int level, int optname, void *optval, socklen_t optlen) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_settimeofday_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, struct timeval *tv, struct timezone *tz) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_shutdown_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int s, int how) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_socket_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int domain, int type, int protocol) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_stat64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, struct stat64 *buf) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(buf == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL) { v[i].iov_base = buf; v[i].iov_len = sizeof(struct stat64); *nbytes += sizeof(struct stat64); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_statfs64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, struct statfs64 *buf) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(buf == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL) { v[i].iov_base = buf; v[i].iov_len = sizeof(struct statfs64); *nbytes += sizeof(struct statfs64); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_symlink_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *oldpath, char *newpath) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_truncate64_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *path, __off64_t length) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_umount2_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *target, int flags) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_uname_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, struct utsname *buf) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* I read the buffers */ if(resp_header->resp_size > sizeof(struct sys_resp_header)) { int i; vcount = 1; if(buf == NULL) vcount--; if(vcount != 0) { v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } *nbytes = 0; i = 0; if(buf != NULL) { v[i].iov_base = buf; v[i].iov_len = sizeof(struct utsname); *nbytes += sizeof(struct utsname); } } } *iovec_count = vcount; return v; } struct iovec *rscc_manage_unlink_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *pathname) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_utime_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *filename, struct utimbuf *buf) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_utimes_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, char *filename, struct timeval tv[2]) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } struct iovec *rscc_manage_write_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, int fd, void *buf, size_t count) { struct iovec *v = NULL; size_t vcount = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_rsc_const = %s (0x%lX); resp_size = %d (0x%lX) bytes", sizeof(struct sys_resp_header), rsc2str(resp_header->resp_rsc_const), resp_header->resp_rsc_const, resp_header->resp_size, resp_header->resp_size); RSC_DEBUG(RSCD_MINIMAL, "\tretval = %d (0x%lX); errno = %d (0x%lX)\n", resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); *iovec_count = vcount; return v; } /*##########################################################*/ /*## ##*/ /*## RSCC FUNCTIONS ##*/ /*## ##*/ /*##########################################################*/ int rscc__llseek(unsigned int fd, unsigned long int offset_high, unsigned long int offset_low, loff_t *result, unsigned int whence) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create__llseek_request(&nbytes, &iovec_count, fd, offset_high, offset_low, result, whence); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall '_llseek'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage__llseek_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage__llseek_response(&resp_header, &iovec_count, &nbytes, fd, offset_high, offset_low, result, whence); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_accept_request(&nbytes, &iovec_count, sockfd, addr, addrlen); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'accept'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_accept_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_accept_response(&resp_header, &iovec_count, &nbytes, sockfd, addr, addrlen); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_access(char *pathname, int mode) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_access_request(&nbytes, &iovec_count, pathname, mode); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'access'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_access_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_access_response(&resp_header, &iovec_count, &nbytes, pathname, mode); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_adjtimex(struct timex *buf) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_adjtimex_request(&nbytes, &iovec_count, buf); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'adjtimex'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_adjtimex_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_adjtimex_response(&resp_header, &iovec_count, &nbytes, buf); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_bind_request(&nbytes, &iovec_count, sockfd, my_addr, addrlen); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'bind'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_bind_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_bind_response(&resp_header, &iovec_count, &nbytes, sockfd, my_addr, addrlen); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_chdir(char *path) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_chdir_request(&nbytes, &iovec_count, path); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'chdir'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_chdir_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_chdir_response(&resp_header, &iovec_count, &nbytes, path); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_chmod(char *path, mode_t mode) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_chmod_request(&nbytes, &iovec_count, path, mode); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'chmod'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_chmod_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_chmod_response(&resp_header, &iovec_count, &nbytes, path, mode); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_chown(char *path, uid_t owner, gid_t group) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_chown_request(&nbytes, &iovec_count, path, owner, group); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'chown'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_chown_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_chown_response(&resp_header, &iovec_count, &nbytes, path, owner, group); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_chown32(char *path, uid_t owner, gid_t group) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_chown32_request(&nbytes, &iovec_count, path, owner, group); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'chown32'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_chown32_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_chown32_response(&resp_header, &iovec_count, &nbytes, path, owner, group); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_clock_getres(clockid_t clk_id, struct timespec *res) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_clock_getres_request(&nbytes, &iovec_count, clk_id, res); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'clock_getres'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_clock_getres_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_clock_getres_response(&resp_header, &iovec_count, &nbytes, clk_id, res); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_clock_gettime(clockid_t clk_id, struct timespec *tp) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_clock_gettime_request(&nbytes, &iovec_count, clk_id, tp); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'clock_gettime'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_clock_gettime_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_clock_gettime_response(&resp_header, &iovec_count, &nbytes, clk_id, tp); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_clock_settime(clockid_t clk_id, struct timespec *tp) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_clock_settime_request(&nbytes, &iovec_count, clk_id, tp); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'clock_settime'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_clock_settime_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_clock_settime_response(&resp_header, &iovec_count, &nbytes, clk_id, tp); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_close(int fd) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_close_request(&nbytes, &iovec_count, fd); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'close'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_close_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_close_response(&resp_header, &iovec_count, &nbytes, fd); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_connect(int sockfd, struct sockaddr *serv_addr, socklen_t addrlen) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_connect_request(&nbytes, &iovec_count, sockfd, serv_addr, addrlen); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'connect'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_connect_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_connect_response(&resp_header, &iovec_count, &nbytes, sockfd, serv_addr, addrlen); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_dup(int oldfd) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_dup_request(&nbytes, &iovec_count, oldfd); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'dup'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_dup_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_dup_response(&resp_header, &iovec_count, &nbytes, oldfd); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_dup2(int oldfd, int newfd) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_dup2_request(&nbytes, &iovec_count, oldfd, newfd); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'dup2'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_dup2_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_dup2_response(&resp_header, &iovec_count, &nbytes, oldfd, newfd); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_fchdir(int fd) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_fchdir_request(&nbytes, &iovec_count, fd); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'fchdir'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_fchdir_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_fchdir_response(&resp_header, &iovec_count, &nbytes, fd); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_fchmod(int fildes, mode_t mode) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_fchmod_request(&nbytes, &iovec_count, fildes, mode); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'fchmod'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_fchmod_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_fchmod_response(&resp_header, &iovec_count, &nbytes, fildes, mode); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_fchown(int fd, uid_t owner, gid_t group) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_fchown_request(&nbytes, &iovec_count, fd, owner, group); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'fchown'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_fchown_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_fchown_response(&resp_header, &iovec_count, &nbytes, fd, owner, group); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_fchown32(int fd, uid_t owner, gid_t group) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_fchown32_request(&nbytes, &iovec_count, fd, owner, group); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'fchown32'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_fchown32_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_fchown32_response(&resp_header, &iovec_count, &nbytes, fd, owner, group); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_fdatasync(int fd) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_fdatasync_request(&nbytes, &iovec_count, fd); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'fdatasync'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_fdatasync_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_fdatasync_response(&resp_header, &iovec_count, &nbytes, fd); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_fgetxattr(int filedes, char *name, void *value, size_t size) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_fgetxattr_request(&nbytes, &iovec_count, filedes, name, value, size); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'fgetxattr'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_fgetxattr_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_fgetxattr_response(&resp_header, &iovec_count, &nbytes, filedes, name, value, size); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_fstat64(int filedes, struct stat64 *buf) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_fstat64_request(&nbytes, &iovec_count, filedes, buf); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'fstat64'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_fstat64_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_fstat64_response(&resp_header, &iovec_count, &nbytes, filedes, buf); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_fstatfs64(unsigned int fd, struct statfs64 *buf) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_fstatfs64_request(&nbytes, &iovec_count, fd, buf); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'fstatfs64'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_fstatfs64_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_fstatfs64_response(&resp_header, &iovec_count, &nbytes, fd, buf); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_fsync(int fd) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_fsync_request(&nbytes, &iovec_count, fd); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'fsync'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_fsync_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_fsync_response(&resp_header, &iovec_count, &nbytes, fd); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_ftruncate64(int fd, __off64_t length) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_ftruncate64_request(&nbytes, &iovec_count, fd, length); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'ftruncate64'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_ftruncate64_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_ftruncate64_response(&resp_header, &iovec_count, &nbytes, fd, length); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_getdents64(unsigned int fd, struct dirent64 *dirp, unsigned int count) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_getdents64_request(&nbytes, &iovec_count, fd, dirp, count); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'getdents64'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_getdents64_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_getdents64_response(&resp_header, &iovec_count, &nbytes, fd, dirp, count); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_getpeername(int s, struct sockaddr *name, socklen_t *namelen) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_getpeername_request(&nbytes, &iovec_count, s, name, namelen); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'getpeername'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_getpeername_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_getpeername_response(&resp_header, &iovec_count, &nbytes, s, name, namelen); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_getsockname(int s, struct sockaddr *name, socklen_t *namelen) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_getsockname_request(&nbytes, &iovec_count, s, name, namelen); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'getsockname'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_getsockname_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_getsockname_response(&resp_header, &iovec_count, &nbytes, s, name, namelen); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_getsockopt_request(&nbytes, &iovec_count, s, level, optname, optval, optlen); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'getsockopt'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_getsockopt_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_getsockopt_response(&resp_header, &iovec_count, &nbytes, s, level, optname, optval, optlen); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_gettimeofday(struct timeval *tv, struct timezone *tz) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_gettimeofday_request(&nbytes, &iovec_count, tv, tz); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'gettimeofday'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_gettimeofday_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_gettimeofday_response(&resp_header, &iovec_count, &nbytes, tv, tz); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_getxattr(char *path, char *name, void *value, size_t size) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_getxattr_request(&nbytes, &iovec_count, path, name, value, size); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'getxattr'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_getxattr_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_getxattr_response(&resp_header, &iovec_count, &nbytes, path, name, value, size); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_lchown(char *path, uid_t owner, gid_t group) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_lchown_request(&nbytes, &iovec_count, path, owner, group); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'lchown'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_lchown_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_lchown_response(&resp_header, &iovec_count, &nbytes, path, owner, group); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_lchown32(char *path, uid_t owner, gid_t group) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_lchown32_request(&nbytes, &iovec_count, path, owner, group); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'lchown32'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_lchown32_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_lchown32_response(&resp_header, &iovec_count, &nbytes, path, owner, group); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_lgetxattr(char *path, char *name, void *value, size_t size) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_lgetxattr_request(&nbytes, &iovec_count, path, name, value, size); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'lgetxattr'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_lgetxattr_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_lgetxattr_response(&resp_header, &iovec_count, &nbytes, path, name, value, size); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_link(char *oldpath, char *newpath) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_link_request(&nbytes, &iovec_count, oldpath, newpath); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'link'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_link_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_link_response(&resp_header, &iovec_count, &nbytes, oldpath, newpath); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_listen(int sockfd, int backlog) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_listen_request(&nbytes, &iovec_count, sockfd, backlog); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'listen'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_listen_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_listen_response(&resp_header, &iovec_count, &nbytes, sockfd, backlog); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_lseek(int fildes, off_t offset, int whence) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_lseek_request(&nbytes, &iovec_count, fildes, offset, whence); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'lseek'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_lseek_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_lseek_response(&resp_header, &iovec_count, &nbytes, fildes, offset, whence); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_lstat64(char *path, struct stat64 *buf) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_lstat64_request(&nbytes, &iovec_count, path, buf); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'lstat64'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_lstat64_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_lstat64_response(&resp_header, &iovec_count, &nbytes, path, buf); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_mkdir(char *pathname, mode_t mode) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_mkdir_request(&nbytes, &iovec_count, pathname, mode); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'mkdir'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_mkdir_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_mkdir_response(&resp_header, &iovec_count, &nbytes, pathname, mode); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_mount(char *source, char *target, char *filesystemtype, unsigned long int mountflags, void *data) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_mount_request(&nbytes, &iovec_count, source, target, filesystemtype, mountflags, data); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'mount'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_mount_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_mount_response(&resp_header, &iovec_count, &nbytes, source, target, filesystemtype, mountflags, data); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_open(char *pathname, int flags) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_open_request(&nbytes, &iovec_count, pathname, flags); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'open'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_open_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_open_response(&resp_header, &iovec_count, &nbytes, pathname, flags); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_pread64(int fd, void *buf, size_t count, off_t offset) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_pread64_request(&nbytes, &iovec_count, fd, buf, count, offset); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'pread64'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_pread64_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_pread64_response(&resp_header, &iovec_count, &nbytes, fd, buf, count, offset); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_pwrite64(int fd, void *buf, size_t count, off_t offset) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_pwrite64_request(&nbytes, &iovec_count, fd, buf, count, offset); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'pwrite64'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_pwrite64_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_pwrite64_response(&resp_header, &iovec_count, &nbytes, fd, buf, count, offset); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_read(int fd, void *buf, size_t count) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_read_request(&nbytes, &iovec_count, fd, buf, count); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'read'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_read_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_read_response(&resp_header, &iovec_count, &nbytes, fd, buf, count); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_readlink(char *path, char *buf, size_t bufsiz) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_readlink_request(&nbytes, &iovec_count, path, buf, bufsiz); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'readlink'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_readlink_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_readlink_response(&resp_header, &iovec_count, &nbytes, path, buf, bufsiz); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_recv(int s, void *buf, size_t len, int flags) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_recv_request(&nbytes, &iovec_count, s, buf, len, flags); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'recv'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_recv_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_recv_response(&resp_header, &iovec_count, &nbytes, s, buf, len, flags); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_recvfrom_request(&nbytes, &iovec_count, s, buf, len, flags, from, fromlen); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'recvfrom'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_recvfrom_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_recvfrom_response(&resp_header, &iovec_count, &nbytes, s, buf, len, flags, from, fromlen); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_rename(char *oldpath, char *newpath) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_rename_request(&nbytes, &iovec_count, oldpath, newpath); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'rename'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_rename_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_rename_response(&resp_header, &iovec_count, &nbytes, oldpath, newpath); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_rmdir(char *pathname) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_rmdir_request(&nbytes, &iovec_count, pathname); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'rmdir'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_rmdir_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_rmdir_response(&resp_header, &iovec_count, &nbytes, pathname); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_send(int s, void *buf, size_t len, int flags) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_send_request(&nbytes, &iovec_count, s, buf, len, flags); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'send'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_send_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_send_response(&resp_header, &iovec_count, &nbytes, s, buf, len, flags); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_sendto(int s, void *buf, size_t len, int flags, struct sockaddr *to, socklen_t tolen) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_sendto_request(&nbytes, &iovec_count, s, buf, len, flags, to, tolen); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'sendto'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_sendto_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_sendto_response(&resp_header, &iovec_count, &nbytes, s, buf, len, flags, to, tolen); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_setdomainname(char *name, size_t len) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_setdomainname_request(&nbytes, &iovec_count, name, len); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'setdomainname'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_setdomainname_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_setdomainname_response(&resp_header, &iovec_count, &nbytes, name, len); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_sethostname(char *name, size_t len) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_sethostname_request(&nbytes, &iovec_count, name, len); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'sethostname'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_sethostname_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_sethostname_response(&resp_header, &iovec_count, &nbytes, name, len); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_setsockopt(int s, int level, int optname, void *optval, socklen_t optlen) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_setsockopt_request(&nbytes, &iovec_count, s, level, optname, optval, optlen); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'setsockopt'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_setsockopt_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_setsockopt_response(&resp_header, &iovec_count, &nbytes, s, level, optname, optval, optlen); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_settimeofday(struct timeval *tv, struct timezone *tz) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_settimeofday_request(&nbytes, &iovec_count, tv, tz); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'settimeofday'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_settimeofday_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_settimeofday_response(&resp_header, &iovec_count, &nbytes, tv, tz); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_shutdown(int s, int how) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_shutdown_request(&nbytes, &iovec_count, s, how); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'shutdown'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_shutdown_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_shutdown_response(&resp_header, &iovec_count, &nbytes, s, how); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_socket(int domain, int type, int protocol) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_socket_request(&nbytes, &iovec_count, domain, type, protocol); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'socket'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_socket_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_socket_response(&resp_header, &iovec_count, &nbytes, domain, type, protocol); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_stat64(char *path, struct stat64 *buf) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_stat64_request(&nbytes, &iovec_count, path, buf); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'stat64'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_stat64_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_stat64_response(&resp_header, &iovec_count, &nbytes, path, buf); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_statfs64(char *path, struct statfs64 *buf) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_statfs64_request(&nbytes, &iovec_count, path, buf); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'statfs64'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_statfs64_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_statfs64_response(&resp_header, &iovec_count, &nbytes, path, buf); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_symlink(char *oldpath, char *newpath) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_symlink_request(&nbytes, &iovec_count, oldpath, newpath); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'symlink'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_symlink_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_symlink_response(&resp_header, &iovec_count, &nbytes, oldpath, newpath); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_truncate64(char *path, __off64_t length) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_truncate64_request(&nbytes, &iovec_count, path, length); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'truncate64'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_truncate64_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_truncate64_response(&resp_header, &iovec_count, &nbytes, path, length); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_umount2(char *target, int flags) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_umount2_request(&nbytes, &iovec_count, target, flags); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'umount2'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_umount2_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_umount2_response(&resp_header, &iovec_count, &nbytes, target, flags); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_uname(struct utsname *buf) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_uname_request(&nbytes, &iovec_count, buf); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'uname'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_uname_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_uname_response(&resp_header, &iovec_count, &nbytes, buf); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_unlink(char *pathname) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_unlink_request(&nbytes, &iovec_count, pathname); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'unlink'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_unlink_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_unlink_response(&resp_header, &iovec_count, &nbytes, pathname); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_utime(char *filename, struct utimbuf *buf) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_utime_request(&nbytes, &iovec_count, filename, buf); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'utime'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_utime_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_utime_response(&resp_header, &iovec_count, &nbytes, filename, buf); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_utimes(char *filename, struct timeval tv[2]) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_utimes_request(&nbytes, &iovec_count, filename, tv); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'utimes'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_utimes_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_utimes_response(&resp_header, &iovec_count, &nbytes, filename, tv); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } int rscc_write(int fd, void *buf, size_t count) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; /* I build the request */ v = rscc_create_write_request(&nbytes, &iovec_count, fd, buf, count); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'write'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I call the rscc_manage_write_response(). If the return value isn't NULL, * I need to read other data (the write buffers). The returned value is a list of struct iovec, * one for each write buffer. The ->iov_base of each element points to the syscall argument, * in this way the data are read directly into the original buffer. After the call of the * management functions the fields into the resp_header are un-marshaled and ready to be used. */ v = rscc_manage_write_response(&resp_header, &iovec_count, &nbytes, fd, buf, count); if(v != NULL) { /* I read the buffers (if they aren't NULL)...*/ nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } # if 0 int rsc_recvmsg(int s, struct msghdr *msg, int flags) { struct recvmsg_req recvmsg_req; struct recvmsg_resp recvmsg_resp; int nwrite, nread, i, total_size; size_t *iov_len_array; enum rsc_constant rsc_const; memset(&recvmsg_req, 0, sizeof(struct recvmsg_req)); if( (rsc_const = nr2rsc(__NR_socketcall, SYS_RECVMSG, my_arch)) == __RSC_ERROR ) return -1; recvmsg_req.req_rsc_const = htons(rsc_const); /* The size of the request is formed by: * 1. the size of structure recvmsg_req * 2. the size of the msg->msg_name and msg->msg_controll buffers * 3. the sizes of iov_base buffers inside the msg->msg_iov array */ total_size = sizeof(struct recvmsg_req); if(msg->msg_name != NULL) total_size += msg->msg_namelen; if(msg->msg_control != NULL) total_size += msg->msg_controllen; if(msg->msg_iov != NULL) total_size += msg->msg_iovlen * sizeof(size_t); recvmsg_req.req_size = htonl(total_size); recvmsg_req.s = s; memcpy(&(recvmsg_req.msg), msg, sizeof(recvmsg_req.msg)); recvmsg_req.flags = flags; printf("RECVMSG: Header: req_rsc_const = %d (%lX); req_size = %d (%lX)\n", ntohl(recvmsg_req.req_rsc_const), ntohl(recvmsg_req.req_rsc_const), ntohl(recvmsg_req.req_size), ntohl(recvmsg_req.req_size)); printf("s = %d, flags = %d\n", recvmsg_req.s, recvmsg_req.flags); RSC_PRINT_MSGHDR(RSCD_REQ_RESP, msg); /* I send the request header */ nwrite = write_n_bytes(rsc_sockfd, &recvmsg_req, sizeof(struct recvmsg_req)); if(nwrite != sizeof(struct recvmsg_req)) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, sizeof(struct recvmsg_req)); return -1; } /* Now I have to send the data pointed by the pointer inside the msg structure: */ /* 1. "msg_name": it can be null, so I send it only if it isn't null. */ if(msg->msg_name != NULL) { printf("Sending msg_name (len = %d)\n", msg->msg_namelen); nwrite = write_n_bytes(rsc_sockfd, msg->msg_name, msg->msg_namelen); printf("Sent %d/%d bytes\n", nwrite, msg->msg_namelen); if(nwrite != msg->msg_namelen) { fprintf(stderr, "I've sent only %d/%d bytes of msg->msg_name.\n", nwrite, msg->msg_namelen); return -1; } } /* 2. "msg_iov": it's an array of buffers so I don't need to send them, but I have * to send the length of each buffer. */ if(msg->msg_iov != NULL) { iov_len_array = calloc(msg->msg_iovlen, sizeof(size_t)); for(i = 0; i < msg->msg_iovlen; i++) { printf("msg->msg_iov[%d].iov_len = %d\n", i, (msg->msg_iov[i]).iov_len); iov_len_array[i] = (msg->msg_iov[i]).iov_len; } } printf("msg->msg_iovlen = %d\n", msg->msg_iovlen); for(i = 0; i < msg->msg_iovlen; i++) { printf("iov_len_array[%d] = %d\n", i, iov_len_array[i]); } nwrite = write_n_bytes(rsc_sockfd, iov_len_array, msg->msg_iovlen * sizeof(size_t)); printf("Sent %d/%d byte od msg->msg_iov\n", nwrite, msg->msg_iovlen); if(nwrite != msg->msg_iovlen * sizeof(size_t)) { fprintf(stderr, "I've sent only %d/%d bytes of msg->msg_name.\n", nwrite, msg->msg_iovlen); return -1; } /* 3. "msg_control" */ if(msg->msg_control != NULL) { printf("Sending msg_control (len = %d)\n", msg->msg_controllen); nwrite = write_n_bytes(rsc_sockfd, msg->msg_control, msg->msg_controllen); printf("Sent %d/%d byte od msg->msg_control\n", nwrite, msg->msg_controllen); if(nwrite != msg->msg_controllen) { fprintf(stderr, "I've sent only %d/%d bytes of msg->msg_name.\n", nwrite, msg->msg_controllen); return -1; } } nread = read_n_bytes(rsc_sockfd, &recvmsg_resp, sizeof(struct recvmsg_resp)); if(nread != sizeof(struct recvmsg_resp)) { fprintf(stderr, "I've read only %d/%d bytes.\n", nwrite, sizeof(struct recvmsg_req)); return -1; } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s", rsc2str(recvmsg_resp.resp_type)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader: resp_type = %d (0x%lX); resp_size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", recvmsg_resp.resp_type, recvmsg_resp.resp_type, recvmsg_resp.resp_size, recvmsg_resp.resp_size, recvmsg_resp.resp_retval, recvmsg_resp.resp_retval, recvmsg_resp.resp_errno, recvmsg_resp.resp_errno); if(recvmsg_resp.resp_retval != -1) { int i; for(i = 0; i < msg->msg_iovlen; i++) { nread = read_n_bytes(rsc_sockfd, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len); printf("Reading into buffer # %d; read %d bytes; buffer size = %d bytes\n", i, nread, msg->msg_iov[i].iov_len); } } printf("############## => recvmsg_resp.msg_controllen = %d\n", recvmsg_resp.msg_controllen); msg->msg_controllen = recvmsg_resp.msg_controllen; if(recvmsg_resp.msg_controllen != 0) nread = read_n_bytes(rsc_sockfd, msg->msg_control, recvmsg_resp.msg_controllen); else msg->msg_control = NULL; RSC_PRINT_MSGHDR(RSCD_REQ_RESP, msg); errno = recvmsg_resp.resp_errno; return recvmsg_resp.resp_retval; } #endif /* This function build the request for the system call 'ioctl' */ struct iovec *rscc_create_ioctl_request(int *total_size, int *iovec_count, u_int32_t size_type, int d, int request, void *arg) { struct ioctl_req *ioctl_req; enum rsc_constant rsc_const; int i; struct iovec *v; size_t vcount; int arg_size_value; ioctl_req = calloc(1, sizeof(struct ioctl_req)); if(ioctl_req == NULL) return NULL; if( (rsc_const = nr2rsc(__NR_ioctl, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(ioctl_req); return NULL; } ioctl_req->req_type = RSC_SYS_REQ; ioctl_req->req_rsc_const = htons(rsc_const); /* If arg is NULL or is a write pointer, don't send it */ if(arg != NULL && (size_type & IOCTL_R)) arg_size_value = size_type & IOCTL_LENMASK; else arg_size_value = 0; ioctl_req->req_size = htonl(sizeof(struct ioctl_req) + arg_size_value); ioctl_req->d = d; ioctl_req->request = request; ioctl_req->arg = arg; /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ vcount = 1; if(arg != NULL && (size_type & IOCTL_R)) vcount++; v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = ioctl_req; v[0].iov_len = sizeof(struct ioctl_req); *total_size = v[0].iov_len; i = 1; if(arg != NULL && (size_type & IOCTL_R)) { v[i].iov_base = arg; v[i].iov_len = arg_size_value; *total_size += v[i].iov_len; } *iovec_count = vcount; RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(ioctl_req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct ioctl_req), rsc2str(ntohs(ioctl_req->req_rsc_const)), ntohs(ioctl_req->req_rsc_const), ntohl(ioctl_req->req_size), ntohl(ioctl_req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: d = %ld (0x%lX); request = %ld (0x%lX); arg = %p (0x%lX)", ioctl_req->d, ioctl_req->d, ioctl_req->request, ioctl_req->request, ioctl_req->arg, ioctl_req->arg); return v; } struct iovec *rscc_manage_ioctl_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, u_int32_t size_type, void *arg) { struct iovec *v = NULL; size_t vcount = 0; int byte_num = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_type = %d (0x%lX); resp_size = %d (0x%lX) bytes; resp_rsc_const = %d (0x%lX); resp_retval = %d (0x%lX); errno = %d (0x%lX)\n", sizeof(struct sys_resp_header), resp_header->resp_type, resp_header->resp_type, resp_header->resp_size, resp_header->resp_size, resp_header->resp_rsc_const, resp_header->resp_rsc_const, resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); if((resp_header->resp_size > sizeof(struct sys_resp_header)) && (arg != NULL) && (size_type & IOCTL_W)) { v = calloc(1, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = arg; v[0].iov_len = size_type & IOCTL_LENMASK; vcount = 1; byte_num = v[0].iov_len; } *nbytes = byte_num; *iovec_count = vcount; return v; } int rscc_ioctl(int d, int request, void *arg) { struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; u_int32_t size_type; /* I get the type and the size of 'arg' */ size_type = rscc_check_ioctl_request(request); /* An error occurs or the 'request' isn't managed */ if(size_type == 0 || size_type == IOCTL_UNMANAGED) return -1; /* I build the request */ v = rscc_create_ioctl_request(&nbytes, &iovec_count, size_type, d, request, arg); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'ioctl'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I read the additional data, if there is. */ v = rscc_manage_ioctl_response(&resp_header, &iovec_count, &nbytes, size_type, arg); if(v != NULL) { nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } /***********************************************************************************************/ /***********************************************************************************************/ /***********************************************************************************************/ #ifndef RSCDEBUG static #endif struct ioctl_cache *ioctl_cache_init(int size) { struct ioctl_cache *cache; cache = calloc(1, sizeof(struct ioctl_cache)); if(cache == NULL) return NULL; cache->size = size; cache->nentry = 0; return cache; } #ifndef RSCDEBUG static #endif void ioctl_cache_add(struct ioctl_cache *cache, int request, u_int32_t size_type) { struct ioctl_cache_el *el; el = calloc(1, sizeof(struct ioctl_cache_el)); assert(el != NULL); /* I fill the request and update the pointers */ el->request = request; el->size_type = size_type; /* There isn't room, I have to pop the last element, * before push it the new one */ if(cache->nentry == cache->size) { cache->last = cache->last->prev; free(cache->last->next); cache->last->next = NULL; cache->nentry -= 1; } else if(cache->nentry == 0) cache->last = el; el->next = cache->first; if(cache->first != NULL) cache->first->prev = el; cache->first = el; cache->nentry += 1; } #ifndef RSCDEBUG static #endif u_int32_t ioctl_cache_search(struct ioctl_cache *cache, int request) { struct ioctl_cache_el *el; for(el = cache->first; el != NULL; el = el->next) { if(el->request == request) return el->size_type; } return 0; } /* Returns the size_type for the given request. The returned values * can be: * - 0: if an error occurs * - IOCTL_UNMANAGED: if the server doesn't manage 'request' * - otherwise is the size_type value */ u_int32_t rscc_check_ioctl_request(int request) { struct ioctl_req_header req; struct ioctl_resp_header resp; int ret; u_int32_t size_type; /* I control if the request is in the cache */ size_type = ioctl_cache_search(ioctl_cache, request); if(size_type == 0) { /* otherwise I call the server */ bzero(&req, sizeof(struct ioctl_req_header)); req.req_type = RSC_IOCTL_REQ; req.req_size = htonl(sizeof(struct ioctl_req_header)); req.req_ioctl_request = htonl(request); /* I send the request */ ret = write_n_bytes(rsc_sockfd, &req, sizeof(struct ioctl_req_header)); if(ret != sizeof(struct ioctl_req_header)) return 0; /* I wait the answer */ ret = read_n_bytes(rsc_sockfd, &resp, sizeof(struct ioctl_resp_header)); if(ret != sizeof(struct ioctl_resp_header)) return 0; resp.resp_size = ntohl(resp.resp_size); resp.resp_size_type = ntohl(resp.resp_size_type); /* I add it to the cache */ ioctl_cache_add(ioctl_cache, request, resp.resp_size_type); size_type = resp.resp_size_type; } return size_type; } #ifndef RSCDEBUG static #endif u_int16_t fcntl_cmd_type(int cmd) { u_int16_t res = 0; switch(cmd) { case F_GETFD: case F_GETFL: case F_GETOWN: case F_GETSIG: case F_GETLEASE: res = FCNTL_NO_3RD_ARG; break; case F_DUPFD: case F_SETFD: case F_SETFL: case F_SETOWN: case F_SETSIG: case F_SETLEASE: case F_NOTIFY: res = FCNTL_3RD_LONG; break; case F_SETLK: case F_SETLKW: res = FCNTL_3RD_FLOCK_R; break; case F_GETLK: res = FCNTL_3RD_FLOCK_RW; break; default: res = 0; break; } return res; } /* This function build the request for the system call 'fcntl' */ struct iovec *rscc_create_fcntl_request(int *total_size, int *iovec_count, u_int16_t cmd_type, int fd, int cmd, long third_arg) { struct fcntl_req *fcntl_req; enum rsc_constant rsc_const; struct iovec *v; size_t vcount; int third_arg_size; fcntl_req = calloc(1, sizeof(struct fcntl_req)); if(fcntl_req == NULL) return NULL; if( (rsc_const = nr2rsc(__NR_fcntl, NO_VALUE, my_arch)) == __RSC_ERROR ) { free(fcntl_req); return NULL; } fcntl_req->req_type = RSC_SYS_REQ; fcntl_req->req_rsc_const = htons(rsc_const); fcntl_req->fd = fd; fcntl_req->cmd = cmd; fcntl_req->cmd_type = cmd_type; /* If there is a third argument, I manage it */ if(cmd_type == FCNTL_NO_3RD_ARG) { fcntl_req->req_size = htonl(sizeof(struct fcntl_req)); *iovec_count = 1; v = calloc(*iovec_count, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = fcntl_req; v[0].iov_len = sizeof(struct fcntl_req); *total_size = v[0].iov_len; } else { /* I set the request fields accordingly with the * type of the third argument */ if(cmd_type == FCNTL_3RD_LONG) { third_arg_size = 0; fcntl_req->third.arg = third_arg; vcount = 1; } else { struct flock *lock = (struct flock *)third_arg; vcount = 1; third_arg_size = 0; if(lock != NULL && (cmd_type == FCNTL_3RD_FLOCK_R || cmd_type == FCNTL_3RD_FLOCK_RW)) { third_arg_size = sizeof(struct flock); vcount = 2; } fcntl_req->third.lock = lock; } fcntl_req->req_size = htonl(sizeof(struct fcntl_req) + third_arg_size); /* There are pointers to buffers used by the system call to read data, so * I've to send them. */ v = calloc(vcount, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = fcntl_req; v[0].iov_len = sizeof(struct fcntl_req); *total_size = v[0].iov_len; /* If vcount == 2, the third argument is a non-NULL pointer * to a struct flock. */ if(vcount == 2) { v[1].iov_base = fcntl_req->third.lock; v[1].iov_len = sizeof(struct flock); *total_size += v[1].iov_len; } *iovec_count = vcount; } rsc_const = nr2rsc(__NR_fcntl, NO_VALUE, my_arch); RSC_DEBUG(RSCD_MINIMAL, "==> REQUEST %s:", rsc2str(ntohs(fcntl_req->req_rsc_const))); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): req_rsc_const = %s (0x%lX); req_size = %d (0x%lX) bytes", sizeof(struct fcntl_req), rsc2str(ntohs(fcntl_req->req_rsc_const)), ntohs(fcntl_req->req_rsc_const), ntohl(fcntl_req->req_size), ntohl(fcntl_req->req_size)); RSC_DEBUG(RSCD_MINIMAL, "\tArguments: fd = %ld (0x%lX); cmd = %ld (0x%lX);", fcntl_req->fd, fcntl_req->fd, fcntl_req->cmd, fcntl_req->cmd); return v; } struct iovec *rscc_manage_fcntl_response(struct sys_resp_header *resp_header, int *iovec_count, int *nbytes, u_int16_t cmd_type, long third_arg) { struct iovec *v = NULL; size_t vcount = 0; int bytes_num = 0; resp_header->resp_rsc_const = ntohs(resp_header->resp_rsc_const); resp_header->resp_size = ntohl(resp_header->resp_size); resp_header->resp_retval = ntohl(resp_header->resp_retval); resp_header->resp_errno = ntohl(resp_header->resp_errno); RSC_DEBUG(RSCD_MINIMAL, "<== RESPONSE %s:", rsc2str(resp_header->resp_rsc_const)); RSC_DEBUG(RSCD_MINIMAL, "\tHeader(%dB): resp_type = %d (0x%lX); resp_size = %d (0x%lX) bytes; resp_rsc_const = %d (0x%lX); resp_retval = %d (0x%lX); errno = %d (0x%lX)\n", sizeof(struct sys_resp_header), resp_header->resp_type, resp_header->resp_type, resp_header->resp_size, resp_header->resp_size, resp_header->resp_rsc_const, resp_header->resp_rsc_const, resp_header->resp_retval, resp_header->resp_retval, resp_header->resp_errno, resp_header->resp_errno); /* If the third argument is a write pointer to a struct flock and the * size of the response is greater than the size of a normal response, * read the flock structure */ if( ((cmd_type == FCNTL_3RD_FLOCK_W) || (cmd_type == FCNTL_3RD_FLOCK_RW)) && (resp_header->resp_size > sizeof(struct sys_resp_header)) ) { /* I read the 'lock' argument (id it's not NULL) */ struct flock *lock = (struct flock *)third_arg; if( lock != NULL) { v = calloc(1, sizeof(struct iovec)); if(v == NULL) { fprintf(stderr, "Cannot allocate memory for vector v"); return NULL; } v[0].iov_base = lock; v[0].iov_len = sizeof(struct flock); vcount = 1; bytes_num = v[0].iov_len; } } *iovec_count = vcount; *nbytes = bytes_num; return v; } int rscc_fcntl(int fd, int cmd, ...) { va_list ap; struct sys_resp_header resp_header; int nwrite, nread; int nbytes; struct iovec *v; int iovec_count; long third_arg = 0; u_int16_t cmd_type; /* I get some info about 'cmd' */ if((cmd_type = fcntl_cmd_type(cmd)) == 0) return -1; /* If there is a third argument, I read it */ if(cmd_type != FCNTL_NO_3RD_ARG) { va_start(ap, cmd); third_arg = va_arg(ap, long); va_end(ap); } /* I build the request */ v = rscc_create_fcntl_request(&nbytes, &iovec_count, cmd_type, fd, cmd, third_arg); if(v == NULL) { fprintf(stderr, "I cannot create the request for the syscall 'fcntl'.\n"); return -1; } /* I send the request ...*/ nwrite = writev_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nwrite != nbytes) { fprintf(stderr, "I've sent only %d/%d bytes.\n", nwrite, nbytes); /* I free the request and the iovec structure */ free(v[0].iov_base); free(v); return -1; } free(v[0].iov_base); free(v); /* ... and I wait the answer */ nread = read_n_bytes(rsc_sockfd, &resp_header, sizeof(struct sys_resp_header)); if(nread != sizeof(struct sys_resp_header)) { fprintf(stderr, "I've ent only %d/%d bytes.\n", nread, sizeof(struct sys_resp_header)); return -1; } /* I read the additional data, if there is. */ v = rscc_manage_fcntl_response(&resp_header, &iovec_count, &nbytes, cmd_type, third_arg); if(v != NULL) { nread = readv_n_bytes(rsc_sockfd, v, iovec_count, nbytes); if(nread != nbytes) { fprintf(stderr, "I've read only %d/%d bytes.\n", nread, nbytes); free(v); return -1; } } errno = resp_header.resp_errno; return resp_header.resp_retval; } umview-0.8.2/um_rsc/librsc/src/aconv.c0000644000175000017500000011175211753517213016734 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * aconv.c: Architecture conversion functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include #define __USE_LARGEFILE64 #include #include "aconv.h" #include #include #include #include #include #include #include #if 0 static void dump(void *p, int size, int bytenum) { int i; fprintf(stderr, "Mem %p[%d bytes]:", p, size); for(i = 0; i < size; i++) { if(i % bytenum == 0) fprintf(stderr, "\n\t%p:\t", p+i); fprintf(stderr, "%.2X", 0xFF & *(char *)(p+i)); } fprintf(stderr, "\n"); } #endif static char *arch2str[] = { "ARCH ERROR", "x86", "x86_64", "ppc", "ppc_64" }; char *aconv_arch2str(enum arch arch) { switch(arch) { case ACONV_X86: return arch2str[1]; break; case ACONV_X86_64: return arch2str[2]; break; case ACONV_PPC: return arch2str[3]; break; case ACONV_PPC_64: return arch2str[4]; break; default: return arch2str[0]; break; } } static int get_host_endianess() { int i = 0x00000001; char *c = (char *)&i; if(*c == 0x01) return ACONV_LITTLEE; else return ACONV_BIGE; } enum arch aconv_get_host_arch() { int bitnum; if(sizeof(long) == 4) bitnum = ACONV_32BIT; else if(sizeof(long) == 8) bitnum = ACONV_64BIT; else return ACONV_ARCH_ERROR; return bitnum | get_host_endianess(); } #define pad(size, bitnum) (((size) % ((bitnum)/8) == 0) ? 0 : (((((size) / ((bitnum)/8)) + 1) * ((bitnum)/8)) - (size))) /* #define pad(size, bitnum) ((size % 2 == 0) ? ((size) % ((bitnum) / 8)) : (((bitnum) / 8) - ((size) % ((bitnum) / 8)))) */ /* Swap bytes in 64 bit value */ #define bswap_64(x)\ ((((x) & 0xff00000000000000) >> 56) | \ (((x) & 0x00ff000000000000) >> 40) | \ (((x) & 0x0000ff0000000000) >> 24) | \ (((x) & 0x000000ff00000000) >> 8) | \ (((x) & 0x00000000ff000000) << 8) | \ (((x) & 0x0000000000ff0000) << 24) | \ (((x) & 0x000000000000ff00) << 40) | \ (((x) & 0x00000000000000ff) << 56)) /* Swap bytes in 32 bit value */ #define bswap_32(x)\ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) /* Swap bytes in 16 bit value. */ #define bswap_16(x) \ ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8)) /* byte number conversion of 16/32/64 bit number, from endianess 'from' * to endianess 'to' */ #define bn_conv64(i, from, to) (((from) != (to)) ? (bswap_64((i))) : (i)) #define bn_conv32(i, from, to) (((from) != (to)) ? (bswap_32((i))) : (i)) #define bn_conv16(i, from, to) (((from) != (to)) ? (bswap_16((i))) : (i)) int aconv_char_size(from, to) { return sizeof(char); } int aconv_u_char_size(from, to) { return sizeof(unsigned char); } int aconv_short_size(from, to) { return sizeof(short); } int aconv_u_short_size(from, to) { return sizeof(unsigned short); } int aconv_int_size(from, to) { return sizeof(int); } int aconv_u_int_size(from, to) { return sizeof(unsigned int); } int aconv_u_long_size(from, to) { return aconv_long_size(from, to); } int aconv_longlong_size(from, to) { return sizeof(long long); } int aconv_u_longlong_size(from, to) { return sizeof(unsigned long long); } int aconv_char(char *c, enum arch from, enum arch to, void *p) { if(from == to) return ACONV_UNNEC; /* if the pointer isn't NULL I copy the value */ if(p != NULL) { bzero(p, aconv_char_size(from, to)); *((char *)p) = *c; } return ACONV_OK; } int aconv_u_char(unsigned char *c, enum arch from, enum arch to, void *p) { if(from == to) return ACONV_UNNEC; /* if the pointer isn't NULL I copy the value */ if(p != NULL) { bzero(p, aconv_char_size(from, to)); *((unsigned char *)p) = *c; } return ACONV_OK; } int aconv_short(short *i, enum arch from, enum arch to, void *p) { int from_e, to_e; short out; if(from == to) return ACONV_UNNEC; from_e = from & ACONV_ENDIENESS_MASK; to_e = to & ACONV_ENDIENESS_MASK; out = *i; /* Endieness: if it's different, I swap the byte */ if(from_e != to_e ) out = bn_conv16(out, from_e, to_e); if(p != NULL) { *((short *)p) = out; return ACONV_OK; } *i = out; return ACONV_OK; } int aconv_u_short(unsigned short *i, enum arch from, enum arch to, void *p) { int from_e, to_e; unsigned short out; if(from == to) return ACONV_UNNEC; from_e = from & ACONV_ENDIENESS_MASK; to_e = to & ACONV_ENDIENESS_MASK; out = *i; /* Endieness: if it's different, I swap the byte */ if(from_e != to_e ) out = bn_conv16(out, from_e, to_e); if(p != NULL) { *((unsigned short *)p) = out; return ACONV_OK; } *i = out; return ACONV_OK; } int aconv_int(int *i, enum arch from, enum arch to, void *p) { int from_e, to_e; int out; if(from == to) return ACONV_UNNEC; from_e = from & ACONV_ENDIENESS_MASK; to_e = to & ACONV_ENDIENESS_MASK; out = *i; /* Endieness */ if(from_e != to_e ) out = bn_conv32(out, from_e, to_e); if(p != NULL) { *((int*)p) = out; return ACONV_OK; } *i = out; return ACONV_OK; } int aconv_u_int(unsigned int *i, enum arch from, enum arch to, void *p) { int from_e, to_e; unsigned int out; if(from == to) return ACONV_UNNEC; from_e = from & ACONV_ENDIENESS_MASK; to_e = to & ACONV_ENDIENESS_MASK; out = *i; /* Endieness */ if(from_e != to_e ) out = bn_conv32(out, from_e, to_e); if(p != NULL) { *((unsigned int*)p) = out; return ACONV_OK; } *i = out; return ACONV_OK; } int aconv_long_size(enum arch from, enum arch to) { int from_bn, to_bn; /* bn = bitnumber */ from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; if(from_bn == to_bn) return sizeof(long); /* 32 => 64 */ if(from_bn == ACONV_32BIT && to_bn == ACONV_64BIT) return 8; else /* 64 => 32 */ return 4; } int aconv_long(long *l, enum arch from, enum arch to, void *p) { int from_bn, to_bn; int from_e, to_e; int ret; void *in, *out; if(from == to) return ACONV_UNNEC; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; from_e = from & ACONV_ENDIENESS_MASK; to_e = to & ACONV_ENDIENESS_MASK; ret = ACONV_OK; out = l; in = l; if(p != NULL) out = p; if(from_bn != to_bn) { if(p == NULL) return ACONV_ERROR; ret = ACONV_OK; bzero(out, aconv_long_size(from, to)); /* 32 bit => 64 bit */ if(from_bn == ACONV_32BIT && to_bn == ACONV_64BIT) { /* The cast extend the sign of the number */ *((int64_t *)out) = (int64_t)(*l); /* 64 bit => 32 bit */ } else { /* int is always 32 bit */ if(*l > INT_MAX) *((int32_t *)out) = INT_MAX; else if(*l < INT_MIN) *((int32_t *)out) = INT_MIN; else { /* If the from arch is big-endian I need to use * a bitmask to get the right data */ /* big64 => {big32 | little32} */ if(from_e == ACONV_BIGE) { *((int32_t *)out) = (*l & 0x00000000ffffffff); /* little64 => big32 */ } else { *((int32_t *)out) = *((int32_t *)l); } } } /* in this way the endianess code will use the content of * 'out' insetead of the content of 'l' */ in = out; } /* Here 'lp' points to 'p' is the bit number is different, * otherwise it points to 'l'. * Now I manage the endieness */ if(from_e != to_e) { /* If the endianess is different, I swap the bit, i don't care * of the 'from' and 'to' endianess, I care only of the bit * number */ if(from_bn == to_bn) { if(from_bn == ACONV_32BIT) *((int32_t *)out) = bn_conv32(*((int32_t *)in), from_e, to_e); else { /* In a32bit architecture 'in' (which is equal to the 32bit long 'l') * cannot be casted to int64 without a warning of the compiler */ # if __WORDSIZE == 64 *((int64_t *)out) = bn_conv64(*((int64_t *)in), from_e, to_e); # endif } } else { if(from_bn == ACONV_32BIT && to_bn == ACONV_64BIT) *((int64_t *)out) = bn_conv64(*((int64_t *)in), from_e, to_e); else *((int32_t *)out) = bn_conv32(*((int32_t *)in), from_e, to_e); } } return ret; } int aconv_u_long(unsigned long *l, enum arch from, enum arch to, void *p) { int from_bn, to_bn; int from_e, to_e; int ret; void *in, *out; if(from == to) return ACONV_UNNEC; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; from_e = from & ACONV_ENDIENESS_MASK; to_e = to & ACONV_ENDIENESS_MASK; ret = ACONV_OK; out = l; in = l; if(p != NULL) out = p; if(from_bn != to_bn) { if(p == NULL) return ACONV_ERROR; ret = ACONV_OK; bzero(out, aconv_u_long_size(from, to)); /* 32 bit => 64 bit */ if(from_bn == ACONV_32BIT && to_bn == ACONV_64BIT) { /* The cast extend the sign of the number */ *((uint64_t *)out) = (uint64_t)(*l); /* 64 bit => 32 bit */ } else { /* int is always 32 bit */ if(*l > UINT_MAX) *((uint32_t *)out) = UINT_MAX; else { /* If the from arch is big-endian I need to use * a bitmask to get the right data */ /* big64 => {big32 | little32} */ if(from_e == ACONV_BIGE) { *((uint32_t *)out) = (*l & 0x00000000ffffffff); /* little64 => big32 */ } else { *((uint32_t *)out) = *((uint32_t *)l); } } } /* in this way the endianess code will use the content of * 'out' insetead of the content of 'l' */ in = out; } /* Here 'lp' points to 'p' is the bit number is different, * otherwise it points to 'l'. * Now I manage the endieness */ if(from_e != to_e) { /* If the endianess is different, I swap the bit, i don't care * of the 'from' and 'to' endianess, I care only of the bit * number */ if(from_bn == to_bn) { if(from_bn == ACONV_32BIT) *((uint32_t *)out) = bn_conv32(*((uint32_t *)in), from_e, to_e); else { /* In a 32bit architecture 'in' (which is equal to the 32bit long 'l') * cannot be casted to int64 without a warning of the compiler */ # if __WORDSIZE == 64 *((uint64_t *)out) = bn_conv64(*((uint64_t *)in), from_e, to_e); # endif } } else { if(from_bn == ACONV_32BIT && to_bn == ACONV_64BIT) *((uint64_t *)out) = bn_conv64(*((uint64_t *)in), from_e, to_e); else *((uint32_t *)out) = bn_conv32(*((uint32_t *)in), from_e, to_e); } } return ret; } int aconv_longlong(long long *l, enum arch from, enum arch to, void *p) { int from_e, to_e; long long out; if(from == to) return ACONV_UNNEC; from_e = from & ACONV_ENDIENESS_MASK; to_e = to & ACONV_ENDIENESS_MASK; out = *l; /* Endieness */ if(from_e != to_e ) out = bn_conv64(out, from_e, to_e); if(p != NULL) { *((long long *)p) = out; return ACONV_OK; } *l = out; return ACONV_OK; } int aconv_u_longlong(unsigned long long *l, enum arch from, enum arch to, void *p) { int from_e, to_e; unsigned long long out; if(from == to) return ACONV_UNNEC; from_e = from & ACONV_ENDIENESS_MASK; to_e = to & ACONV_ENDIENESS_MASK; out = *l; /* Endieness */ if(from_e != to_e ) out = bn_conv64(out, from_e, to_e); if(p != NULL) { *((unsigned long long *)p) = out; return ACONV_OK; } *l = out; return ACONV_OK; } int aconv_pointer_size(enum arch from, enum arch to) { int to_bn; to_bn = to & ACONV_BITNUM_MASK; if(to_bn == ACONV_64BIT) return 8; return 4; } int aconv_pointer(void *p, enum arch from, enum arch to, void *dest) { unsigned long l = (unsigned long)p; return aconv_u_long(&l, from, to, (void *)dest); } #if 0 int aconv_pointer(void *p, enum arch from, enum arch to, void **dest) { int from_bn, to_bn; int size = aconv_pointer_size(from, to); from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; if(from == to || from_bn == to_bn) return ACONV_UNNEC; /* Convert a pointer between different architectures is meaningless, * so the only thing I do is to return the pointer with the * right bit number */ if(dest != NULL) { bzero(dest, size); /* I need to control the value I put on 'dest' because if * *p = 0x0000000012345678 or *p = 0x1234567800000000 * I could copy the 0x00000000 part of the address into * *dest, but *p isn't NULL */ if(p != NULL && from_bn == ACONV_64BIT && to_bn == ACONV_32BIT) { #if __WORDSIZE == 64 if((0x00000000FFFFFFFF & (long)p) != NULL) *dest = (u_int32_t)(0x00000000FFFFFFFF & (long)p); else *dest = (u_int32_t)((0xFFFFFFFF00000000 & (long)p) >> 32); #endif } else *dest = p; } return ACONV_OK; } #endif int aconv_string_size(char *s, enum arch from, enum arch to) { return (strlen(s) + 1 ) * aconv_char_size(from, to); } int aconv_string(char *s, enum arch from, enum arch to, void *p) { if(from == to) return ACONV_UNNEC; if(p != NULL) strncpy(p, s, aconv_string_size(s, from, to)); return ACONV_OK; } /**************************************************************************/ /* xxx_t type menagement */ /**************************************************************************/ int aconv_mode_t_size(from, to) { assert(sizeof(mode_t) == 4); return sizeof(mode_t); } int aconv_loff_t_size(from, to) { assert(sizeof(loff_t) == 8); return sizeof(loff_t); } int aconv_uid_t_size(from, to) { assert(sizeof(uid_t) == 4); return sizeof(uid_t); } int aconv_gid_t_size(from, to) { assert(sizeof(gid_t) == 4); return sizeof(gid_t); } int aconv_clockid_t_size(from, to) { assert(sizeof(clockid_t) == 4); return sizeof(clockid_t); } int aconv___off64_t_size(from, to) { assert(sizeof(__off64_t) == 8); return sizeof(__off64_t); } int aconv_socklen_t_size(from, to) { assert(sizeof(socklen_t) == 4); return sizeof(socklen_t); } int aconv_mode_t(mode_t *n, enum arch from, enum arch to, void *p) { assert(sizeof(mode_t) == 4); return aconv_u_int((unsigned int *)n, from, to, p); } int aconv_loff_t(loff_t *n, enum arch from, enum arch to, void *p) { assert(sizeof(loff_t) == 8); return aconv_longlong((long long *)n, from, to, p); } int aconv_uid_t(uid_t *n, enum arch from, enum arch to, void *p) { assert(sizeof(uid_t) == 4); return aconv_u_int((unsigned int *)n, from, to, p); } int aconv_gid_t(gid_t *n, enum arch from, enum arch to, void *p) { assert(sizeof(gid_t) == 4); return aconv_u_int((unsigned int *)n, from, to, p); } int aconv_clockid_t(clockid_t *n, enum arch from, enum arch to, void *p){ assert(sizeof(clockid_t) == 4); return aconv_int((int *)n, from, to, p); } int aconv___off64_t(__off64_t *n, enum arch from, enum arch to, void *p) { assert(sizeof(__off64_t) == 8); return aconv_longlong((long long *)n, from, to, p); } int aconv_socklen_t(socklen_t *n, enum arch from, enum arch to, void *p) { assert(sizeof(socklen_t) == 4); return aconv_u_int((unsigned int *)n, from, to, p); } /* The type 'size_t' has different size that depends from * the architecture: it's a 'unsigned int' in ppc and x86, and * it's a 'unsigned long' in ppc64 and x86_64 */ int aconv_size_t_size(enum arch from, enum arch to) { if((to & ACONV_BITNUM_MASK) == ACONV_64BIT) return aconv_u_long_size(from, to); else return aconv_u_int_size(from, to); } int aconv_size_t(size_t *n, enum arch from, enum arch to, void *p) { int from_bn, to_bn, ret; if(from == to) return ACONV_UNNEC; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; if(from_bn == ACONV_32BIT && to_bn == ACONV_32BIT) { ret = aconv_u_int((unsigned int *)n, from, to, p); } else { /* One or both architectures use 64bit. Here I use always the * aconv_u_long() function because if: * - both are 64bit: size_t is an 'unsigned long' * - from 32 to 64 : into 32bit arch 'int == long' so aconv_u_long() takes * care of the conversion * - from 64 to 32 : aconv_u_long() takes care of the conversion between * 64bit long and 32bit long, and seeing that 'int == long' * in the latter architecture, all works well. */ ret = aconv_u_long((unsigned long *)n, from, to, p); } return ret; } int aconv_off_t_size(enum arch from, enum arch to) { if((to & ACONV_BITNUM_MASK) == ACONV_64BIT) return aconv_u_long_size(from, to); else return aconv_u_int_size(from, to); } int aconv_off_t(off_t *n, enum arch from, enum arch to, void *p) { int from_bn, to_bn, ret; if(from == to) return ACONV_UNNEC; from_bn = from & ACONV_BITNUM_MASK; to_bn = to & ACONV_BITNUM_MASK; if(from_bn == ACONV_32BIT && to_bn == ACONV_32BIT) { ret = aconv_u_int((unsigned int *)n, from, to, p); } else { /* See the explanation into the aconv_size_t() function */ ret = aconv_u_long((unsigned long *)n, from, to, p); } return ret; } int aconv___ino64_t_size(enum arch from, enum arch to) { return aconv_u_longlong_size(from, to); } int aconv___ino64_t(__ino64_t *n, enum arch from, enum arch to, void *p) { return aconv_u_longlong((unsigned long long *)n, from, to, p); } int aconv_sa_family_t_size(enum arch from, enum arch to) { return aconv_u_short_size(from, to); } int aconv_sa_family_t(sa_family_t *n, enum arch from, enum arch to, void *p) { return aconv_u_short((unsigned short *)n, from, to, p); } int aconv_time_t_size(enum arch from, enum arch to) { return aconv_long_size(from, to); } int aconv_time_t(time_t *n, enum arch from, enum arch to, void *p) { return aconv_long((long *)n, from, to, p); } int aconv_suseconds_t_size(enum arch from, enum arch to) { return aconv_long_size(from, to); } int aconv_suseconds_t(suseconds_t *n, enum arch from, enum arch to, void *p) { return aconv_long((long *)n, from, to, p); } /**************************************************************************/ /**************************************************************************/ /* Array and structs */ /**************************************************************************/ /* Returns the size of an fixed-length arrays of "elnum" homogeneous elements * The size of each element is returned by 'size_fun'. * NOTE: If the array is an array of pointers, the size of each element is * 4 bytes (for 32 bits architectures) or 8 bytes (for 64 bits architectures), * not the size of the pointed memory. * */ int aconv_array_size(enum arch from, enum arch to, int elnum, aconv_size_fun size_fun) { return (elnum * size_fun(from, to)); } int aconv_array(void *a, enum arch from, enum arch to, int elnum, void *p, aconv_size_fun size_fun, aconv_fun aconv_fun) { int i, from_size, to_size; if(from == to) return ACONV_UNNEC; from_size = size_fun(to, from); to_size = size_fun(from, to); if(p != NULL) { for(i = 0; i < elnum; i++) { aconv_fun(a + (from_size * i), from, to, p + (to_size * i)); } } else for(i = 0; i < elnum; i++) aconv_fun(a + (to_size * i), from, to, NULL); return ACONV_OK; } /* * TODO List: * - 'socklen_t' done * - 'socklen_t *' done * - 'struct dirent64 *' done * - 'struct sockaddr *' done * - 'struct stat64 *' * - 'struct statfs64 *' done * - 'struct timespec *' done * - 'struct timeval' done * - 'struct timex *' done * - 'struct timezone *' done * - 'struct utimbuf *' done * - 'struct utsname *' done * - 'uid_t' done * - 'void *' */ int aconv_struct_dirent64_size(enum arch from, enum arch to) { int s; int bitnum = to; s = aconv___ino64_t_size(from, to) + aconv___off64_t_size(from, to) + aconv_u_short_size(from, to) + aconv_u_char_size(from, to) + aconv_array_size(from, to, 256, aconv_char_size); /* On ppc32 the structure alignment is of 8 byte */ if(to == ACONV_PPC) bitnum = ACONV_64BIT; s += pad(s, bitnum); return s; } int aconv_struct_dirent64(struct dirent64 *d, enum arch from, enum arch to, void *p) { int s1, s2, s3, s4; if(from == to) return ACONV_UNNEC; s1 = aconv___ino64_t_size(from, to); s2 = aconv___off64_t_size(from, to); s3 = aconv_u_short_size(from, to); s4 = aconv_u_char_size(from, to); if(aconv___ino64_t(&d->d_ino, from, to, p) == ACONV_ERROR) return ACONV_ERROR; if(aconv___off64_t(&d->d_off, from, to, p+s1) == ACONV_ERROR) return ACONV_ERROR; if(aconv_u_short(&d->d_reclen, from, to, p+s1+s2) == ACONV_ERROR) return ACONV_ERROR; if(aconv_u_char(&d->d_type, from, to, p+s1+s2+s3) == ACONV_ERROR) return ACONV_ERROR; if(aconv_array(d->d_name, from, to, 256, p+s1+s2+s3+s4, aconv_char_size, aconv_char) == ACONV_ERROR) return ACONV_ERROR; return ACONV_OK; } int aconv_struct_sockaddr_size(enum arch from, enum arch to) { return ( aconv_sa_family_t_size(from, to) + aconv_array_size(from, to, 14, aconv_char_size)); } int aconv_struct_sockaddr(struct sockaddr *s, enum arch from, enum arch to, void *p) { int s1; if(from == to) return ACONV_UNNEC; s1 = aconv_sa_family_t_size(from, to); if(aconv_sa_family_t(&s->sa_family, from, to, p) == ACONV_ERROR) return ACONV_ERROR; if(aconv_array(s->sa_data, from, to, 14, p+s1, aconv_char_size, aconv_char) == ACONV_ERROR) return ACONV_ERROR; return ACONV_OK; } int aconv_struct_timespec_size(enum arch from, enum arch to) { return ( aconv_time_t_size(from, to) + aconv_long_size(from, to)); } int aconv_struct_timespec(struct timespec *s, enum arch from, enum arch to, void *p) { int s1; if(from == to) return ACONV_UNNEC; s1 = aconv_time_t_size(from, to); if(aconv_time_t(&s->tv_sec, from, to, p) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&s->tv_nsec, from, to, p + s1) == ACONV_ERROR) return ACONV_ERROR; return ACONV_OK; } int aconv_struct_timeval_size(enum arch from, enum arch to) { return ( aconv_time_t_size(from, to) + aconv_suseconds_t_size(from, to)); } int aconv_struct_timeval(struct timeval *s, enum arch from, enum arch to, void *p) { int s1; if(from == to) return ACONV_UNNEC; s1 = aconv_time_t_size(from, to); if(aconv_time_t(&s->tv_sec, from, to, p) == ACONV_ERROR) return ACONV_ERROR; if(aconv_suseconds_t(&s->tv_usec, from, to, p+s1) == ACONV_ERROR) return ACONV_ERROR; return ACONV_OK; } int aconv_struct_timezone_size(enum arch from, enum arch to) { return ( aconv_int_size(from, to) + aconv_int_size(from, to)); } int aconv_struct_timezone(struct timezone *s, enum arch from, enum arch to, void *p) { int s1; if(from == to) return ACONV_UNNEC; s1 = aconv_int_size(from, to); if(aconv_int(&s->tz_minuteswest, from, to, p) == ACONV_ERROR) return ACONV_ERROR; if(aconv_int(&s->tz_dsttime, from, to, p+s1) == ACONV_ERROR) return ACONV_ERROR; return ACONV_OK; } int aconv_struct_utimbuf_size(enum arch from, enum arch to) { return ( aconv_time_t_size(from, to) + aconv_time_t_size(from, to)); } int aconv_struct_utimbuf(struct utimbuf *s, enum arch from, enum arch to, void *p) { int s1; if(from == to) return ACONV_UNNEC; s1 = aconv_time_t_size(from, to); if(aconv_time_t(&s->actime, from, to, p) == ACONV_ERROR) return ACONV_ERROR; if(aconv_time_t(&s->modtime, from, to, p+s1) == ACONV_ERROR) return ACONV_ERROR; return ACONV_OK; } int aconv_struct_utsname_size(enum arch from, enum arch to) { return ( aconv_array_size(from, to, _UTSNAME_SYSNAME_LENGTH, aconv_char_size) + aconv_array_size(from, to, _UTSNAME_NODENAME_LENGTH, aconv_char_size) + aconv_array_size(from, to, _UTSNAME_RELEASE_LENGTH, aconv_char_size) + aconv_array_size(from, to, _UTSNAME_VERSION_LENGTH, aconv_char_size) + aconv_array_size(from, to, _UTSNAME_MACHINE_LENGTH, aconv_char_size) + aconv_array_size(from, to, _UTSNAME_DOMAIN_LENGTH, aconv_char_size)); } int aconv_struct_utsname(struct utsname *s, enum arch from, enum arch to, void *p) { int s1, s2, s3, s4, s5; if(from == to) return ACONV_UNNEC; s1 = aconv_array_size(from, to, _UTSNAME_SYSNAME_LENGTH, aconv_char_size); s2 = aconv_array_size(from, to, _UTSNAME_NODENAME_LENGTH, aconv_char_size); s3 = aconv_array_size(from, to, _UTSNAME_RELEASE_LENGTH, aconv_char_size); s4 = aconv_array_size(from, to, _UTSNAME_VERSION_LENGTH, aconv_char_size); s5 = aconv_array_size(from, to, _UTSNAME_MACHINE_LENGTH, aconv_char_size); if(aconv_array(s->sysname, from, to, _UTSNAME_SYSNAME_LENGTH, p, aconv_char_size, aconv_char) == ACONV_ERROR) return ACONV_ERROR; if(aconv_array(s->nodename, from, to, _UTSNAME_NODENAME_LENGTH, p+s1, aconv_char_size, aconv_char) == ACONV_ERROR) return ACONV_ERROR; if(aconv_array(s->release, from, to, _UTSNAME_RELEASE_LENGTH, p+s1+s2, aconv_char_size, aconv_char) == ACONV_ERROR) return ACONV_ERROR; if(aconv_array(s->version, from, to, _UTSNAME_VERSION_LENGTH, p+s1+s2+s3, aconv_char_size, aconv_char) == ACONV_ERROR) return ACONV_ERROR; if(aconv_array(s->machine, from, to, _UTSNAME_MACHINE_LENGTH, p+s1+s2+s3+s4, aconv_char_size, aconv_char) == ACONV_ERROR) return ACONV_ERROR; #if _UTSNAME_DOMAIN_LENGTH - 0 /* Name of the domain of this node on the network. */ # ifdef __USE_GNU if(aconv_array(s->domainname, from, to, _UTSNAME_DOMAIN_LENGTH, p+s1+s2+s3+s4+s5, aconv_char_size, aconv_char) == ACONV_ERROR) # else if(aconv_array(s->__domainname, from, to, _UTSNAME_DOMAIN_LENGTH, p+s1+s2+s3+s4+s5, aconv_char_size, aconv_char) == ACONV_ERROR) # endif #endif return ACONV_ERROR; return ACONV_OK; } int aconv_struct_timex_size(enum arch from, enum arch to) { int s_u_int, s_long, s_int; s_u_int = aconv_u_int_size(from, to); s_int = aconv_int_size(from, to); s_long = aconv_long_size(from, to); return (s_u_int + pad(s_u_int, to) + s_long + s_long + s_long + s_long + s_int + pad(s_int, to) + s_long + s_long + s_long + aconv_struct_timeval_size(from, to) + s_long + s_long + s_long + s_int + pad(s_int, to) + s_long + s_long + s_long + s_long + s_long + 12 * s_int); } int aconv_struct_timex(struct timex *t, enum arch from, enum arch to, void *p) { int s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18; if(from == to) return ACONV_UNNEC; s1 = aconv_u_int_size(from, to); s1 += pad(s1, to); s2 = aconv_long_size(from, to); s3 = s4 = s5 = s2; s6 = aconv_int_size(from, to); s6 += pad(s6, to); s7 = s8 = s9 = s2; s10 = aconv_struct_timeval_size(from, to); s11 = s12 = s13 = s2; s14 = s6; s15 = s16 = s17 = s18 = s2; if(aconv_u_int(&t->modes ,from, to, p) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->offset ,from, to, p+s1) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->freq ,from, to, p+s1+s2) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->maxerror ,from, to, p+s1+s2+s3) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->esterror ,from, to, p+s1+s2+s3+s4) == ACONV_ERROR) return ACONV_ERROR; if(aconv_int(&t->status ,from, to, p+s1+s2+s3+s4+s5) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->constant ,from, to, p+s1+s2+s3+s4+s5+s6) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->precision ,from, to, p+s1+s2+s3+s4+s5+s6+s7) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->tolerance ,from, to, p+s1+s2+s3+s4+s5+s6+s7+s8) == ACONV_ERROR) return ACONV_ERROR; if(aconv_struct_timeval(&t->time ,from, to, p+s1+s2+s3+s4+s5+s6+s7+s8+s9) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->tick ,from, to, p+s1+s2+s3+s4+s5+s6+s7+s8+s9+s10) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->ppsfreq ,from, to, p+s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->jitter ,from, to, p+s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12) == ACONV_ERROR) return ACONV_ERROR; if(aconv_int(&t->shift ,from, to, p+s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->stabil ,from, to, p+s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13+s14) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->jitcnt ,from, to, p+s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13+s14+s15) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->calcnt ,from, to, p+s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13+s14+s15+s16) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->errcnt ,from, to, p+s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13+s14+s15+s16+s17) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&t->stbcnt ,from, to, p+s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13+s14+s15+s16+s17+s18) == ACONV_ERROR) return ACONV_ERROR; return ACONV_OK; } int aconv_struct_statfs64_size(enum arch from, enum arch to) { int s; int bitnum = to; s = aconv_long_size(from, to) * 4 + aconv_longlong_size(from, to) * 5 + aconv_array_size(from, to, 2, aconv_int_size) + aconv_array_size(from, to, 5, aconv_long_size); /* On ppc32 the structure alignment is of 8 byte */ if(to == ACONV_PPC) bitnum = ACONV_64BIT; s += pad(s, bitnum); return s; } int aconv_struct_statfs64(struct statfs64 *s, enum arch from, enum arch to, void *p) { int sl, sll, sa1; if(from == to) return ACONV_UNNEC; sl = aconv_long_size(from, to); sll = aconv_longlong_size(from, to); sa1 = aconv_array_size(from, to, 2, aconv_int_size); if(aconv_long(&s->f_type, from, to, p) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&s->f_bsize, from, to, p+sl) == ACONV_ERROR) return ACONV_ERROR; if(aconv_longlong(&s->f_blocks, from, to, p+sl+sl) == ACONV_ERROR) return ACONV_ERROR; if(aconv_longlong(&s->f_bfree, from, to, p+sl+sl+sll) == ACONV_ERROR) return ACONV_ERROR; if(aconv_longlong(&s->f_bavail, from, to, p+sl+sl+sll+sll) == ACONV_ERROR) return ACONV_ERROR; if(aconv_longlong(&s->f_files, from, to, p+sl+sl+sll+sll+sll) == ACONV_ERROR) return ACONV_ERROR; if(aconv_longlong(&s->f_ffree, from, to, p+sl+sl+sll+sll+sll+sll) == ACONV_ERROR) return ACONV_ERROR; if(aconv_array(&s->f_fsid, from, to, 2, p+sl+sl+sll+sll+sll+sll+sll, aconv_int_size, aconv_int) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&s->f_namelen, from, to, p+sl+sl+sll+sll+sll+sll+sll+sa1) == ACONV_ERROR) return ACONV_ERROR; if(aconv_long(&s->f_frsize, from, to, p+sl+sl+sll+sll+sll+sll+sll+sa1+sl) == ACONV_ERROR) return ACONV_ERROR; if(aconv_array(&s->f_spare, from, to, 5, p+sl+sl+sll+sll+sll+sll+sll+sa1+sl+sl, aconv_long_size, aconv_long) == ACONV_ERROR) return ACONV_ERROR; return ACONV_OK; } int aconv_struct_stat64_size(enum arch from, enum arch to) { int s; s = aconv___dev_t_size(from, to); if(to == ACONV_X86) { s += aconv_u_int_size(from, to) + /* pad1 */ aconv___ino_t_size(from, to); } else { s += aconv___ino64_t_size(from, to); } s += aconv___nlink_t_size(from, to) + aconv___mode_t_size(from, to) + aconv___uid_t_size(from, to) + aconv___gid_t_size(from, to); if(to == ACONV_X86_64) { s += aconv_u_int_size(from, to) + /* pad0 */ aconv___dev_t_size(from, to) + aconv___off_t_size(from, to); } else if(to == ACONV_PPC_64) { s += aconv_u_int_size(from, to) + /* pad0 */ aconv___dev_t_size(from, to) + aconv___off64_t_size(from, to); } else if(to == ACONV_PPC) { s += aconv___dev_t_size(from, to) + aconv_u_short_size(from, to) + pad(aconv_u_short_size(from, to), ACONV_64BIT) + /* __pad2 */ aconv___off64_t_size(from, to); } else { s += aconv___dev_t_size(from, to) + aconv_u_int_size(from, to) + /* pad2 */ aconv___off64_t_size(from, to); } s += aconv___blksize_t_size(from, to) + aconv___blkcnt64_t_size(from, to) + #ifdef __USE_MISC aconv_struct_timespec_size(from, to) * 3; #else aconv___time_t_size(from, to) * 3 + aconv_u_long_size(from, to) * 3; #endif if(to == ACONV_X86) s += aconv___ino64_t_size(from, to); else if(to == ACONV_PPC) s += aconv_u_long_size(from, to) * 2; else s += aconv_u_long_size(from, to) * 3; if(to == ACONV_PPC) s += pad(s, ACONV_64BIT); else s += pad(s, to); return s; } int aconv_struct_stat64(struct stat64 *s, enum arch from, enum arch to, void *p) { int ret; void *mem = p; if(from == to) return ACONV_UNNEC; ret = aconv___dev_t(&s->st_dev, from, to, mem); mem += aconv___dev_t_size(from, to); /* In x86 arch there is a __st_ino filed that is the 32 bit serial number, the other architectures * have only st_ino that is a 64 bit field, so I have to convert the 64bit filed to 32bit one * and if st_ino is too large I save into __st_ino the maximum value savable. */ if(to == ACONV_X86) { /* There is a 'unsigned int' pad field after st_dev */ mem += aconv_u_int_size(from, to); __ino_t ino; if(s->st_ino > UINT_MAX) ino = UINT_MAX; else ino = (__off_t)s->st_ino; ret = aconv___ino_t(&ino, from, to, mem); mem += aconv___ino_t_size(from, to); } else { ret = aconv___ino64_t(&s->st_ino, from, to, mem); mem += aconv___ino64_t_size(from, to); } /* Into ppc and x86 architectures st_mode and st_nlink fields are inverted */ if(to == ACONV_PPC || to == ACONV_X86) { ret = aconv___mode_t(&s->st_mode, from, to, mem); mem += aconv___mode_t_size(from, to); ret = aconv___nlink_t(&s->st_nlink, from, to, mem); mem += aconv___nlink_t_size(from, to); } else { ret = aconv___nlink_t(&s->st_nlink, from, to, mem); mem += aconv___nlink_t_size(from, to); ret = aconv___mode_t(&s->st_mode, from, to, mem); mem += aconv___mode_t_size(from, to); } ret = aconv___uid_t(&s->st_uid, from, to, mem); mem += aconv___uid_t_size(from, to); ret = aconv___gid_t(&s->st_gid, from, to, mem); mem += aconv___gid_t_size(from, to); /* In ppc64 arch. there is a integer pad after st_gid field, instead in x86_64 there isn't * a pad field, but st_gid is 8byte aligned a*/ if(to == ACONV_PPC_64) mem += aconv_int_size(from, to); else if(to == ACONV_X86_64) mem += pad(aconv___gid_t_size(from, to), to); ret = aconv___dev_t(&s->st_rdev, from, to, mem); mem += aconv___dev_t_size(from, to); /* In ppc arch. there is an 'unsigned short' pad after st_rdev, aligned to an 8 byte address. * In x86 arch. there is a 'unsigned int' pad field. */ if(to == ACONV_PPC) mem += aconv_u_short_size(from, to) + pad(aconv_u_short_size(from, to), ACONV_64BIT); else if(to == ACONV_X86) mem += aconv_u_int_size(from, to); ret = aconv___off64_t(&s->st_size, from, to, mem); /* In x86_64 arch. st_size is of type __off_t and not __off64_t */ if(to == ACONV_X86_64) mem += aconv___off_t_size(from, to); else mem += aconv___off64_t_size(from, to); ret = aconv___blksize_t(&s->st_blksize, from, to, mem); mem += aconv___blksize_t_size(from, to); /* In ppc and 64bit architecture, the st_blksize filed is 8byte aligned */ if(to != ACONV_X86) mem += pad(aconv___blksize_t_size(from, to), ACONV_64BIT); ret = aconv___blkcnt64_t(&s->st_blocks, from, to, mem); mem += aconv___blkcnt64_t_size(from, to); #ifdef __USE_MISC ret = aconv_struct_timespec(&s->st_atim, from, to, mem); mem += aconv_struct_timespec_size(from, to); ret = aconv_struct_timespec(&s->st_mtim, from, to, mem); mem += aconv_struct_timespec_size(from, to); ret = aconv_struct_timespec(&s->st_ctim, from, to, mem); mem += aconv_struct_timespec_size(from, to); #else ret = aconv___time_t(&s->st_atime, from, to, mem); mem += aconv___time_t_size(from, to); ret = aconv_u_long(&s->st_atimensec, from, to, mem); mem += aconv_u_long_size(from, to); ret = aconv___time_t(&s->st_mtime, from, to, mem); mem += aconv___time_t_size(from, to); ret = aconv_u_long(&s->st_mtimensec, from, to, mem); mem += aconv_u_long_size(from, to); ret = aconv___time_t(&s->st_ctime, from, to, mem); mem += aconv___time_t_size(from, to); ret = aconv_u_long(&s->st_ctimensec, from, to, mem); mem += aconv_u_long_size(from, to); #endif /* In x86 arch. there is a st_ino filed at hte end of the structure */ if(to == ACONV_X86) ret = aconv___ino64_t(&s->st_ino, from, to, mem); return ACONV_OK; } int aconv_bytes_size(int bytenum, enum arch from, enum arch to) { return bytenum; } int aconv_bytes(void *b, enum arch from, enum arch to, void *p, int bytenum) { return aconv_array(b, from, to, bytenum, p, aconv_char_size, aconv_char); } umview-0.8.2/um_rsc/librsc/src/debug.c0000644000175000017500000001035011753517213016704 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * debiug.c: debug functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include "rsc_consts.h" #include "debug.h" #ifdef _PTHREAD_H #include #endif void rsc_debug(int level, int rscdebug_level, const char *file, const int line, const char *func, const char *fmt, ...) { va_list ap; if( rscdebug_level >= level ) { va_start(ap, fmt); #ifdef _PTHREAD_H fprintf(stderr, "[%d:%lu] %s:%d %s(): ", getpid(), pthread_self(), file, line, func); #else fprintf(stderr, "[%d] %s:%d %s(): ", getpid(), file, line, func); #endif vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); fflush(stderr); va_end(ap); } } /* type of print: * - 1: for ex * - 2: for char */ static void rsc_exdump_print_line(const void* text, int byte_num, int type) { int i; for(i = 0; i < byte_num; i++) { if((i != 0) && ((i % 4) == 0)) fprintf(stderr, " "); switch (type) { case 2: { char c = (char)((char *)text)[i]; /* I control if it's a printable char */ if(c >= 32 && c <= 126) fprintf(stderr, "%c", c); else fprintf(stderr, "."); break; } default: fprintf(stderr, "%02x", (unsigned char)((char *)text)[i]); break; } } } void rsc_exdump(int level, int rscdebug_level, const char *file, const int line, const char *func, const void* text, int len) { int i; if ( rscdebug_level >= level) { #ifdef _PTHREAD_H fprintf(stderr, "[%d:%lu] %s:%d %s(): [%d bytes]\n", getpid(), pthread_self(), file, line, func, len); #else fprintf(stderr, "[%d] %s:%d %s(): [%d bytes]\n", getpid(), file, line, func, len); #endif for (i = 0; i < len; i++) { if( (i == 0) || ((i % 16) == 0) ) { int bytes_num; if(i != 0) fprintf(stderr, "\n"); fprintf(stderr, " %p: ", text + i); bytes_num = ((len - i) >= 16 ) ? 16 : (len - i); rsc_exdump_print_line(text + i, bytes_num, 1); if(bytes_num < 16) { int space_num, not_printed, j; /* one space for each ex not printed (16 - len), each * ex is 2 char long (* 2) and there is a space between * 4 ex numbers */ not_printed = 16 - bytes_num; space_num = not_printed * 2; if(bytes_num < 4) space_num += 3; else if(bytes_num < 8) space_num += 2; else if(bytes_num < 12) space_num += 1; for(j = 0; j < space_num; j++) fprintf(stderr, " "); fprintf(stderr, "\t"); } else fprintf(stderr, "\t"); rsc_exdump_print_line(text + i, bytes_num, 2); } } fprintf(stderr, "\n"); } } void rsc_print_msghdr(int level, struct msghdr *msg) { int i; RSC_DEBUG(level, "msg = {"); RSC_DEBUG(level, " msg_name = %p", msg->msg_name); RSC_DEBUG(level, " msg_namelen = %d", msg->msg_namelen); RSC_DEBUG(level, " msg_iov (%p) = {", msg->msg_iov); for(i = 0; i < msg->msg_iovlen; i++) { RSC_DEBUG(level, " %d. iov_base = %p", i,(msg->msg_iov)[i].iov_base); RSC_DEBUG(level, " iov_len = %d", (msg->msg_iov)[i].iov_len); } RSC_DEBUG(level, " }"); RSC_DEBUG(level, " msg_iovlen = %d", msg->msg_iovlen); RSC_DEBUG(level, " msg_control = %p", msg->msg_control); RSC_DEBUG(level, " msg_controllen = %d", msg->msg_controllen); RSC_DEBUG(level, " msg_flags = %d", msg->msg_flags); RSC_DEBUG(level, "}"); } umview-0.8.2/um_rsc/librsc/src/generic_list.c0000644000175000017500000000553511753517213020276 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * generic_list.c: List data structure * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include "generic_list.h" struct list *init_list(int initial_size) { struct list *l; l = calloc(1, sizeof(struct list)); if(l == NULL) return NULL; l->v = calloc(initial_size, sizeof(void *)); if(l->v == NULL) { free(l); return NULL; } l->size = initial_size; l->nentry = 0; return l; } void teardown_list(struct list *l, void (free_el)(void *element) ) { int i; for(i = 0; l->nentry && i < l->size; i++) { if(l->v[i] != NULL) free_el(l->v[i]); } free(l->v); free(l); } void list_add(struct list *l, void *element) { int i, empty_i = -1; /* I have to enlarge the array */ if(l->nentry >= l->size) { l->size *= 2; l->v = realloc(l->v, l->size * sizeof(void *)); assert(l->v != NULL); empty_i = l->nentry; } else if(l->nentry == 0) { empty_i = 0; } else { for(i = 0; (i < l->size) && (l->v[i] != NULL); i++); empty_i = i; } l->v[empty_i] = element; l->nentry += 1; } void *list_del(struct list *l, int i) { void *ret; if(i < 0 || i >= l->size) return NULL; ret = l->v[i]; l->v[i] = NULL; l->nentry -= 1; return ret; } /* Search inside le list 'l'. The function 'compare' is used to * test non-NULL entries. The argument 'arg' is an opaque argument * passed to 'compare' function. * On success the index of the element is returned, -1 otherwise. */ int list_search(struct list *l, int (compare)(void *element, void *arg), void *arg) { int i; if(l->nentry == 0) return -1; for(i = 0; i < l->size; i++) { if(l->v[i] != NULL && compare(l->v[i], arg)) return i; } return -1; } #ifdef RSCDEBUG #include void print_list(struct list *l, void (* print_list_element)(void *element)) { int i; fprintf(stderr, "List: nentry = %d, size = %d:\n", l->nentry, l->size); for(i = 0; i < l->size; i++){ fprintf(stderr, "\t %d. ", i); if(l->v[i] != NULL) print_list_element(l->v[i]); else fprintf(stderr, "EMPTY"); fprintf(stderr, "\n"); } } #endif umview-0.8.2/um_rsc/librsc/src/event_monitor.c0000644000175000017500000001643111753517213020514 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * event_monitor.c: server event subscription management * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #define __USE_LARGEFILE64 #include #include #include #include #include #include #include #include "debug.h" #include "rsc_messages.h" #include "generic_list.h" /*************************************************/ /* Static structures and local constants */ /*************************************************/ static struct list *rscs_es_list; #define RSCEM_EV_OCCURRED 0x01 #define RSCEM_EV_NOT_OCCURRED 0x02 struct rscs_es_listel { /* event subscriber fd, used to distinguish between two different * event subscriber with same mfd and event */ int esfd; int mfd; /* monitored fd */ short event; /* Show if the event 'event' is occurred or not */ u_int8_t state; }; /****************************/ /* Static functions */ /****************************/ static int rscs_es_list_compare(void *el, void *arg) { struct rscs_es_listel *a = el; struct rscs_es_listel *b = arg; return ((a->esfd == b->esfd) && (a->mfd == b->mfd) && (a->event == b->event)); } static int is_a_regular_file(int fd) { struct stat64 stat; if(fstat64(fd, &stat) == -1) return 0; return S_ISREG(stat.st_mode); } #ifdef RSCDEBUG # define PRINT_RSCEM_LIST(list) PRINT_LIST(list, print_rscel) static void print_rscel(void *element) { struct rscs_es_listel *el = element; char *str; switch(el->state) { case RSCEM_EV_OCCURRED: str = "event occurred"; break; case RSCEM_EV_NOT_OCCURRED: str = "event not occurred"; break; default: str = "state error"; break; } } #else # define PRINT_RSCEM_LIST(list) #endif /****************************/ /* Global functions */ /****************************/ void rscs_es_init() { rscs_es_list = init_list(10); } /* The function takes in input the file descriptor of the connection * with the client (esfd) and the data read by the server (data), * then analyzes the kind of message contained in data, executes an * immediate test using a poll with timeout set to zero, creates a * acknowledgment message based on the poll result and returns it. * */ struct rsc_es_ack *rscs_es_manage_msg(int esfd, void *data) { struct pollfd testfd[1]; struct rsc_es_hdr *hdr = (struct rsc_es_hdr *)data; struct rsc_es_ack *ack; int ret = 0; assert(hdr->type == EVENT_SUB_REQ || hdr->type == EVENT_SUB_DEREG); ack = calloc(1, sizeof(struct rsc_es_ack)); assert(ack != NULL); if(hdr->type == EVENT_SUB_REQ) { /* It's a event subscription */ struct rsc_es_req *req = (struct rsc_es_req *)data; int is_regfile; RSC_DEBUG(1, "It's a event subscribe request\n"); req->fd = ntohl(req->fd); req->how = ntohl(req->how); /* I test if is a fd of a regular file. A regular file * never block during reading so I can sand back a * positive ACK. */ if(!(is_regfile = is_a_regular_file(req->fd)) || req->how != POLLIN) { bzero(&testfd[0], sizeof(struct pollfd)); testfd[0].fd = req->fd; testfd[0].events = req->how; ret = poll(testfd, 1, 0); } ack->type = EVENT_SUB_ACK; ack->fd = htonl(req->fd); ack->how = htonl(req->how); if(is_regfile || (ret == 1 && testfd[0].revents == req->how)) { RSC_DEBUG(1, "fd %d is ready for event %d, I send a positive ACK\n", req->fd, req->how); ack->response = ACK_FD_READY; } else { RSC_DEBUG(1, "fd %d is NOT ready for event %d, I send a negative ACK \n", req->fd, req->how); ack->response = ACK_FD_REG; } /* The fd isn't ready so I have to register it */ if(ack->response == ACK_FD_REG) { struct rscs_es_listel *el; el = calloc(1, sizeof(struct rscs_es_listel)); assert(el != NULL); el->esfd = esfd; el->mfd = req->fd; el->event = req->how; el->state = RSCEM_EV_NOT_OCCURRED; RSC_DEBUG(1, "Before insert new element:"); PRINT_RSCEM_LIST(rscs_es_list); list_add(rscs_es_list, el); RSC_DEBUG(1, "After inserted the new element:"); PRINT_RSCEM_LIST(rscs_es_list); } } else if(hdr->type == EVENT_SUB_DEREG) { struct rsc_es_dereg *rmev = (struct rsc_es_dereg *)data; int resp = ACK_FD_DEREG_NOT_READY; int index; struct rscs_es_listel *res; struct rscs_es_listel el; RSC_DEBUG(1, "It's a event subscribe remove event. Before manage it:\n"); rmev->fd = ntohl(rmev->fd); rmev->how = ntohl(rmev->how); bzero(&el, sizeof(struct rscs_es_listel)); el.esfd = esfd; el.mfd = rmev->fd; el.event = rmev->how; RSC_DEBUG(1, "Before searching for esfd = %d, mfd = %d, event = %d:", el.esfd, el.mfd, el.event); PRINT_RSCEM_LIST(rscs_es_list); index = list_search(rscs_es_list, rscs_es_list_compare, &el); RSC_DEBUG(1, "index = %d:", index); res = list_getel(rscs_es_list, index); if( res != NULL) { /* Found, I remove and I send back an ACK with the result of the poll */ bzero(&testfd[0], sizeof(struct pollfd)); testfd[0].fd = res->mfd; testfd[0].events = res->event; ret = poll(testfd, 1, 0); if(ret == 1 && testfd[0].revents == res->event) resp = ACK_FD_DEREG_READY; /* I remove and free the element */ free(list_del(rscs_es_list, index)); RSC_DEBUG(1, "After deletion"); PRINT_RSCEM_LIST(rscs_es_list); } /* Now I send the ACK back */ ack->type = EVENT_SUB_ACK; ack->fd = htonl(rmev->fd); ack->how = htonl(rmev->how); ack->response = resp; } return ack; } /* It search the entry with the given values, changes * the state from RSCEM_EV_NOT_OCCURRED to RSCEM_EV_OCCURRED and * returns a response to send back to the event subscriber. * If the state was already RSCEM_EV_OCCURRED, NULL is returned. * */ struct rsc_es_resp *rscs_es_event_occurred(int esfd, int mfd, int event) { struct rscs_es_listel el, *res; struct rsc_es_resp *resp; int index; RSC_DEBUG(1, "Event %d occurred for fd 0x%X:\n", event, mfd); el.esfd = esfd; el.mfd = mfd; el.event = event; index = list_search(rscs_es_list, rscs_es_list_compare, &el); res = list_getel(rscs_es_list, index); if(res == NULL) return NULL; if(res->state == RSCEM_EV_OCCURRED) return NULL; res->state = RSCEM_EV_OCCURRED; resp = calloc(1, sizeof(struct rsc_es_resp)); assert(resp != NULL); resp->type = EVENT_SUB_RESP; resp->fd = htonl(res->mfd); resp->how = htonl(res->event); RSC_DEBUG(1, "Created the response fd = %d, how = %d\n", ntohl(resp->fd), ntohl(resp->how)); return resp; } umview-0.8.2/um_rsc/librsc/src/Makefile0000644000175000017500000000254311753517213017117 0ustar renzorenzo# # This is part of Remote System Call (RSC) Library. # # Makefile: library sources makefile # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # RSCDEBUGLEVEL = 2 RELEASE = false C_DEBUG_FLAGS = -O0 -g -ggdb -DRSCDEBUG -DRSC_DEBUG_LEVEL=$(RSCDEBUGLEVEL) CFLAGS = -fPIC -Wall -I ../include/ -I ./include/ sources = $(shell ls *.c) .PHONY: all clean ifeq ($(RELEASE), false) CFLAGS += ${C_DEBUG_FLAGS} .PHONY: tags all: $(sources:.c=.o) tags: ctags-exuberant -R ../ else CFLAGS += -O3 all: $(sources:.c=.o) endif # ifeq ($(RELEASE), false) %.d: %.c set -e; $(CC) -MM $(CFLAGS) $< \ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ [ -s $@ ] || rm -f $@ include $(sources:.c=.d) clean: rm -fr *.o *.d tags umview-0.8.2/um_rsc/librsc/src/registered_callbacks.c0000644000175000017500000000616111753517213021757 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * registered_callbacks.c: data structure and functions for * registered callback management * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include "rsc_client.h" #include "registered_callbacks.h" static void init_empty_entry(struct reg_cbs *p, int i) { p->v[i].fd = -1; p->v[i].how = -1; p->v[i].cb = NULL; p->v[i].arg = NULL; p->v[i].ack = ACK_NOT_INIT; p->v[i].cb_executed = 0; } struct reg_cbs *init_reg_cb() { int i; struct reg_cbs *p; p = calloc(1, sizeof(struct reg_cbs)); if(p == NULL) return NULL; p->v = calloc(REG_CB_INITIAL_SIZE, sizeof(struct reg_cb)); if(p->v == NULL) { free(p); return NULL; } p->size = REG_CB_INITIAL_SIZE; p->nentry = 0; for(i = 0; i < p->size; i++) { init_empty_entry(p, i); } return p; } int reg_cb_add(struct reg_cbs *p, void (* cb)(), void *arg, int fd, int how) { int empty_i = -1; /* I have to enlarge the array */ if(p->nentry >= p->size) { int i; p->size += REG_CB_INITIAL_SIZE; p->v = realloc(p->v, p->size * sizeof(struct reg_cb)); assert(p->v != NULL); /* I init the new entries created */ for(i = p->nentry; i < p->size; i++) { init_empty_entry(p, i); } empty_i = p->nentry; } else { int i; for(i = 0; i < p->size; i++) if(p->v[i].fd == -1) { empty_i = i; break; } } assert(empty_i != -1); p->v[empty_i].fd = fd; p->v[empty_i].how = how; p->v[empty_i].cb = cb; p->v[empty_i].arg = arg; p->v[empty_i].ack = ACK_NOT_INIT; p->nentry += 1; return empty_i; } void reg_cb_del(struct reg_cbs *p, int i) { if(i < 0 || i >= p->size) return; init_empty_entry(p, i); p->nentry -= 1; } #ifdef RSCDEBUG #include void print_regcb_entry(struct reg_cbs *rc, int i) { if(i < 0 || i > rc->size) return; if(rc->v[i].fd == -1) fprintf(stderr, "EMPTY"); else fprintf(stderr, "FD = %d; HOW = %d; CB = %p; ARG = %p; ACK = %d; CB EXECUTED = %d", rc->v[i].fd, rc->v[i].how, rc->v[i].cb, rc->v[i].arg, rc->v[i].ack, rc->v[i].cb_executed); } void print_regcbs(struct reg_cbs *rc) { int i; fprintf(stderr, "Registered callbacks: nentry = %d, size = %d:\n", rc->nentry, rc->size); for(i = 0; i < rc->size; i++){ fprintf(stderr, "\t%d. ", i); print_regcb_entry(rc, i); fprintf(stderr, "\n"); } } #endif umview-0.8.2/um_rsc/librsc/src/rsc_server.c0000644000175000017500000126272511753517213020013 0ustar renzorenzo/* * This is part of Remote System Call (RSC) Library. * * rsc_server.c: server side functions * * Copyright (C) 2007 Andrea Forni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __USE_LARGEFILE64 #define __USE_LARGEFILE64 #endif #include #include #include "debug.h" #include "rsc_server.h" #include "utils.h" #include "aconv.h" #include "rsc_consts.h" #include "generic_list.h" #include "event_sub.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static enum arch my_arch; static struct list *ioctl_list; /*########################################################################*/ /*## ##*/ /*## REQUEST FUNCTION DECLARATIONS and HANDLER TABLE ##*/ /*## ##*/ /*########################################################################*/ typedef struct sys_resp_header *(*rscs_pre_exec)(void *req, enum arch client_arch); typedef int (*rscs_exec)(void *request); typedef struct iovec *(*rscs_post_exec)(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); /* static void *req_func_recvmsg(void *req); */ struct sys_resp_header *rscs_pre__llseek_exec(void *req, enum arch client_arch); int rscs_exec__llseek(void *request); struct iovec *rscs_post__llseek_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_accept_exec(void *req, enum arch client_arch); int rscs_exec_accept(void *request); struct iovec *rscs_post_accept_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_access_exec(void *req, enum arch client_arch); int rscs_exec_access(void *request); struct iovec *rscs_post_access_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_adjtimex_exec(void *req, enum arch client_arch); int rscs_exec_adjtimex(void *request); struct iovec *rscs_post_adjtimex_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_bind_exec(void *req, enum arch client_arch); int rscs_exec_bind(void *request); struct iovec *rscs_post_bind_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_chdir_exec(void *req, enum arch client_arch); int rscs_exec_chdir(void *request); struct iovec *rscs_post_chdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_chmod_exec(void *req, enum arch client_arch); int rscs_exec_chmod(void *request); struct iovec *rscs_post_chmod_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_chown_exec(void *req, enum arch client_arch); int rscs_exec_chown(void *request); struct iovec *rscs_post_chown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_chown32_exec(void *req, enum arch client_arch); int rscs_exec_chown32(void *request); struct iovec *rscs_post_chown32_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_clock_getres_exec(void *req, enum arch client_arch); int rscs_exec_clock_getres(void *request); struct iovec *rscs_post_clock_getres_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_clock_gettime_exec(void *req, enum arch client_arch); int rscs_exec_clock_gettime(void *request); struct iovec *rscs_post_clock_gettime_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_clock_settime_exec(void *req, enum arch client_arch); int rscs_exec_clock_settime(void *request); struct iovec *rscs_post_clock_settime_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_close_exec(void *req, enum arch client_arch); int rscs_exec_close(void *request); struct iovec *rscs_post_close_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_connect_exec(void *req, enum arch client_arch); int rscs_exec_connect(void *request); struct iovec *rscs_post_connect_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_dup_exec(void *req, enum arch client_arch); int rscs_exec_dup(void *request); struct iovec *rscs_post_dup_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_dup2_exec(void *req, enum arch client_arch); int rscs_exec_dup2(void *request); struct iovec *rscs_post_dup2_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fchdir_exec(void *req, enum arch client_arch); int rscs_exec_fchdir(void *request); struct iovec *rscs_post_fchdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fchmod_exec(void *req, enum arch client_arch); int rscs_exec_fchmod(void *request); struct iovec *rscs_post_fchmod_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fchown_exec(void *req, enum arch client_arch); int rscs_exec_fchown(void *request); struct iovec *rscs_post_fchown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fchown32_exec(void *req, enum arch client_arch); int rscs_exec_fchown32(void *request); struct iovec *rscs_post_fchown32_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fdatasync_exec(void *req, enum arch client_arch); int rscs_exec_fdatasync(void *request); struct iovec *rscs_post_fdatasync_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fgetxattr_exec(void *req, enum arch client_arch); int rscs_exec_fgetxattr(void *request); struct iovec *rscs_post_fgetxattr_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fstat64_exec(void *req, enum arch client_arch); int rscs_exec_fstat64(void *request); struct iovec *rscs_post_fstat64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fstatfs64_exec(void *req, enum arch client_arch); int rscs_exec_fstatfs64(void *request); struct iovec *rscs_post_fstatfs64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fsync_exec(void *req, enum arch client_arch); int rscs_exec_fsync(void *request); struct iovec *rscs_post_fsync_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_ftruncate64_exec(void *req, enum arch client_arch); int rscs_exec_ftruncate64(void *request); struct iovec *rscs_post_ftruncate64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_getdents64_exec(void *req, enum arch client_arch); int rscs_exec_getdents64(void *request); struct iovec *rscs_post_getdents64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_getpeername_exec(void *req, enum arch client_arch); int rscs_exec_getpeername(void *request); struct iovec *rscs_post_getpeername_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_getsockname_exec(void *req, enum arch client_arch); int rscs_exec_getsockname(void *request); struct iovec *rscs_post_getsockname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_getsockopt_exec(void *req, enum arch client_arch); int rscs_exec_getsockopt(void *request); struct iovec *rscs_post_getsockopt_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_gettimeofday_exec(void *req, enum arch client_arch); int rscs_exec_gettimeofday(void *request); struct iovec *rscs_post_gettimeofday_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_getxattr_exec(void *req, enum arch client_arch); int rscs_exec_getxattr(void *request); struct iovec *rscs_post_getxattr_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_lchown_exec(void *req, enum arch client_arch); int rscs_exec_lchown(void *request); struct iovec *rscs_post_lchown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_lchown32_exec(void *req, enum arch client_arch); int rscs_exec_lchown32(void *request); struct iovec *rscs_post_lchown32_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_lgetxattr_exec(void *req, enum arch client_arch); int rscs_exec_lgetxattr(void *request); struct iovec *rscs_post_lgetxattr_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_link_exec(void *req, enum arch client_arch); int rscs_exec_link(void *request); struct iovec *rscs_post_link_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_listen_exec(void *req, enum arch client_arch); int rscs_exec_listen(void *request); struct iovec *rscs_post_listen_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_lseek_exec(void *req, enum arch client_arch); int rscs_exec_lseek(void *request); struct iovec *rscs_post_lseek_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_lstat64_exec(void *req, enum arch client_arch); int rscs_exec_lstat64(void *request); struct iovec *rscs_post_lstat64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_mkdir_exec(void *req, enum arch client_arch); int rscs_exec_mkdir(void *request); struct iovec *rscs_post_mkdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_mount_exec(void *req, enum arch client_arch); int rscs_exec_mount(void *request); struct iovec *rscs_post_mount_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_open_exec(void *req, enum arch client_arch); int rscs_exec_open(void *request); struct iovec *rscs_post_open_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_pread64_exec(void *req, enum arch client_arch); int rscs_exec_pread64(void *request); struct iovec *rscs_post_pread64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_pwrite64_exec(void *req, enum arch client_arch); int rscs_exec_pwrite64(void *request); struct iovec *rscs_post_pwrite64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_read_exec(void *req, enum arch client_arch); int rscs_exec_read(void *request); struct iovec *rscs_post_read_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_readlink_exec(void *req, enum arch client_arch); int rscs_exec_readlink(void *request); struct iovec *rscs_post_readlink_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_recv_exec(void *req, enum arch client_arch); int rscs_exec_recv(void *request); struct iovec *rscs_post_recv_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_recvfrom_exec(void *req, enum arch client_arch); int rscs_exec_recvfrom(void *request); struct iovec *rscs_post_recvfrom_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_rename_exec(void *req, enum arch client_arch); int rscs_exec_rename(void *request); struct iovec *rscs_post_rename_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_rmdir_exec(void *req, enum arch client_arch); int rscs_exec_rmdir(void *request); struct iovec *rscs_post_rmdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_send_exec(void *req, enum arch client_arch); int rscs_exec_send(void *request); struct iovec *rscs_post_send_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_sendto_exec(void *req, enum arch client_arch); int rscs_exec_sendto(void *request); struct iovec *rscs_post_sendto_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_setdomainname_exec(void *req, enum arch client_arch); int rscs_exec_setdomainname(void *request); struct iovec *rscs_post_setdomainname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_sethostname_exec(void *req, enum arch client_arch); int rscs_exec_sethostname(void *request); struct iovec *rscs_post_sethostname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_setsockopt_exec(void *req, enum arch client_arch); int rscs_exec_setsockopt(void *request); struct iovec *rscs_post_setsockopt_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_settimeofday_exec(void *req, enum arch client_arch); int rscs_exec_settimeofday(void *request); struct iovec *rscs_post_settimeofday_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_shutdown_exec(void *req, enum arch client_arch); int rscs_exec_shutdown(void *request); struct iovec *rscs_post_shutdown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_socket_exec(void *req, enum arch client_arch); int rscs_exec_socket(void *request); struct iovec *rscs_post_socket_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_stat64_exec(void *req, enum arch client_arch); int rscs_exec_stat64(void *request); struct iovec *rscs_post_stat64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_statfs64_exec(void *req, enum arch client_arch); int rscs_exec_statfs64(void *request); struct iovec *rscs_post_statfs64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_symlink_exec(void *req, enum arch client_arch); int rscs_exec_symlink(void *request); struct iovec *rscs_post_symlink_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_truncate64_exec(void *req, enum arch client_arch); int rscs_exec_truncate64(void *request); struct iovec *rscs_post_truncate64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_umount2_exec(void *req, enum arch client_arch); int rscs_exec_umount2(void *request); struct iovec *rscs_post_umount2_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_uname_exec(void *req, enum arch client_arch); int rscs_exec_uname(void *request); struct iovec *rscs_post_uname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_unlink_exec(void *req, enum arch client_arch); int rscs_exec_unlink(void *request); struct iovec *rscs_post_unlink_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_utime_exec(void *req, enum arch client_arch); int rscs_exec_utime(void *request); struct iovec *rscs_post_utime_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_utimes_exec(void *req, enum arch client_arch); int rscs_exec_utimes(void *request); struct iovec *rscs_post_utimes_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_write_exec(void *req, enum arch client_arch); int rscs_exec_write(void *request); struct iovec *rscs_post_write_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_ioctl_exec(void *req, enum arch client_arch); int rscs_exec_ioctl(void *request); struct iovec *rscs_post_ioctl_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); struct sys_resp_header *rscs_pre_fcntl_exec(void *req, enum arch client_arch); int rscs_exec_fcntl(void *request); struct iovec *rscs_post_fcntl_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch); /* Handler Tables */ rscs_pre_exec rscs_pre_exec_table[] = { /* 0. __RSC__exit */ NULL, /* 1. __RSC__llseek */ rscs_pre__llseek_exec, /* 2. __RSC__newselect */ NULL, /* 3. __RSC__sysctl */ NULL, /* 4. __RSC_accept */ rscs_pre_accept_exec, /* 5. __RSC_access */ rscs_pre_access_exec, /* 6. __RSC_acct */ NULL, /* 7. __RSC_add_key */ NULL, /* 8. __RSC_adjtimex */ rscs_pre_adjtimex_exec, /* 9. __RSC_afs_syscall */ NULL, /* 10. __RSC_alarm */ NULL, /* 11. __RSC_arch_prctl */ NULL, /* 12. __RSC_bdflush */ NULL, /* 13. __RSC_bind */ rscs_pre_bind_exec, /* 14. __RSC_break */ NULL, /* 15. __RSC_brk */ NULL, /* 16. __RSC_capget */ NULL, /* 17. __RSC_capset */ NULL, /* 18. __RSC_chdir */ rscs_pre_chdir_exec, /* 19. __RSC_chmod */ rscs_pre_chmod_exec, /* 20. __RSC_chown */ rscs_pre_chown_exec, /* 21. __RSC_chown32 */ rscs_pre_chown32_exec, /* 22. __RSC_chroot */ NULL, /* 23. __RSC_clock_getres */ rscs_pre_clock_getres_exec, /* 24. __RSC_clock_gettime */ rscs_pre_clock_gettime_exec, /* 25. __RSC_clock_nanosleep */ NULL, /* 26. __RSC_clock_settime */ rscs_pre_clock_settime_exec, /* 27. __RSC_clone */ NULL, /* 28. __RSC_close */ rscs_pre_close_exec, /* 29. __RSC_connect */ rscs_pre_connect_exec, /* 30. __RSC_creat */ NULL, /* 31. __RSC_create_module */ NULL, /* 32. __RSC_delete_module */ NULL, /* 33. __RSC_dup */ rscs_pre_dup_exec, /* 34. __RSC_dup2 */ rscs_pre_dup2_exec, /* 35. __RSC_epoll_create */ NULL, /* 36. __RSC_epoll_ctl */ NULL, /* 37. __RSC_epoll_ctl_old */ NULL, /* 38. __RSC_epoll_wait */ NULL, /* 39. __RSC_epoll_wait_old */ NULL, /* 40. __RSC_execve */ NULL, /* 41. __RSC_exit */ NULL, /* 42. __RSC_exit_group */ NULL, /* 43. __RSC_fadvise64 */ NULL, /* 44. __RSC_fadvise64_64 */ NULL, /* 45. __RSC_fchdir */ rscs_pre_fchdir_exec, /* 46. __RSC_fchmod */ rscs_pre_fchmod_exec, /* 47. __RSC_fchown */ rscs_pre_fchown_exec, /* 48. __RSC_fchown32 */ rscs_pre_fchown32_exec, /* 49. __RSC_fcntl */ rscs_pre_fcntl_exec, /* 50. __RSC_fcntl64 */ NULL, /* 51. __RSC_fdatasync */ rscs_pre_fdatasync_exec, /* 52. __RSC_fgetxattr */ rscs_pre_fgetxattr_exec, /* 53. __RSC_flistxattr */ NULL, /* 54. __RSC_flock */ NULL, /* 55. __RSC_fork */ NULL, /* 56. __RSC_fremovexattr */ NULL, /* 57. __RSC_fsetxattr */ NULL, /* 58. __RSC_fstat */ NULL, /* 59. __RSC_fstat64 */ rscs_pre_fstat64_exec, /* 60. __RSC_fstatfs */ NULL, /* 61. __RSC_fstatfs64 */ rscs_pre_fstatfs64_exec, /* 62. __RSC_fsync */ rscs_pre_fsync_exec, /* 63. __RSC_ftime */ NULL, /* 64. __RSC_ftruncate */ NULL, /* 65. __RSC_ftruncate64 */ rscs_pre_ftruncate64_exec, /* 66. __RSC_futex */ NULL, /* 67. __RSC_get_kernel_syms */ NULL, /* 68. __RSC_get_mempolicy */ NULL, /* 69. __RSC_get_thread_area */ NULL, /* 70. __RSC_getcwd */ NULL, /* 71. __RSC_getdents */ NULL, /* 72. __RSC_getdents64 */ rscs_pre_getdents64_exec, /* 73. __RSC_getegid */ NULL, /* 74. __RSC_getegid32 */ NULL, /* 75. __RSC_geteuid */ NULL, /* 76. __RSC_geteuid32 */ NULL, /* 77. __RSC_getgid */ NULL, /* 78. __RSC_getgid32 */ NULL, /* 79. __RSC_getgroups */ NULL, /* 80. __RSC_getgroups32 */ NULL, /* 81. __RSC_getitimer */ NULL, /* 82. __RSC_getpeername */ rscs_pre_getpeername_exec, /* 83. __RSC_getpgid */ NULL, /* 84. __RSC_getpgrp */ NULL, /* 85. __RSC_getpid */ NULL, /* 86. __RSC_getpmsg */ NULL, /* 87. __RSC_getppid */ NULL, /* 88. __RSC_getpriority */ NULL, /* 89. __RSC_getresgid */ NULL, /* 90. __RSC_getresgid32 */ NULL, /* 91. __RSC_getresuid */ NULL, /* 92. __RSC_getresuid32 */ NULL, /* 93. __RSC_getrlimit */ NULL, /* 94. __RSC_getrusage */ NULL, /* 95. __RSC_getsid */ NULL, /* 96. __RSC_getsockname */ rscs_pre_getsockname_exec, /* 97. __RSC_getsockopt */ rscs_pre_getsockopt_exec, /* 98. __RSC_gettid */ NULL, /* 99. __RSC_gettimeofday */ rscs_pre_gettimeofday_exec, /* 100. __RSC_getuid */ NULL, /* 101. __RSC_getuid32 */ NULL, /* 102. __RSC_getxattr */ rscs_pre_getxattr_exec, /* 103. __RSC_gtty */ NULL, /* 104. __RSC_idle */ NULL, /* 105. __RSC_init_module */ NULL, /* 106. __RSC_io_cancel */ NULL, /* 107. __RSC_io_destroy */ NULL, /* 108. __RSC_io_getevents */ NULL, /* 109. __RSC_io_setup */ NULL, /* 110. __RSC_io_submit */ NULL, /* 111. __RSC_ioctl */ rscs_pre_ioctl_exec, /* 112. __RSC_ioperm */ NULL, /* 113. __RSC_iopl */ NULL, /* 114. __RSC_ipc */ NULL, /* 115. __RSC_kexec_load */ NULL, /* 116. __RSC_keyctl */ NULL, /* 117. __RSC_kill */ NULL, /* 118. __RSC_lchown */ rscs_pre_lchown_exec, /* 119. __RSC_lchown32 */ rscs_pre_lchown32_exec, /* 120. __RSC_lgetxattr */ rscs_pre_lgetxattr_exec, /* 121. __RSC_link */ rscs_pre_link_exec, /* 122. __RSC_listen */ rscs_pre_listen_exec, /* 123. __RSC_listxattr */ NULL, /* 124. __RSC_llistxattr */ NULL, /* 125. __RSC_lock */ NULL, /* 126. __RSC_lookup_dcookie */ NULL, /* 127. __RSC_lremovexattr */ NULL, /* 128. __RSC_lseek */ rscs_pre_lseek_exec, /* 129. __RSC_lsetxattr */ NULL, /* 130. __RSC_lstat */ NULL, /* 131. __RSC_lstat64 */ rscs_pre_lstat64_exec, /* 132. __RSC_madvise */ NULL, /* 133. __RSC_madvise1 */ NULL, /* 134. __RSC_mbind */ NULL, /* 135. __RSC_mincore */ NULL, /* 136. __RSC_mkdir */ rscs_pre_mkdir_exec, /* 137. __RSC_mknod */ NULL, /* 138. __RSC_mlock */ NULL, /* 139. __RSC_mlockall */ NULL, /* 140. __RSC_mmap */ NULL, /* 141. __RSC_mmap2 */ NULL, /* 142. __RSC_modify_ldt */ NULL, /* 143. __RSC_mount */ rscs_pre_mount_exec, /* 144. __RSC_mprotect */ NULL, /* 145. __RSC_mpx */ NULL, /* 146. __RSC_mq_getsetattr */ NULL, /* 147. __RSC_mq_notify */ NULL, /* 148. __RSC_mq_open */ NULL, /* 149. __RSC_mq_timedreceive */ NULL, /* 150. __RSC_mq_timedsend */ NULL, /* 151. __RSC_mq_unlink */ NULL, /* 152. __RSC_mremap */ NULL, /* 153. __RSC_msgctl */ NULL, /* 154. __RSC_msgget */ NULL, /* 155. __RSC_msgrcv */ NULL, /* 156. __RSC_msgsnd */ NULL, /* 157. __RSC_msync */ NULL, /* 158. __RSC_multiplexer */ NULL, /* 159. __RSC_munlock */ NULL, /* 160. __RSC_munlockall */ NULL, /* 161. __RSC_munmap */ NULL, /* 162. __RSC_nanosleep */ NULL, /* 163. __RSC_nfsservctl */ NULL, /* 164. __RSC_nice */ NULL, /* 165. __RSC_oldfstat */ NULL, /* 166. __RSC_oldlstat */ NULL, /* 167. __RSC_oldolduname */ NULL, /* 168. __RSC_oldstat */ NULL, /* 169. __RSC_olduname */ NULL, /* 170. __RSC_open */ rscs_pre_open_exec, /* 171. __RSC_pause */ NULL, /* 172. __RSC_pciconfig_iobase */ NULL, /* 173. __RSC_pciconfig_read */ NULL, /* 174. __RSC_pciconfig_write */ NULL, /* 175. __RSC_personality */ NULL, /* 176. __RSC_pipe */ NULL, /* 177. __RSC_pivot_root */ NULL, /* 178. __RSC_poll */ NULL, /* 179. __RSC_prctl */ NULL, /* 180. __RSC_pread64 */ rscs_pre_pread64_exec, /* 181. __RSC_prof */ NULL, /* 182. __RSC_profil */ NULL, /* 183. __RSC_ptrace */ NULL, /* 184. __RSC_putpmsg */ NULL, /* 185. __RSC_pwrite64 */ rscs_pre_pwrite64_exec, /* 186. __RSC_query_module */ NULL, /* 187. __RSC_quotactl */ NULL, /* 188. __RSC_read */ rscs_pre_read_exec, /* 189. __RSC_readahead */ NULL, /* 190. __RSC_readdir */ NULL, /* 191. __RSC_readlink */ rscs_pre_readlink_exec, /* 192. __RSC_readv */ NULL, /* 193. __RSC_reboot */ NULL, /* 194. __RSC_recv */ rscs_pre_recv_exec, /* 195. __RSC_recvfrom */ rscs_pre_recvfrom_exec, /* 196. __RSC_recvmsg */ NULL, /* 197. __RSC_remap_file_pages */ NULL, /* 198. __RSC_removexattr */ NULL, /* 199. __RSC_rename */ rscs_pre_rename_exec, /* 200. __RSC_request_key */ NULL, /* 201. __RSC_restart_syscall */ NULL, /* 202. __RSC_rmdir */ rscs_pre_rmdir_exec, /* 203. __RSC_rt_sigaction */ NULL, /* 204. __RSC_rt_sigpending */ NULL, /* 205. __RSC_rt_sigprocmask */ NULL, /* 206. __RSC_rt_sigqueueinfo */ NULL, /* 207. __RSC_rt_sigreturn */ NULL, /* 208. __RSC_rt_sigsuspend */ NULL, /* 209. __RSC_rt_sigtimedwait */ NULL, /* 210. __RSC_sched_get_priority_max */ NULL, /* 211. __RSC_sched_get_priority_min */ NULL, /* 212. __RSC_sched_getaffinity */ NULL, /* 213. __RSC_sched_getparam */ NULL, /* 214. __RSC_sched_getscheduler */ NULL, /* 215. __RSC_sched_rr_get_interval */ NULL, /* 216. __RSC_sched_setaffinity */ NULL, /* 217. __RSC_sched_setparam */ NULL, /* 218. __RSC_sched_setscheduler */ NULL, /* 219. __RSC_sched_yield */ NULL, /* 220. __RSC_security */ NULL, /* 221. __RSC_select */ NULL, /* 222. __RSC_semctl */ NULL, /* 223. __RSC_semget */ NULL, /* 224. __RSC_semop */ NULL, /* 225. __RSC_semtimedop */ NULL, /* 226. __RSC_send */ rscs_pre_send_exec, /* 227. __RSC_sendfile */ NULL, /* 228. __RSC_sendfile64 */ NULL, /* 229. __RSC_sendmsg */ NULL, /* 230. __RSC_sendto */ rscs_pre_sendto_exec, /* 231. __RSC_set_mempolicy */ NULL, /* 232. __RSC_set_thread_area */ NULL, /* 233. __RSC_set_tid_address */ NULL, /* 234. __RSC_setdomainname */ rscs_pre_setdomainname_exec, /* 235. __RSC_setfsgid */ NULL, /* 236. __RSC_setfsgid32 */ NULL, /* 237. __RSC_setfsuid */ NULL, /* 238. __RSC_setfsuid32 */ NULL, /* 239. __RSC_setgid */ NULL, /* 240. __RSC_setgid32 */ NULL, /* 241. __RSC_setgroups */ NULL, /* 242. __RSC_setgroups32 */ NULL, /* 243. __RSC_sethostname */ rscs_pre_sethostname_exec, /* 244. __RSC_setitimer */ NULL, /* 245. __RSC_setpgid */ NULL, /* 246. __RSC_setpriority */ NULL, /* 247. __RSC_setregid */ NULL, /* 248. __RSC_setregid32 */ NULL, /* 249. __RSC_setresgid */ NULL, /* 250. __RSC_setresgid32 */ NULL, /* 251. __RSC_setresuid */ NULL, /* 252. __RSC_setresuid32 */ NULL, /* 253. __RSC_setreuid */ NULL, /* 254. __RSC_setreuid32 */ NULL, /* 255. __RSC_setrlimit */ NULL, /* 256. __RSC_setsid */ NULL, /* 257. __RSC_setsockopt */ rscs_pre_setsockopt_exec, /* 258. __RSC_settimeofday */ rscs_pre_settimeofday_exec, /* 259. __RSC_setuid */ NULL, /* 260. __RSC_setuid32 */ NULL, /* 261. __RSC_setxattr */ NULL, /* 262. __RSC_sgetmask */ NULL, /* 263. __RSC_shmat */ NULL, /* 264. __RSC_shmctl */ NULL, /* 265. __RSC_shmdt */ NULL, /* 266. __RSC_shmget */ NULL, /* 267. __RSC_shutdown */ rscs_pre_shutdown_exec, /* 268. __RSC_sigaction */ NULL, /* 269. __RSC_sigaltstack */ NULL, /* 270. __RSC_signal */ NULL, /* 271. __RSC_sigpending */ NULL, /* 272. __RSC_sigprocmask */ NULL, /* 273. __RSC_sigreturn */ NULL, /* 274. __RSC_sigsuspend */ NULL, /* 275. __RSC_socket */ rscs_pre_socket_exec, /* 276. __RSC_socketcall */ NULL, /* 277. __RSC_socketpair */ NULL, /* 278. __RSC_ssetmask */ NULL, /* 279. __RSC_stat */ NULL, /* 280. __RSC_stat64 */ rscs_pre_stat64_exec, /* 281. __RSC_statfs */ NULL, /* 282. __RSC_statfs64 */ rscs_pre_statfs64_exec, /* 283. __RSC_stime */ NULL, /* 284. __RSC_stty */ NULL, /* 285. __RSC_swapcontext */ NULL, /* 286. __RSC_swapoff */ NULL, /* 287. __RSC_swapon */ NULL, /* 288. __RSC_symlink */ rscs_pre_symlink_exec, /* 289. __RSC_sync */ NULL, /* 290. __RSC_sys_kexec_load */ NULL, /* 291. __RSC_sysfs */ NULL, /* 292. __RSC_sysinfo */ NULL, /* 293. __RSC_syslog */ NULL, /* 294. __RSC_tgkill */ NULL, /* 295. __RSC_time */ NULL, /* 296. __RSC_timer_create */ NULL, /* 297. __RSC_timer_delete */ NULL, /* 298. __RSC_timer_getoverrun */ NULL, /* 299. __RSC_timer_gettime */ NULL, /* 300. __RSC_timer_settime */ NULL, /* 301. __RSC_times */ NULL, /* 302. __RSC_tkill */ NULL, /* 303. __RSC_truncate */ NULL, /* 304. __RSC_truncate64 */ rscs_pre_truncate64_exec, /* 305. __RSC_tuxcall */ NULL, /* 306. __RSC_ugetrlimit */ NULL, /* 307. __RSC_ulimit */ NULL, /* 308. __RSC_umask */ NULL, /* 309. __RSC_umount */ NULL, /* 310. __RSC_umount2 */ rscs_pre_umount2_exec, /* 311. __RSC_uname */ rscs_pre_uname_exec, /* 312. __RSC_unlink */ rscs_pre_unlink_exec, /* 313. __RSC_uselib */ NULL, /* 314. __RSC_ustat */ NULL, /* 315. __RSC_utime */ rscs_pre_utime_exec, /* 316. __RSC_utimes */ rscs_pre_utimes_exec, /* 317. __RSC_vfork */ NULL, /* 318. __RSC_vhangup */ NULL, /* 319. __RSC_vm86 */ NULL, /* 320. __RSC_vm86old */ NULL, /* 321. __RSC_vserver */ NULL, /* 322. __RSC_wait4 */ NULL, /* 323. __RSC_waitid */ NULL, /* 324. __RSC_waitpid */ NULL, /* 325. __RSC_write */ rscs_pre_write_exec, /* 326. __RSC_writev */ NULL }; rscs_exec rscs_exec_table[] = { /* 0. __RSC__exit */ NULL, /* 1. __RSC__llseek */ rscs_exec__llseek, /* 2. __RSC__newselect */ NULL, /* 3. __RSC__sysctl */ NULL, /* 4. __RSC_accept */ rscs_exec_accept, /* 5. __RSC_access */ rscs_exec_access, /* 6. __RSC_acct */ NULL, /* 7. __RSC_add_key */ NULL, /* 8. __RSC_adjtimex */ rscs_exec_adjtimex, /* 9. __RSC_afs_syscall */ NULL, /* 10. __RSC_alarm */ NULL, /* 11. __RSC_arch_prctl */ NULL, /* 12. __RSC_bdflush */ NULL, /* 13. __RSC_bind */ rscs_exec_bind, /* 14. __RSC_break */ NULL, /* 15. __RSC_brk */ NULL, /* 16. __RSC_capget */ NULL, /* 17. __RSC_capset */ NULL, /* 18. __RSC_chdir */ rscs_exec_chdir, /* 19. __RSC_chmod */ rscs_exec_chmod, /* 20. __RSC_chown */ rscs_exec_chown, /* 21. __RSC_chown32 */ rscs_exec_chown32, /* 22. __RSC_chroot */ NULL, /* 23. __RSC_clock_getres */ rscs_exec_clock_getres, /* 24. __RSC_clock_gettime */ rscs_exec_clock_gettime, /* 25. __RSC_clock_nanosleep */ NULL, /* 26. __RSC_clock_settime */ rscs_exec_clock_settime, /* 27. __RSC_clone */ NULL, /* 28. __RSC_close */ rscs_exec_close, /* 29. __RSC_connect */ rscs_exec_connect, /* 30. __RSC_creat */ NULL, /* 31. __RSC_create_module */ NULL, /* 32. __RSC_delete_module */ NULL, /* 33. __RSC_dup */ rscs_exec_dup, /* 34. __RSC_dup2 */ rscs_exec_dup2, /* 35. __RSC_epoll_create */ NULL, /* 36. __RSC_epoll_ctl */ NULL, /* 37. __RSC_epoll_ctl_old */ NULL, /* 38. __RSC_epoll_wait */ NULL, /* 39. __RSC_epoll_wait_old */ NULL, /* 40. __RSC_execve */ NULL, /* 41. __RSC_exit */ NULL, /* 42. __RSC_exit_group */ NULL, /* 43. __RSC_fadvise64 */ NULL, /* 44. __RSC_fadvise64_64 */ NULL, /* 45. __RSC_fchdir */ rscs_exec_fchdir, /* 46. __RSC_fchmod */ rscs_exec_fchmod, /* 47. __RSC_fchown */ rscs_exec_fchown, /* 48. __RSC_fchown32 */ rscs_exec_fchown32, /* 49. __RSC_fcntl */ rscs_exec_fcntl, /* 50. __RSC_fcntl64 */ NULL, /* 51. __RSC_fdatasync */ rscs_exec_fdatasync, /* 52. __RSC_fgetxattr */ rscs_exec_fgetxattr, /* 53. __RSC_flistxattr */ NULL, /* 54. __RSC_flock */ NULL, /* 55. __RSC_fork */ NULL, /* 56. __RSC_fremovexattr */ NULL, /* 57. __RSC_fsetxattr */ NULL, /* 58. __RSC_fstat */ NULL, /* 59. __RSC_fstat64 */ rscs_exec_fstat64, /* 60. __RSC_fstatfs */ NULL, /* 61. __RSC_fstatfs64 */ rscs_exec_fstatfs64, /* 62. __RSC_fsync */ rscs_exec_fsync, /* 63. __RSC_ftime */ NULL, /* 64. __RSC_ftruncate */ NULL, /* 65. __RSC_ftruncate64 */ rscs_exec_ftruncate64, /* 66. __RSC_futex */ NULL, /* 67. __RSC_get_kernel_syms */ NULL, /* 68. __RSC_get_mempolicy */ NULL, /* 69. __RSC_get_thread_area */ NULL, /* 70. __RSC_getcwd */ NULL, /* 71. __RSC_getdents */ NULL, /* 72. __RSC_getdents64 */ rscs_exec_getdents64, /* 73. __RSC_getegid */ NULL, /* 74. __RSC_getegid32 */ NULL, /* 75. __RSC_geteuid */ NULL, /* 76. __RSC_geteuid32 */ NULL, /* 77. __RSC_getgid */ NULL, /* 78. __RSC_getgid32 */ NULL, /* 79. __RSC_getgroups */ NULL, /* 80. __RSC_getgroups32 */ NULL, /* 81. __RSC_getitimer */ NULL, /* 82. __RSC_getpeername */ rscs_exec_getpeername, /* 83. __RSC_getpgid */ NULL, /* 84. __RSC_getpgrp */ NULL, /* 85. __RSC_getpid */ NULL, /* 86. __RSC_getpmsg */ NULL, /* 87. __RSC_getppid */ NULL, /* 88. __RSC_getpriority */ NULL, /* 89. __RSC_getresgid */ NULL, /* 90. __RSC_getresgid32 */ NULL, /* 91. __RSC_getresuid */ NULL, /* 92. __RSC_getresuid32 */ NULL, /* 93. __RSC_getrlimit */ NULL, /* 94. __RSC_getrusage */ NULL, /* 95. __RSC_getsid */ NULL, /* 96. __RSC_getsockname */ rscs_exec_getsockname, /* 97. __RSC_getsockopt */ rscs_exec_getsockopt, /* 98. __RSC_gettid */ NULL, /* 99. __RSC_gettimeofday */ rscs_exec_gettimeofday, /* 100. __RSC_getuid */ NULL, /* 101. __RSC_getuid32 */ NULL, /* 102. __RSC_getxattr */ rscs_exec_getxattr, /* 103. __RSC_gtty */ NULL, /* 104. __RSC_idle */ NULL, /* 105. __RSC_init_module */ NULL, /* 106. __RSC_io_cancel */ NULL, /* 107. __RSC_io_destroy */ NULL, /* 108. __RSC_io_getevents */ NULL, /* 109. __RSC_io_setup */ NULL, /* 110. __RSC_io_submit */ NULL, /* 111. __RSC_ioctl */ rscs_exec_ioctl, /* 112. __RSC_ioperm */ NULL, /* 113. __RSC_iopl */ NULL, /* 114. __RSC_ipc */ NULL, /* 115. __RSC_kexec_load */ NULL, /* 116. __RSC_keyctl */ NULL, /* 117. __RSC_kill */ NULL, /* 118. __RSC_lchown */ rscs_exec_lchown, /* 119. __RSC_lchown32 */ rscs_exec_lchown32, /* 120. __RSC_lgetxattr */ rscs_exec_lgetxattr, /* 121. __RSC_link */ rscs_exec_link, /* 122. __RSC_listen */ rscs_exec_listen, /* 123. __RSC_listxattr */ NULL, /* 124. __RSC_llistxattr */ NULL, /* 125. __RSC_lock */ NULL, /* 126. __RSC_lookup_dcookie */ NULL, /* 127. __RSC_lremovexattr */ NULL, /* 128. __RSC_lseek */ rscs_exec_lseek, /* 129. __RSC_lsetxattr */ NULL, /* 130. __RSC_lstat */ NULL, /* 131. __RSC_lstat64 */ rscs_exec_lstat64, /* 132. __RSC_madvise */ NULL, /* 133. __RSC_madvise1 */ NULL, /* 134. __RSC_mbind */ NULL, /* 135. __RSC_mincore */ NULL, /* 136. __RSC_mkdir */ rscs_exec_mkdir, /* 137. __RSC_mknod */ NULL, /* 138. __RSC_mlock */ NULL, /* 139. __RSC_mlockall */ NULL, /* 140. __RSC_mmap */ NULL, /* 141. __RSC_mmap2 */ NULL, /* 142. __RSC_modify_ldt */ NULL, /* 143. __RSC_mount */ rscs_exec_mount, /* 144. __RSC_mprotect */ NULL, /* 145. __RSC_mpx */ NULL, /* 146. __RSC_mq_getsetattr */ NULL, /* 147. __RSC_mq_notify */ NULL, /* 148. __RSC_mq_open */ NULL, /* 149. __RSC_mq_timedreceive */ NULL, /* 150. __RSC_mq_timedsend */ NULL, /* 151. __RSC_mq_unlink */ NULL, /* 152. __RSC_mremap */ NULL, /* 153. __RSC_msgctl */ NULL, /* 154. __RSC_msgget */ NULL, /* 155. __RSC_msgrcv */ NULL, /* 156. __RSC_msgsnd */ NULL, /* 157. __RSC_msync */ NULL, /* 158. __RSC_multiplexer */ NULL, /* 159. __RSC_munlock */ NULL, /* 160. __RSC_munlockall */ NULL, /* 161. __RSC_munmap */ NULL, /* 162. __RSC_nanosleep */ NULL, /* 163. __RSC_nfsservctl */ NULL, /* 164. __RSC_nice */ NULL, /* 165. __RSC_oldfstat */ NULL, /* 166. __RSC_oldlstat */ NULL, /* 167. __RSC_oldolduname */ NULL, /* 168. __RSC_oldstat */ NULL, /* 169. __RSC_olduname */ NULL, /* 170. __RSC_open */ rscs_exec_open, /* 171. __RSC_pause */ NULL, /* 172. __RSC_pciconfig_iobase */ NULL, /* 173. __RSC_pciconfig_read */ NULL, /* 174. __RSC_pciconfig_write */ NULL, /* 175. __RSC_personality */ NULL, /* 176. __RSC_pipe */ NULL, /* 177. __RSC_pivot_root */ NULL, /* 178. __RSC_poll */ NULL, /* 179. __RSC_prctl */ NULL, /* 180. __RSC_pread64 */ rscs_exec_pread64, /* 181. __RSC_prof */ NULL, /* 182. __RSC_profil */ NULL, /* 183. __RSC_ptrace */ NULL, /* 184. __RSC_putpmsg */ NULL, /* 185. __RSC_pwrite64 */ rscs_exec_pwrite64, /* 186. __RSC_query_module */ NULL, /* 187. __RSC_quotactl */ NULL, /* 188. __RSC_read */ rscs_exec_read, /* 189. __RSC_readahead */ NULL, /* 190. __RSC_readdir */ NULL, /* 191. __RSC_readlink */ rscs_exec_readlink, /* 192. __RSC_readv */ NULL, /* 193. __RSC_reboot */ NULL, /* 194. __RSC_recv */ rscs_exec_recv, /* 195. __RSC_recvfrom */ rscs_exec_recvfrom, /* 196. __RSC_recvmsg */ NULL, /* 197. __RSC_remap_file_pages */ NULL, /* 198. __RSC_removexattr */ NULL, /* 199. __RSC_rename */ rscs_exec_rename, /* 200. __RSC_request_key */ NULL, /* 201. __RSC_restart_syscall */ NULL, /* 202. __RSC_rmdir */ rscs_exec_rmdir, /* 203. __RSC_rt_sigaction */ NULL, /* 204. __RSC_rt_sigpending */ NULL, /* 205. __RSC_rt_sigprocmask */ NULL, /* 206. __RSC_rt_sigqueueinfo */ NULL, /* 207. __RSC_rt_sigreturn */ NULL, /* 208. __RSC_rt_sigsuspend */ NULL, /* 209. __RSC_rt_sigtimedwait */ NULL, /* 210. __RSC_sched_get_priority_max */ NULL, /* 211. __RSC_sched_get_priority_min */ NULL, /* 212. __RSC_sched_getaffinity */ NULL, /* 213. __RSC_sched_getparam */ NULL, /* 214. __RSC_sched_getscheduler */ NULL, /* 215. __RSC_sched_rr_get_interval */ NULL, /* 216. __RSC_sched_setaffinity */ NULL, /* 217. __RSC_sched_setparam */ NULL, /* 218. __RSC_sched_setscheduler */ NULL, /* 219. __RSC_sched_yield */ NULL, /* 220. __RSC_security */ NULL, /* 221. __RSC_select */ NULL, /* 222. __RSC_semctl */ NULL, /* 223. __RSC_semget */ NULL, /* 224. __RSC_semop */ NULL, /* 225. __RSC_semtimedop */ NULL, /* 226. __RSC_send */ rscs_exec_send, /* 227. __RSC_sendfile */ NULL, /* 228. __RSC_sendfile64 */ NULL, /* 229. __RSC_sendmsg */ NULL, /* 230. __RSC_sendto */ rscs_exec_sendto, /* 231. __RSC_set_mempolicy */ NULL, /* 232. __RSC_set_thread_area */ NULL, /* 233. __RSC_set_tid_address */ NULL, /* 234. __RSC_setdomainname */ rscs_exec_setdomainname, /* 235. __RSC_setfsgid */ NULL, /* 236. __RSC_setfsgid32 */ NULL, /* 237. __RSC_setfsuid */ NULL, /* 238. __RSC_setfsuid32 */ NULL, /* 239. __RSC_setgid */ NULL, /* 240. __RSC_setgid32 */ NULL, /* 241. __RSC_setgroups */ NULL, /* 242. __RSC_setgroups32 */ NULL, /* 243. __RSC_sethostname */ rscs_exec_sethostname, /* 244. __RSC_setitimer */ NULL, /* 245. __RSC_setpgid */ NULL, /* 246. __RSC_setpriority */ NULL, /* 247. __RSC_setregid */ NULL, /* 248. __RSC_setregid32 */ NULL, /* 249. __RSC_setresgid */ NULL, /* 250. __RSC_setresgid32 */ NULL, /* 251. __RSC_setresuid */ NULL, /* 252. __RSC_setresuid32 */ NULL, /* 253. __RSC_setreuid */ NULL, /* 254. __RSC_setreuid32 */ NULL, /* 255. __RSC_setrlimit */ NULL, /* 256. __RSC_setsid */ NULL, /* 257. __RSC_setsockopt */ rscs_exec_setsockopt, /* 258. __RSC_settimeofday */ rscs_exec_settimeofday, /* 259. __RSC_setuid */ NULL, /* 260. __RSC_setuid32 */ NULL, /* 261. __RSC_setxattr */ NULL, /* 262. __RSC_sgetmask */ NULL, /* 263. __RSC_shmat */ NULL, /* 264. __RSC_shmctl */ NULL, /* 265. __RSC_shmdt */ NULL, /* 266. __RSC_shmget */ NULL, /* 267. __RSC_shutdown */ rscs_exec_shutdown, /* 268. __RSC_sigaction */ NULL, /* 269. __RSC_sigaltstack */ NULL, /* 270. __RSC_signal */ NULL, /* 271. __RSC_sigpending */ NULL, /* 272. __RSC_sigprocmask */ NULL, /* 273. __RSC_sigreturn */ NULL, /* 274. __RSC_sigsuspend */ NULL, /* 275. __RSC_socket */ rscs_exec_socket, /* 276. __RSC_socketcall */ NULL, /* 277. __RSC_socketpair */ NULL, /* 278. __RSC_ssetmask */ NULL, /* 279. __RSC_stat */ NULL, /* 280. __RSC_stat64 */ rscs_exec_stat64, /* 281. __RSC_statfs */ NULL, /* 282. __RSC_statfs64 */ rscs_exec_statfs64, /* 283. __RSC_stime */ NULL, /* 284. __RSC_stty */ NULL, /* 285. __RSC_swapcontext */ NULL, /* 286. __RSC_swapoff */ NULL, /* 287. __RSC_swapon */ NULL, /* 288. __RSC_symlink */ rscs_exec_symlink, /* 289. __RSC_sync */ NULL, /* 290. __RSC_sys_kexec_load */ NULL, /* 291. __RSC_sysfs */ NULL, /* 292. __RSC_sysinfo */ NULL, /* 293. __RSC_syslog */ NULL, /* 294. __RSC_tgkill */ NULL, /* 295. __RSC_time */ NULL, /* 296. __RSC_timer_create */ NULL, /* 297. __RSC_timer_delete */ NULL, /* 298. __RSC_timer_getoverrun */ NULL, /* 299. __RSC_timer_gettime */ NULL, /* 300. __RSC_timer_settime */ NULL, /* 301. __RSC_times */ NULL, /* 302. __RSC_tkill */ NULL, /* 303. __RSC_truncate */ NULL, /* 304. __RSC_truncate64 */ rscs_exec_truncate64, /* 305. __RSC_tuxcall */ NULL, /* 306. __RSC_ugetrlimit */ NULL, /* 307. __RSC_ulimit */ NULL, /* 308. __RSC_umask */ NULL, /* 309. __RSC_umount */ NULL, /* 310. __RSC_umount2 */ rscs_exec_umount2, /* 311. __RSC_uname */ rscs_exec_uname, /* 312. __RSC_unlink */ rscs_exec_unlink, /* 313. __RSC_uselib */ NULL, /* 314. __RSC_ustat */ NULL, /* 315. __RSC_utime */ rscs_exec_utime, /* 316. __RSC_utimes */ rscs_exec_utimes, /* 317. __RSC_vfork */ NULL, /* 318. __RSC_vhangup */ NULL, /* 319. __RSC_vm86 */ NULL, /* 320. __RSC_vm86old */ NULL, /* 321. __RSC_vserver */ NULL, /* 322. __RSC_wait4 */ NULL, /* 323. __RSC_waitid */ NULL, /* 324. __RSC_waitpid */ NULL, /* 325. __RSC_write */ rscs_exec_write, /* 326. __RSC_writev */ NULL }; rscs_post_exec rscs_post_exec_table[] = { /* 0. __RSC__exit */ NULL, /* 1. __RSC__llseek */ rscs_post__llseek_exec, /* 2. __RSC__newselect */ NULL, /* 3. __RSC__sysctl */ NULL, /* 4. __RSC_accept */ rscs_post_accept_exec, /* 5. __RSC_access */ rscs_post_access_exec, /* 6. __RSC_acct */ NULL, /* 7. __RSC_add_key */ NULL, /* 8. __RSC_adjtimex */ rscs_post_adjtimex_exec, /* 9. __RSC_afs_syscall */ NULL, /* 10. __RSC_alarm */ NULL, /* 11. __RSC_arch_prctl */ NULL, /* 12. __RSC_bdflush */ NULL, /* 13. __RSC_bind */ rscs_post_bind_exec, /* 14. __RSC_break */ NULL, /* 15. __RSC_brk */ NULL, /* 16. __RSC_capget */ NULL, /* 17. __RSC_capset */ NULL, /* 18. __RSC_chdir */ rscs_post_chdir_exec, /* 19. __RSC_chmod */ rscs_post_chmod_exec, /* 20. __RSC_chown */ rscs_post_chown_exec, /* 21. __RSC_chown32 */ rscs_post_chown32_exec, /* 22. __RSC_chroot */ NULL, /* 23. __RSC_clock_getres */ rscs_post_clock_getres_exec, /* 24. __RSC_clock_gettime */ rscs_post_clock_gettime_exec, /* 25. __RSC_clock_nanosleep */ NULL, /* 26. __RSC_clock_settime */ rscs_post_clock_settime_exec, /* 27. __RSC_clone */ NULL, /* 28. __RSC_close */ rscs_post_close_exec, /* 29. __RSC_connect */ rscs_post_connect_exec, /* 30. __RSC_creat */ NULL, /* 31. __RSC_create_module */ NULL, /* 32. __RSC_delete_module */ NULL, /* 33. __RSC_dup */ rscs_post_dup_exec, /* 34. __RSC_dup2 */ rscs_post_dup2_exec, /* 35. __RSC_epoll_create */ NULL, /* 36. __RSC_epoll_ctl */ NULL, /* 37. __RSC_epoll_ctl_old */ NULL, /* 38. __RSC_epoll_wait */ NULL, /* 39. __RSC_epoll_wait_old */ NULL, /* 40. __RSC_execve */ NULL, /* 41. __RSC_exit */ NULL, /* 42. __RSC_exit_group */ NULL, /* 43. __RSC_fadvise64 */ NULL, /* 44. __RSC_fadvise64_64 */ NULL, /* 45. __RSC_fchdir */ rscs_post_fchdir_exec, /* 46. __RSC_fchmod */ rscs_post_fchmod_exec, /* 47. __RSC_fchown */ rscs_post_fchown_exec, /* 48. __RSC_fchown32 */ rscs_post_fchown32_exec, /* 49. __RSC_fcntl */ rscs_post_fcntl_exec, /* 50. __RSC_fcntl64 */ NULL, /* 51. __RSC_fdatasync */ rscs_post_fdatasync_exec, /* 52. __RSC_fgetxattr */ rscs_post_fgetxattr_exec, /* 53. __RSC_flistxattr */ NULL, /* 54. __RSC_flock */ NULL, /* 55. __RSC_fork */ NULL, /* 56. __RSC_fremovexattr */ NULL, /* 57. __RSC_fsetxattr */ NULL, /* 58. __RSC_fstat */ NULL, /* 59. __RSC_fstat64 */ rscs_post_fstat64_exec, /* 60. __RSC_fstatfs */ NULL, /* 61. __RSC_fstatfs64 */ rscs_post_fstatfs64_exec, /* 62. __RSC_fsync */ rscs_post_fsync_exec, /* 63. __RSC_ftime */ NULL, /* 64. __RSC_ftruncate */ NULL, /* 65. __RSC_ftruncate64 */ rscs_post_ftruncate64_exec, /* 66. __RSC_futex */ NULL, /* 67. __RSC_get_kernel_syms */ NULL, /* 68. __RSC_get_mempolicy */ NULL, /* 69. __RSC_get_thread_area */ NULL, /* 70. __RSC_getcwd */ NULL, /* 71. __RSC_getdents */ NULL, /* 72. __RSC_getdents64 */ rscs_post_getdents64_exec, /* 73. __RSC_getegid */ NULL, /* 74. __RSC_getegid32 */ NULL, /* 75. __RSC_geteuid */ NULL, /* 76. __RSC_geteuid32 */ NULL, /* 77. __RSC_getgid */ NULL, /* 78. __RSC_getgid32 */ NULL, /* 79. __RSC_getgroups */ NULL, /* 80. __RSC_getgroups32 */ NULL, /* 81. __RSC_getitimer */ NULL, /* 82. __RSC_getpeername */ rscs_post_getpeername_exec, /* 83. __RSC_getpgid */ NULL, /* 84. __RSC_getpgrp */ NULL, /* 85. __RSC_getpid */ NULL, /* 86. __RSC_getpmsg */ NULL, /* 87. __RSC_getppid */ NULL, /* 88. __RSC_getpriority */ NULL, /* 89. __RSC_getresgid */ NULL, /* 90. __RSC_getresgid32 */ NULL, /* 91. __RSC_getresuid */ NULL, /* 92. __RSC_getresuid32 */ NULL, /* 93. __RSC_getrlimit */ NULL, /* 94. __RSC_getrusage */ NULL, /* 95. __RSC_getsid */ NULL, /* 96. __RSC_getsockname */ rscs_post_getsockname_exec, /* 97. __RSC_getsockopt */ rscs_post_getsockopt_exec, /* 98. __RSC_gettid */ NULL, /* 99. __RSC_gettimeofday */ rscs_post_gettimeofday_exec, /* 100. __RSC_getuid */ NULL, /* 101. __RSC_getuid32 */ NULL, /* 102. __RSC_getxattr */ rscs_post_getxattr_exec, /* 103. __RSC_gtty */ NULL, /* 104. __RSC_idle */ NULL, /* 105. __RSC_init_module */ NULL, /* 106. __RSC_io_cancel */ NULL, /* 107. __RSC_io_destroy */ NULL, /* 108. __RSC_io_getevents */ NULL, /* 109. __RSC_io_setup */ NULL, /* 110. __RSC_io_submit */ NULL, /* 111. __RSC_ioctl */ rscs_post_ioctl_exec, /* 112. __RSC_ioperm */ NULL, /* 113. __RSC_iopl */ NULL, /* 114. __RSC_ipc */ NULL, /* 115. __RSC_kexec_load */ NULL, /* 116. __RSC_keyctl */ NULL, /* 117. __RSC_kill */ NULL, /* 118. __RSC_lchown */ rscs_post_lchown_exec, /* 119. __RSC_lchown32 */ rscs_post_lchown32_exec, /* 120. __RSC_lgetxattr */ rscs_post_lgetxattr_exec, /* 121. __RSC_link */ rscs_post_link_exec, /* 122. __RSC_listen */ rscs_post_listen_exec, /* 123. __RSC_listxattr */ NULL, /* 124. __RSC_llistxattr */ NULL, /* 125. __RSC_lock */ NULL, /* 126. __RSC_lookup_dcookie */ NULL, /* 127. __RSC_lremovexattr */ NULL, /* 128. __RSC_lseek */ rscs_post_lseek_exec, /* 129. __RSC_lsetxattr */ NULL, /* 130. __RSC_lstat */ NULL, /* 131. __RSC_lstat64 */ rscs_post_lstat64_exec, /* 132. __RSC_madvise */ NULL, /* 133. __RSC_madvise1 */ NULL, /* 134. __RSC_mbind */ NULL, /* 135. __RSC_mincore */ NULL, /* 136. __RSC_mkdir */ rscs_post_mkdir_exec, /* 137. __RSC_mknod */ NULL, /* 138. __RSC_mlock */ NULL, /* 139. __RSC_mlockall */ NULL, /* 140. __RSC_mmap */ NULL, /* 141. __RSC_mmap2 */ NULL, /* 142. __RSC_modify_ldt */ NULL, /* 143. __RSC_mount */ rscs_post_mount_exec, /* 144. __RSC_mprotect */ NULL, /* 145. __RSC_mpx */ NULL, /* 146. __RSC_mq_getsetattr */ NULL, /* 147. __RSC_mq_notify */ NULL, /* 148. __RSC_mq_open */ NULL, /* 149. __RSC_mq_timedreceive */ NULL, /* 150. __RSC_mq_timedsend */ NULL, /* 151. __RSC_mq_unlink */ NULL, /* 152. __RSC_mremap */ NULL, /* 153. __RSC_msgctl */ NULL, /* 154. __RSC_msgget */ NULL, /* 155. __RSC_msgrcv */ NULL, /* 156. __RSC_msgsnd */ NULL, /* 157. __RSC_msync */ NULL, /* 158. __RSC_multiplexer */ NULL, /* 159. __RSC_munlock */ NULL, /* 160. __RSC_munlockall */ NULL, /* 161. __RSC_munmap */ NULL, /* 162. __RSC_nanosleep */ NULL, /* 163. __RSC_nfsservctl */ NULL, /* 164. __RSC_nice */ NULL, /* 165. __RSC_oldfstat */ NULL, /* 166. __RSC_oldlstat */ NULL, /* 167. __RSC_oldolduname */ NULL, /* 168. __RSC_oldstat */ NULL, /* 169. __RSC_olduname */ NULL, /* 170. __RSC_open */ rscs_post_open_exec, /* 171. __RSC_pause */ NULL, /* 172. __RSC_pciconfig_iobase */ NULL, /* 173. __RSC_pciconfig_read */ NULL, /* 174. __RSC_pciconfig_write */ NULL, /* 175. __RSC_personality */ NULL, /* 176. __RSC_pipe */ NULL, /* 177. __RSC_pivot_root */ NULL, /* 178. __RSC_poll */ NULL, /* 179. __RSC_prctl */ NULL, /* 180. __RSC_pread64 */ rscs_post_pread64_exec, /* 181. __RSC_prof */ NULL, /* 182. __RSC_profil */ NULL, /* 183. __RSC_ptrace */ NULL, /* 184. __RSC_putpmsg */ NULL, /* 185. __RSC_pwrite64 */ rscs_post_pwrite64_exec, /* 186. __RSC_query_module */ NULL, /* 187. __RSC_quotactl */ NULL, /* 188. __RSC_read */ rscs_post_read_exec, /* 189. __RSC_readahead */ NULL, /* 190. __RSC_readdir */ NULL, /* 191. __RSC_readlink */ rscs_post_readlink_exec, /* 192. __RSC_readv */ NULL, /* 193. __RSC_reboot */ NULL, /* 194. __RSC_recv */ rscs_post_recv_exec, /* 195. __RSC_recvfrom */ rscs_post_recvfrom_exec, /* 196. __RSC_recvmsg */ NULL, /* 197. __RSC_remap_file_pages */ NULL, /* 198. __RSC_removexattr */ NULL, /* 199. __RSC_rename */ rscs_post_rename_exec, /* 200. __RSC_request_key */ NULL, /* 201. __RSC_restart_syscall */ NULL, /* 202. __RSC_rmdir */ rscs_post_rmdir_exec, /* 203. __RSC_rt_sigaction */ NULL, /* 204. __RSC_rt_sigpending */ NULL, /* 205. __RSC_rt_sigprocmask */ NULL, /* 206. __RSC_rt_sigqueueinfo */ NULL, /* 207. __RSC_rt_sigreturn */ NULL, /* 208. __RSC_rt_sigsuspend */ NULL, /* 209. __RSC_rt_sigtimedwait */ NULL, /* 210. __RSC_sched_get_priority_max */ NULL, /* 211. __RSC_sched_get_priority_min */ NULL, /* 212. __RSC_sched_getaffinity */ NULL, /* 213. __RSC_sched_getparam */ NULL, /* 214. __RSC_sched_getscheduler */ NULL, /* 215. __RSC_sched_rr_get_interval */ NULL, /* 216. __RSC_sched_setaffinity */ NULL, /* 217. __RSC_sched_setparam */ NULL, /* 218. __RSC_sched_setscheduler */ NULL, /* 219. __RSC_sched_yield */ NULL, /* 220. __RSC_security */ NULL, /* 221. __RSC_select */ NULL, /* 222. __RSC_semctl */ NULL, /* 223. __RSC_semget */ NULL, /* 224. __RSC_semop */ NULL, /* 225. __RSC_semtimedop */ NULL, /* 226. __RSC_send */ rscs_post_send_exec, /* 227. __RSC_sendfile */ NULL, /* 228. __RSC_sendfile64 */ NULL, /* 229. __RSC_sendmsg */ NULL, /* 230. __RSC_sendto */ rscs_post_sendto_exec, /* 231. __RSC_set_mempolicy */ NULL, /* 232. __RSC_set_thread_area */ NULL, /* 233. __RSC_set_tid_address */ NULL, /* 234. __RSC_setdomainname */ rscs_post_setdomainname_exec, /* 235. __RSC_setfsgid */ NULL, /* 236. __RSC_setfsgid32 */ NULL, /* 237. __RSC_setfsuid */ NULL, /* 238. __RSC_setfsuid32 */ NULL, /* 239. __RSC_setgid */ NULL, /* 240. __RSC_setgid32 */ NULL, /* 241. __RSC_setgroups */ NULL, /* 242. __RSC_setgroups32 */ NULL, /* 243. __RSC_sethostname */ rscs_post_sethostname_exec, /* 244. __RSC_setitimer */ NULL, /* 245. __RSC_setpgid */ NULL, /* 246. __RSC_setpriority */ NULL, /* 247. __RSC_setregid */ NULL, /* 248. __RSC_setregid32 */ NULL, /* 249. __RSC_setresgid */ NULL, /* 250. __RSC_setresgid32 */ NULL, /* 251. __RSC_setresuid */ NULL, /* 252. __RSC_setresuid32 */ NULL, /* 253. __RSC_setreuid */ NULL, /* 254. __RSC_setreuid32 */ NULL, /* 255. __RSC_setrlimit */ NULL, /* 256. __RSC_setsid */ NULL, /* 257. __RSC_setsockopt */ rscs_post_setsockopt_exec, /* 258. __RSC_settimeofday */ rscs_post_settimeofday_exec, /* 259. __RSC_setuid */ NULL, /* 260. __RSC_setuid32 */ NULL, /* 261. __RSC_setxattr */ NULL, /* 262. __RSC_sgetmask */ NULL, /* 263. __RSC_shmat */ NULL, /* 264. __RSC_shmctl */ NULL, /* 265. __RSC_shmdt */ NULL, /* 266. __RSC_shmget */ NULL, /* 267. __RSC_shutdown */ rscs_post_shutdown_exec, /* 268. __RSC_sigaction */ NULL, /* 269. __RSC_sigaltstack */ NULL, /* 270. __RSC_signal */ NULL, /* 271. __RSC_sigpending */ NULL, /* 272. __RSC_sigprocmask */ NULL, /* 273. __RSC_sigreturn */ NULL, /* 274. __RSC_sigsuspend */ NULL, /* 275. __RSC_socket */ rscs_post_socket_exec, /* 276. __RSC_socketcall */ NULL, /* 277. __RSC_socketpair */ NULL, /* 278. __RSC_ssetmask */ NULL, /* 279. __RSC_stat */ NULL, /* 280. __RSC_stat64 */ rscs_post_stat64_exec, /* 281. __RSC_statfs */ NULL, /* 282. __RSC_statfs64 */ rscs_post_statfs64_exec, /* 283. __RSC_stime */ NULL, /* 284. __RSC_stty */ NULL, /* 285. __RSC_swapcontext */ NULL, /* 286. __RSC_swapoff */ NULL, /* 287. __RSC_swapon */ NULL, /* 288. __RSC_symlink */ rscs_post_symlink_exec, /* 289. __RSC_sync */ NULL, /* 290. __RSC_sys_kexec_load */ NULL, /* 291. __RSC_sysfs */ NULL, /* 292. __RSC_sysinfo */ NULL, /* 293. __RSC_syslog */ NULL, /* 294. __RSC_tgkill */ NULL, /* 295. __RSC_time */ NULL, /* 296. __RSC_timer_create */ NULL, /* 297. __RSC_timer_delete */ NULL, /* 298. __RSC_timer_getoverrun */ NULL, /* 299. __RSC_timer_gettime */ NULL, /* 300. __RSC_timer_settime */ NULL, /* 301. __RSC_times */ NULL, /* 302. __RSC_tkill */ NULL, /* 303. __RSC_truncate */ NULL, /* 304. __RSC_truncate64 */ rscs_post_truncate64_exec, /* 305. __RSC_tuxcall */ NULL, /* 306. __RSC_ugetrlimit */ NULL, /* 307. __RSC_ulimit */ NULL, /* 308. __RSC_umask */ NULL, /* 309. __RSC_umount */ NULL, /* 310. __RSC_umount2 */ rscs_post_umount2_exec, /* 311. __RSC_uname */ rscs_post_uname_exec, /* 312. __RSC_unlink */ rscs_post_unlink_exec, /* 313. __RSC_uselib */ NULL, /* 314. __RSC_ustat */ NULL, /* 315. __RSC_utime */ rscs_post_utime_exec, /* 316. __RSC_utimes */ rscs_post_utimes_exec, /* 317. __RSC_vfork */ NULL, /* 318. __RSC_vhangup */ NULL, /* 319. __RSC_vm86 */ NULL, /* 320. __RSC_vm86old */ NULL, /* 321. __RSC_vserver */ NULL, /* 322. __RSC_wait4 */ NULL, /* 323. __RSC_waitid */ NULL, /* 324. __RSC_waitpid */ NULL, /* 325. __RSC_write */ rscs_post_write_exec, /* 326. __RSC_writev */ NULL }; /*########################################################################*/ /*## ##*/ /*## IOCTL MANAGEMENT ##*/ /*## ##*/ /*########################################################################*/ struct ioctl_entry { int request; u_int32_t size_type; }; static int ioctl_entry_compare(void *e, void *request) { return ( ((struct ioctl_entry *)e)->request == *((int *)request)); } #define ioctl_search(request) (list_search(ioctl_list, ioctl_entry_compare, &(request))) #define ioctl_getel(index) ((struct ioctl_entry *)list_getel(ioctl_list, (index))) #define free_ioctl_req(ioctl_req) free(ioctl_req) void rscs_ioctl_register_request(int request, u_int32_t rw, u_int32_t size) { struct ioctl_entry *req; req = calloc(1, sizeof(struct ioctl_entry)); assert(req != NULL); req->request = request; req->size_type = rw | size; list_add(ioctl_list, req); } #ifndef RSCDEBUG static #endif struct iovec *rscs_manage_ioctl_request(struct ioctl_req_header *ioctl_req) { struct ioctl_entry *res; struct ioctl_resp_header *resp; struct iovec *v; int index; v = calloc(1, sizeof(struct iovec)); assert(v != NULL); resp = calloc(1, sizeof(struct ioctl_resp_header)); assert(resp != NULL); ioctl_req->req_ioctl_request = ntohl(ioctl_req->req_ioctl_request); index = ioctl_search(ioctl_req->req_ioctl_request); res = ioctl_getel(index); /* I create the answer */ resp->resp_type = RSC_IOCTL_RESP; resp->resp_size = htonl(sizeof(struct ioctl_resp_header)); if(res == NULL) { /* Negative answer */ resp->resp_size_type = htonl(IOCTL_UNMANAGED); } else { /* Positive one */ resp->resp_size_type = htonl(res->size_type); } v[0].iov_base = resp; v[0].iov_len = ntohl(resp->resp_size); return v; } /**************************************************************************/ /*** ADJUST READ POINTERS ***/ /**************************************************************************/ /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void accept_adjust_read_pointers(struct accept_req *accept_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) accept_req) + sizeof(struct accept_req); if(accept_req->addrlen != NULL) { accept_req->addrlen = var_data; var_data += sizeof(socklen_t); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void access_adjust_read_pointers(struct access_req *access_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) access_req) + sizeof(struct access_req); if(access_req->pathname != NULL) { access_req->pathname = var_data; var_data += (strlen(access_req->pathname) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void adjtimex_adjust_read_pointers(struct adjtimex_req *adjtimex_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) adjtimex_req) + sizeof(struct adjtimex_req); if(adjtimex_req->buf != NULL) { adjtimex_req->buf = var_data; var_data += sizeof(struct timex); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void bind_adjust_read_pointers(struct bind_req *bind_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) bind_req) + sizeof(struct bind_req); if(bind_req->my_addr != NULL) { bind_req->my_addr = var_data; var_data += bind_req->addrlen; } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void chdir_adjust_read_pointers(struct chdir_req *chdir_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) chdir_req) + sizeof(struct chdir_req); if(chdir_req->path != NULL) { chdir_req->path = var_data; var_data += (strlen(chdir_req->path) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void chmod_adjust_read_pointers(struct chmod_req *chmod_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) chmod_req) + sizeof(struct chmod_req); if(chmod_req->path != NULL) { chmod_req->path = var_data; var_data += (strlen(chmod_req->path) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void chown_adjust_read_pointers(struct chown_req *chown_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) chown_req) + sizeof(struct chown_req); if(chown_req->path != NULL) { chown_req->path = var_data; var_data += (strlen(chown_req->path) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void chown32_adjust_read_pointers(struct chown32_req *chown32_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) chown32_req) + sizeof(struct chown32_req); if(chown32_req->path != NULL) { chown32_req->path = var_data; var_data += (strlen(chown32_req->path) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void clock_settime_adjust_read_pointers(struct clock_settime_req *clock_settime_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) clock_settime_req) + sizeof(struct clock_settime_req); if(clock_settime_req->tp != NULL) { clock_settime_req->tp = var_data; var_data += sizeof(struct timespec); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void connect_adjust_read_pointers(struct connect_req *connect_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) connect_req) + sizeof(struct connect_req); if(connect_req->serv_addr != NULL) { connect_req->serv_addr = var_data; var_data += connect_req->addrlen; } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void fgetxattr_adjust_read_pointers(struct fgetxattr_req *fgetxattr_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) fgetxattr_req) + sizeof(struct fgetxattr_req); if(fgetxattr_req->name != NULL) { fgetxattr_req->name = var_data; var_data += (strlen(fgetxattr_req->name) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void getpeername_adjust_read_pointers(struct getpeername_req *getpeername_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) getpeername_req) + sizeof(struct getpeername_req); if(getpeername_req->namelen != NULL) { getpeername_req->namelen = var_data; var_data += sizeof(socklen_t); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void getsockname_adjust_read_pointers(struct getsockname_req *getsockname_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) getsockname_req) + sizeof(struct getsockname_req); if(getsockname_req->namelen != NULL) { getsockname_req->namelen = var_data; var_data += sizeof(socklen_t); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void getsockopt_adjust_read_pointers(struct getsockopt_req *getsockopt_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) getsockopt_req) + sizeof(struct getsockopt_req); if(getsockopt_req->optlen != NULL) { getsockopt_req->optlen = var_data; var_data += sizeof(socklen_t); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void getxattr_adjust_read_pointers(struct getxattr_req *getxattr_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) getxattr_req) + sizeof(struct getxattr_req); if(getxattr_req->path != NULL) { getxattr_req->path = var_data; var_data += (strlen(getxattr_req->path) + 1); } if(getxattr_req->name != NULL) { getxattr_req->name = var_data; var_data += (strlen(getxattr_req->name) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void lchown_adjust_read_pointers(struct lchown_req *lchown_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) lchown_req) + sizeof(struct lchown_req); if(lchown_req->path != NULL) { lchown_req->path = var_data; var_data += (strlen(lchown_req->path) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void lchown32_adjust_read_pointers(struct lchown32_req *lchown32_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) lchown32_req) + sizeof(struct lchown32_req); if(lchown32_req->path != NULL) { lchown32_req->path = var_data; var_data += (strlen(lchown32_req->path) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void lgetxattr_adjust_read_pointers(struct lgetxattr_req *lgetxattr_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) lgetxattr_req) + sizeof(struct lgetxattr_req); if(lgetxattr_req->path != NULL) { lgetxattr_req->path = var_data; var_data += (strlen(lgetxattr_req->path) + 1); } if(lgetxattr_req->name != NULL) { lgetxattr_req->name = var_data; var_data += (strlen(lgetxattr_req->name) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void link_adjust_read_pointers(struct link_req *link_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) link_req) + sizeof(struct link_req); if(link_req->oldpath != NULL) { link_req->oldpath = var_data; var_data += (strlen(link_req->oldpath) + 1); } if(link_req->newpath != NULL) { link_req->newpath = var_data; var_data += (strlen(link_req->newpath) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void lstat64_adjust_read_pointers(struct lstat64_req *lstat64_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) lstat64_req) + sizeof(struct lstat64_req); if(lstat64_req->path != NULL) { lstat64_req->path = var_data; var_data += (strlen(lstat64_req->path) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void mkdir_adjust_read_pointers(struct mkdir_req *mkdir_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) mkdir_req) + sizeof(struct mkdir_req); if(mkdir_req->pathname != NULL) { mkdir_req->pathname = var_data; var_data += (strlen(mkdir_req->pathname) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void mount_adjust_read_pointers(struct mount_req *mount_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) mount_req) + sizeof(struct mount_req); if(mount_req->source != NULL) { mount_req->source = var_data; var_data += (strlen(mount_req->source) + 1); } if(mount_req->target != NULL) { mount_req->target = var_data; var_data += (strlen(mount_req->target) + 1); } if(mount_req->filesystemtype != NULL) { mount_req->filesystemtype = var_data; var_data += (strlen(mount_req->filesystemtype) + 1); } if(mount_req->data != NULL) { mount_req->data = var_data; var_data += (strlen(mount_req->data) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void open_adjust_read_pointers(struct open_req *open_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) open_req) + sizeof(struct open_req); if(open_req->pathname != NULL) { open_req->pathname = var_data; var_data += (strlen(open_req->pathname) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void pwrite64_adjust_read_pointers(struct pwrite64_req *pwrite64_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) pwrite64_req) + sizeof(struct pwrite64_req); if(pwrite64_req->buf != NULL) { pwrite64_req->buf = var_data; var_data += pwrite64_req->count; } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void readlink_adjust_read_pointers(struct readlink_req *readlink_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) readlink_req) + sizeof(struct readlink_req); if(readlink_req->path != NULL) { readlink_req->path = var_data; var_data += (strlen(readlink_req->path) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void recvfrom_adjust_read_pointers(struct recvfrom_req *recvfrom_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) recvfrom_req) + sizeof(struct recvfrom_req); if(recvfrom_req->fromlen != NULL) { recvfrom_req->fromlen = var_data; var_data += sizeof(socklen_t); } if(recvfrom_req->from != NULL) { recvfrom_req->from = var_data; var_data += *(recvfrom_req->fromlen); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void rename_adjust_read_pointers(struct rename_req *rename_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) rename_req) + sizeof(struct rename_req); if(rename_req->oldpath != NULL) { rename_req->oldpath = var_data; var_data += (strlen(rename_req->oldpath) + 1); } if(rename_req->newpath != NULL) { rename_req->newpath = var_data; var_data += (strlen(rename_req->newpath) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void rmdir_adjust_read_pointers(struct rmdir_req *rmdir_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) rmdir_req) + sizeof(struct rmdir_req); if(rmdir_req->pathname != NULL) { rmdir_req->pathname = var_data; var_data += (strlen(rmdir_req->pathname) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void send_adjust_read_pointers(struct send_req *send_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) send_req) + sizeof(struct send_req); if(send_req->buf != NULL) { send_req->buf = var_data; var_data += send_req->len; } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void sendto_adjust_read_pointers(struct sendto_req *sendto_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) sendto_req) + sizeof(struct sendto_req); if(sendto_req->buf != NULL) { sendto_req->buf = var_data; var_data += sendto_req->len; } if(sendto_req->to != NULL) { sendto_req->to = var_data; var_data += sendto_req->tolen; } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void setdomainname_adjust_read_pointers(struct setdomainname_req *setdomainname_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) setdomainname_req) + sizeof(struct setdomainname_req); if(setdomainname_req->name != NULL) { setdomainname_req->name = var_data; var_data += setdomainname_req->len; } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void sethostname_adjust_read_pointers(struct sethostname_req *sethostname_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) sethostname_req) + sizeof(struct sethostname_req); if(sethostname_req->name != NULL) { sethostname_req->name = var_data; var_data += sethostname_req->len; } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void setsockopt_adjust_read_pointers(struct setsockopt_req *setsockopt_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) setsockopt_req) + sizeof(struct setsockopt_req); if(setsockopt_req->optval != NULL) { setsockopt_req->optval = var_data; var_data += setsockopt_req->optlen; } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void settimeofday_adjust_read_pointers(struct settimeofday_req *settimeofday_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) settimeofday_req) + sizeof(struct settimeofday_req); if(settimeofday_req->tv != NULL) { settimeofday_req->tv = var_data; var_data += sizeof(struct timeval); } if(settimeofday_req->tz != NULL) { settimeofday_req->tz = var_data; var_data += sizeof(struct timezone); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void stat64_adjust_read_pointers(struct stat64_req *stat64_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) stat64_req) + sizeof(struct stat64_req); if(stat64_req->path != NULL) { stat64_req->path = var_data; var_data += (strlen(stat64_req->path) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void statfs64_adjust_read_pointers(struct statfs64_req *statfs64_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) statfs64_req) + sizeof(struct statfs64_req); if(statfs64_req->path != NULL) { statfs64_req->path = var_data; var_data += (strlen(statfs64_req->path) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void symlink_adjust_read_pointers(struct symlink_req *symlink_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) symlink_req) + sizeof(struct symlink_req); if(symlink_req->oldpath != NULL) { symlink_req->oldpath = var_data; var_data += (strlen(symlink_req->oldpath) + 1); } if(symlink_req->newpath != NULL) { symlink_req->newpath = var_data; var_data += (strlen(symlink_req->newpath) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void truncate64_adjust_read_pointers(struct truncate64_req *truncate64_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) truncate64_req) + sizeof(struct truncate64_req); if(truncate64_req->path != NULL) { truncate64_req->path = var_data; var_data += (strlen(truncate64_req->path) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void umount2_adjust_read_pointers(struct umount2_req *umount2_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) umount2_req) + sizeof(struct umount2_req); if(umount2_req->target != NULL) { umount2_req->target = var_data; var_data += (strlen(umount2_req->target) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void unlink_adjust_read_pointers(struct unlink_req *unlink_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) unlink_req) + sizeof(struct unlink_req); if(unlink_req->pathname != NULL) { unlink_req->pathname = var_data; var_data += (strlen(unlink_req->pathname) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void utime_adjust_read_pointers(struct utime_req *utime_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) utime_req) + sizeof(struct utime_req); if(utime_req->filename != NULL) { utime_req->filename = var_data; var_data += (strlen(utime_req->filename) + 1); } if(utime_req->buf != NULL) { utime_req->buf = var_data; var_data += sizeof(struct utimbuf); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void utimes_adjust_read_pointers(struct utimes_req *utimes_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) utimes_req) + sizeof(struct utimes_req); if(utimes_req->filename != NULL) { utimes_req->filename = var_data; var_data += (strlen(utimes_req->filename) + 1); } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void write_adjust_read_pointers(struct write_req *write_req) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) write_req) + sizeof(struct write_req); if(write_req->buf != NULL) { write_req->buf = var_data; var_data += write_req->count; } } # if 0 /* I need also of the resp structure because the space for the buffer that need to be * send back are allocated after it. */ static void recvmsg_adjust_read_pointers(struct recvmsg_req *recvmsg_req) { struct msghdr *msg; int i; void *var_data; msg = &(recvmsg_req->msg); /* "var_data" points to the next data to read */ printf("msg = %p\n", msg); var_data = ((void *) recvmsg_req) + sizeof(struct recvmsg_req); printf("var_data: begin = %p\n", var_data); if(msg->msg_name != NULL) { msg->msg_name = var_data; var_data += msg->msg_namelen; } printf("var_data: after msg_name = %p\n", var_data); if(msg->msg_iov != NULL) { msg->msg_iov = calloc(msg->msg_iovlen, sizeof(struct iovec)); /*FIXME: maybe a control on the result of calloc? */ for(i = 0; i < msg->msg_iovlen; i++) { (msg->msg_iov[i]).iov_len = *((size_t *)var_data); (msg->msg_iov[i]).iov_base = malloc((msg->msg_iov[i]).iov_len); var_data += sizeof((msg->msg_iov[i]).iov_len); } } printf("var_data: after msg_iov = %p\n", var_data); if(msg->msg_control != NULL) msg->msg_control = var_data; printf("var_data: after msg_control = %p\n", var_data); } #endif /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void ioctl_adjust_read_pointers(struct ioctl_req *ioctl_req, u_int32_t size_type) { void *var_data; if(ioctl_req->arg != NULL && (size_type & IOCTL_R)) { /* "var_data" points to the next data to read */ var_data = ((void *) ioctl_req) + sizeof(struct ioctl_req); RSC_DEBUG(RSCD_REQ_RESP, "ioctl_req->arg = %p", var_data); ioctl_req->arg = var_data; } } /* Adjusts the read pointers of the request, the space pointed by them * is stored in the request (in fact these informations are sent by the client). */ #ifndef RSCDEBUG static #endif void fcntl_adjust_read_pointers(struct fcntl_req *fcntl_req) { if(fcntl_req->cmd_type & FCNTL_3RD_FLOCK_R) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) fcntl_req) + sizeof(struct fcntl_req); RSC_DEBUG(RSCD_REQ_RESP, "fcntl_req->third.lock = %p", var_data); if(fcntl_req->third.lock != NULL) fcntl_req->third.lock = var_data; } } /**************************************************************************/ /*** ADJUST WRITE POINTERS ***/ /**************************************************************************/ /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void _llseek_adjust_write_pointers(struct _llseek_req *_llseek_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(_llseek_req->result != NULL) { if(my_arch == client_arch) { _llseek_req->result = var_data; var_data += sizeof(loff_t); } else { _llseek_req->result = calloc(1, aconv_loff_t_size(my_arch, client_arch)); assert(_llseek_req->result != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "_llseek_req->result = %p", var_data); if(_llseek_req->result != NULL) { _llseek_req->result = var_data; var_data += sizeof(loff_t); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void accept_adjust_write_pointers(struct accept_req *accept_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(accept_req->addrlen != NULL) { if(my_arch == client_arch) { /* 'accept_req->addrlen' contains the old value */ memcpy(var_data, accept_req->addrlen, sizeof(socklen_t)); accept_req->addrlen = var_data; var_data += sizeof(socklen_t); } else { } } if(accept_req->addr != NULL) { if(my_arch == client_arch) { accept_req->addr = var_data; var_data += *(accept_req->addrlen); } else { accept_req->addr = calloc(1, aconv_struct_sockaddr_size(my_arch, client_arch)); assert(accept_req->addr != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "accept_req->addrlen = %p", var_data); if(accept_req->addrlen != NULL) { /* 'accept_req->addrlen' contains the old value */ memcpy(var_data, accept_req->addrlen, sizeof(socklen_t)); accept_req->addrlen = var_data; var_data += sizeof(socklen_t); } RSC_DEBUG(RSCD_REQ_RESP, "accept_req->addr = %p", var_data); if(accept_req->addr != NULL) { accept_req->addr = var_data; var_data += *(accept_req->addrlen); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void adjtimex_adjust_write_pointers(struct adjtimex_req *adjtimex_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(adjtimex_req->buf != NULL) { if(my_arch == client_arch) { /* 'adjtimex_req->buf' contains the old value */ memcpy(var_data, adjtimex_req->buf, sizeof(struct timex)); adjtimex_req->buf = var_data; var_data += sizeof(struct timex); } else { } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "adjtimex_req->buf = %p", var_data); if(adjtimex_req->buf != NULL) { /* 'adjtimex_req->buf' contains the old value */ memcpy(var_data, adjtimex_req->buf, sizeof(struct timex)); adjtimex_req->buf = var_data; var_data += sizeof(struct timex); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void clock_getres_adjust_write_pointers(struct clock_getres_req *clock_getres_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(clock_getres_req->res != NULL) { if(my_arch == client_arch) { clock_getres_req->res = var_data; var_data += sizeof(struct timespec); } else { clock_getres_req->res = calloc(1, aconv_struct_timespec_size(my_arch, client_arch)); assert(clock_getres_req->res != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "clock_getres_req->res = %p", var_data); if(clock_getres_req->res != NULL) { clock_getres_req->res = var_data; var_data += sizeof(struct timespec); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void clock_gettime_adjust_write_pointers(struct clock_gettime_req *clock_gettime_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(clock_gettime_req->tp != NULL) { if(my_arch == client_arch) { clock_gettime_req->tp = var_data; var_data += sizeof(struct timespec); } else { clock_gettime_req->tp = calloc(1, aconv_struct_timespec_size(my_arch, client_arch)); assert(clock_gettime_req->tp != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "clock_gettime_req->tp = %p", var_data); if(clock_gettime_req->tp != NULL) { clock_gettime_req->tp = var_data; var_data += sizeof(struct timespec); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void fgetxattr_adjust_write_pointers(struct fgetxattr_req *fgetxattr_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(fgetxattr_req->value != NULL) { if(my_arch == client_arch) { fgetxattr_req->value = var_data; var_data += fgetxattr_req->size; } else { fgetxattr_req->value = calloc(1, aconv_bytes_size(fgetxattr_req->size, my_arch, client_arch)); assert(fgetxattr_req->value != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "fgetxattr_req->value = %p", var_data); if(fgetxattr_req->value != NULL) { fgetxattr_req->value = var_data; var_data += fgetxattr_req->size; } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void fstat64_adjust_write_pointers(struct fstat64_req *fstat64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(fstat64_req->buf != NULL) { if(my_arch == client_arch) { fstat64_req->buf = var_data; var_data += sizeof(struct stat64); } else { fstat64_req->buf = calloc(1, aconv_struct_stat64_size(my_arch, client_arch)); assert(fstat64_req->buf != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "fstat64_req->buf = %p", var_data); if(fstat64_req->buf != NULL) { fstat64_req->buf = var_data; var_data += sizeof(struct stat64); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void fstatfs64_adjust_write_pointers(struct fstatfs64_req *fstatfs64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(fstatfs64_req->buf != NULL) { if(my_arch == client_arch) { fstatfs64_req->buf = var_data; var_data += sizeof(struct statfs64); } else { fstatfs64_req->buf = calloc(1, aconv_struct_statfs64_size(my_arch, client_arch)); assert(fstatfs64_req->buf != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "fstatfs64_req->buf = %p", var_data); if(fstatfs64_req->buf != NULL) { fstatfs64_req->buf = var_data; var_data += sizeof(struct statfs64); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void getdents64_adjust_write_pointers(struct getdents64_req *getdents64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(getdents64_req->dirp != NULL) { if(my_arch == client_arch) { getdents64_req->dirp = var_data; var_data += getdents64_req->count; } else { getdents64_req->dirp = calloc(1, aconv_struct_dirent64_size(my_arch, client_arch)); assert(getdents64_req->dirp != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "getdents64_req->dirp = %p", var_data); if(getdents64_req->dirp != NULL) { getdents64_req->dirp = var_data; var_data += getdents64_req->count; } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void getpeername_adjust_write_pointers(struct getpeername_req *getpeername_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(getpeername_req->namelen != NULL) { if(my_arch == client_arch) { /* 'getpeername_req->namelen' contains the old value */ memcpy(var_data, getpeername_req->namelen, sizeof(socklen_t)); getpeername_req->namelen = var_data; var_data += sizeof(socklen_t); } else { } } if(getpeername_req->name != NULL) { if(my_arch == client_arch) { getpeername_req->name = var_data; var_data += *(getpeername_req->namelen); } else { getpeername_req->name = calloc(1, aconv_struct_sockaddr_size(my_arch, client_arch)); assert(getpeername_req->name != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "getpeername_req->namelen = %p", var_data); if(getpeername_req->namelen != NULL) { /* 'getpeername_req->namelen' contains the old value */ memcpy(var_data, getpeername_req->namelen, sizeof(socklen_t)); getpeername_req->namelen = var_data; var_data += sizeof(socklen_t); } RSC_DEBUG(RSCD_REQ_RESP, "getpeername_req->name = %p", var_data); if(getpeername_req->name != NULL) { getpeername_req->name = var_data; var_data += *(getpeername_req->namelen); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void getsockname_adjust_write_pointers(struct getsockname_req *getsockname_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(getsockname_req->namelen != NULL) { if(my_arch == client_arch) { /* 'getsockname_req->namelen' contains the old value */ memcpy(var_data, getsockname_req->namelen, sizeof(socklen_t)); getsockname_req->namelen = var_data; var_data += sizeof(socklen_t); } else { } } if(getsockname_req->name != NULL) { if(my_arch == client_arch) { getsockname_req->name = var_data; var_data += *(getsockname_req->namelen); } else { getsockname_req->name = calloc(1, aconv_struct_sockaddr_size(my_arch, client_arch)); assert(getsockname_req->name != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "getsockname_req->namelen = %p", var_data); if(getsockname_req->namelen != NULL) { /* 'getsockname_req->namelen' contains the old value */ memcpy(var_data, getsockname_req->namelen, sizeof(socklen_t)); getsockname_req->namelen = var_data; var_data += sizeof(socklen_t); } RSC_DEBUG(RSCD_REQ_RESP, "getsockname_req->name = %p", var_data); if(getsockname_req->name != NULL) { getsockname_req->name = var_data; var_data += *(getsockname_req->namelen); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void getsockopt_adjust_write_pointers(struct getsockopt_req *getsockopt_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(getsockopt_req->optlen != NULL) { if(my_arch == client_arch) { /* 'getsockopt_req->optlen' contains the old value */ memcpy(var_data, getsockopt_req->optlen, sizeof(socklen_t)); getsockopt_req->optlen = var_data; var_data += sizeof(socklen_t); } else { } } if(getsockopt_req->optval != NULL) { if(my_arch == client_arch) { getsockopt_req->optval = var_data; var_data += *(getsockopt_req->optlen); } else { getsockopt_req->optval = calloc(1, aconv_bytes_size(*(getsockopt_req->optlen), my_arch, client_arch)); assert(getsockopt_req->optval != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "getsockopt_req->optlen = %p", var_data); if(getsockopt_req->optlen != NULL) { /* 'getsockopt_req->optlen' contains the old value */ memcpy(var_data, getsockopt_req->optlen, sizeof(socklen_t)); getsockopt_req->optlen = var_data; var_data += sizeof(socklen_t); } RSC_DEBUG(RSCD_REQ_RESP, "getsockopt_req->optval = %p", var_data); if(getsockopt_req->optval != NULL) { getsockopt_req->optval = var_data; var_data += *(getsockopt_req->optlen); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void gettimeofday_adjust_write_pointers(struct gettimeofday_req *gettimeofday_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(gettimeofday_req->tv != NULL) { if(my_arch == client_arch) { gettimeofday_req->tv = var_data; var_data += sizeof(struct timeval); } else { gettimeofday_req->tv = calloc(1, aconv_struct_timeval_size(my_arch, client_arch)); assert(gettimeofday_req->tv != NULL); } } if(gettimeofday_req->tz != NULL) { if(my_arch == client_arch) { gettimeofday_req->tz = var_data; var_data += sizeof(struct timezone); } else { gettimeofday_req->tz = calloc(1, aconv_struct_timezone_size(my_arch, client_arch)); assert(gettimeofday_req->tz != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "gettimeofday_req->tv = %p", var_data); if(gettimeofday_req->tv != NULL) { gettimeofday_req->tv = var_data; var_data += sizeof(struct timeval); } RSC_DEBUG(RSCD_REQ_RESP, "gettimeofday_req->tz = %p", var_data); if(gettimeofday_req->tz != NULL) { gettimeofday_req->tz = var_data; var_data += sizeof(struct timezone); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void getxattr_adjust_write_pointers(struct getxattr_req *getxattr_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(getxattr_req->value != NULL) { if(my_arch == client_arch) { getxattr_req->value = var_data; var_data += getxattr_req->size; } else { getxattr_req->value = calloc(1, aconv_bytes_size(getxattr_req->size, my_arch, client_arch)); assert(getxattr_req->value != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "getxattr_req->value = %p", var_data); if(getxattr_req->value != NULL) { getxattr_req->value = var_data; var_data += getxattr_req->size; } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void lgetxattr_adjust_write_pointers(struct lgetxattr_req *lgetxattr_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(lgetxattr_req->value != NULL) { if(my_arch == client_arch) { lgetxattr_req->value = var_data; var_data += lgetxattr_req->size; } else { lgetxattr_req->value = calloc(1, aconv_bytes_size(lgetxattr_req->size, my_arch, client_arch)); assert(lgetxattr_req->value != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "lgetxattr_req->value = %p", var_data); if(lgetxattr_req->value != NULL) { lgetxattr_req->value = var_data; var_data += lgetxattr_req->size; } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void lstat64_adjust_write_pointers(struct lstat64_req *lstat64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(lstat64_req->buf != NULL) { if(my_arch == client_arch) { lstat64_req->buf = var_data; var_data += sizeof(struct stat64); } else { lstat64_req->buf = calloc(1, aconv_struct_stat64_size(my_arch, client_arch)); assert(lstat64_req->buf != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "lstat64_req->buf = %p", var_data); if(lstat64_req->buf != NULL) { lstat64_req->buf = var_data; var_data += sizeof(struct stat64); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void pread64_adjust_write_pointers(struct pread64_req *pread64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(pread64_req->buf != NULL) { if(my_arch == client_arch) { pread64_req->buf = var_data; var_data += pread64_req->count; } else { pread64_req->buf = calloc(1, aconv_bytes_size(pread64_req->count, my_arch, client_arch)); assert(pread64_req->buf != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "pread64_req->buf = %p", var_data); if(pread64_req->buf != NULL) { pread64_req->buf = var_data; var_data += pread64_req->count; } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void read_adjust_write_pointers(struct read_req *read_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(read_req->buf != NULL) { if(my_arch == client_arch) { read_req->buf = var_data; var_data += read_req->count; } else { read_req->buf = calloc(1, aconv_bytes_size(read_req->count, my_arch, client_arch)); assert(read_req->buf != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "read_req->buf = %p", var_data); if(read_req->buf != NULL) { read_req->buf = var_data; var_data += read_req->count; } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void readlink_adjust_write_pointers(struct readlink_req *readlink_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(readlink_req->buf != NULL) { if(my_arch == client_arch) { readlink_req->buf = var_data; var_data += readlink_req->bufsiz; } else { readlink_req->buf = calloc(1, readlink_req->bufsiz); assert(readlink_req->buf != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "readlink_req->buf = %p", var_data); if(readlink_req->buf != NULL) { readlink_req->buf = var_data; var_data += readlink_req->bufsiz; } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void recv_adjust_write_pointers(struct recv_req *recv_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(recv_req->buf != NULL) { if(my_arch == client_arch) { recv_req->buf = var_data; var_data += recv_req->len; } else { recv_req->buf = calloc(1, aconv_bytes_size(recv_req->len, my_arch, client_arch)); assert(recv_req->buf != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "recv_req->buf = %p", var_data); if(recv_req->buf != NULL) { recv_req->buf = var_data; var_data += recv_req->len; } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void recvfrom_adjust_write_pointers(struct recvfrom_req *recvfrom_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(recvfrom_req->buf != NULL) { if(my_arch == client_arch) { recvfrom_req->buf = var_data; var_data += recvfrom_req->len; } else { recvfrom_req->buf = calloc(1, aconv_bytes_size(recvfrom_req->len, my_arch, client_arch)); assert(recvfrom_req->buf != NULL); } } if(recvfrom_req->fromlen != NULL) { if(my_arch == client_arch) { /* 'recvfrom_req->fromlen' contains the old value */ memcpy(var_data, recvfrom_req->fromlen, sizeof(socklen_t)); recvfrom_req->fromlen = var_data; var_data += sizeof(socklen_t); } else { } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "recvfrom_req->buf = %p", var_data); if(recvfrom_req->buf != NULL) { recvfrom_req->buf = var_data; var_data += recvfrom_req->len; } RSC_DEBUG(RSCD_REQ_RESP, "recvfrom_req->fromlen = %p", var_data); if(recvfrom_req->fromlen != NULL) { /* 'recvfrom_req->fromlen' contains the old value */ memcpy(var_data, recvfrom_req->fromlen, sizeof(socklen_t)); recvfrom_req->fromlen = var_data; var_data += sizeof(socklen_t); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void stat64_adjust_write_pointers(struct stat64_req *stat64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(stat64_req->buf != NULL) { if(my_arch == client_arch) { stat64_req->buf = var_data; var_data += sizeof(struct stat64); } else { stat64_req->buf = calloc(1, aconv_struct_stat64_size(my_arch, client_arch)); assert(stat64_req->buf != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "stat64_req->buf = %p", var_data); if(stat64_req->buf != NULL) { stat64_req->buf = var_data; var_data += sizeof(struct stat64); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void statfs64_adjust_write_pointers(struct statfs64_req *statfs64_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(statfs64_req->buf != NULL) { if(my_arch == client_arch) { statfs64_req->buf = var_data; var_data += sizeof(struct statfs64); } else { statfs64_req->buf = calloc(1, aconv_struct_statfs64_size(my_arch, client_arch)); assert(statfs64_req->buf != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "statfs64_req->buf = %p", var_data); if(statfs64_req->buf != NULL) { statfs64_req->buf = var_data; var_data += sizeof(struct statfs64); } #endif } /* Adjusts the write pointers of the request. If client and server architecture * are equal, the space is stored inside the response, otherwise new space * is malloced and after the execution of the syscall will be copied inside the * response. * The value-result arguments have been already adjusted by *_adjust_read_pointers() * function. */ #ifndef RSCDEBUG static #endif void uname_adjust_write_pointers(struct uname_req *uname_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); if(uname_req->buf != NULL) { if(my_arch == client_arch) { uname_req->buf = var_data; var_data += sizeof(struct utsname); } else { uname_req->buf = calloc(1, aconv_struct_utsname_size(my_arch, client_arch)); assert(uname_req->buf != NULL); } } #if 0 RSC_DEBUG(RSCD_REQ_RESP, "uname_req->buf = %p", var_data); if(uname_req->buf != NULL) { uname_req->buf = var_data; var_data += sizeof(struct utsname); } #endif } /* Adjusts the write pointers of the request, the space pointed by them * is stored in the response (in fact these informations are sent back to the client). * Note: read/write pointers are sent by the client and have to be sent back to it after * the system call, this kind of arguments are usually called "value-result". So, for * these arguments, their content is copied from the request to the response, in this * way when the syscall change it, the new value resides already in the response. */ #ifndef RSCDEBUG static #endif void ioctl_adjust_write_pointers(struct ioctl_req *ioctl_req, struct sys_resp_header *resp_header, int resp_size, u_int32_t size_type, enum arch client_arch) { void *var_data; if(ioctl_req->arg != NULL && (size_type & IOCTL_W)) { var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); RSC_DEBUG(RSCD_REQ_RESP, "ioctl_req->arg = %p", var_data); /* if 'ioctl_req->arg' is also a read pointer, I need to copy its content */ if(size_type & IOCTL_R) memcpy(var_data, ioctl_req->arg, (size_type & IOCTL_LENMASK)); ioctl_req->arg = var_data; } } /* Adjusts the write pointers of the request, the space pointed by them * is stored in the response (in fact these informations are sent back to the client). * Note: read/write pointers are sent by the client and have to be sent back to it after * the system call, this kind of arguments are usually called "value-result". So, for * these arguments, their content is copied from the request to the response, in this * way when the syscall change it, the new value resides already in the response. */ #ifndef RSCDEBUG static #endif void fcntl_adjust_write_pointers(struct fcntl_req *fcntl_req, struct sys_resp_header *resp_header, int resp_size, enum arch client_arch) { void *var_data; if( (fcntl_req->cmd_type & FCNTL_3RD_FLOCK_W) && (fcntl_req->third.lock != NULL)) { /* "var_data" points to the next data to read */ var_data = ((void *) resp_header) + sizeof(struct sys_resp_header); RSC_DEBUG(RSCD_REQ_RESP, "fcntl_req->third.lock = %p", var_data); /* 'fcntl_req->third.lock' contains the old value */ memcpy(var_data, fcntl_req->third.lock, sizeof(struct flock)); fcntl_req->third.lock = var_data; } } /**************************************************************************/ /*** EXECUTION FUNCTIONS ***/ /**************************************************************************/ static void rscs_serialize_resp_hdr(struct sys_resp_header *resp) { resp->resp_rsc_const = htons(resp->resp_rsc_const); resp->resp_size = htonl(resp->resp_size); resp->resp_retval = htonl(resp->resp_retval); resp->resp_errno = htonl(resp->resp_errno); } struct sys_resp_header *rscs_pre__llseek_exec(void *req, enum arch client_arch) { struct _llseek_req *_llseek_req; struct sys_resp_header *resp_header; int resp_size; _llseek_req = (struct _llseek_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(_llseek_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(_llseek_req), rsc2str(_llseek_req->req_rsc_const), _llseek_req->req_rsc_const, _llseek_req->req_type, _llseek_req->req_type, _llseek_req->req_size, _llseek_req->req_size); if(_llseek_req->req_size < sizeof(struct _llseek_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %u (0x%lX); offset_high = %lu (0x%lX); offset_low = %lu (0x%lX); result = %p (0x%lX); whence = %u (0x%lX)", _llseek_req->fd, _llseek_req->fd, _llseek_req->offset_high, _llseek_req->offset_high, _llseek_req->offset_low, _llseek_req->offset_low, _llseek_req->result, _llseek_req->result, _llseek_req->whence, _llseek_req->whence); resp_size = sizeof(struct sys_resp_header); if(_llseek_req->result != NULL) { resp_size += aconv_loff_t_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ _llseek_adjust_write_pointers(_llseek_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, _llseek_req, _llseek_req->req_size); /* resp_header->resp_type = _llseek_req->req_type; */ resp_header->resp_rsc_const = _llseek_req->req_rsc_const; return resp_header; } int rscs_exec__llseek(void *request) { int ret; struct _llseek_req *req = (struct _llseek_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd, req->offset_high, req->offset_low, req->result, req->whence); return ret; } struct iovec*rscs_post__llseek_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct _llseek_req *_llseek_req = (struct _llseek_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_loff_t(_llseek_req->result, my_arch, client_arch, mem); mem += aconv_loff_t_size(my_arch, client_arch); free(_llseek_req->result); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_accept_exec(void *req, enum arch client_arch) { struct accept_req *accept_req; struct sys_resp_header *resp_header; int resp_size; accept_req = (struct accept_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(accept_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(accept_req), rsc2str(accept_req->req_rsc_const), accept_req->req_rsc_const, accept_req->req_type, accept_req->req_type, accept_req->req_size, accept_req->req_size); if(accept_req->req_size < sizeof(struct accept_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: sockfd = %ld (0x%lX); addr = %p (0x%lX); addrlen = %p (0x%lX)", accept_req->sockfd, accept_req->sockfd, accept_req->addr, accept_req->addr, accept_req->addrlen, accept_req->addrlen); /* Adjusts the read pointers of the request */ accept_adjust_read_pointers(accept_req); resp_size = sizeof(struct sys_resp_header); if(accept_req->addrlen != NULL) { resp_size += aconv_socklen_t_size(my_arch, client_arch); } if(accept_req->addr != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'addrlen' argument. */ /* The client can have changed the value of socklen_t *addrlen if it was less than * the size of addr into server arch. So If socklen_t *addrlen is equal * to this value I need to change it to the right value on client arch. */ if(*(accept_req->addrlen) == aconv_struct_sockaddr_size(client_arch, my_arch)) { resp_size += aconv_struct_sockaddr_size(my_arch, client_arch); } else { resp_size += *(accept_req->addrlen); } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ accept_adjust_write_pointers(accept_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, accept_req, accept_req->req_size); /* resp_header->resp_type = accept_req->req_type; */ resp_header->resp_rsc_const = accept_req->req_rsc_const; return resp_header; } int rscs_exec_accept(void *request) { int ret; struct accept_req *req = (struct accept_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->sockfd, req->addr, req->addrlen); #else { unsigned long args[] = { (unsigned long)(req->sockfd), (unsigned long)(req->addr), (unsigned long)(req->addrlen) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_accept_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct accept_req *accept_req = (struct accept_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_socklen_t(accept_req->addrlen, my_arch, client_arch, mem); mem += aconv_socklen_t_size(my_arch, client_arch); aconv_struct_sockaddr(accept_req->addr, my_arch, client_arch, mem); mem += aconv_struct_sockaddr_size(my_arch, client_arch); free(accept_req->addr); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_access_exec(void *req, enum arch client_arch) { struct access_req *access_req; struct sys_resp_header *resp_header; int resp_size; access_req = (struct access_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(access_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(access_req), rsc2str(access_req->req_rsc_const), access_req->req_rsc_const, access_req->req_type, access_req->req_type, access_req->req_size, access_req->req_size); if(access_req->req_size < sizeof(struct access_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: pathname = %p (0x%lX); mode = %ld (0x%lX)", access_req->pathname, access_req->pathname, access_req->mode, access_req->mode); /* Adjusts the read pointers of the request */ access_adjust_read_pointers(access_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, access_req, access_req->req_size); /* resp_header->resp_type = access_req->req_type; */ resp_header->resp_rsc_const = access_req->req_rsc_const; return resp_header; } int rscs_exec_access(void *request) { int ret; struct access_req *req = (struct access_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->pathname, req->mode); return ret; } struct iovec*rscs_post_access_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_adjtimex_exec(void *req, enum arch client_arch) { struct adjtimex_req *adjtimex_req; struct sys_resp_header *resp_header; int resp_size; adjtimex_req = (struct adjtimex_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(adjtimex_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(adjtimex_req), rsc2str(adjtimex_req->req_rsc_const), adjtimex_req->req_rsc_const, adjtimex_req->req_type, adjtimex_req->req_type, adjtimex_req->req_size, adjtimex_req->req_size); if(adjtimex_req->req_size < sizeof(struct adjtimex_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: buf = %p (0x%lX)", adjtimex_req->buf, adjtimex_req->buf); /* Adjusts the read pointers of the request */ adjtimex_adjust_read_pointers(adjtimex_req); resp_size = sizeof(struct sys_resp_header); if(adjtimex_req->buf != NULL) { resp_size += aconv_struct_timex_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ adjtimex_adjust_write_pointers(adjtimex_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, adjtimex_req, adjtimex_req->req_size); /* resp_header->resp_type = adjtimex_req->req_type; */ resp_header->resp_rsc_const = adjtimex_req->req_rsc_const; return resp_header; } int rscs_exec_adjtimex(void *request) { int ret; struct adjtimex_req *req = (struct adjtimex_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->buf); return ret; } struct iovec*rscs_post_adjtimex_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct adjtimex_req *adjtimex_req = (struct adjtimex_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_struct_timex(adjtimex_req->buf, my_arch, client_arch, mem); mem += aconv_struct_timex_size(my_arch, client_arch); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_bind_exec(void *req, enum arch client_arch) { struct bind_req *bind_req; struct sys_resp_header *resp_header; int resp_size; bind_req = (struct bind_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(bind_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(bind_req), rsc2str(bind_req->req_rsc_const), bind_req->req_rsc_const, bind_req->req_type, bind_req->req_type, bind_req->req_size, bind_req->req_size); if(bind_req->req_size < sizeof(struct bind_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: sockfd = %ld (0x%lX); my_addr = %p (0x%lX); addrlen = %ld (0x%lX)", bind_req->sockfd, bind_req->sockfd, bind_req->my_addr, bind_req->my_addr, bind_req->addrlen, bind_req->addrlen); /* Adjusts the read pointers of the request */ bind_adjust_read_pointers(bind_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, bind_req, bind_req->req_size); /* resp_header->resp_type = bind_req->req_type; */ resp_header->resp_rsc_const = bind_req->req_rsc_const; return resp_header; } int rscs_exec_bind(void *request) { int ret; struct bind_req *req = (struct bind_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->sockfd, req->my_addr, req->addrlen); #else { unsigned long args[] = { (unsigned long)(req->sockfd), (unsigned long)(req->my_addr), (unsigned long)(req->addrlen) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_bind_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_chdir_exec(void *req, enum arch client_arch) { struct chdir_req *chdir_req; struct sys_resp_header *resp_header; int resp_size; chdir_req = (struct chdir_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(chdir_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(chdir_req), rsc2str(chdir_req->req_rsc_const), chdir_req->req_rsc_const, chdir_req->req_type, chdir_req->req_type, chdir_req->req_size, chdir_req->req_size); if(chdir_req->req_size < sizeof(struct chdir_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX)", chdir_req->path, chdir_req->path); /* Adjusts the read pointers of the request */ chdir_adjust_read_pointers(chdir_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, chdir_req, chdir_req->req_size); /* resp_header->resp_type = chdir_req->req_type; */ resp_header->resp_rsc_const = chdir_req->req_rsc_const; return resp_header; } int rscs_exec_chdir(void *request) { int ret; struct chdir_req *req = (struct chdir_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path); return ret; } struct iovec*rscs_post_chdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_chmod_exec(void *req, enum arch client_arch) { struct chmod_req *chmod_req; struct sys_resp_header *resp_header; int resp_size; chmod_req = (struct chmod_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(chmod_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(chmod_req), rsc2str(chmod_req->req_rsc_const), chmod_req->req_rsc_const, chmod_req->req_type, chmod_req->req_type, chmod_req->req_size, chmod_req->req_size); if(chmod_req->req_size < sizeof(struct chmod_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); mode = %ld (0x%lX)", chmod_req->path, chmod_req->path, chmod_req->mode, chmod_req->mode); /* Adjusts the read pointers of the request */ chmod_adjust_read_pointers(chmod_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, chmod_req, chmod_req->req_size); /* resp_header->resp_type = chmod_req->req_type; */ resp_header->resp_rsc_const = chmod_req->req_rsc_const; return resp_header; } int rscs_exec_chmod(void *request) { int ret; struct chmod_req *req = (struct chmod_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, req->mode); return ret; } struct iovec*rscs_post_chmod_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_chown_exec(void *req, enum arch client_arch) { struct chown_req *chown_req; struct sys_resp_header *resp_header; int resp_size; chown_req = (struct chown_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(chown_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(chown_req), rsc2str(chown_req->req_rsc_const), chown_req->req_rsc_const, chown_req->req_type, chown_req->req_type, chown_req->req_size, chown_req->req_size); if(chown_req->req_size < sizeof(struct chown_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", chown_req->path, chown_req->path, chown_req->owner, chown_req->owner, chown_req->group, chown_req->group); /* Adjusts the read pointers of the request */ chown_adjust_read_pointers(chown_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, chown_req, chown_req->req_size); /* resp_header->resp_type = chown_req->req_type; */ resp_header->resp_rsc_const = chown_req->req_rsc_const; return resp_header; } int rscs_exec_chown(void *request) { int ret; struct chown_req *req = (struct chown_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, req->owner, req->group); return ret; } struct iovec*rscs_post_chown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_chown32_exec(void *req, enum arch client_arch) { struct chown32_req *chown32_req; struct sys_resp_header *resp_header; int resp_size; chown32_req = (struct chown32_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(chown32_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(chown32_req), rsc2str(chown32_req->req_rsc_const), chown32_req->req_rsc_const, chown32_req->req_type, chown32_req->req_type, chown32_req->req_size, chown32_req->req_size); if(chown32_req->req_size < sizeof(struct chown32_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", chown32_req->path, chown32_req->path, chown32_req->owner, chown32_req->owner, chown32_req->group, chown32_req->group); /* Adjusts the read pointers of the request */ chown32_adjust_read_pointers(chown32_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, chown32_req, chown32_req->req_size); /* resp_header->resp_type = chown32_req->req_type; */ resp_header->resp_rsc_const = chown32_req->req_rsc_const; return resp_header; } int rscs_exec_chown32(void *request) { int ret; struct chown32_req *req = (struct chown32_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, req->owner, req->group); return ret; } struct iovec*rscs_post_chown32_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_clock_getres_exec(void *req, enum arch client_arch) { struct clock_getres_req *clock_getres_req; struct sys_resp_header *resp_header; int resp_size; clock_getres_req = (struct clock_getres_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(clock_getres_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(clock_getres_req), rsc2str(clock_getres_req->req_rsc_const), clock_getres_req->req_rsc_const, clock_getres_req->req_type, clock_getres_req->req_type, clock_getres_req->req_size, clock_getres_req->req_size); if(clock_getres_req->req_size < sizeof(struct clock_getres_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: clk_id = %ld (0x%lX); res = %p (0x%lX)", clock_getres_req->clk_id, clock_getres_req->clk_id, clock_getres_req->res, clock_getres_req->res); resp_size = sizeof(struct sys_resp_header); if(clock_getres_req->res != NULL) { resp_size += aconv_struct_timespec_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ clock_getres_adjust_write_pointers(clock_getres_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, clock_getres_req, clock_getres_req->req_size); /* resp_header->resp_type = clock_getres_req->req_type; */ resp_header->resp_rsc_const = clock_getres_req->req_rsc_const; return resp_header; } int rscs_exec_clock_getres(void *request) { int ret; struct clock_getres_req *req = (struct clock_getres_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->clk_id, req->res); return ret; } struct iovec*rscs_post_clock_getres_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct clock_getres_req *clock_getres_req = (struct clock_getres_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_struct_timespec(clock_getres_req->res, my_arch, client_arch, mem); mem += aconv_struct_timespec_size(my_arch, client_arch); free(clock_getres_req->res); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_clock_gettime_exec(void *req, enum arch client_arch) { struct clock_gettime_req *clock_gettime_req; struct sys_resp_header *resp_header; int resp_size; clock_gettime_req = (struct clock_gettime_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(clock_gettime_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(clock_gettime_req), rsc2str(clock_gettime_req->req_rsc_const), clock_gettime_req->req_rsc_const, clock_gettime_req->req_type, clock_gettime_req->req_type, clock_gettime_req->req_size, clock_gettime_req->req_size); if(clock_gettime_req->req_size < sizeof(struct clock_gettime_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: clk_id = %ld (0x%lX); tp = %p (0x%lX)", clock_gettime_req->clk_id, clock_gettime_req->clk_id, clock_gettime_req->tp, clock_gettime_req->tp); resp_size = sizeof(struct sys_resp_header); if(clock_gettime_req->tp != NULL) { resp_size += aconv_struct_timespec_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ clock_gettime_adjust_write_pointers(clock_gettime_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, clock_gettime_req, clock_gettime_req->req_size); /* resp_header->resp_type = clock_gettime_req->req_type; */ resp_header->resp_rsc_const = clock_gettime_req->req_rsc_const; return resp_header; } int rscs_exec_clock_gettime(void *request) { int ret; struct clock_gettime_req *req = (struct clock_gettime_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->clk_id, req->tp); return ret; } struct iovec*rscs_post_clock_gettime_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct clock_gettime_req *clock_gettime_req = (struct clock_gettime_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_struct_timespec(clock_gettime_req->tp, my_arch, client_arch, mem); mem += aconv_struct_timespec_size(my_arch, client_arch); free(clock_gettime_req->tp); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_clock_settime_exec(void *req, enum arch client_arch) { struct clock_settime_req *clock_settime_req; struct sys_resp_header *resp_header; int resp_size; clock_settime_req = (struct clock_settime_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(clock_settime_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(clock_settime_req), rsc2str(clock_settime_req->req_rsc_const), clock_settime_req->req_rsc_const, clock_settime_req->req_type, clock_settime_req->req_type, clock_settime_req->req_size, clock_settime_req->req_size); if(clock_settime_req->req_size < sizeof(struct clock_settime_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: clk_id = %ld (0x%lX); tp = %p (0x%lX)", clock_settime_req->clk_id, clock_settime_req->clk_id, clock_settime_req->tp, clock_settime_req->tp); /* Adjusts the read pointers of the request */ clock_settime_adjust_read_pointers(clock_settime_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, clock_settime_req, clock_settime_req->req_size); /* resp_header->resp_type = clock_settime_req->req_type; */ resp_header->resp_rsc_const = clock_settime_req->req_rsc_const; return resp_header; } int rscs_exec_clock_settime(void *request) { int ret; struct clock_settime_req *req = (struct clock_settime_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->clk_id, req->tp); return ret; } struct iovec*rscs_post_clock_settime_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_close_exec(void *req, enum arch client_arch) { struct close_req *close_req; struct sys_resp_header *resp_header; int resp_size; close_req = (struct close_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(close_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(close_req), rsc2str(close_req->req_rsc_const), close_req->req_rsc_const, close_req->req_type, close_req->req_type, close_req->req_size, close_req->req_size); if(close_req->req_size < sizeof(struct close_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX)", close_req->fd, close_req->fd); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, close_req, close_req->req_size); /* resp_header->resp_type = close_req->req_type; */ resp_header->resp_rsc_const = close_req->req_rsc_const; return resp_header; } int rscs_exec_close(void *request) { int ret; struct close_req *req = (struct close_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd); return ret; } struct iovec*rscs_post_close_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_connect_exec(void *req, enum arch client_arch) { struct connect_req *connect_req; struct sys_resp_header *resp_header; int resp_size; connect_req = (struct connect_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(connect_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(connect_req), rsc2str(connect_req->req_rsc_const), connect_req->req_rsc_const, connect_req->req_type, connect_req->req_type, connect_req->req_size, connect_req->req_size); if(connect_req->req_size < sizeof(struct connect_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: sockfd = %ld (0x%lX); serv_addr = %p (0x%lX); addrlen = %ld (0x%lX)", connect_req->sockfd, connect_req->sockfd, connect_req->serv_addr, connect_req->serv_addr, connect_req->addrlen, connect_req->addrlen); /* Adjusts the read pointers of the request */ connect_adjust_read_pointers(connect_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, connect_req, connect_req->req_size); /* resp_header->resp_type = connect_req->req_type; */ resp_header->resp_rsc_const = connect_req->req_rsc_const; return resp_header; } int rscs_exec_connect(void *request) { int ret; struct connect_req *req = (struct connect_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->sockfd, req->serv_addr, req->addrlen); #else { unsigned long args[] = { (unsigned long)(req->sockfd), (unsigned long)(req->serv_addr), (unsigned long)(req->addrlen) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_connect_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_dup_exec(void *req, enum arch client_arch) { struct dup_req *dup_req; struct sys_resp_header *resp_header; int resp_size; dup_req = (struct dup_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(dup_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(dup_req), rsc2str(dup_req->req_rsc_const), dup_req->req_rsc_const, dup_req->req_type, dup_req->req_type, dup_req->req_size, dup_req->req_size); if(dup_req->req_size < sizeof(struct dup_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: oldfd = %ld (0x%lX)", dup_req->oldfd, dup_req->oldfd); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, dup_req, dup_req->req_size); /* resp_header->resp_type = dup_req->req_type; */ resp_header->resp_rsc_const = dup_req->req_rsc_const; return resp_header; } int rscs_exec_dup(void *request) { int ret; struct dup_req *req = (struct dup_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->oldfd); return ret; } struct iovec*rscs_post_dup_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_dup2_exec(void *req, enum arch client_arch) { struct dup2_req *dup2_req; struct sys_resp_header *resp_header; int resp_size; dup2_req = (struct dup2_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(dup2_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(dup2_req), rsc2str(dup2_req->req_rsc_const), dup2_req->req_rsc_const, dup2_req->req_type, dup2_req->req_type, dup2_req->req_size, dup2_req->req_size); if(dup2_req->req_size < sizeof(struct dup2_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: oldfd = %ld (0x%lX); newfd = %ld (0x%lX)", dup2_req->oldfd, dup2_req->oldfd, dup2_req->newfd, dup2_req->newfd); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, dup2_req, dup2_req->req_size); /* resp_header->resp_type = dup2_req->req_type; */ resp_header->resp_rsc_const = dup2_req->req_rsc_const; return resp_header; } int rscs_exec_dup2(void *request) { int ret; struct dup2_req *req = (struct dup2_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->oldfd, req->newfd); return ret; } struct iovec*rscs_post_dup2_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_fchdir_exec(void *req, enum arch client_arch) { struct fchdir_req *fchdir_req; struct sys_resp_header *resp_header; int resp_size; fchdir_req = (struct fchdir_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(fchdir_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(fchdir_req), rsc2str(fchdir_req->req_rsc_const), fchdir_req->req_rsc_const, fchdir_req->req_type, fchdir_req->req_type, fchdir_req->req_size, fchdir_req->req_size); if(fchdir_req->req_size < sizeof(struct fchdir_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX)", fchdir_req->fd, fchdir_req->fd); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, fchdir_req, fchdir_req->req_size); /* resp_header->resp_type = fchdir_req->req_type; */ resp_header->resp_rsc_const = fchdir_req->req_rsc_const; return resp_header; } int rscs_exec_fchdir(void *request) { int ret; struct fchdir_req *req = (struct fchdir_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd); return ret; } struct iovec*rscs_post_fchdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_fchmod_exec(void *req, enum arch client_arch) { struct fchmod_req *fchmod_req; struct sys_resp_header *resp_header; int resp_size; fchmod_req = (struct fchmod_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(fchmod_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(fchmod_req), rsc2str(fchmod_req->req_rsc_const), fchmod_req->req_rsc_const, fchmod_req->req_type, fchmod_req->req_type, fchmod_req->req_size, fchmod_req->req_size); if(fchmod_req->req_size < sizeof(struct fchmod_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fildes = %ld (0x%lX); mode = %ld (0x%lX)", fchmod_req->fildes, fchmod_req->fildes, fchmod_req->mode, fchmod_req->mode); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, fchmod_req, fchmod_req->req_size); /* resp_header->resp_type = fchmod_req->req_type; */ resp_header->resp_rsc_const = fchmod_req->req_rsc_const; return resp_header; } int rscs_exec_fchmod(void *request) { int ret; struct fchmod_req *req = (struct fchmod_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fildes, req->mode); return ret; } struct iovec*rscs_post_fchmod_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_fchown_exec(void *req, enum arch client_arch) { struct fchown_req *fchown_req; struct sys_resp_header *resp_header; int resp_size; fchown_req = (struct fchown_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(fchown_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(fchown_req), rsc2str(fchown_req->req_rsc_const), fchown_req->req_rsc_const, fchown_req->req_type, fchown_req->req_type, fchown_req->req_size, fchown_req->req_size); if(fchown_req->req_size < sizeof(struct fchown_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", fchown_req->fd, fchown_req->fd, fchown_req->owner, fchown_req->owner, fchown_req->group, fchown_req->group); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, fchown_req, fchown_req->req_size); /* resp_header->resp_type = fchown_req->req_type; */ resp_header->resp_rsc_const = fchown_req->req_rsc_const; return resp_header; } int rscs_exec_fchown(void *request) { int ret; struct fchown_req *req = (struct fchown_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd, req->owner, req->group); return ret; } struct iovec*rscs_post_fchown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_fchown32_exec(void *req, enum arch client_arch) { struct fchown32_req *fchown32_req; struct sys_resp_header *resp_header; int resp_size; fchown32_req = (struct fchown32_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(fchown32_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(fchown32_req), rsc2str(fchown32_req->req_rsc_const), fchown32_req->req_rsc_const, fchown32_req->req_type, fchown32_req->req_type, fchown32_req->req_size, fchown32_req->req_size); if(fchown32_req->req_size < sizeof(struct fchown32_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", fchown32_req->fd, fchown32_req->fd, fchown32_req->owner, fchown32_req->owner, fchown32_req->group, fchown32_req->group); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, fchown32_req, fchown32_req->req_size); /* resp_header->resp_type = fchown32_req->req_type; */ resp_header->resp_rsc_const = fchown32_req->req_rsc_const; return resp_header; } int rscs_exec_fchown32(void *request) { int ret; struct fchown32_req *req = (struct fchown32_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd, req->owner, req->group); return ret; } struct iovec*rscs_post_fchown32_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_fdatasync_exec(void *req, enum arch client_arch) { struct fdatasync_req *fdatasync_req; struct sys_resp_header *resp_header; int resp_size; fdatasync_req = (struct fdatasync_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(fdatasync_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(fdatasync_req), rsc2str(fdatasync_req->req_rsc_const), fdatasync_req->req_rsc_const, fdatasync_req->req_type, fdatasync_req->req_type, fdatasync_req->req_size, fdatasync_req->req_size); if(fdatasync_req->req_size < sizeof(struct fdatasync_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX)", fdatasync_req->fd, fdatasync_req->fd); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, fdatasync_req, fdatasync_req->req_size); /* resp_header->resp_type = fdatasync_req->req_type; */ resp_header->resp_rsc_const = fdatasync_req->req_rsc_const; return resp_header; } int rscs_exec_fdatasync(void *request) { int ret; struct fdatasync_req *req = (struct fdatasync_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd); return ret; } struct iovec*rscs_post_fdatasync_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_fgetxattr_exec(void *req, enum arch client_arch) { struct fgetxattr_req *fgetxattr_req; struct sys_resp_header *resp_header; int resp_size; fgetxattr_req = (struct fgetxattr_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(fgetxattr_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(fgetxattr_req), rsc2str(fgetxattr_req->req_rsc_const), fgetxattr_req->req_rsc_const, fgetxattr_req->req_type, fgetxattr_req->req_type, fgetxattr_req->req_size, fgetxattr_req->req_size); if(fgetxattr_req->req_size < sizeof(struct fgetxattr_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: filedes = %ld (0x%lX); name = %p (0x%lX); value = %p (0x%lX); size = %ld (0x%lX)", fgetxattr_req->filedes, fgetxattr_req->filedes, fgetxattr_req->name, fgetxattr_req->name, fgetxattr_req->value, fgetxattr_req->value, fgetxattr_req->size, fgetxattr_req->size); /* Adjusts the read pointers of the request */ fgetxattr_adjust_read_pointers(fgetxattr_req); resp_size = sizeof(struct sys_resp_header); if(fgetxattr_req->value != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'size' argument. */ /* The client can have changed the value of size_t size if it was less than * the size of value into server arch. So If size_t size is equal * to this value I need to change it to the right value on client arch. */ if(fgetxattr_req->size == aconv_bytes_size(fgetxattr_req->size, client_arch, my_arch)) { resp_size += aconv_bytes_size(fgetxattr_req->size, my_arch, client_arch); } else { resp_size += fgetxattr_req->size; } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ fgetxattr_adjust_write_pointers(fgetxattr_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, fgetxattr_req, fgetxattr_req->req_size); /* resp_header->resp_type = fgetxattr_req->req_type; */ resp_header->resp_rsc_const = fgetxattr_req->req_rsc_const; return resp_header; } int rscs_exec_fgetxattr(void *request) { int ret; struct fgetxattr_req *req = (struct fgetxattr_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->filedes, req->name, req->value, req->size); return ret; } struct iovec*rscs_post_fgetxattr_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct fgetxattr_req *fgetxattr_req = (struct fgetxattr_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_bytes(fgetxattr_req->value, my_arch, client_arch, mem, fgetxattr_req->size); mem += aconv_bytes_size(fgetxattr_req->size, my_arch, client_arch); free(fgetxattr_req->value); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_fstat64_exec(void *req, enum arch client_arch) { struct fstat64_req *fstat64_req; struct sys_resp_header *resp_header; int resp_size; fstat64_req = (struct fstat64_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(fstat64_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(fstat64_req), rsc2str(fstat64_req->req_rsc_const), fstat64_req->req_rsc_const, fstat64_req->req_type, fstat64_req->req_type, fstat64_req->req_size, fstat64_req->req_size); if(fstat64_req->req_size < sizeof(struct fstat64_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: filedes = %ld (0x%lX); buf = %p (0x%lX)", fstat64_req->filedes, fstat64_req->filedes, fstat64_req->buf, fstat64_req->buf); resp_size = sizeof(struct sys_resp_header); if(fstat64_req->buf != NULL) { resp_size += aconv_struct_stat64_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ fstat64_adjust_write_pointers(fstat64_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, fstat64_req, fstat64_req->req_size); /* resp_header->resp_type = fstat64_req->req_type; */ resp_header->resp_rsc_const = fstat64_req->req_rsc_const; return resp_header; } int rscs_exec_fstat64(void *request) { int ret; struct fstat64_req *req = (struct fstat64_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->filedes, req->buf); return ret; } struct iovec*rscs_post_fstat64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct fstat64_req *fstat64_req = (struct fstat64_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_struct_stat64(fstat64_req->buf, my_arch, client_arch, mem); mem += aconv_struct_stat64_size(my_arch, client_arch); free(fstat64_req->buf); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_fstatfs64_exec(void *req, enum arch client_arch) { struct fstatfs64_req *fstatfs64_req; struct sys_resp_header *resp_header; int resp_size; fstatfs64_req = (struct fstatfs64_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(fstatfs64_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(fstatfs64_req), rsc2str(fstatfs64_req->req_rsc_const), fstatfs64_req->req_rsc_const, fstatfs64_req->req_type, fstatfs64_req->req_type, fstatfs64_req->req_size, fstatfs64_req->req_size); if(fstatfs64_req->req_size < sizeof(struct fstatfs64_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %u (0x%lX); buf = %p (0x%lX)", fstatfs64_req->fd, fstatfs64_req->fd, fstatfs64_req->buf, fstatfs64_req->buf); resp_size = sizeof(struct sys_resp_header); if(fstatfs64_req->buf != NULL) { resp_size += aconv_struct_statfs64_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ fstatfs64_adjust_write_pointers(fstatfs64_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, fstatfs64_req, fstatfs64_req->req_size); /* resp_header->resp_type = fstatfs64_req->req_type; */ resp_header->resp_rsc_const = fstatfs64_req->req_rsc_const; return resp_header; } int rscs_exec_fstatfs64(void *request) { int ret; struct fstatfs64_req *req = (struct fstatfs64_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd, sizeof(struct statfs64), req->buf); return ret; } struct iovec*rscs_post_fstatfs64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct fstatfs64_req *fstatfs64_req = (struct fstatfs64_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_struct_statfs64(fstatfs64_req->buf, my_arch, client_arch, mem); mem += aconv_struct_statfs64_size(my_arch, client_arch); free(fstatfs64_req->buf); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_fsync_exec(void *req, enum arch client_arch) { struct fsync_req *fsync_req; struct sys_resp_header *resp_header; int resp_size; fsync_req = (struct fsync_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(fsync_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(fsync_req), rsc2str(fsync_req->req_rsc_const), fsync_req->req_rsc_const, fsync_req->req_type, fsync_req->req_type, fsync_req->req_size, fsync_req->req_size); if(fsync_req->req_size < sizeof(struct fsync_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX)", fsync_req->fd, fsync_req->fd); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, fsync_req, fsync_req->req_size); /* resp_header->resp_type = fsync_req->req_type; */ resp_header->resp_rsc_const = fsync_req->req_rsc_const; return resp_header; } int rscs_exec_fsync(void *request) { int ret; struct fsync_req *req = (struct fsync_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd); return ret; } struct iovec*rscs_post_fsync_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_ftruncate64_exec(void *req, enum arch client_arch) { struct ftruncate64_req *ftruncate64_req; struct sys_resp_header *resp_header; int resp_size; ftruncate64_req = (struct ftruncate64_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(ftruncate64_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(ftruncate64_req), rsc2str(ftruncate64_req->req_rsc_const), ftruncate64_req->req_rsc_const, ftruncate64_req->req_type, ftruncate64_req->req_type, ftruncate64_req->req_size, ftruncate64_req->req_size); if(ftruncate64_req->req_size < sizeof(struct ftruncate64_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX); length = %ld (0x%lX)", ftruncate64_req->fd, ftruncate64_req->fd, ftruncate64_req->length, ftruncate64_req->length); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, ftruncate64_req, ftruncate64_req->req_size); /* resp_header->resp_type = ftruncate64_req->req_type; */ resp_header->resp_rsc_const = ftruncate64_req->req_rsc_const; return resp_header; } int rscs_exec_ftruncate64(void *request) { int ret; struct ftruncate64_req *req = (struct ftruncate64_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd, req->length); return ret; } struct iovec*rscs_post_ftruncate64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_getdents64_exec(void *req, enum arch client_arch) { struct getdents64_req *getdents64_req; struct sys_resp_header *resp_header; int resp_size; getdents64_req = (struct getdents64_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(getdents64_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(getdents64_req), rsc2str(getdents64_req->req_rsc_const), getdents64_req->req_rsc_const, getdents64_req->req_type, getdents64_req->req_type, getdents64_req->req_size, getdents64_req->req_size); if(getdents64_req->req_size < sizeof(struct getdents64_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %u (0x%lX); dirp = %p (0x%lX); count = %u (0x%lX)", getdents64_req->fd, getdents64_req->fd, getdents64_req->dirp, getdents64_req->dirp, getdents64_req->count, getdents64_req->count); resp_size = sizeof(struct sys_resp_header); if(getdents64_req->dirp != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'count' argument. */ /* The client can have changed the value of unsigned int count if it was less than * the size of dirp into server arch. So If unsigned int count is equal * to this value I need to change it to the right value on client arch. */ if(getdents64_req->count == aconv_struct_dirent64_size(client_arch, my_arch)) { resp_size += aconv_struct_dirent64_size(my_arch, client_arch); } else { resp_size += getdents64_req->count; } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ getdents64_adjust_write_pointers(getdents64_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, getdents64_req, getdents64_req->req_size); /* resp_header->resp_type = getdents64_req->req_type; */ resp_header->resp_rsc_const = getdents64_req->req_rsc_const; return resp_header; } int rscs_exec_getdents64(void *request) { int ret; struct getdents64_req *req = (struct getdents64_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd, req->dirp, req->count); return ret; } struct iovec*rscs_post_getdents64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct getdents64_req *getdents64_req = (struct getdents64_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_struct_dirent64(getdents64_req->dirp, my_arch, client_arch, mem); mem += aconv_struct_dirent64_size(my_arch, client_arch); free(getdents64_req->dirp); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_getpeername_exec(void *req, enum arch client_arch) { struct getpeername_req *getpeername_req; struct sys_resp_header *resp_header; int resp_size; getpeername_req = (struct getpeername_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(getpeername_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(getpeername_req), rsc2str(getpeername_req->req_rsc_const), getpeername_req->req_rsc_const, getpeername_req->req_type, getpeername_req->req_type, getpeername_req->req_size, getpeername_req->req_size); if(getpeername_req->req_size < sizeof(struct getpeername_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: s = %ld (0x%lX); name = %p (0x%lX); namelen = %p (0x%lX)", getpeername_req->s, getpeername_req->s, getpeername_req->name, getpeername_req->name, getpeername_req->namelen, getpeername_req->namelen); /* Adjusts the read pointers of the request */ getpeername_adjust_read_pointers(getpeername_req); resp_size = sizeof(struct sys_resp_header); if(getpeername_req->namelen != NULL) { resp_size += aconv_socklen_t_size(my_arch, client_arch); } if(getpeername_req->name != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'namelen' argument. */ /* The client can have changed the value of socklen_t *namelen if it was less than * the size of name into server arch. So If socklen_t *namelen is equal * to this value I need to change it to the right value on client arch. */ if(*(getpeername_req->namelen) == aconv_struct_sockaddr_size(client_arch, my_arch)) { resp_size += aconv_struct_sockaddr_size(my_arch, client_arch); } else { resp_size += *(getpeername_req->namelen); } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ getpeername_adjust_write_pointers(getpeername_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, getpeername_req, getpeername_req->req_size); /* resp_header->resp_type = getpeername_req->req_type; */ resp_header->resp_rsc_const = getpeername_req->req_rsc_const; return resp_header; } int rscs_exec_getpeername(void *request) { int ret; struct getpeername_req *req = (struct getpeername_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->s, req->name, req->namelen); #else { unsigned long args[] = { (unsigned long)(req->s), (unsigned long)(req->name), (unsigned long)(req->namelen) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_getpeername_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct getpeername_req *getpeername_req = (struct getpeername_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_socklen_t(getpeername_req->namelen, my_arch, client_arch, mem); mem += aconv_socklen_t_size(my_arch, client_arch); aconv_struct_sockaddr(getpeername_req->name, my_arch, client_arch, mem); mem += aconv_struct_sockaddr_size(my_arch, client_arch); free(getpeername_req->name); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_getsockname_exec(void *req, enum arch client_arch) { struct getsockname_req *getsockname_req; struct sys_resp_header *resp_header; int resp_size; getsockname_req = (struct getsockname_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(getsockname_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(getsockname_req), rsc2str(getsockname_req->req_rsc_const), getsockname_req->req_rsc_const, getsockname_req->req_type, getsockname_req->req_type, getsockname_req->req_size, getsockname_req->req_size); if(getsockname_req->req_size < sizeof(struct getsockname_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: s = %ld (0x%lX); name = %p (0x%lX); namelen = %p (0x%lX)", getsockname_req->s, getsockname_req->s, getsockname_req->name, getsockname_req->name, getsockname_req->namelen, getsockname_req->namelen); /* Adjusts the read pointers of the request */ getsockname_adjust_read_pointers(getsockname_req); resp_size = sizeof(struct sys_resp_header); if(getsockname_req->namelen != NULL) { resp_size += aconv_socklen_t_size(my_arch, client_arch); } if(getsockname_req->name != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'namelen' argument. */ /* The client can have changed the value of socklen_t *namelen if it was less than * the size of name into server arch. So If socklen_t *namelen is equal * to this value I need to change it to the right value on client arch. */ if(*(getsockname_req->namelen) == aconv_struct_sockaddr_size(client_arch, my_arch)) { resp_size += aconv_struct_sockaddr_size(my_arch, client_arch); } else { resp_size += *(getsockname_req->namelen); } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ getsockname_adjust_write_pointers(getsockname_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, getsockname_req, getsockname_req->req_size); /* resp_header->resp_type = getsockname_req->req_type; */ resp_header->resp_rsc_const = getsockname_req->req_rsc_const; return resp_header; } int rscs_exec_getsockname(void *request) { int ret; struct getsockname_req *req = (struct getsockname_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->s, req->name, req->namelen); #else { unsigned long args[] = { (unsigned long)(req->s), (unsigned long)(req->name), (unsigned long)(req->namelen) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_getsockname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct getsockname_req *getsockname_req = (struct getsockname_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_socklen_t(getsockname_req->namelen, my_arch, client_arch, mem); mem += aconv_socklen_t_size(my_arch, client_arch); aconv_struct_sockaddr(getsockname_req->name, my_arch, client_arch, mem); mem += aconv_struct_sockaddr_size(my_arch, client_arch); free(getsockname_req->name); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_getsockopt_exec(void *req, enum arch client_arch) { struct getsockopt_req *getsockopt_req; struct sys_resp_header *resp_header; int resp_size; getsockopt_req = (struct getsockopt_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(getsockopt_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(getsockopt_req), rsc2str(getsockopt_req->req_rsc_const), getsockopt_req->req_rsc_const, getsockopt_req->req_type, getsockopt_req->req_type, getsockopt_req->req_size, getsockopt_req->req_size); if(getsockopt_req->req_size < sizeof(struct getsockopt_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: s = %ld (0x%lX); level = %ld (0x%lX); optname = %ld (0x%lX); optval = %p (0x%lX); optlen = %p (0x%lX)", getsockopt_req->s, getsockopt_req->s, getsockopt_req->level, getsockopt_req->level, getsockopt_req->optname, getsockopt_req->optname, getsockopt_req->optval, getsockopt_req->optval, getsockopt_req->optlen, getsockopt_req->optlen); /* Adjusts the read pointers of the request */ getsockopt_adjust_read_pointers(getsockopt_req); resp_size = sizeof(struct sys_resp_header); if(getsockopt_req->optlen != NULL) { resp_size += aconv_socklen_t_size(my_arch, client_arch); } if(getsockopt_req->optval != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'optlen' argument. */ /* The client can have changed the value of socklen_t *optlen if it was less than * the size of optval into server arch. So If socklen_t *optlen is equal * to this value I need to change it to the right value on client arch. */ if(*(getsockopt_req->optlen) == aconv_bytes_size(*(getsockopt_req->optlen), client_arch, my_arch)) { resp_size += aconv_bytes_size(*(getsockopt_req->optlen), my_arch, client_arch); } else { resp_size += *(getsockopt_req->optlen); } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ getsockopt_adjust_write_pointers(getsockopt_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, getsockopt_req, getsockopt_req->req_size); /* resp_header->resp_type = getsockopt_req->req_type; */ resp_header->resp_rsc_const = getsockopt_req->req_rsc_const; return resp_header; } int rscs_exec_getsockopt(void *request) { int ret; struct getsockopt_req *req = (struct getsockopt_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->s, req->level, req->optname, req->optval, req->optlen); #else { unsigned long args[] = { (unsigned long)(req->s), (unsigned long)(req->level), (unsigned long)(req->optname), (unsigned long)(req->optval), (unsigned long)(req->optlen) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_getsockopt_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct getsockopt_req *getsockopt_req = (struct getsockopt_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_socklen_t(getsockopt_req->optlen, my_arch, client_arch, mem); mem += aconv_socklen_t_size(my_arch, client_arch); aconv_bytes(getsockopt_req->optval, my_arch, client_arch, mem, *(getsockopt_req->optlen)); mem += aconv_bytes_size(*(getsockopt_req->optlen), my_arch, client_arch); free(getsockopt_req->optval); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_gettimeofday_exec(void *req, enum arch client_arch) { struct gettimeofday_req *gettimeofday_req; struct sys_resp_header *resp_header; int resp_size; gettimeofday_req = (struct gettimeofday_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(gettimeofday_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(gettimeofday_req), rsc2str(gettimeofday_req->req_rsc_const), gettimeofday_req->req_rsc_const, gettimeofday_req->req_type, gettimeofday_req->req_type, gettimeofday_req->req_size, gettimeofday_req->req_size); if(gettimeofday_req->req_size < sizeof(struct gettimeofday_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: tv = %p (0x%lX); tz = %p (0x%lX)", gettimeofday_req->tv, gettimeofday_req->tv, gettimeofday_req->tz, gettimeofday_req->tz); resp_size = sizeof(struct sys_resp_header); if(gettimeofday_req->tv != NULL) { resp_size += aconv_struct_timeval_size(my_arch, client_arch); } if(gettimeofday_req->tz != NULL) { resp_size += aconv_struct_timezone_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ gettimeofday_adjust_write_pointers(gettimeofday_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, gettimeofday_req, gettimeofday_req->req_size); /* resp_header->resp_type = gettimeofday_req->req_type; */ resp_header->resp_rsc_const = gettimeofday_req->req_rsc_const; return resp_header; } int rscs_exec_gettimeofday(void *request) { int ret; struct gettimeofday_req *req = (struct gettimeofday_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->tv, req->tz); return ret; } struct iovec*rscs_post_gettimeofday_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct gettimeofday_req *gettimeofday_req = (struct gettimeofday_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_struct_timeval(gettimeofday_req->tv, my_arch, client_arch, mem); mem += aconv_struct_timeval_size(my_arch, client_arch); free(gettimeofday_req->tv); aconv_struct_timezone(gettimeofday_req->tz, my_arch, client_arch, mem); mem += aconv_struct_timezone_size(my_arch, client_arch); free(gettimeofday_req->tz); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_getxattr_exec(void *req, enum arch client_arch) { struct getxattr_req *getxattr_req; struct sys_resp_header *resp_header; int resp_size; getxattr_req = (struct getxattr_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(getxattr_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(getxattr_req), rsc2str(getxattr_req->req_rsc_const), getxattr_req->req_rsc_const, getxattr_req->req_type, getxattr_req->req_type, getxattr_req->req_size, getxattr_req->req_size); if(getxattr_req->req_size < sizeof(struct getxattr_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); name = %p (0x%lX); value = %p (0x%lX); size = %ld (0x%lX)", getxattr_req->path, getxattr_req->path, getxattr_req->name, getxattr_req->name, getxattr_req->value, getxattr_req->value, getxattr_req->size, getxattr_req->size); /* Adjusts the read pointers of the request */ getxattr_adjust_read_pointers(getxattr_req); resp_size = sizeof(struct sys_resp_header); if(getxattr_req->value != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'size' argument. */ /* The client can have changed the value of size_t size if it was less than * the size of value into server arch. So If size_t size is equal * to this value I need to change it to the right value on client arch. */ if(getxattr_req->size == aconv_bytes_size(getxattr_req->size, client_arch, my_arch)) { resp_size += aconv_bytes_size(getxattr_req->size, my_arch, client_arch); } else { resp_size += getxattr_req->size; } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ getxattr_adjust_write_pointers(getxattr_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, getxattr_req, getxattr_req->req_size); /* resp_header->resp_type = getxattr_req->req_type; */ resp_header->resp_rsc_const = getxattr_req->req_rsc_const; return resp_header; } int rscs_exec_getxattr(void *request) { int ret; struct getxattr_req *req = (struct getxattr_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, req->name, req->value, req->size); return ret; } struct iovec*rscs_post_getxattr_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct getxattr_req *getxattr_req = (struct getxattr_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_bytes(getxattr_req->value, my_arch, client_arch, mem, getxattr_req->size); mem += aconv_bytes_size(getxattr_req->size, my_arch, client_arch); free(getxattr_req->value); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_lchown_exec(void *req, enum arch client_arch) { struct lchown_req *lchown_req; struct sys_resp_header *resp_header; int resp_size; lchown_req = (struct lchown_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(lchown_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(lchown_req), rsc2str(lchown_req->req_rsc_const), lchown_req->req_rsc_const, lchown_req->req_type, lchown_req->req_type, lchown_req->req_size, lchown_req->req_size); if(lchown_req->req_size < sizeof(struct lchown_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", lchown_req->path, lchown_req->path, lchown_req->owner, lchown_req->owner, lchown_req->group, lchown_req->group); /* Adjusts the read pointers of the request */ lchown_adjust_read_pointers(lchown_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, lchown_req, lchown_req->req_size); /* resp_header->resp_type = lchown_req->req_type; */ resp_header->resp_rsc_const = lchown_req->req_rsc_const; return resp_header; } int rscs_exec_lchown(void *request) { int ret; struct lchown_req *req = (struct lchown_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, req->owner, req->group); return ret; } struct iovec*rscs_post_lchown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_lchown32_exec(void *req, enum arch client_arch) { struct lchown32_req *lchown32_req; struct sys_resp_header *resp_header; int resp_size; lchown32_req = (struct lchown32_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(lchown32_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(lchown32_req), rsc2str(lchown32_req->req_rsc_const), lchown32_req->req_rsc_const, lchown32_req->req_type, lchown32_req->req_type, lchown32_req->req_size, lchown32_req->req_size); if(lchown32_req->req_size < sizeof(struct lchown32_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); owner = %ld (0x%lX); group = %ld (0x%lX)", lchown32_req->path, lchown32_req->path, lchown32_req->owner, lchown32_req->owner, lchown32_req->group, lchown32_req->group); /* Adjusts the read pointers of the request */ lchown32_adjust_read_pointers(lchown32_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, lchown32_req, lchown32_req->req_size); /* resp_header->resp_type = lchown32_req->req_type; */ resp_header->resp_rsc_const = lchown32_req->req_rsc_const; return resp_header; } int rscs_exec_lchown32(void *request) { int ret; struct lchown32_req *req = (struct lchown32_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, req->owner, req->group); return ret; } struct iovec*rscs_post_lchown32_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_lgetxattr_exec(void *req, enum arch client_arch) { struct lgetxattr_req *lgetxattr_req; struct sys_resp_header *resp_header; int resp_size; lgetxattr_req = (struct lgetxattr_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(lgetxattr_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(lgetxattr_req), rsc2str(lgetxattr_req->req_rsc_const), lgetxattr_req->req_rsc_const, lgetxattr_req->req_type, lgetxattr_req->req_type, lgetxattr_req->req_size, lgetxattr_req->req_size); if(lgetxattr_req->req_size < sizeof(struct lgetxattr_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); name = %p (0x%lX); value = %p (0x%lX); size = %ld (0x%lX)", lgetxattr_req->path, lgetxattr_req->path, lgetxattr_req->name, lgetxattr_req->name, lgetxattr_req->value, lgetxattr_req->value, lgetxattr_req->size, lgetxattr_req->size); /* Adjusts the read pointers of the request */ lgetxattr_adjust_read_pointers(lgetxattr_req); resp_size = sizeof(struct sys_resp_header); if(lgetxattr_req->value != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'size' argument. */ /* The client can have changed the value of size_t size if it was less than * the size of value into server arch. So If size_t size is equal * to this value I need to change it to the right value on client arch. */ if(lgetxattr_req->size == aconv_bytes_size(lgetxattr_req->size, client_arch, my_arch)) { resp_size += aconv_bytes_size(lgetxattr_req->size, my_arch, client_arch); } else { resp_size += lgetxattr_req->size; } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ lgetxattr_adjust_write_pointers(lgetxattr_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, lgetxattr_req, lgetxattr_req->req_size); /* resp_header->resp_type = lgetxattr_req->req_type; */ resp_header->resp_rsc_const = lgetxattr_req->req_rsc_const; return resp_header; } int rscs_exec_lgetxattr(void *request) { int ret; struct lgetxattr_req *req = (struct lgetxattr_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, req->name, req->value, req->size); return ret; } struct iovec*rscs_post_lgetxattr_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct lgetxattr_req *lgetxattr_req = (struct lgetxattr_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_bytes(lgetxattr_req->value, my_arch, client_arch, mem, lgetxattr_req->size); mem += aconv_bytes_size(lgetxattr_req->size, my_arch, client_arch); free(lgetxattr_req->value); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_link_exec(void *req, enum arch client_arch) { struct link_req *link_req; struct sys_resp_header *resp_header; int resp_size; link_req = (struct link_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(link_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(link_req), rsc2str(link_req->req_rsc_const), link_req->req_rsc_const, link_req->req_type, link_req->req_type, link_req->req_size, link_req->req_size); if(link_req->req_size < sizeof(struct link_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: oldpath = %p (0x%lX); newpath = %p (0x%lX)", link_req->oldpath, link_req->oldpath, link_req->newpath, link_req->newpath); /* Adjusts the read pointers of the request */ link_adjust_read_pointers(link_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, link_req, link_req->req_size); /* resp_header->resp_type = link_req->req_type; */ resp_header->resp_rsc_const = link_req->req_rsc_const; return resp_header; } int rscs_exec_link(void *request) { int ret; struct link_req *req = (struct link_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->oldpath, req->newpath); return ret; } struct iovec*rscs_post_link_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_listen_exec(void *req, enum arch client_arch) { struct listen_req *listen_req; struct sys_resp_header *resp_header; int resp_size; listen_req = (struct listen_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(listen_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(listen_req), rsc2str(listen_req->req_rsc_const), listen_req->req_rsc_const, listen_req->req_type, listen_req->req_type, listen_req->req_size, listen_req->req_size); if(listen_req->req_size < sizeof(struct listen_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: sockfd = %ld (0x%lX); backlog = %ld (0x%lX)", listen_req->sockfd, listen_req->sockfd, listen_req->backlog, listen_req->backlog); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, listen_req, listen_req->req_size); /* resp_header->resp_type = listen_req->req_type; */ resp_header->resp_rsc_const = listen_req->req_rsc_const; return resp_header; } int rscs_exec_listen(void *request) { int ret; struct listen_req *req = (struct listen_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->sockfd, req->backlog); #else { unsigned long args[] = { (unsigned long)(req->sockfd), (unsigned long)(req->backlog) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_listen_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_lseek_exec(void *req, enum arch client_arch) { struct lseek_req *lseek_req; struct sys_resp_header *resp_header; int resp_size; lseek_req = (struct lseek_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(lseek_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(lseek_req), rsc2str(lseek_req->req_rsc_const), lseek_req->req_rsc_const, lseek_req->req_type, lseek_req->req_type, lseek_req->req_size, lseek_req->req_size); if(lseek_req->req_size < sizeof(struct lseek_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fildes = %ld (0x%lX); offset = %ld (0x%lX); whence = %ld (0x%lX)", lseek_req->fildes, lseek_req->fildes, lseek_req->offset, lseek_req->offset, lseek_req->whence, lseek_req->whence); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, lseek_req, lseek_req->req_size); /* resp_header->resp_type = lseek_req->req_type; */ resp_header->resp_rsc_const = lseek_req->req_rsc_const; return resp_header; } int rscs_exec_lseek(void *request) { int ret; struct lseek_req *req = (struct lseek_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fildes, req->offset, req->whence); return ret; } struct iovec*rscs_post_lseek_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_lstat64_exec(void *req, enum arch client_arch) { struct lstat64_req *lstat64_req; struct sys_resp_header *resp_header; int resp_size; lstat64_req = (struct lstat64_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(lstat64_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(lstat64_req), rsc2str(lstat64_req->req_rsc_const), lstat64_req->req_rsc_const, lstat64_req->req_type, lstat64_req->req_type, lstat64_req->req_size, lstat64_req->req_size); if(lstat64_req->req_size < sizeof(struct lstat64_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); buf = %p (0x%lX)", lstat64_req->path, lstat64_req->path, lstat64_req->buf, lstat64_req->buf); /* Adjusts the read pointers of the request */ lstat64_adjust_read_pointers(lstat64_req); resp_size = sizeof(struct sys_resp_header); if(lstat64_req->buf != NULL) { resp_size += aconv_struct_stat64_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ lstat64_adjust_write_pointers(lstat64_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, lstat64_req, lstat64_req->req_size); /* resp_header->resp_type = lstat64_req->req_type; */ resp_header->resp_rsc_const = lstat64_req->req_rsc_const; return resp_header; } int rscs_exec_lstat64(void *request) { int ret; struct lstat64_req *req = (struct lstat64_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, req->buf); return ret; } struct iovec*rscs_post_lstat64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct lstat64_req *lstat64_req = (struct lstat64_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_struct_stat64(lstat64_req->buf, my_arch, client_arch, mem); mem += aconv_struct_stat64_size(my_arch, client_arch); free(lstat64_req->buf); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_mkdir_exec(void *req, enum arch client_arch) { struct mkdir_req *mkdir_req; struct sys_resp_header *resp_header; int resp_size; mkdir_req = (struct mkdir_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(mkdir_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(mkdir_req), rsc2str(mkdir_req->req_rsc_const), mkdir_req->req_rsc_const, mkdir_req->req_type, mkdir_req->req_type, mkdir_req->req_size, mkdir_req->req_size); if(mkdir_req->req_size < sizeof(struct mkdir_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: pathname = %p (0x%lX); mode = %ld (0x%lX)", mkdir_req->pathname, mkdir_req->pathname, mkdir_req->mode, mkdir_req->mode); /* Adjusts the read pointers of the request */ mkdir_adjust_read_pointers(mkdir_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, mkdir_req, mkdir_req->req_size); /* resp_header->resp_type = mkdir_req->req_type; */ resp_header->resp_rsc_const = mkdir_req->req_rsc_const; return resp_header; } int rscs_exec_mkdir(void *request) { int ret; struct mkdir_req *req = (struct mkdir_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->pathname, req->mode); return ret; } struct iovec*rscs_post_mkdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_mount_exec(void *req, enum arch client_arch) { struct mount_req *mount_req; struct sys_resp_header *resp_header; int resp_size; mount_req = (struct mount_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(mount_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(mount_req), rsc2str(mount_req->req_rsc_const), mount_req->req_rsc_const, mount_req->req_type, mount_req->req_type, mount_req->req_size, mount_req->req_size); if(mount_req->req_size < sizeof(struct mount_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: source = %p (0x%lX); target = %p (0x%lX); filesystemtype = %p (0x%lX); mountflags = %lu (0x%lX); data = %p (0x%lX)", mount_req->source, mount_req->source, mount_req->target, mount_req->target, mount_req->filesystemtype, mount_req->filesystemtype, mount_req->mountflags, mount_req->mountflags, mount_req->data, mount_req->data); /* Adjusts the read pointers of the request */ mount_adjust_read_pointers(mount_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, mount_req, mount_req->req_size); /* resp_header->resp_type = mount_req->req_type; */ resp_header->resp_rsc_const = mount_req->req_rsc_const; return resp_header; } int rscs_exec_mount(void *request) { int ret; struct mount_req *req = (struct mount_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->source, req->target, req->filesystemtype, req->mountflags, req->data); return ret; } struct iovec*rscs_post_mount_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_open_exec(void *req, enum arch client_arch) { struct open_req *open_req; struct sys_resp_header *resp_header; int resp_size; open_req = (struct open_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(open_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(open_req), rsc2str(open_req->req_rsc_const), open_req->req_rsc_const, open_req->req_type, open_req->req_type, open_req->req_size, open_req->req_size); if(open_req->req_size < sizeof(struct open_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: pathname = %p (0x%lX); flags = %ld (0x%lX)", open_req->pathname, open_req->pathname, open_req->flags, open_req->flags); /* Adjusts the read pointers of the request */ open_adjust_read_pointers(open_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, open_req, open_req->req_size); /* resp_header->resp_type = open_req->req_type; */ resp_header->resp_rsc_const = open_req->req_rsc_const; return resp_header; } int rscs_exec_open(void *request) { int ret; struct open_req *req = (struct open_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->pathname, req->flags); return ret; } struct iovec*rscs_post_open_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_pread64_exec(void *req, enum arch client_arch) { struct pread64_req *pread64_req; struct sys_resp_header *resp_header; int resp_size; pread64_req = (struct pread64_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(pread64_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(pread64_req), rsc2str(pread64_req->req_rsc_const), pread64_req->req_rsc_const, pread64_req->req_type, pread64_req->req_type, pread64_req->req_size, pread64_req->req_size); if(pread64_req->req_size < sizeof(struct pread64_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX); buf = %p (0x%lX); count = %ld (0x%lX); offset = %ld (0x%lX)", pread64_req->fd, pread64_req->fd, pread64_req->buf, pread64_req->buf, pread64_req->count, pread64_req->count, pread64_req->offset, pread64_req->offset); resp_size = sizeof(struct sys_resp_header); if(pread64_req->buf != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'count' argument. */ /* The client can have changed the value of size_t count if it was less than * the size of buf into server arch. So If size_t count is equal * to this value I need to change it to the right value on client arch. */ if(pread64_req->count == aconv_bytes_size(pread64_req->count, client_arch, my_arch)) { resp_size += aconv_bytes_size(pread64_req->count, my_arch, client_arch); } else { resp_size += pread64_req->count; } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ pread64_adjust_write_pointers(pread64_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, pread64_req, pread64_req->req_size); /* resp_header->resp_type = pread64_req->req_type; */ resp_header->resp_rsc_const = pread64_req->req_rsc_const; return resp_header; } int rscs_exec_pread64(void *request) { int ret; struct pread64_req *req = (struct pread64_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd, req->buf, req->count, req->offset); return ret; } struct iovec*rscs_post_pread64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct pread64_req *pread64_req = (struct pread64_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_bytes(pread64_req->buf, my_arch, client_arch, mem, pread64_req->count); mem += aconv_bytes_size(pread64_req->count, my_arch, client_arch); free(pread64_req->buf); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_pwrite64_exec(void *req, enum arch client_arch) { struct pwrite64_req *pwrite64_req; struct sys_resp_header *resp_header; int resp_size; pwrite64_req = (struct pwrite64_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(pwrite64_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(pwrite64_req), rsc2str(pwrite64_req->req_rsc_const), pwrite64_req->req_rsc_const, pwrite64_req->req_type, pwrite64_req->req_type, pwrite64_req->req_size, pwrite64_req->req_size); if(pwrite64_req->req_size < sizeof(struct pwrite64_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX); buf = %p (0x%lX); count = %ld (0x%lX); offset = %ld (0x%lX)", pwrite64_req->fd, pwrite64_req->fd, pwrite64_req->buf, pwrite64_req->buf, pwrite64_req->count, pwrite64_req->count, pwrite64_req->offset, pwrite64_req->offset); /* Adjusts the read pointers of the request */ pwrite64_adjust_read_pointers(pwrite64_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, pwrite64_req, pwrite64_req->req_size); /* resp_header->resp_type = pwrite64_req->req_type; */ resp_header->resp_rsc_const = pwrite64_req->req_rsc_const; return resp_header; } int rscs_exec_pwrite64(void *request) { int ret; struct pwrite64_req *req = (struct pwrite64_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd, req->buf, req->count, req->offset); return ret; } struct iovec*rscs_post_pwrite64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_read_exec(void *req, enum arch client_arch) { struct read_req *read_req; struct sys_resp_header *resp_header; int resp_size; read_req = (struct read_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(read_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(read_req), rsc2str(read_req->req_rsc_const), read_req->req_rsc_const, read_req->req_type, read_req->req_type, read_req->req_size, read_req->req_size); if(read_req->req_size < sizeof(struct read_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX); buf = %p (0x%lX); count = %ld (0x%lX)", read_req->fd, read_req->fd, read_req->buf, read_req->buf, read_req->count, read_req->count); resp_size = sizeof(struct sys_resp_header); if(read_req->buf != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'count' argument. */ /* The client can have changed the value of size_t count if it was less than * the size of buf into server arch. So If size_t count is equal * to this value I need to change it to the right value on client arch. */ if(read_req->count == aconv_bytes_size(read_req->count, client_arch, my_arch)) { resp_size += aconv_bytes_size(read_req->count, my_arch, client_arch); } else { resp_size += read_req->count; } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ read_adjust_write_pointers(read_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, read_req, read_req->req_size); /* resp_header->resp_type = read_req->req_type; */ resp_header->resp_rsc_const = read_req->req_rsc_const; return resp_header; } int rscs_exec_read(void *request) { int ret; struct read_req *req = (struct read_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd, req->buf, req->count); return ret; } struct iovec*rscs_post_read_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct read_req *read_req = (struct read_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_bytes(read_req->buf, my_arch, client_arch, mem, read_req->count); mem += aconv_bytes_size(read_req->count, my_arch, client_arch); free(read_req->buf); } /* If the right size of the buffer is returned by the system call, * I use it to send back only the part of the buffer with data */ /* resp->resp_size = sizeof(struct sys_resp_header); */ /* Note: I suppose that the buffer is the last data into the response, * So I can subtract the unused buffer space, otherwise this doesn't * work. */ if( resp->resp_retval >= 0 ) { if(((struct read_req *)req)->buf != NULL) resp->resp_size -= (((struct read_req *)req)->count - resp->resp_retval); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_readlink_exec(void *req, enum arch client_arch) { struct readlink_req *readlink_req; struct sys_resp_header *resp_header; int resp_size; readlink_req = (struct readlink_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(readlink_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(readlink_req), rsc2str(readlink_req->req_rsc_const), readlink_req->req_rsc_const, readlink_req->req_type, readlink_req->req_type, readlink_req->req_size, readlink_req->req_size); if(readlink_req->req_size < sizeof(struct readlink_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); buf = %p (0x%lX); bufsiz = %ld (0x%lX)", readlink_req->path, readlink_req->path, readlink_req->buf, readlink_req->buf, readlink_req->bufsiz, readlink_req->bufsiz); /* Adjusts the read pointers of the request */ readlink_adjust_read_pointers(readlink_req); resp_size = sizeof(struct sys_resp_header); if(readlink_req->buf != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'bufsiz' argument. */ /* The client can have changed the value of size_t bufsiz if it was less than * the size of buf into server arch. So If size_t bufsiz is equal * to this value I need to change it to the right value on client arch. */ if(readlink_req->bufsiz == readlink_req->bufsiz) { resp_size += readlink_req->bufsiz; } else { resp_size += readlink_req->bufsiz; } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ readlink_adjust_write_pointers(readlink_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, readlink_req, readlink_req->req_size); /* resp_header->resp_type = readlink_req->req_type; */ resp_header->resp_rsc_const = readlink_req->req_rsc_const; return resp_header; } int rscs_exec_readlink(void *request) { int ret; struct readlink_req *req = (struct readlink_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, req->buf, req->bufsiz); return ret; } struct iovec*rscs_post_readlink_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct readlink_req *readlink_req = (struct readlink_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_string(readlink_req->buf, my_arch, client_arch, mem); mem += readlink_req->bufsiz; free(readlink_req->buf); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_recv_exec(void *req, enum arch client_arch) { struct recv_req *recv_req; struct sys_resp_header *resp_header; int resp_size; recv_req = (struct recv_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(recv_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(recv_req), rsc2str(recv_req->req_rsc_const), recv_req->req_rsc_const, recv_req->req_type, recv_req->req_type, recv_req->req_size, recv_req->req_size); if(recv_req->req_size < sizeof(struct recv_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: s = %ld (0x%lX); buf = %p (0x%lX); len = %ld (0x%lX); flags = %ld (0x%lX)", recv_req->s, recv_req->s, recv_req->buf, recv_req->buf, recv_req->len, recv_req->len, recv_req->flags, recv_req->flags); resp_size = sizeof(struct sys_resp_header); if(recv_req->buf != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'len' argument. */ /* The client can have changed the value of size_t len if it was less than * the size of buf into server arch. So If size_t len is equal * to this value I need to change it to the right value on client arch. */ if(recv_req->len == aconv_bytes_size(recv_req->len, client_arch, my_arch)) { resp_size += aconv_bytes_size(recv_req->len, my_arch, client_arch); } else { resp_size += recv_req->len; } } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ recv_adjust_write_pointers(recv_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, recv_req, recv_req->req_size); /* resp_header->resp_type = recv_req->req_type; */ resp_header->resp_rsc_const = recv_req->req_rsc_const; return resp_header; } int rscs_exec_recv(void *request) { int ret; struct recv_req *req = (struct recv_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->s, req->buf, req->len, req->flags); #else { unsigned long args[] = { (unsigned long)(req->s), (unsigned long)(req->buf), (unsigned long)(req->len), (unsigned long)(req->flags) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_recv_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct recv_req *recv_req = (struct recv_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_bytes(recv_req->buf, my_arch, client_arch, mem, recv_req->len); mem += aconv_bytes_size(recv_req->len, my_arch, client_arch); free(recv_req->buf); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_recvfrom_exec(void *req, enum arch client_arch) { struct recvfrom_req *recvfrom_req; struct sys_resp_header *resp_header; int resp_size; recvfrom_req = (struct recvfrom_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(recvfrom_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(recvfrom_req), rsc2str(recvfrom_req->req_rsc_const), recvfrom_req->req_rsc_const, recvfrom_req->req_type, recvfrom_req->req_type, recvfrom_req->req_size, recvfrom_req->req_size); if(recvfrom_req->req_size < sizeof(struct recvfrom_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: s = %ld (0x%lX); buf = %p (0x%lX); len = %ld (0x%lX); flags = %ld (0x%lX); from = %p (0x%lX); fromlen = %p (0x%lX)", recvfrom_req->s, recvfrom_req->s, recvfrom_req->buf, recvfrom_req->buf, recvfrom_req->len, recvfrom_req->len, recvfrom_req->flags, recvfrom_req->flags, recvfrom_req->from, recvfrom_req->from, recvfrom_req->fromlen, recvfrom_req->fromlen); /* Adjusts the read pointers of the request */ recvfrom_adjust_read_pointers(recvfrom_req); resp_size = sizeof(struct sys_resp_header); if(recvfrom_req->buf != NULL) { /* Here a don't use a aconv_*_size() function, because the size * of the pointed memory is given by 'len' argument. */ /* The client can have changed the value of size_t len if it was less than * the size of buf into server arch. So If size_t len is equal * to this value I need to change it to the right value on client arch. */ if(recvfrom_req->len == aconv_bytes_size(recvfrom_req->len, client_arch, my_arch)) { resp_size += aconv_bytes_size(recvfrom_req->len, my_arch, client_arch); } else { resp_size += recvfrom_req->len; } } if(recvfrom_req->fromlen != NULL) { resp_size += aconv_socklen_t_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ recvfrom_adjust_write_pointers(recvfrom_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, recvfrom_req, recvfrom_req->req_size); /* resp_header->resp_type = recvfrom_req->req_type; */ resp_header->resp_rsc_const = recvfrom_req->req_rsc_const; return resp_header; } int rscs_exec_recvfrom(void *request) { int ret; struct recvfrom_req *req = (struct recvfrom_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->s, req->buf, req->len, req->flags, req->from, req->fromlen); #else { unsigned long args[] = { (unsigned long)(req->s), (unsigned long)(req->buf), (unsigned long)(req->len), (unsigned long)(req->flags), (unsigned long)(req->from), (unsigned long)(req->fromlen) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_recvfrom_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct recvfrom_req *recvfrom_req = (struct recvfrom_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_bytes(recvfrom_req->buf, my_arch, client_arch, mem, recvfrom_req->len); mem += aconv_bytes_size(recvfrom_req->len, my_arch, client_arch); free(recvfrom_req->buf); aconv_socklen_t(recvfrom_req->fromlen, my_arch, client_arch, mem); mem += aconv_socklen_t_size(my_arch, client_arch); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_rename_exec(void *req, enum arch client_arch) { struct rename_req *rename_req; struct sys_resp_header *resp_header; int resp_size; rename_req = (struct rename_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(rename_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(rename_req), rsc2str(rename_req->req_rsc_const), rename_req->req_rsc_const, rename_req->req_type, rename_req->req_type, rename_req->req_size, rename_req->req_size); if(rename_req->req_size < sizeof(struct rename_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: oldpath = %p (0x%lX); newpath = %p (0x%lX)", rename_req->oldpath, rename_req->oldpath, rename_req->newpath, rename_req->newpath); /* Adjusts the read pointers of the request */ rename_adjust_read_pointers(rename_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, rename_req, rename_req->req_size); /* resp_header->resp_type = rename_req->req_type; */ resp_header->resp_rsc_const = rename_req->req_rsc_const; return resp_header; } int rscs_exec_rename(void *request) { int ret; struct rename_req *req = (struct rename_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->oldpath, req->newpath); return ret; } struct iovec*rscs_post_rename_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_rmdir_exec(void *req, enum arch client_arch) { struct rmdir_req *rmdir_req; struct sys_resp_header *resp_header; int resp_size; rmdir_req = (struct rmdir_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(rmdir_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(rmdir_req), rsc2str(rmdir_req->req_rsc_const), rmdir_req->req_rsc_const, rmdir_req->req_type, rmdir_req->req_type, rmdir_req->req_size, rmdir_req->req_size); if(rmdir_req->req_size < sizeof(struct rmdir_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: pathname = %p (0x%lX)", rmdir_req->pathname, rmdir_req->pathname); /* Adjusts the read pointers of the request */ rmdir_adjust_read_pointers(rmdir_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, rmdir_req, rmdir_req->req_size); /* resp_header->resp_type = rmdir_req->req_type; */ resp_header->resp_rsc_const = rmdir_req->req_rsc_const; return resp_header; } int rscs_exec_rmdir(void *request) { int ret; struct rmdir_req *req = (struct rmdir_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->pathname); return ret; } struct iovec*rscs_post_rmdir_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_send_exec(void *req, enum arch client_arch) { struct send_req *send_req; struct sys_resp_header *resp_header; int resp_size; send_req = (struct send_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(send_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(send_req), rsc2str(send_req->req_rsc_const), send_req->req_rsc_const, send_req->req_type, send_req->req_type, send_req->req_size, send_req->req_size); if(send_req->req_size < sizeof(struct send_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: s = %ld (0x%lX); buf = %p (0x%lX); len = %ld (0x%lX); flags = %ld (0x%lX)", send_req->s, send_req->s, send_req->buf, send_req->buf, send_req->len, send_req->len, send_req->flags, send_req->flags); /* Adjusts the read pointers of the request */ send_adjust_read_pointers(send_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, send_req, send_req->req_size); /* resp_header->resp_type = send_req->req_type; */ resp_header->resp_rsc_const = send_req->req_rsc_const; return resp_header; } int rscs_exec_send(void *request) { int ret; struct send_req *req = (struct send_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->s, req->buf, req->len, req->flags); #else { unsigned long args[] = { (unsigned long)(req->s), (unsigned long)(req->buf), (unsigned long)(req->len), (unsigned long)(req->flags) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_send_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_sendto_exec(void *req, enum arch client_arch) { struct sendto_req *sendto_req; struct sys_resp_header *resp_header; int resp_size; sendto_req = (struct sendto_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(sendto_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(sendto_req), rsc2str(sendto_req->req_rsc_const), sendto_req->req_rsc_const, sendto_req->req_type, sendto_req->req_type, sendto_req->req_size, sendto_req->req_size); if(sendto_req->req_size < sizeof(struct sendto_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: s = %ld (0x%lX); buf = %p (0x%lX); len = %ld (0x%lX); flags = %ld (0x%lX); to = %p (0x%lX); tolen = %ld (0x%lX)", sendto_req->s, sendto_req->s, sendto_req->buf, sendto_req->buf, sendto_req->len, sendto_req->len, sendto_req->flags, sendto_req->flags, sendto_req->to, sendto_req->to, sendto_req->tolen, sendto_req->tolen); /* Adjusts the read pointers of the request */ sendto_adjust_read_pointers(sendto_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, sendto_req, sendto_req->req_size); /* resp_header->resp_type = sendto_req->req_type; */ resp_header->resp_rsc_const = sendto_req->req_rsc_const; return resp_header; } int rscs_exec_sendto(void *request) { int ret; struct sendto_req *req = (struct sendto_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->s, req->buf, req->len, req->flags, req->to, req->tolen); #else { unsigned long args[] = { (unsigned long)(req->s), (unsigned long)(req->buf), (unsigned long)(req->len), (unsigned long)(req->flags), (unsigned long)(req->to), (unsigned long)(req->tolen) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_sendto_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_setdomainname_exec(void *req, enum arch client_arch) { struct setdomainname_req *setdomainname_req; struct sys_resp_header *resp_header; int resp_size; setdomainname_req = (struct setdomainname_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(setdomainname_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(setdomainname_req), rsc2str(setdomainname_req->req_rsc_const), setdomainname_req->req_rsc_const, setdomainname_req->req_type, setdomainname_req->req_type, setdomainname_req->req_size, setdomainname_req->req_size); if(setdomainname_req->req_size < sizeof(struct setdomainname_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: name = %p (0x%lX); len = %ld (0x%lX)", setdomainname_req->name, setdomainname_req->name, setdomainname_req->len, setdomainname_req->len); /* Adjusts the read pointers of the request */ setdomainname_adjust_read_pointers(setdomainname_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, setdomainname_req, setdomainname_req->req_size); /* resp_header->resp_type = setdomainname_req->req_type; */ resp_header->resp_rsc_const = setdomainname_req->req_rsc_const; return resp_header; } int rscs_exec_setdomainname(void *request) { int ret; struct setdomainname_req *req = (struct setdomainname_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->name, req->len); return ret; } struct iovec*rscs_post_setdomainname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_sethostname_exec(void *req, enum arch client_arch) { struct sethostname_req *sethostname_req; struct sys_resp_header *resp_header; int resp_size; sethostname_req = (struct sethostname_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(sethostname_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(sethostname_req), rsc2str(sethostname_req->req_rsc_const), sethostname_req->req_rsc_const, sethostname_req->req_type, sethostname_req->req_type, sethostname_req->req_size, sethostname_req->req_size); if(sethostname_req->req_size < sizeof(struct sethostname_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: name = %p (0x%lX); len = %ld (0x%lX)", sethostname_req->name, sethostname_req->name, sethostname_req->len, sethostname_req->len); /* Adjusts the read pointers of the request */ sethostname_adjust_read_pointers(sethostname_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, sethostname_req, sethostname_req->req_size); /* resp_header->resp_type = sethostname_req->req_type; */ resp_header->resp_rsc_const = sethostname_req->req_rsc_const; return resp_header; } int rscs_exec_sethostname(void *request) { int ret; struct sethostname_req *req = (struct sethostname_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->name, req->len); return ret; } struct iovec*rscs_post_sethostname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_setsockopt_exec(void *req, enum arch client_arch) { struct setsockopt_req *setsockopt_req; struct sys_resp_header *resp_header; int resp_size; setsockopt_req = (struct setsockopt_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(setsockopt_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(setsockopt_req), rsc2str(setsockopt_req->req_rsc_const), setsockopt_req->req_rsc_const, setsockopt_req->req_type, setsockopt_req->req_type, setsockopt_req->req_size, setsockopt_req->req_size); if(setsockopt_req->req_size < sizeof(struct setsockopt_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: s = %ld (0x%lX); level = %ld (0x%lX); optname = %ld (0x%lX); optval = %p (0x%lX); optlen = %ld (0x%lX)", setsockopt_req->s, setsockopt_req->s, setsockopt_req->level, setsockopt_req->level, setsockopt_req->optname, setsockopt_req->optname, setsockopt_req->optval, setsockopt_req->optval, setsockopt_req->optlen, setsockopt_req->optlen); /* Adjusts the read pointers of the request */ setsockopt_adjust_read_pointers(setsockopt_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, setsockopt_req, setsockopt_req->req_size); /* resp_header->resp_type = setsockopt_req->req_type; */ resp_header->resp_rsc_const = setsockopt_req->req_rsc_const; return resp_header; } int rscs_exec_setsockopt(void *request) { int ret; struct setsockopt_req *req = (struct setsockopt_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->s, req->level, req->optname, req->optval, req->optlen); #else { unsigned long args[] = { (unsigned long)(req->s), (unsigned long)(req->level), (unsigned long)(req->optname), (unsigned long)(req->optval), (unsigned long)(req->optlen) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_setsockopt_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_settimeofday_exec(void *req, enum arch client_arch) { struct settimeofday_req *settimeofday_req; struct sys_resp_header *resp_header; int resp_size; settimeofday_req = (struct settimeofday_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(settimeofday_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(settimeofday_req), rsc2str(settimeofday_req->req_rsc_const), settimeofday_req->req_rsc_const, settimeofday_req->req_type, settimeofday_req->req_type, settimeofday_req->req_size, settimeofday_req->req_size); if(settimeofday_req->req_size < sizeof(struct settimeofday_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: tv = %p (0x%lX); tz = %p (0x%lX)", settimeofday_req->tv, settimeofday_req->tv, settimeofday_req->tz, settimeofday_req->tz); /* Adjusts the read pointers of the request */ settimeofday_adjust_read_pointers(settimeofday_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, settimeofday_req, settimeofday_req->req_size); /* resp_header->resp_type = settimeofday_req->req_type; */ resp_header->resp_rsc_const = settimeofday_req->req_rsc_const; return resp_header; } int rscs_exec_settimeofday(void *request) { int ret; struct settimeofday_req *req = (struct settimeofday_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->tv, req->tz); return ret; } struct iovec*rscs_post_settimeofday_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_shutdown_exec(void *req, enum arch client_arch) { struct shutdown_req *shutdown_req; struct sys_resp_header *resp_header; int resp_size; shutdown_req = (struct shutdown_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(shutdown_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(shutdown_req), rsc2str(shutdown_req->req_rsc_const), shutdown_req->req_rsc_const, shutdown_req->req_type, shutdown_req->req_type, shutdown_req->req_size, shutdown_req->req_size); if(shutdown_req->req_size < sizeof(struct shutdown_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: s = %ld (0x%lX); how = %ld (0x%lX)", shutdown_req->s, shutdown_req->s, shutdown_req->how, shutdown_req->how); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, shutdown_req, shutdown_req->req_size); /* resp_header->resp_type = shutdown_req->req_type; */ resp_header->resp_rsc_const = shutdown_req->req_rsc_const; return resp_header; } int rscs_exec_shutdown(void *request) { int ret; struct shutdown_req *req = (struct shutdown_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->s, req->how); #else { unsigned long args[] = { (unsigned long)(req->s), (unsigned long)(req->how) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_shutdown_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_socket_exec(void *req, enum arch client_arch) { struct socket_req *socket_req; struct sys_resp_header *resp_header; int resp_size; socket_req = (struct socket_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(socket_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(socket_req), rsc2str(socket_req->req_rsc_const), socket_req->req_rsc_const, socket_req->req_type, socket_req->req_type, socket_req->req_size, socket_req->req_size); if(socket_req->req_size < sizeof(struct socket_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: domain = %ld (0x%lX); type = %ld (0x%lX); protocol = %ld (0x%lX)", socket_req->domain, socket_req->domain, socket_req->type, socket_req->type, socket_req->protocol, socket_req->protocol); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, socket_req, socket_req->req_size); /* resp_header->resp_type = socket_req->req_type; */ resp_header->resp_rsc_const = socket_req->req_rsc_const; return resp_header; } int rscs_exec_socket(void *request) { int ret; struct socket_req *req = (struct socket_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); #ifdef __x86_64__ ret = syscall(nr_and_sys->nr, req->domain, req->type, req->protocol); #else { unsigned long args[] = { (unsigned long)(req->domain), (unsigned long)(req->type), (unsigned long)(req->protocol) }; ret = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } #endif return ret; } struct iovec*rscs_post_socket_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_stat64_exec(void *req, enum arch client_arch) { struct stat64_req *stat64_req; struct sys_resp_header *resp_header; int resp_size; stat64_req = (struct stat64_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(stat64_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(stat64_req), rsc2str(stat64_req->req_rsc_const), stat64_req->req_rsc_const, stat64_req->req_type, stat64_req->req_type, stat64_req->req_size, stat64_req->req_size); if(stat64_req->req_size < sizeof(struct stat64_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); buf = %p (0x%lX)", stat64_req->path, stat64_req->path, stat64_req->buf, stat64_req->buf); /* Adjusts the read pointers of the request */ stat64_adjust_read_pointers(stat64_req); resp_size = sizeof(struct sys_resp_header); if(stat64_req->buf != NULL) { resp_size += aconv_struct_stat64_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ stat64_adjust_write_pointers(stat64_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, stat64_req, stat64_req->req_size); /* resp_header->resp_type = stat64_req->req_type; */ resp_header->resp_rsc_const = stat64_req->req_rsc_const; return resp_header; } int rscs_exec_stat64(void *request) { int ret; struct stat64_req *req = (struct stat64_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, req->buf); return ret; } struct iovec*rscs_post_stat64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct stat64_req *stat64_req = (struct stat64_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_struct_stat64(stat64_req->buf, my_arch, client_arch, mem); mem += aconv_struct_stat64_size(my_arch, client_arch); free(stat64_req->buf); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_statfs64_exec(void *req, enum arch client_arch) { struct statfs64_req *statfs64_req; struct sys_resp_header *resp_header; int resp_size; statfs64_req = (struct statfs64_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(statfs64_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(statfs64_req), rsc2str(statfs64_req->req_rsc_const), statfs64_req->req_rsc_const, statfs64_req->req_type, statfs64_req->req_type, statfs64_req->req_size, statfs64_req->req_size); if(statfs64_req->req_size < sizeof(struct statfs64_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); buf = %p (0x%lX)", statfs64_req->path, statfs64_req->path, statfs64_req->buf, statfs64_req->buf); /* Adjusts the read pointers of the request */ statfs64_adjust_read_pointers(statfs64_req); resp_size = sizeof(struct sys_resp_header); if(statfs64_req->buf != NULL) { resp_size += aconv_struct_statfs64_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ statfs64_adjust_write_pointers(statfs64_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, statfs64_req, statfs64_req->req_size); /* resp_header->resp_type = statfs64_req->req_type; */ resp_header->resp_rsc_const = statfs64_req->req_rsc_const; return resp_header; } int rscs_exec_statfs64(void *request) { int ret; struct statfs64_req *req = (struct statfs64_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, sizeof(struct statfs64), req->buf); return ret; } struct iovec*rscs_post_statfs64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct statfs64_req *statfs64_req = (struct statfs64_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_struct_statfs64(statfs64_req->buf, my_arch, client_arch, mem); mem += aconv_struct_statfs64_size(my_arch, client_arch); free(statfs64_req->buf); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_symlink_exec(void *req, enum arch client_arch) { struct symlink_req *symlink_req; struct sys_resp_header *resp_header; int resp_size; symlink_req = (struct symlink_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(symlink_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(symlink_req), rsc2str(symlink_req->req_rsc_const), symlink_req->req_rsc_const, symlink_req->req_type, symlink_req->req_type, symlink_req->req_size, symlink_req->req_size); if(symlink_req->req_size < sizeof(struct symlink_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: oldpath = %p (0x%lX); newpath = %p (0x%lX)", symlink_req->oldpath, symlink_req->oldpath, symlink_req->newpath, symlink_req->newpath); /* Adjusts the read pointers of the request */ symlink_adjust_read_pointers(symlink_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, symlink_req, symlink_req->req_size); /* resp_header->resp_type = symlink_req->req_type; */ resp_header->resp_rsc_const = symlink_req->req_rsc_const; return resp_header; } int rscs_exec_symlink(void *request) { int ret; struct symlink_req *req = (struct symlink_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->oldpath, req->newpath); return ret; } struct iovec*rscs_post_symlink_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_truncate64_exec(void *req, enum arch client_arch) { struct truncate64_req *truncate64_req; struct sys_resp_header *resp_header; int resp_size; truncate64_req = (struct truncate64_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(truncate64_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(truncate64_req), rsc2str(truncate64_req->req_rsc_const), truncate64_req->req_rsc_const, truncate64_req->req_type, truncate64_req->req_type, truncate64_req->req_size, truncate64_req->req_size); if(truncate64_req->req_size < sizeof(struct truncate64_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: path = %p (0x%lX); length = %ld (0x%lX)", truncate64_req->path, truncate64_req->path, truncate64_req->length, truncate64_req->length); /* Adjusts the read pointers of the request */ truncate64_adjust_read_pointers(truncate64_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, truncate64_req, truncate64_req->req_size); /* resp_header->resp_type = truncate64_req->req_type; */ resp_header->resp_rsc_const = truncate64_req->req_rsc_const; return resp_header; } int rscs_exec_truncate64(void *request) { int ret; struct truncate64_req *req = (struct truncate64_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->path, req->length); return ret; } struct iovec*rscs_post_truncate64_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_umount2_exec(void *req, enum arch client_arch) { struct umount2_req *umount2_req; struct sys_resp_header *resp_header; int resp_size; umount2_req = (struct umount2_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(umount2_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(umount2_req), rsc2str(umount2_req->req_rsc_const), umount2_req->req_rsc_const, umount2_req->req_type, umount2_req->req_type, umount2_req->req_size, umount2_req->req_size); if(umount2_req->req_size < sizeof(struct umount2_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: target = %p (0x%lX); flags = %ld (0x%lX)", umount2_req->target, umount2_req->target, umount2_req->flags, umount2_req->flags); /* Adjusts the read pointers of the request */ umount2_adjust_read_pointers(umount2_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, umount2_req, umount2_req->req_size); /* resp_header->resp_type = umount2_req->req_type; */ resp_header->resp_rsc_const = umount2_req->req_rsc_const; return resp_header; } int rscs_exec_umount2(void *request) { int ret; struct umount2_req *req = (struct umount2_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->target, req->flags); return ret; } struct iovec*rscs_post_umount2_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_uname_exec(void *req, enum arch client_arch) { struct uname_req *uname_req; struct sys_resp_header *resp_header; int resp_size; uname_req = (struct uname_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(uname_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(uname_req), rsc2str(uname_req->req_rsc_const), uname_req->req_rsc_const, uname_req->req_type, uname_req->req_type, uname_req->req_size, uname_req->req_size); if(uname_req->req_size < sizeof(struct uname_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: buf = %p (0x%lX)", uname_req->buf, uname_req->buf); resp_size = sizeof(struct sys_resp_header); if(uname_req->buf != NULL) { resp_size += aconv_struct_utsname_size(my_arch, client_arch); } resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ uname_adjust_write_pointers(uname_req, resp_header, resp_size, client_arch); RSC_EXDUMP(RSCD_REQ_RESP, uname_req, uname_req->req_size); /* resp_header->resp_type = uname_req->req_type; */ resp_header->resp_rsc_const = uname_req->req_rsc_const; return resp_header; } int rscs_exec_uname(void *request) { int ret; struct uname_req *req = (struct uname_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->buf); return ret; } struct iovec*rscs_post_uname_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ /* Now I manage the write buffer. If server and client arch. are the same * I've nothing to do, otherwise I need to convert all the write buffers * and free the memory allocated for write-only buffers */ if(my_arch != client_arch) { struct uname_req *uname_req = (struct uname_req *)req; void *mem = ((void *)resp) + sizeof(struct sys_resp_header); aconv_struct_utsname(uname_req->buf, my_arch, client_arch, mem); mem += aconv_struct_utsname_size(my_arch, client_arch); free(uname_req->buf); } RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_unlink_exec(void *req, enum arch client_arch) { struct unlink_req *unlink_req; struct sys_resp_header *resp_header; int resp_size; unlink_req = (struct unlink_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(unlink_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(unlink_req), rsc2str(unlink_req->req_rsc_const), unlink_req->req_rsc_const, unlink_req->req_type, unlink_req->req_type, unlink_req->req_size, unlink_req->req_size); if(unlink_req->req_size < sizeof(struct unlink_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: pathname = %p (0x%lX)", unlink_req->pathname, unlink_req->pathname); /* Adjusts the read pointers of the request */ unlink_adjust_read_pointers(unlink_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, unlink_req, unlink_req->req_size); /* resp_header->resp_type = unlink_req->req_type; */ resp_header->resp_rsc_const = unlink_req->req_rsc_const; return resp_header; } int rscs_exec_unlink(void *request) { int ret; struct unlink_req *req = (struct unlink_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->pathname); return ret; } struct iovec*rscs_post_unlink_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_utime_exec(void *req, enum arch client_arch) { struct utime_req *utime_req; struct sys_resp_header *resp_header; int resp_size; utime_req = (struct utime_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(utime_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(utime_req), rsc2str(utime_req->req_rsc_const), utime_req->req_rsc_const, utime_req->req_type, utime_req->req_type, utime_req->req_size, utime_req->req_size); if(utime_req->req_size < sizeof(struct utime_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: filename = %p (0x%lX); buf = %p (0x%lX)", utime_req->filename, utime_req->filename, utime_req->buf, utime_req->buf); /* Adjusts the read pointers of the request */ utime_adjust_read_pointers(utime_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, utime_req, utime_req->req_size); /* resp_header->resp_type = utime_req->req_type; */ resp_header->resp_rsc_const = utime_req->req_rsc_const; return resp_header; } int rscs_exec_utime(void *request) { int ret; struct utime_req *req = (struct utime_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->filename, req->buf); return ret; } struct iovec*rscs_post_utime_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_utimes_exec(void *req, enum arch client_arch) { struct utimes_req *utimes_req; struct sys_resp_header *resp_header; int resp_size; utimes_req = (struct utimes_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(utimes_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(utimes_req), rsc2str(utimes_req->req_rsc_const), utimes_req->req_rsc_const, utimes_req->req_type, utimes_req->req_type, utimes_req->req_size, utimes_req->req_size); if(utimes_req->req_size < sizeof(struct utimes_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: filename = %p (0x%lX); tv = %p (0x%lX)", utimes_req->filename, utimes_req->filename, utimes_req->tv, utimes_req->tv); /* Adjusts the read pointers of the request */ utimes_adjust_read_pointers(utimes_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, utimes_req, utimes_req->req_size); /* resp_header->resp_type = utimes_req->req_type; */ resp_header->resp_rsc_const = utimes_req->req_rsc_const; return resp_header; } int rscs_exec_utimes(void *request) { int ret; struct utimes_req *req = (struct utimes_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->filename, req->tv); return ret; } struct iovec*rscs_post_utimes_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_write_exec(void *req, enum arch client_arch) { struct write_req *write_req; struct sys_resp_header *resp_header; int resp_size; write_req = (struct write_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(write_req->req_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(write_req), rsc2str(write_req->req_rsc_const), write_req->req_rsc_const, write_req->req_type, write_req->req_type, write_req->req_size, write_req->req_size); if(write_req->req_size < sizeof(struct write_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX); buf = %p (0x%lX); count = %ld (0x%lX)", write_req->fd, write_req->fd, write_req->buf, write_req->buf, write_req->count, write_req->count); /* Adjusts the read pointers of the request */ write_adjust_read_pointers(write_req); resp_size = sizeof(struct sys_resp_header); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; RSC_EXDUMP(RSCD_REQ_RESP, write_req, write_req->req_size); /* resp_header->resp_type = write_req->req_type; */ resp_header->resp_rsc_const = write_req->req_rsc_const; return resp_header; } int rscs_exec_write(void *request) { int ret; struct write_req *req = (struct write_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->fd, req->buf, req->count); return ret; } struct iovec*rscs_post_write_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) resp->resp_errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_ioctl_exec(void *req, enum arch client_arch) { struct ioctl_req *ioctl_req; struct sys_resp_header *resp_header; int resp_size, index; struct ioctl_entry *ioctle; ioctl_req = (struct ioctl_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(ioctl_req->req_type)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(ioctl_req), rsc2str(ioctl_req->req_rsc_const), ioctl_req->req_rsc_const, ioctl_req->req_type, ioctl_req->req_type, ioctl_req->req_size, ioctl_req->req_size); if(ioctl_req->req_size < sizeof(struct ioctl_req)) return NULL; index = ioctl_search(ioctl_req->request); ioctle = ioctl_getel(index); assert(ioctle != NULL); RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: d = %ld (0x%lX); request = %ld (0x%lX); arg = %p (0x%lX)", ioctl_req->d, ioctl_req->d, ioctl_req->request, ioctl_req->request, ioctl_req->arg, ioctl_req->arg); /* Adjusts the read pointers of the request */ ioctl_adjust_read_pointers(ioctl_req, ioctle->size_type); resp_size = sizeof(struct sys_resp_header); if(ioctl_req->arg != NULL && (ioctle->size_type & IOCTL_W)) resp_size += ioctle->size_type & IOCTL_LENMASK; resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* Adjusts the write pointers of the request */ ioctl_adjust_write_pointers(ioctl_req, resp_header, resp_size, ioctle->size_type, client_arch); /* resp_header->resp_type = ioctl_req->req_type; */ resp_header->resp_rsc_const = ioctl_req->req_rsc_const; return resp_header; } int rscs_exec_ioctl(void *request) { int ret; struct ioctl_req *req = (struct ioctl_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); ret = syscall(nr_and_sys->nr, req->d, req->request, req->arg); return ret; } struct iovec *rscs_post_ioctl_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } struct sys_resp_header *rscs_pre_fcntl_exec(void *req, enum arch client_arch) { struct fcntl_req *fcntl_req; struct sys_resp_header *resp_header; int resp_size; fcntl_req = (struct fcntl_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s:", rsc2str(fcntl_req->req_type)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): rsc_const = %s (0x%X); req_type = %d (0x%lX); req_size = %d (0x%lX) bytes", sizeof(fcntl_req), rsc2str(fcntl_req->req_rsc_const), fcntl_req->req_rsc_const, fcntl_req->req_type, fcntl_req->req_type, fcntl_req->req_size, fcntl_req->req_size); if(fcntl_req->req_size < sizeof(struct fcntl_req)) return NULL; RSC_DEBUG(RSCD_REQ_RESP, "\tArguments: fd = %ld (0x%lX); cmd = %ld (0x%lX);", fcntl_req->fd, fcntl_req->fd, fcntl_req->cmd, fcntl_req->cmd); resp_size = sizeof(struct sys_resp_header); if(fcntl_req->cmd_type & FCNTL_3RD_FLOCK_W) resp_size += sizeof(struct flock); resp_header = calloc(1, resp_size); if(resp_header == NULL) return NULL; resp_header->resp_type = RSC_SYS_RESP; resp_header->resp_size = resp_size; /* If there is a third argument and it is a 'struct flock' pointer */ if(fcntl_req->cmd_type & FCNTL_3RD_FLOCK) { /* Adjusts the read pointers of the request */ fcntl_adjust_read_pointers(fcntl_req); /* Adjusts the write pointers of the request */ fcntl_adjust_write_pointers(fcntl_req, resp_header, resp_size, client_arch); } resp_header->resp_rsc_const = fcntl_req->req_rsc_const; return resp_header; } int rscs_exec_fcntl(void *request) { int ret; struct fcntl_req *req = (struct fcntl_req *)request; struct nr_and_sys *nr_and_sys; nr_and_sys = rsc2nr(req->req_rsc_const, my_arch); if(req->cmd_type & FCNTL_NO_3RD_ARG) { ret = syscall(nr_and_sys->nr, req->fd, req->cmd); } else if(req->cmd_type & FCNTL_3RD_LONG) { ret = syscall(nr_and_sys->nr, req->fd, req->cmd, req->third.arg); } else { ret = syscall(nr_and_sys->nr, req->fd, req->cmd, req->third.lock); } return ret; } struct iovec *rscs_post_fcntl_exec(void *req, struct sys_resp_header *resp, int retval, int errnoval, enum arch client_arch) { struct iovec *v; resp->resp_retval = retval; resp->resp_errno = errnoval; /* workaround for the wrap_in_getsock() pc->erno problem */ if(resp->resp_retval != -1) errno = 0; /* workaround for the wrap_in_getsock() pc->erno problem: END*/ RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s:", rsc2str(resp->resp_rsc_const)); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader(%dB): resp_type = %d (0x%lX); size = %d (0x%lX) bytes; resp_retval = %d (0x%lX); errno = %d (0x%lX)", sizeof(struct sys_resp_header), resp->resp_type, resp->resp_type, resp->resp_size, resp->resp_size, resp->resp_retval, resp->resp_retval, resp->resp_errno, resp->resp_errno); /* I create the iovec structure */ v = calloc(1, sizeof(struct iovec)); if(v == NULL) return NULL; v[0].iov_base = resp; v[0].iov_len = resp->resp_size; /* I convert the header fields to network byte order */ rscs_serialize_resp_hdr(resp); return v; } /*########################################################################*/ /*## ##*/ /*## REQUEST MANAGEMENT ##*/ /*## ##*/ /*########################################################################*/ #if 0 void *req_func_recvmsg(void *req) { struct recvmsg_req *recvmsg_req; struct recvmsg_resp *recvmsg_resp; struct nr_and_sys *nr_and_sys; void *data, *new_ptr; int read_buffer_size, i; recvmsg_req = (struct recvmsg_req *) req; RSC_DEBUG(RSCD_REQ_RESP, "==> REQUEST %s (%p):", rsc2str(recvmsg_req->req_type), recvmsg_req); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader: req_type = %d (0x%X); req_size = %d (0x%X) bytes", recvmsg_req->req_type, recvmsg_req->req_type, recvmsg_req->req_size, recvmsg_req->req_size); RSC_DEBUG(RSCD_REQ_RESP, "\ts = %ld; msg = * ; flags = %ld", recvmsg_req->s, recvmsg_req->flags); recvmsg_adjust_read_pointers(recvmsg_req); RSC_PRINT_MSGHDR(RSCD_REQ_RESP, &(recvmsg_req->msg)); recvmsg_resp = malloc(sizeof(struct recvmsg_resp)); if(recvmsg_resp == NULL) return NULL; bzero(recvmsg_resp, sizeof(struct recvmsg_resp)); recvmsg_resp->resp_type = recvmsg_req->req_type; if( (nr_and_sys = rsc2nr(recvmsg_req->req_type, my_arch)) == NULL) return NULL; { unsigned long args[] = {(unsigned long)(recvmsg_req->s), (unsigned long)(&(recvmsg_req->msg)), (unsigned long)(recvmsg_req->flags)}; recvmsg_resp->resp_retval = syscall(nr_and_sys->nr, nr_and_sys->sys, args); } recvmsg_resp->resp_errno = errno; /* I need to add the buffers read */ read_buffer_size = 0; if(recvmsg_resp->resp_retval > 0) { for(i = 0; i < recvmsg_req->msg.msg_iovlen; i++) read_buffer_size += recvmsg_req->msg.msg_iov[i].iov_len; } recvmsg_resp->resp_size = sizeof(struct recvmsg_resp) + read_buffer_size; if(recvmsg_req->msg.msg_control != NULL) recvmsg_resp->resp_size += recvmsg_req->msg.msg_controllen; if((new_ptr = realloc(recvmsg_resp, recvmsg_resp->resp_size)) == NULL) return NULL; recvmsg_resp = new_ptr; data = ((void *)recvmsg_resp) + sizeof(struct recvmsg_resp); for(i = 0; i < recvmsg_req->msg.msg_iovlen; i++) { memcpy(data, recvmsg_req->msg.msg_iov[i].iov_base, recvmsg_req->msg.msg_iov[i].iov_len); data += recvmsg_req->msg.msg_iov[i].iov_len; } if(recvmsg_req->msg.msg_control != NULL) memcpy(data, recvmsg_req->msg.msg_control, recvmsg_req->msg.msg_controllen); recvmsg_resp->msg_controllen = recvmsg_req->msg.msg_controllen; RSC_DEBUG(RSCD_REQ_RESP, "<== RESPONSE %s (%p):", rsc2str(recvmsg_resp->resp_rsc_const), recvmsg_resp); RSC_DEBUG(RSCD_REQ_RESP, "\tHeader: resp_type = %d (0x%X); resp_size = %d (0x%X) bytes; resp_retval = %d (0x%X); resp_errno = %d (0x%X)", recvmsg_resp->resp_type, recvmsg_resp->resp_type, recvmsg_resp->resp_size, recvmsg_resp->resp_size, recvmsg_resp->resp_retval, recvmsg_resp->resp_retval, recvmsg_resp->resp_errno, recvmsg_resp->resp_errno); return recvmsg_resp; } #endif /*########################################################################*/ /*## ##*/ /*## PUBLIC FUNCTIONS ##*/ /*## ##*/ /*########################################################################*/ int rscs_init(enum arch server_arch) { my_arch = server_arch; rscs_es_init(); ioctl_list = init_list(100); if(ioctl_list == NULL) return -1; return 0; } void rsc_server_teardown() { my_arch = ACONV_ARCH_ERROR; teardown_list(ioctl_list, free); ioctl_list = NULL; } struct iovec*rscs_manage_request(int client_arch, void *request) { struct iovec*ret_data; struct req_header *req_hd; req_hd = (struct req_header *)request; req_hd->req_size = ntohl(req_hd->req_size); if( req_hd->req_type == RSC_IOCTL_REQ) { RSC_DEBUG(RSCD_REQ_RESP,"RSC IOCTL Request management"); ret_data = rscs_manage_ioctl_request((struct ioctl_req_header *)request); } else if( req_hd->req_type == RSC_SYS_REQ) { struct sys_req_header *req_hd; struct sys_resp_header *resp_hd; rscs_pre_exec pre_exec_f; int ret; rscs_exec exec_f; rscs_post_exec post_exec_f; req_hd = (struct sys_req_header *)request; /* I convert the filed of the RSC SYS request header */ req_hd->req_rsc_const = ntohs(req_hd->req_rsc_const); RSC_DEBUG(RSCD_REQ_RESP,"RSC SYS Request management: %X(%s)", req_hd->req_rsc_const, rsc2str(req_hd->req_rsc_const)); if( req_hd->req_rsc_const < __RSC_FIRST || req_hd->req_rsc_const > __RSC_LAST ) return NULL; pre_exec_f = rscs_pre_exec_table[req_hd->req_rsc_const]; exec_f = rscs_exec_table[req_hd->req_rsc_const]; post_exec_f = rscs_post_exec_table[req_hd->req_rsc_const]; if(pre_exec_f == NULL || exec_f == NULL || post_exec_f == NULL) return NULL; if((resp_hd = pre_exec_f(request, client_arch)) == NULL) return NULL; ret = exec_f(request); ret_data = post_exec_f(request, resp_hd, ret, errno, client_arch); } else { /* Bad request type */ ret_data = NULL; } return ret_data; } umview-0.8.2/um_rsc/librsc/Makefile0000644000175000017500000000307211753517213016326 0ustar renzorenzo# # This is part of Remote System Call (RSC) Library. # # Makefile: library makefile # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # # If RELEASE is false, the sources are compiled with debug prints # and some static functions become global functions, in this way # they can be tested. RELEASE = true # If TEST is true, the sources are compiled as if RELEASE = false # but without debug prints TEST = false MAKE_OVERRIDING_VARS= CC = gcc sources = $(shell ls src/*.c) ifeq ($(TEST), true) MAKE_OVERRIDING_VARS += "RSCDEBUGLEVEL=0" RELEASE = false endif .PHONY: clean librsc.a ifeq ($(RELEASE), true) all: librsc.a else MAKE_OVERRIDING_VARS += "RELEASE=false" .PHONY: tags all: librsc.a tags: ctags-exuberant -R . endif librsc.a: make -C src/ $(MAKE_OVERRIDING_VARS) rm -f $@ ar rcs $@ ${sources:.c=.o} clean: make -C tests/ clean make -C src/ clean RELEASE=$(RELEASE) rm -f tags cscope.out rm -f librsc.a umview-0.8.2/um_rsc/Makefile0000644000175000017500000000234211753517213015047 0ustar renzorenzo# # This is part of um-ViewOS # The user-mode implementation of OSVIEW -- A Process with a View # # Makefile: global makefile # # Copyright (C) 2007 Andrea Forni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # .PHONY: all server module librsc clean tags RELEASE=true all: librsc server module server: make -C server/ all RELEASE=$(RELEASE) module: make -C module/ all RELEASE=$(RELEASE) librsc: make -C librsc/ all RELEASE=$(RELEASE) tags: ctags-exuberant -R . clean: make -C server/ clean RELEASE=$(RELEASE) make -C module/ clean RELEASE=$(RELEASE) make -C librsc/ clean RELEASE=$(RELEASE) rm -fr tags umview-0.8.2/um_rsc/README0000644000175000017500000001635611753517213014301 0ustar renzorenzoThis is UMView Remote System Call (RSC) service module (C) 2007 Andrea Forni This is FREE software: this work has been released under the GPLv2 license (see the file COPYING and the header note in the source files). This project provides a UMView service module that permits to execute the system calls generated by a process in different machine from the one where the process resides. The directory structure is: - module/ : the UMView service module directory - server/ : the RSC server directory - librsc/ : the Remote System Call library - librsc_templates/ : the Ruby script and templates to generate some librsc's files ###################################### ## Howto compile the project ###################################### There is a global Makefile in the root directory, call it without arguments to compile the library, the module and the server. The Makefile has a variable called RELEASE, if it's set to 'true' the code is compiled without debug messages; if you want them set it to 'false'. ###################################### ## The module ###################################### The module can be uploaded into UMView using the 'um_add_service' command. Without extra arguments the module tries to connect to the server at localhost, ports 8050 and 8051. The module needs to establish two connections with the server: one used to exchange all the data (syscall execution requests/response and ioctl management), the other is used for event subscription management. The module accepts 3 arguments to change these default values: - 'sa' : permits to change the Server Address - 'sp' : permits to change the Server Port - 'essp': permits to change the Event Subscription Server Port For example, if the server is in execution on 'example.com' at ports 8050 (for normal traffic) and 9090 (for event subscription traffic), you can connect the module in the following way: $ um_add_service um_rsc.so,sa=example.com,essp=9090 The arguments follow the module and are separated by commas, white spaces between options and between option name, equal symbol and option value are not allowed. ###################################### ## The Server ###################################### There isn't much to say, when executed without arguments the server waits any inbound connection from 8050 and 8051 ports; as for the module the server address and ports can be changed. To know the name of the options type: $ rsc_server -h ###################################### ## The RSC Library ###################################### The structure of the directory librsc/ is: - include/ : contains the global headers of the library. The client (module) needs to include only the header 'rsc_client.h'; the server 'rsc_server.h' - src/ : contains the source files of the library. - src/include/ : contains some local headers - tests/ : contains some tests to verify the correctness of the library. Running the Makefile inside that directory produce 3 executable: client, server and selftests. 'server' implements a very simple server waiting a 'client' connection; some tests need client-server interaction and others no, but the first things client and server do is to establish a connection, so the connection is needed also for tests that don't need it. 'server' and 'client' are useful if you want to test the library between different architecture (running the server in one and the client in the other); if you want to execute 'server' and 'client' on the same machine, use 'selftests'. 'selftests' creates two threads, one for the client tests and one for the server tests. NOTE: to compile, the programs need a debug version of librsc with no debug messages (RELEASE=false and RSCDEBUGLEVEL=0), to obtain it type: $ make cleanlib; make 'make cleanlib' remove librsc/librsc.a library and 'make' builds the right version of the library needed by the tests. The tests need a debug version of the library because in this version some static functions are exposed so the be can testes. If you use the librsc/Makefile with RELEASE=false, you obtain a debug version of the library, but this version contains debug message that can complicate the tests output. NOTE: the marshaling support is still under-development and testing, so running the module and the server in two host with different architecture doesn't work well (for now). NOTE2: The interaction of the module and server has been tested on a machine with x86 architecture. The code compile also into powerpc and x86_64 architectures but more tests are needed to see if they work correctly on these architectures. ###################################### ## The librsc template directory ###################################### The librsc_templates/ directory contains the Ruby script 'rsc_file_gen.rb' used to generate some librsc source files in a automatic way. The directory contains two sub-dirs: - 'program' : contains the Ruby script - 'input' : the files passed in input at the script The contents of the program directory are: - rsc_file_gen.rb : the ruby script - src : some additional module needed by the script - tests : some unit tests - Rakefile.rb : a Makefile written in Ruby. The tasks (tasks are equivalent to Makefile's targets) offered by this rakefile are: - 'doc' (the default) : it creates a doc/ directory with HTML documentation of the classes and modules. - 'test' : execute the tests inside the tests/ directory - 'clean' : guess... Executing the rsc_file_gen.rb with the '-h' option produce the usage message. The scripts need 4 arguments, 3 of them are input argument the last is the base directory of librsc. The 3 input arguments are: - the syscall_list_file a text file describing the system calls. - a unistd directory where the script search 3 files: unistd_ppc.h, unistd_x86_64.h and unistd_x86.h used to get information about the number and the type of system call in each architecture - a template directory containing the template. The script search and load only the templates with extension '.c' or '.h' The librsc_templates/input/ contains the 3 arguments needed by the script. The librsc_templates/Makefile call the script with the right arguments, so to generate the files is sufficient to type 'make' inside the librsc_templates/ directory. NOTE: The global Makefile doesn't call this makefile to update the generated files NOTE2: rsc_file_gen.rb process each template and if the generated file isn't different from the one already existing it doesn't do anything and pass to the next template. If there are some changes the old file is overwritten but a backup copy is saved in a hidden file in the same directory. The hidden file has the following name format: .-bak___