From b5279ecc51ff751ccd052fbb7c20efd529575f7e Mon Sep 17 00:00:00 2001 From: cvs2svn <> Date: Tue, 18 Feb 2014 19:58:41 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'cygwin-pre-user-db'. Sprout from cygwin-1_7_29-release-branchpoint 2014-02-18 19:58:40 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'cygwin-1_7_29' Cherrypick from master 2014-02-08 22:25:11 UTC Corinna Vinschen 'Fix ChangeLog': winsup/cygwin/ChangeLog winsup/cygwin/miscfuncs.cc winsup/cygwin/miscfuncs.h winsup/cygwin/mount.cc Delete: winsup/COPYING winsup/CYGWIN_LICENSE winsup/ChangeLog winsup/Makefile.common winsup/Makefile.in winsup/README winsup/acinclude.m4 winsup/aclocal.m4 winsup/autogen.sh winsup/c++wrap winsup/ccwrap winsup/config.guess winsup/config.sub winsup/configure winsup/configure.ac winsup/configure.cygwin winsup/cygserver/ChangeLog winsup/cygserver/ChangeLog.64bit winsup/cygserver/Makefile.in winsup/cygserver/README winsup/cygserver/aclocal.m4 winsup/cygserver/autogen.sh winsup/cygserver/bsd_helper.cc winsup/cygserver/bsd_helper.h winsup/cygserver/bsd_log.cc winsup/cygserver/bsd_log.h winsup/cygserver/bsd_mutex.cc winsup/cygserver/bsd_mutex.h winsup/cygserver/client.cc winsup/cygserver/configure winsup/cygserver/configure.ac winsup/cygserver/cygserver-config winsup/cygserver/cygserver.cc winsup/cygserver/cygserver.conf winsup/cygserver/msg.cc winsup/cygserver/process.cc winsup/cygserver/process.h winsup/cygserver/sem.cc winsup/cygserver/setpwd.cc winsup/cygserver/shm.cc winsup/cygserver/sysv_msg.cc winsup/cygserver/sysv_sem.cc winsup/cygserver/sysv_shm.cc winsup/cygserver/threaded_queue.cc winsup/cygserver/threaded_queue.h winsup/cygserver/transport.cc winsup/cygserver/transport.h winsup/cygserver/transport_pipes.cc winsup/cygserver/transport_pipes.h winsup/cygserver/woutsup.h winsup/cygwin/release/1.7.29 winsup/doc/.cvsignore winsup/doc/ChangeLog winsup/doc/Makefile.in winsup/doc/README winsup/doc/Wishlist winsup/doc/aclocal.m4 winsup/doc/bodysnatcher.pl winsup/doc/configure winsup/doc/configure.ac winsup/doc/cygserver.xml winsup/doc/cygwin-api.in.xml winsup/doc/cygwin-ug-net.xml winsup/doc/cygwin.xsl winsup/doc/cygwinenv.xml winsup/doc/dll.xml winsup/doc/doctool.c winsup/doc/doctool.txt winsup/doc/effectively.xml winsup/doc/faq-api.xml winsup/doc/faq-copyright.xml winsup/doc/faq-programming.xml winsup/doc/faq-resources.xml winsup/doc/faq-setup.xml winsup/doc/faq-using.xml winsup/doc/faq-what.xml winsup/doc/faq.xml winsup/doc/fhandler-tut.txt winsup/doc/filemodes.xml winsup/doc/fo.xsl winsup/doc/gcc.xml winsup/doc/gdb.xml winsup/doc/highlights.xml winsup/doc/legal.xml winsup/doc/new-features.xml winsup/doc/ntsec.xml winsup/doc/ov-ex-unix.xml winsup/doc/ov-ex-win.xml winsup/doc/overview.xml winsup/doc/pathnames.xml winsup/doc/programming.xml winsup/doc/setup-env.xml winsup/doc/setup-files.xml winsup/doc/setup-locale.xml winsup/doc/setup-maxmem.xml winsup/doc/setup-net.xml winsup/doc/specialnames.xml winsup/doc/textbinary.xml winsup/doc/ug-info.xml winsup/doc/using.xml winsup/doc/windres.xml winsup/doc/xidepend winsup/install-sh winsup/lsaauth/ChangeLog winsup/lsaauth/ChangeLog.64bit winsup/lsaauth/Makefile.in winsup/lsaauth/aclocal.m4 winsup/lsaauth/configure winsup/lsaauth/configure.ac winsup/lsaauth/cyglsa-config winsup/lsaauth/cyglsa.c winsup/lsaauth/cyglsa.din winsup/lsaauth/cyglsa64.def winsup/testsuite/ChangeLog winsup/testsuite/Makefile.in winsup/testsuite/README winsup/testsuite/aclocal.m4 winsup/testsuite/config/default.exp winsup/testsuite/configure winsup/testsuite/configure.ac winsup/testsuite/cygrun.c winsup/testsuite/libltp/include/dataascii.h winsup/testsuite/libltp/include/databin.h winsup/testsuite/libltp/include/file_lock.h winsup/testsuite/libltp/include/forker.h winsup/testsuite/libltp/include/open_flags.h winsup/testsuite/libltp/include/pattern.h winsup/testsuite/libltp/include/random_range.h winsup/testsuite/libltp/include/rmobj.h winsup/testsuite/libltp/include/search_path.h winsup/testsuite/libltp/include/str_to_bytes.h winsup/testsuite/libltp/include/string_to_tokens.h winsup/testsuite/libltp/include/test.h winsup/testsuite/libltp/include/tlibio.h winsup/testsuite/libltp/include/usctest.h winsup/testsuite/libltp/include/write_log.h winsup/testsuite/libltp/lib/dataascii.c winsup/testsuite/libltp/lib/databin.c winsup/testsuite/libltp/lib/datapid.c winsup/testsuite/libltp/lib/forker.c winsup/testsuite/libltp/lib/get_high_address.c winsup/testsuite/libltp/lib/libtestsuite.c winsup/testsuite/libltp/lib/open_flags.c winsup/testsuite/libltp/lib/parse_opts.c winsup/testsuite/libltp/lib/pattern.c winsup/testsuite/libltp/lib/rmobj.c winsup/testsuite/libltp/lib/search_path.c winsup/testsuite/libltp/lib/str_to_bytes.c winsup/testsuite/libltp/lib/string_to_tokens.c winsup/testsuite/libltp/lib/tst_res.c winsup/testsuite/libltp/lib/tst_sig.c winsup/testsuite/libltp/lib/tst_tmpdir.c winsup/testsuite/libltp/lib/write_log.c winsup/testsuite/winsup.api/checksignal.c winsup/testsuite/winsup.api/crlf.c winsup/testsuite/winsup.api/cygload.cc winsup/testsuite/winsup.api/cygload.exp winsup/testsuite/winsup.api/cygload.h winsup/testsuite/winsup.api/devdsp.c winsup/testsuite/winsup.api/devdsp_okay.h winsup/testsuite/winsup.api/devzero.c winsup/testsuite/winsup.api/iospeed.c winsup/testsuite/winsup.api/known_bugs.tcl winsup/testsuite/winsup.api/ltp/access01.c winsup/testsuite/winsup.api/ltp/access03.c winsup/testsuite/winsup.api/ltp/access04.c winsup/testsuite/winsup.api/ltp/access05.c winsup/testsuite/winsup.api/ltp/alarm01.c winsup/testsuite/winsup.api/ltp/alarm02.c winsup/testsuite/winsup.api/ltp/alarm03.c winsup/testsuite/winsup.api/ltp/alarm07.c winsup/testsuite/winsup.api/ltp/asyncio02.c winsup/testsuite/winsup.api/ltp/chdir02.c winsup/testsuite/winsup.api/ltp/chdir04.c winsup/testsuite/winsup.api/ltp/chmod01.c winsup/testsuite/winsup.api/ltp/chmod02.c winsup/testsuite/winsup.api/ltp/chown01.c winsup/testsuite/winsup.api/ltp/close01.c winsup/testsuite/winsup.api/ltp/close02.c winsup/testsuite/winsup.api/ltp/close08.c winsup/testsuite/winsup.api/ltp/creat01.c winsup/testsuite/winsup.api/ltp/creat03.c winsup/testsuite/winsup.api/ltp/creat09.c winsup/testsuite/winsup.api/ltp/dup01.c winsup/testsuite/winsup.api/ltp/dup02.c winsup/testsuite/winsup.api/ltp/dup03.c winsup/testsuite/winsup.api/ltp/dup04.c winsup/testsuite/winsup.api/ltp/dup05.c winsup/testsuite/winsup.api/ltp/execl01.c winsup/testsuite/winsup.api/ltp/execle01.c winsup/testsuite/winsup.api/ltp/execlp01.c winsup/testsuite/winsup.api/ltp/execv01.c winsup/testsuite/winsup.api/ltp/execve01.c winsup/testsuite/winsup.api/ltp/execvp01.c winsup/testsuite/winsup.api/ltp/exit01.c winsup/testsuite/winsup.api/ltp/exit02.c winsup/testsuite/winsup.api/ltp/fchdir01.c winsup/testsuite/winsup.api/ltp/fchdir02.c winsup/testsuite/winsup.api/ltp/fchmod01.c winsup/testsuite/winsup.api/ltp/fchown01.c winsup/testsuite/winsup.api/ltp/fcntl02.c winsup/testsuite/winsup.api/ltp/fcntl03.c winsup/testsuite/winsup.api/ltp/fcntl04.c winsup/testsuite/winsup.api/ltp/fcntl05.c winsup/testsuite/winsup.api/ltp/fcntl07.c winsup/testsuite/winsup.api/ltp/fcntl07B.c winsup/testsuite/winsup.api/ltp/fcntl08.c winsup/testsuite/winsup.api/ltp/fcntl09.c winsup/testsuite/winsup.api/ltp/fcntl10.c winsup/testsuite/winsup.api/ltp/fork01.c winsup/testsuite/winsup.api/ltp/fork02.c winsup/testsuite/winsup.api/ltp/fork03.c winsup/testsuite/winsup.api/ltp/fork04.c winsup/testsuite/winsup.api/ltp/fork06.c winsup/testsuite/winsup.api/ltp/fork07.c winsup/testsuite/winsup.api/ltp/fork09.c winsup/testsuite/winsup.api/ltp/fork10.c winsup/testsuite/winsup.api/ltp/fork11.c winsup/testsuite/winsup.api/ltp/fpathconf01.c winsup/testsuite/winsup.api/ltp/fstat01.c winsup/testsuite/winsup.api/ltp/fstat02.c winsup/testsuite/winsup.api/ltp/fstat03.c winsup/testsuite/winsup.api/ltp/fstat04.c winsup/testsuite/winsup.api/ltp/fsync01.c winsup/testsuite/winsup.api/ltp/ftruncate01.c winsup/testsuite/winsup.api/ltp/ftruncate02.c winsup/testsuite/winsup.api/ltp/ftruncate03.c winsup/testsuite/winsup.api/ltp/getegid01.c winsup/testsuite/winsup.api/ltp/geteuid01.c winsup/testsuite/winsup.api/ltp/getgid01.c winsup/testsuite/winsup.api/ltp/getgid02.c winsup/testsuite/winsup.api/ltp/getgid03.c winsup/testsuite/winsup.api/ltp/getgroups01.c winsup/testsuite/winsup.api/ltp/getgroups02.c winsup/testsuite/winsup.api/ltp/gethostid01.c winsup/testsuite/winsup.api/ltp/gethostname01.c winsup/testsuite/winsup.api/ltp/getpgid01.c winsup/testsuite/winsup.api/ltp/getpgid02.c winsup/testsuite/winsup.api/ltp/getpgrp01.c winsup/testsuite/winsup.api/ltp/getpid01.c winsup/testsuite/winsup.api/ltp/getpid02.c winsup/testsuite/winsup.api/ltp/getppid01.c winsup/testsuite/winsup.api/ltp/getppid02.c winsup/testsuite/winsup.api/ltp/getuid01.c winsup/testsuite/winsup.api/ltp/getuid02.c winsup/testsuite/winsup.api/ltp/getuid03.c winsup/testsuite/winsup.api/ltp/kill01.c winsup/testsuite/winsup.api/ltp/kill02.c winsup/testsuite/winsup.api/ltp/kill03.c winsup/testsuite/winsup.api/ltp/kill04.c winsup/testsuite/winsup.api/ltp/kill09.c winsup/testsuite/winsup.api/ltp/link02.c winsup/testsuite/winsup.api/ltp/link03.c winsup/testsuite/winsup.api/ltp/link04.c winsup/testsuite/winsup.api/ltp/link05.c winsup/testsuite/winsup.api/ltp/lseek01.c winsup/testsuite/winsup.api/ltp/lseek02.c winsup/testsuite/winsup.api/ltp/lseek03.c winsup/testsuite/winsup.api/ltp/lseek04.c winsup/testsuite/winsup.api/ltp/lseek05.c winsup/testsuite/winsup.api/ltp/lseek06.c winsup/testsuite/winsup.api/ltp/lseek07.c winsup/testsuite/winsup.api/ltp/lseek08.c winsup/testsuite/winsup.api/ltp/lseek09.c winsup/testsuite/winsup.api/ltp/lseek10.c winsup/testsuite/winsup.api/ltp/lstat02.c winsup/testsuite/winsup.api/ltp/mkdir01.c winsup/testsuite/winsup.api/ltp/mkdir08.c winsup/testsuite/winsup.api/ltp/mknod01.c winsup/testsuite/winsup.api/ltp/mmap001.c winsup/testsuite/winsup.api/ltp/mmap02.c winsup/testsuite/winsup.api/ltp/mmap03.c winsup/testsuite/winsup.api/ltp/mmap04.c winsup/testsuite/winsup.api/ltp/mmap05.c winsup/testsuite/winsup.api/ltp/mmap06.c winsup/testsuite/winsup.api/ltp/mmap07.c winsup/testsuite/winsup.api/ltp/mmap08.c winsup/testsuite/winsup.api/ltp/munmap01.c winsup/testsuite/winsup.api/ltp/munmap02.c winsup/testsuite/winsup.api/ltp/nice05.c winsup/testsuite/winsup.api/ltp/open02.c winsup/testsuite/winsup.api/ltp/open03.c winsup/testsuite/winsup.api/ltp/pathconf01.c winsup/testsuite/winsup.api/ltp/pause01.c winsup/testsuite/winsup.api/ltp/pipe01.c winsup/testsuite/winsup.api/ltp/pipe08.c winsup/testsuite/winsup.api/ltp/pipe09.c winsup/testsuite/winsup.api/ltp/pipe10.c winsup/testsuite/winsup.api/ltp/pipe11.c winsup/testsuite/winsup.api/ltp/poll01.c winsup/testsuite/winsup.api/ltp/read01.c winsup/testsuite/winsup.api/ltp/read04.c winsup/testsuite/winsup.api/ltp/readdir01.c winsup/testsuite/winsup.api/ltp/readlink01.c winsup/testsuite/winsup.api/ltp/readlink02.c winsup/testsuite/winsup.api/ltp/readlink03.c winsup/testsuite/winsup.api/ltp/rename01.c winsup/testsuite/winsup.api/ltp/rename02.c winsup/testsuite/winsup.api/ltp/rename08.c winsup/testsuite/winsup.api/ltp/rename10.c winsup/testsuite/winsup.api/ltp/rmdir01.c winsup/testsuite/winsup.api/ltp/rmdir04.c winsup/testsuite/winsup.api/ltp/rmdir05.c winsup/testsuite/winsup.api/ltp/sbrk01.c winsup/testsuite/winsup.api/ltp/select01.c winsup/testsuite/winsup.api/ltp/select02.c winsup/testsuite/winsup.api/ltp/select03.c winsup/testsuite/winsup.api/ltp/setgid01.c winsup/testsuite/winsup.api/ltp/setgroups01.c winsup/testsuite/winsup.api/ltp/setpgid01.c winsup/testsuite/winsup.api/ltp/setregid01.c winsup/testsuite/winsup.api/ltp/setreuid01.c winsup/testsuite/winsup.api/ltp/setuid01.c winsup/testsuite/winsup.api/ltp/setuid02.c winsup/testsuite/winsup.api/ltp/signal03.c winsup/testsuite/winsup.api/ltp/stat01.c winsup/testsuite/winsup.api/ltp/stat02.c winsup/testsuite/winsup.api/ltp/stat03.c winsup/testsuite/winsup.api/ltp/stat05.c winsup/testsuite/winsup.api/ltp/stat06.c winsup/testsuite/winsup.api/ltp/symlink01.c winsup/testsuite/winsup.api/ltp/symlink02.c winsup/testsuite/winsup.api/ltp/symlink03.c winsup/testsuite/winsup.api/ltp/symlink04.c winsup/testsuite/winsup.api/ltp/symlink05.c winsup/testsuite/winsup.api/ltp/sync01.c winsup/testsuite/winsup.api/ltp/sync02.c winsup/testsuite/winsup.api/ltp/time01.c winsup/testsuite/winsup.api/ltp/time02.c winsup/testsuite/winsup.api/ltp/times01.c winsup/testsuite/winsup.api/ltp/times02.c winsup/testsuite/winsup.api/ltp/times03.c winsup/testsuite/winsup.api/ltp/truncate01.c winsup/testsuite/winsup.api/ltp/truncate02.c winsup/testsuite/winsup.api/ltp/ulimit01.c winsup/testsuite/winsup.api/ltp/umask01.c winsup/testsuite/winsup.api/ltp/umask02.c winsup/testsuite/winsup.api/ltp/umask03.c winsup/testsuite/winsup.api/ltp/uname01.c winsup/testsuite/winsup.api/ltp/unlink05.c winsup/testsuite/winsup.api/ltp/unlink06.c winsup/testsuite/winsup.api/ltp/unlink07.c winsup/testsuite/winsup.api/ltp/unlink08.c winsup/testsuite/winsup.api/ltp/vfork01.c winsup/testsuite/winsup.api/ltp/wait02.c winsup/testsuite/winsup.api/ltp/wait401.c winsup/testsuite/winsup.api/ltp/wait402.c winsup/testsuite/winsup.api/ltp/write01.c winsup/testsuite/winsup.api/ltp/write02.c winsup/testsuite/winsup.api/ltp/write03.c winsup/testsuite/winsup.api/mmaptest01.c winsup/testsuite/winsup.api/mmaptest02.c winsup/testsuite/winsup.api/mmaptest03.c winsup/testsuite/winsup.api/mmaptest04.c winsup/testsuite/winsup.api/msgtest.c winsup/testsuite/winsup.api/nullgetcwd.c winsup/testsuite/winsup.api/pthread/cancel1.c winsup/testsuite/winsup.api/pthread/cancel10.c winsup/testsuite/winsup.api/pthread/cancel11.c winsup/testsuite/winsup.api/pthread/cancel12.c winsup/testsuite/winsup.api/pthread/cancel2.c winsup/testsuite/winsup.api/pthread/cancel3.c winsup/testsuite/winsup.api/pthread/cancel4.c winsup/testsuite/winsup.api/pthread/cancel5.c winsup/testsuite/winsup.api/pthread/cancel6.c winsup/testsuite/winsup.api/pthread/cancel7.c winsup/testsuite/winsup.api/pthread/cancel8.c winsup/testsuite/winsup.api/pthread/cancel9.c winsup/testsuite/winsup.api/pthread/cleanup2.c winsup/testsuite/winsup.api/pthread/cleanup3.c winsup/testsuite/winsup.api/pthread/condvar1.c winsup/testsuite/winsup.api/pthread/condvar2.c winsup/testsuite/winsup.api/pthread/condvar2_1.c winsup/testsuite/winsup.api/pthread/condvar3.c winsup/testsuite/winsup.api/pthread/condvar3_1.c winsup/testsuite/winsup.api/pthread/condvar3_2.c winsup/testsuite/winsup.api/pthread/condvar3_3.c winsup/testsuite/winsup.api/pthread/condvar4.c winsup/testsuite/winsup.api/pthread/condvar5.c winsup/testsuite/winsup.api/pthread/condvar6.c winsup/testsuite/winsup.api/pthread/condvar7.c winsup/testsuite/winsup.api/pthread/condvar8.c winsup/testsuite/winsup.api/pthread/condvar9.c winsup/testsuite/winsup.api/pthread/count1.c winsup/testsuite/winsup.api/pthread/create1.c winsup/testsuite/winsup.api/pthread/create2.c winsup/testsuite/winsup.api/pthread/equal1.c winsup/testsuite/winsup.api/pthread/exit1.c winsup/testsuite/winsup.api/pthread/exit2.c winsup/testsuite/winsup.api/pthread/exit3.c winsup/testsuite/winsup.api/pthread/inherit1.c winsup/testsuite/winsup.api/pthread/join0.c winsup/testsuite/winsup.api/pthread/join1.c winsup/testsuite/winsup.api/pthread/join2.c winsup/testsuite/winsup.api/pthread/mainthreadexits.c winsup/testsuite/winsup.api/pthread/mutex1.c winsup/testsuite/winsup.api/pthread/mutex1d.c winsup/testsuite/winsup.api/pthread/mutex1e.c winsup/testsuite/winsup.api/pthread/mutex1n.c winsup/testsuite/winsup.api/pthread/mutex1r.c winsup/testsuite/winsup.api/pthread/mutex2.c winsup/testsuite/winsup.api/pthread/mutex3.c winsup/testsuite/winsup.api/pthread/mutex4.c winsup/testsuite/winsup.api/pthread/mutex5.c winsup/testsuite/winsup.api/pthread/mutex6d.c winsup/testsuite/winsup.api/pthread/mutex6e.c winsup/testsuite/winsup.api/pthread/mutex6n.c winsup/testsuite/winsup.api/pthread/mutex6r.c winsup/testsuite/winsup.api/pthread/mutex7.c winsup/testsuite/winsup.api/pthread/mutex7d.c winsup/testsuite/winsup.api/pthread/mutex7e.c winsup/testsuite/winsup.api/pthread/mutex7n.c winsup/testsuite/winsup.api/pthread/mutex7r.c winsup/testsuite/winsup.api/pthread/mutex8e.c winsup/testsuite/winsup.api/pthread/mutex8n.c winsup/testsuite/winsup.api/pthread/mutex8r.c winsup/testsuite/winsup.api/pthread/once1.c winsup/testsuite/winsup.api/pthread/priority1.c winsup/testsuite/winsup.api/pthread/priority2.c winsup/testsuite/winsup.api/pthread/rwlock1.c winsup/testsuite/winsup.api/pthread/rwlock2.c winsup/testsuite/winsup.api/pthread/rwlock3.c winsup/testsuite/winsup.api/pthread/rwlock4.c winsup/testsuite/winsup.api/pthread/rwlock5.c winsup/testsuite/winsup.api/pthread/rwlock6.c winsup/testsuite/winsup.api/pthread/rwlock7.c winsup/testsuite/winsup.api/pthread/self1.c winsup/testsuite/winsup.api/pthread/self2.c winsup/testsuite/winsup.api/pthread/test.h winsup/testsuite/winsup.api/pthread/threadidafterfork.c winsup/testsuite/winsup.api/pthread/tsd1.c winsup/testsuite/winsup.api/resethand.c winsup/testsuite/winsup.api/samples/sample-fail.c winsup/testsuite/winsup.api/samples/sample-miscompile.c winsup/testsuite/winsup.api/samples/sample-pass.c winsup/testsuite/winsup.api/semtest.c winsup/testsuite/winsup.api/shmtest.c winsup/testsuite/winsup.api/sigchld.c winsup/testsuite/winsup.api/signal-into-win32-api.c winsup/testsuite/winsup.api/systemcall.c winsup/testsuite/winsup.api/user_malloc.c winsup/testsuite/winsup.api/waitpid.c winsup/testsuite/winsup.api/winsup.exp winsup/utils/COPYING.dumper winsup/utils/ChangeLog winsup/utils/ChangeLog-2000 winsup/utils/ChangeLog.64bit winsup/utils/Makefile.in winsup/utils/aclocal.m4 winsup/utils/autogen.sh winsup/utils/bloda.cc winsup/utils/configure winsup/utils/configure.ac winsup/utils/cygcheck.cc winsup/utils/cygpath.cc winsup/utils/cygwin-console-helper.cc winsup/utils/dump_setup.cc winsup/utils/dumper.cc winsup/utils/dumper.h winsup/utils/getconf.c winsup/utils/getfacl.c winsup/utils/kill.cc winsup/utils/ldd.cc winsup/utils/ldh.cc winsup/utils/loadlib.h winsup/utils/locale.cc winsup/utils/minidumper.cc winsup/utils/mkgroup.c winsup/utils/mkpasswd.c winsup/utils/module_info.cc winsup/utils/mount.cc winsup/utils/parse_pe.cc winsup/utils/passwd.c winsup/utils/path.cc winsup/utils/path.h winsup/utils/pldd.c winsup/utils/ps.cc winsup/utils/regtool.cc winsup/utils/setfacl.c winsup/utils/setmetamode.c winsup/utils/ssp.c winsup/utils/ssp.txt winsup/utils/strace.cc winsup/utils/testsuite.cc winsup/utils/testsuite.h winsup/utils/tzset.c winsup/utils/umount.cc winsup/utils/utils.xml winsup/utils/wide_path.h --- winsup/COPYING | 674 --- winsup/CYGWIN_LICENSE | 70 - winsup/ChangeLog | 626 --- winsup/Makefile.common | 55 - winsup/Makefile.in | 129 - winsup/README | 9 - winsup/acinclude.m4 | 83 - winsup/aclocal.m4 | 15 - winsup/autogen.sh | 17 - winsup/c++wrap | 6 - winsup/ccwrap | 55 - winsup/config.guess | 1537 ------ winsup/config.sub | 1789 ------- winsup/configure | 4776 ------------------ winsup/configure.ac | 42 - winsup/configure.cygwin | 48 - winsup/cygserver/ChangeLog | 743 --- winsup/cygserver/ChangeLog.64bit | 87 - winsup/cygserver/Makefile.in | 94 - winsup/cygserver/README | 198 - winsup/cygserver/aclocal.m4 | 98 - winsup/cygserver/autogen.sh | 4 - winsup/cygserver/bsd_helper.cc | 691 --- winsup/cygserver/bsd_helper.h | 66 - winsup/cygserver/bsd_log.cc | 95 - winsup/cygserver/bsd_log.h | 33 - winsup/cygserver/bsd_mutex.cc | 386 -- winsup/cygserver/bsd_mutex.h | 52 - winsup/cygserver/client.cc | 536 -- winsup/cygserver/configure | 5318 -------------------- winsup/cygserver/configure.ac | 67 - winsup/cygserver/cygserver-config | 202 - winsup/cygserver/cygserver.cc | 762 --- winsup/cygserver/cygserver.conf | 147 - winsup/cygserver/msg.cc | 117 - winsup/cygserver/process.cc | 500 -- winsup/cygserver/process.h | 179 - winsup/cygserver/sem.cc | 107 - winsup/cygserver/setpwd.cc | 104 - winsup/cygserver/shm.cc | 124 - winsup/cygserver/sysv_msg.cc | 1215 ----- winsup/cygserver/sysv_sem.cc | 1389 ----- winsup/cygserver/sysv_shm.cc | 1045 ---- winsup/cygserver/threaded_queue.cc | 410 -- winsup/cygserver/threaded_queue.h | 127 - winsup/cygserver/transport.cc | 49 - winsup/cygserver/transport.h | 39 - winsup/cygserver/transport_pipes.cc | 336 -- winsup/cygserver/transport_pipes.h | 50 - winsup/cygserver/woutsup.h | 56 - winsup/cygwin/ChangeLog | 9 + winsup/cygwin/miscfuncs.cc | 78 +- winsup/cygwin/miscfuncs.h | 20 +- winsup/cygwin/mount.cc | 82 +- winsup/cygwin/release/1.7.29 | 29 - winsup/doc/.cvsignore | 14 - winsup/doc/ChangeLog | 2458 --------- winsup/doc/Makefile.in | 93 - winsup/doc/README | 29 - winsup/doc/Wishlist | 111 - winsup/doc/aclocal.m4 | 875 ---- winsup/doc/bodysnatcher.pl | 44 - winsup/doc/configure | 4006 --------------- winsup/doc/configure.ac | 23 - winsup/doc/cygserver.xml | 239 - winsup/doc/cygwin-api.in.xml | 34 - winsup/doc/cygwin-ug-net.xml | 16 - winsup/doc/cygwin.xsl | 12 - winsup/doc/cygwinenv.xml | 264 - winsup/doc/dll.xml | 145 - winsup/doc/doctool.c | 622 --- winsup/doc/doctool.txt | 146 - winsup/doc/effectively.xml | 184 - winsup/doc/faq-api.xml | 329 -- winsup/doc/faq-copyright.xml | 17 - winsup/doc/faq-programming.xml | 1125 ----- winsup/doc/faq-resources.xml | 58 - winsup/doc/faq-setup.xml | 621 --- winsup/doc/faq-using.xml | 1249 ----- winsup/doc/faq-what.xml | 162 - winsup/doc/faq.xml | 21 - winsup/doc/fhandler-tut.txt | 94 - winsup/doc/filemodes.xml | 37 - winsup/doc/fo.xsl | 32 - winsup/doc/gcc.xml | 142 - winsup/doc/gdb.xml | 88 - winsup/doc/highlights.xml | 384 -- winsup/doc/legal.xml | 32 - winsup/doc/new-features.xml | 1363 ----- winsup/doc/ntsec.xml | 889 ---- winsup/doc/ov-ex-unix.xml | 54 - winsup/doc/ov-ex-win.xml | 47 - winsup/doc/overview.xml | 131 - winsup/doc/pathnames.xml | 570 --- winsup/doc/programming.xml | 12 - winsup/doc/setup-env.xml | 129 - winsup/doc/setup-files.xml | 85 - winsup/doc/setup-locale.xml | 432 -- winsup/doc/setup-maxmem.xml | 66 - winsup/doc/setup-net.xml | 291 -- winsup/doc/specialnames.xml | 513 -- winsup/doc/textbinary.xml | 196 - winsup/doc/ug-info.xml | 36 - winsup/doc/using.xml | 21 - winsup/doc/windres.xml | 172 - winsup/doc/xidepend | 34 - winsup/install-sh | 520 -- winsup/lsaauth/ChangeLog | 165 - winsup/lsaauth/ChangeLog.64bit | 13 - winsup/lsaauth/Makefile.in | 95 - winsup/lsaauth/aclocal.m4 | 875 ---- winsup/lsaauth/configure | 4218 ---------------- winsup/lsaauth/configure.ac | 42 - winsup/lsaauth/cyglsa-config | 123 - winsup/lsaauth/cyglsa.c | 633 --- winsup/lsaauth/cyglsa.din | 9 - winsup/lsaauth/cyglsa64.def | 9 - winsup/testsuite/ChangeLog | 790 --- winsup/testsuite/Makefile.in | 170 - winsup/testsuite/README | 40 - winsup/testsuite/aclocal.m4 | 831 --- winsup/testsuite/config/default.exp | 13 - winsup/testsuite/configure | 3937 --------------- winsup/testsuite/configure.ac | 19 - winsup/testsuite/cygrun.c | 69 - winsup/testsuite/libltp/include/dataascii.h | 65 - winsup/testsuite/libltp/include/databin.h | 44 - winsup/testsuite/libltp/include/file_lock.h | 40 - winsup/testsuite/libltp/include/forker.h | 63 - winsup/testsuite/libltp/include/open_flags.h | 73 - winsup/testsuite/libltp/include/pattern.h | 90 - winsup/testsuite/libltp/include/random_range.h | 45 - winsup/testsuite/libltp/include/rmobj.h | 12 - winsup/testsuite/libltp/include/search_path.h | 36 - winsup/testsuite/libltp/include/str_to_bytes.h | 39 - winsup/testsuite/libltp/include/string_to_tokens.h | 48 - winsup/testsuite/libltp/include/test.h | 232 - winsup/testsuite/libltp/include/tlibio.h | 148 - winsup/testsuite/libltp/include/usctest.h | 319 -- winsup/testsuite/libltp/include/write_log.h | 169 - winsup/testsuite/libltp/lib/dataascii.c | 218 - winsup/testsuite/libltp/lib/databin.c | 298 -- winsup/testsuite/libltp/lib/datapid.c | 374 -- winsup/testsuite/libltp/lib/forker.c | 286 -- winsup/testsuite/libltp/lib/get_high_address.c | 46 - winsup/testsuite/libltp/lib/libtestsuite.c | 70 - winsup/testsuite/libltp/lib/open_flags.c | 330 -- winsup/testsuite/libltp/lib/parse_opts.c | 876 ---- winsup/testsuite/libltp/lib/pattern.c | 168 - winsup/testsuite/libltp/lib/rmobj.c | 211 - winsup/testsuite/libltp/lib/search_path.c | 249 - winsup/testsuite/libltp/lib/str_to_bytes.c | 211 - winsup/testsuite/libltp/lib/string_to_tokens.c | 109 - winsup/testsuite/libltp/lib/tst_res.c | 960 ---- winsup/testsuite/libltp/lib/tst_sig.c | 220 - winsup/testsuite/libltp/lib/tst_tmpdir.c | 347 -- winsup/testsuite/libltp/lib/write_log.c | 468 -- winsup/testsuite/winsup.api/checksignal.c | 91 - winsup/testsuite/winsup.api/crlf.c | 527 -- winsup/testsuite/winsup.api/cygload.cc | 628 --- winsup/testsuite/winsup.api/cygload.exp | 40 - winsup/testsuite/winsup.api/cygload.h | 158 - winsup/testsuite/winsup.api/devdsp.c | 783 --- winsup/testsuite/winsup.api/devdsp_okay.h | 531 -- winsup/testsuite/winsup.api/devzero.c | 115 - winsup/testsuite/winsup.api/iospeed.c | 115 - winsup/testsuite/winsup.api/known_bugs.tcl | 4 - winsup/testsuite/winsup.api/ltp/access01.c | 300 -- winsup/testsuite/winsup.api/ltp/access03.c | 506 -- winsup/testsuite/winsup.api/ltp/access04.c | 241 - winsup/testsuite/winsup.api/ltp/access05.c | 424 -- winsup/testsuite/winsup.api/ltp/alarm01.c | 226 - winsup/testsuite/winsup.api/ltp/alarm02.c | 240 - winsup/testsuite/winsup.api/ltp/alarm03.c | 229 - winsup/testsuite/winsup.api/ltp/alarm07.c | 201 - winsup/testsuite/winsup.api/ltp/asyncio02.c | 364 -- winsup/testsuite/winsup.api/ltp/chdir02.c | 219 - winsup/testsuite/winsup.api/ltp/chdir04.c | 188 - winsup/testsuite/winsup.api/ltp/chmod01.c | 230 - winsup/testsuite/winsup.api/ltp/chmod02.c | 260 - winsup/testsuite/winsup.api/ltp/chown01.c | 244 - winsup/testsuite/winsup.api/ltp/close01.c | 201 - winsup/testsuite/winsup.api/ltp/close02.c | 143 - winsup/testsuite/winsup.api/ltp/close08.c | 241 - winsup/testsuite/winsup.api/ltp/creat01.c | 207 - winsup/testsuite/winsup.api/ltp/creat03.c | 154 - winsup/testsuite/winsup.api/ltp/creat09.c | 246 - winsup/testsuite/winsup.api/ltp/dup01.c | 261 - winsup/testsuite/winsup.api/ltp/dup02.c | 246 - winsup/testsuite/winsup.api/ltp/dup03.c | 291 -- winsup/testsuite/winsup.api/ltp/dup04.c | 297 -- winsup/testsuite/winsup.api/ltp/dup05.c | 266 - winsup/testsuite/winsup.api/ltp/execl01.c | 258 - winsup/testsuite/winsup.api/ltp/execle01.c | 257 - winsup/testsuite/winsup.api/ltp/execlp01.c | 256 - winsup/testsuite/winsup.api/ltp/execv01.c | 254 - winsup/testsuite/winsup.api/ltp/execve01.c | 258 - winsup/testsuite/winsup.api/ltp/execvp01.c | 257 - winsup/testsuite/winsup.api/ltp/exit01.c | 165 - winsup/testsuite/winsup.api/ltp/exit02.c | 228 - winsup/testsuite/winsup.api/ltp/fchdir01.c | 249 - winsup/testsuite/winsup.api/ltp/fchdir02.c | 160 - winsup/testsuite/winsup.api/ltp/fchmod01.c | 241 - winsup/testsuite/winsup.api/ltp/fchown01.c | 234 - winsup/testsuite/winsup.api/ltp/fcntl02.c | 244 - winsup/testsuite/winsup.api/ltp/fcntl03.c | 240 - winsup/testsuite/winsup.api/ltp/fcntl04.c | 239 - winsup/testsuite/winsup.api/ltp/fcntl05.c | 249 - winsup/testsuite/winsup.api/ltp/fcntl07.c | 423 -- winsup/testsuite/winsup.api/ltp/fcntl07B.c | 422 -- winsup/testsuite/winsup.api/ltp/fcntl08.c | 250 - winsup/testsuite/winsup.api/ltp/fcntl09.c | 278 - winsup/testsuite/winsup.api/ltp/fcntl10.c | 284 -- winsup/testsuite/winsup.api/ltp/fork01.c | 316 -- winsup/testsuite/winsup.api/ltp/fork02.c | 139 - winsup/testsuite/winsup.api/ltp/fork03.c | 165 - winsup/testsuite/winsup.api/ltp/fork04.c | 403 -- winsup/testsuite/winsup.api/ltp/fork06.c | 153 - winsup/testsuite/winsup.api/ltp/fork07.c | 200 - winsup/testsuite/winsup.api/ltp/fork09.c | 229 - winsup/testsuite/winsup.api/ltp/fork10.c | 216 - winsup/testsuite/winsup.api/ltp/fork11.c | 141 - winsup/testsuite/winsup.api/ltp/fpathconf01.c | 256 - winsup/testsuite/winsup.api/ltp/fstat01.c | 237 - winsup/testsuite/winsup.api/ltp/fstat02.c | 244 - winsup/testsuite/winsup.api/ltp/fstat03.c | 189 - winsup/testsuite/winsup.api/ltp/fstat04.c | 244 - winsup/testsuite/winsup.api/ltp/fsync01.c | 248 - winsup/testsuite/winsup.api/ltp/ftruncate01.c | 244 - winsup/testsuite/winsup.api/ltp/ftruncate02.c | 313 -- winsup/testsuite/winsup.api/ltp/ftruncate03.c | 324 -- winsup/testsuite/winsup.api/ltp/getegid01.c | 226 - winsup/testsuite/winsup.api/ltp/geteuid01.c | 226 - winsup/testsuite/winsup.api/ltp/getgid01.c | 219 - winsup/testsuite/winsup.api/ltp/getgid02.c | 159 - winsup/testsuite/winsup.api/ltp/getgid03.c | 158 - winsup/testsuite/winsup.api/ltp/getgroups01.c | 314 -- winsup/testsuite/winsup.api/ltp/getgroups02.c | 226 - winsup/testsuite/winsup.api/ltp/gethostid01.c | 224 - winsup/testsuite/winsup.api/ltp/gethostname01.c | 226 - winsup/testsuite/winsup.api/ltp/getpgid01.c | 236 - winsup/testsuite/winsup.api/ltp/getpgid02.c | 172 - winsup/testsuite/winsup.api/ltp/getpgrp01.c | 219 - winsup/testsuite/winsup.api/ltp/getpid01.c | 217 - winsup/testsuite/winsup.api/ltp/getpid02.c | 186 - winsup/testsuite/winsup.api/ltp/getppid01.c | 219 - winsup/testsuite/winsup.api/ltp/getppid02.c | 148 - winsup/testsuite/winsup.api/ltp/getuid01.c | 219 - winsup/testsuite/winsup.api/ltp/getuid02.c | 137 - winsup/testsuite/winsup.api/ltp/getuid03.c | 138 - winsup/testsuite/winsup.api/ltp/kill01.c | 162 - winsup/testsuite/winsup.api/ltp/kill02.c | 857 ---- winsup/testsuite/winsup.api/ltp/kill03.c | 170 - winsup/testsuite/winsup.api/ltp/kill04.c | 181 - winsup/testsuite/winsup.api/ltp/kill09.c | 258 - winsup/testsuite/winsup.api/ltp/link02.c | 263 - winsup/testsuite/winsup.api/ltp/link03.c | 330 -- winsup/testsuite/winsup.api/ltp/link04.c | 426 -- winsup/testsuite/winsup.api/ltp/link05.c | 351 -- winsup/testsuite/winsup.api/ltp/lseek01.c | 255 - winsup/testsuite/winsup.api/ltp/lseek02.c | 242 - winsup/testsuite/winsup.api/ltp/lseek03.c | 289 -- winsup/testsuite/winsup.api/ltp/lseek04.c | 256 - winsup/testsuite/winsup.api/ltp/lseek05.c | 252 - winsup/testsuite/winsup.api/ltp/lseek06.c | 235 - winsup/testsuite/winsup.api/ltp/lseek07.c | 286 -- winsup/testsuite/winsup.api/ltp/lseek08.c | 240 - winsup/testsuite/winsup.api/ltp/lseek09.c | 266 - winsup/testsuite/winsup.api/ltp/lseek10.c | 344 -- winsup/testsuite/winsup.api/ltp/lstat02.c | 253 - winsup/testsuite/winsup.api/ltp/mkdir01.c | 270 - winsup/testsuite/winsup.api/ltp/mkdir08.c | 235 - winsup/testsuite/winsup.api/ltp/mknod01.c | 275 - winsup/testsuite/winsup.api/ltp/mmap001.c | 203 - winsup/testsuite/winsup.api/ltp/mmap02.c | 291 -- winsup/testsuite/winsup.api/ltp/mmap03.c | 290 -- winsup/testsuite/winsup.api/ltp/mmap04.c | 291 -- winsup/testsuite/winsup.api/ltp/mmap05.c | 301 -- winsup/testsuite/winsup.api/ltp/mmap06.c | 234 - winsup/testsuite/winsup.api/ltp/mmap07.c | 233 - winsup/testsuite/winsup.api/ltp/mmap08.c | 234 - winsup/testsuite/winsup.api/ltp/munmap01.c | 281 -- winsup/testsuite/winsup.api/ltp/munmap02.c | 306 -- winsup/testsuite/winsup.api/ltp/nice05.c | 219 - winsup/testsuite/winsup.api/ltp/open02.c | 146 - winsup/testsuite/winsup.api/ltp/open03.c | 243 - winsup/testsuite/winsup.api/ltp/pathconf01.c | 245 - winsup/testsuite/winsup.api/ltp/pause01.c | 229 - winsup/testsuite/winsup.api/ltp/pipe01.c | 156 - winsup/testsuite/winsup.api/ltp/pipe08.c | 158 - winsup/testsuite/winsup.api/ltp/pipe09.c | 230 - winsup/testsuite/winsup.api/ltp/pipe10.c | 167 - winsup/testsuite/winsup.api/ltp/pipe11.c | 227 - winsup/testsuite/winsup.api/ltp/poll01.c | 250 - winsup/testsuite/winsup.api/ltp/read01.c | 280 -- winsup/testsuite/winsup.api/ltp/read04.c | 174 - winsup/testsuite/winsup.api/ltp/readdir01.c | 350 -- winsup/testsuite/winsup.api/ltp/readlink01.c | 229 - winsup/testsuite/winsup.api/ltp/readlink02.c | 244 - winsup/testsuite/winsup.api/ltp/readlink03.c | 360 -- winsup/testsuite/winsup.api/ltp/rename01.c | 263 - winsup/testsuite/winsup.api/ltp/rename02.c | 251 - winsup/testsuite/winsup.api/ltp/rename08.c | 205 - winsup/testsuite/winsup.api/ltp/rename10.c | 203 - winsup/testsuite/winsup.api/ltp/rmdir01.c | 189 - winsup/testsuite/winsup.api/ltp/rmdir04.c | 236 - winsup/testsuite/winsup.api/ltp/rmdir05.c | 447 -- winsup/testsuite/winsup.api/ltp/sbrk01.c | 279 - winsup/testsuite/winsup.api/ltp/select01.c | 276 - winsup/testsuite/winsup.api/ltp/select02.c | 268 - winsup/testsuite/winsup.api/ltp/select03.c | 282 -- winsup/testsuite/winsup.api/ltp/setgid01.c | 219 - winsup/testsuite/winsup.api/ltp/setgroups01.c | 228 - winsup/testsuite/winsup.api/ltp/setpgid01.c | 238 - winsup/testsuite/winsup.api/ltp/setregid01.c | 338 -- winsup/testsuite/winsup.api/ltp/setreuid01.c | 338 -- winsup/testsuite/winsup.api/ltp/setuid01.c | 225 - winsup/testsuite/winsup.api/ltp/setuid02.c | 240 - winsup/testsuite/winsup.api/ltp/signal03.c | 663 --- winsup/testsuite/winsup.api/ltp/stat01.c | 267 - winsup/testsuite/winsup.api/ltp/stat02.c | 276 - winsup/testsuite/winsup.api/ltp/stat03.c | 391 -- winsup/testsuite/winsup.api/ltp/stat05.c | 241 - winsup/testsuite/winsup.api/ltp/stat06.c | 377 -- winsup/testsuite/winsup.api/ltp/symlink01.c | 2032 -------- winsup/testsuite/winsup.api/ltp/symlink02.c | 245 - winsup/testsuite/winsup.api/ltp/symlink03.c | 404 -- winsup/testsuite/winsup.api/ltp/symlink04.c | 238 - winsup/testsuite/winsup.api/ltp/symlink05.c | 222 - winsup/testsuite/winsup.api/ltp/sync01.c | 216 - winsup/testsuite/winsup.api/ltp/sync02.c | 238 - winsup/testsuite/winsup.api/ltp/time01.c | 218 - winsup/testsuite/winsup.api/ltp/time02.c | 182 - winsup/testsuite/winsup.api/ltp/times01.c | 222 - winsup/testsuite/winsup.api/ltp/times02.c | 136 - winsup/testsuite/winsup.api/ltp/times03.c | 247 - winsup/testsuite/winsup.api/ltp/truncate01.c | 262 - winsup/testsuite/winsup.api/ltp/truncate02.c | 335 -- winsup/testsuite/winsup.api/ltp/ulimit01.c | 273 - winsup/testsuite/winsup.api/ltp/umask01.c | 220 - winsup/testsuite/winsup.api/ltp/umask02.c | 135 - winsup/testsuite/winsup.api/ltp/umask03.c | 170 - winsup/testsuite/winsup.api/ltp/uname01.c | 221 - winsup/testsuite/winsup.api/ltp/unlink05.c | 246 - winsup/testsuite/winsup.api/ltp/unlink06.c | 254 - winsup/testsuite/winsup.api/ltp/unlink07.c | 328 -- winsup/testsuite/winsup.api/ltp/unlink08.c | 432 -- winsup/testsuite/winsup.api/ltp/vfork01.c | 400 -- winsup/testsuite/winsup.api/ltp/wait02.c | 230 - winsup/testsuite/winsup.api/ltp/wait401.c | 188 - winsup/testsuite/winsup.api/ltp/wait402.c | 203 - winsup/testsuite/winsup.api/ltp/write01.c | 250 - winsup/testsuite/winsup.api/ltp/write02.c | 165 - winsup/testsuite/winsup.api/ltp/write03.c | 192 - winsup/testsuite/winsup.api/mmaptest01.c | 176 - winsup/testsuite/winsup.api/mmaptest02.c | 190 - winsup/testsuite/winsup.api/mmaptest03.c | 154 - winsup/testsuite/winsup.api/mmaptest04.c | 103 - winsup/testsuite/winsup.api/msgtest.c | 348 -- winsup/testsuite/winsup.api/nullgetcwd.c | 17 - winsup/testsuite/winsup.api/pthread/cancel1.c | 147 - winsup/testsuite/winsup.api/pthread/cancel10.c | 68 - winsup/testsuite/winsup.api/pthread/cancel11.c | 74 - winsup/testsuite/winsup.api/pthread/cancel12.c | 69 - winsup/testsuite/winsup.api/pthread/cancel2.c | 181 - winsup/testsuite/winsup.api/pthread/cancel3.c | 166 - winsup/testsuite/winsup.api/pthread/cancel4.c | 172 - winsup/testsuite/winsup.api/pthread/cancel5.c | 165 - winsup/testsuite/winsup.api/pthread/cancel6.c | 62 - winsup/testsuite/winsup.api/pthread/cancel7.c | 71 - winsup/testsuite/winsup.api/pthread/cancel8.c | 71 - winsup/testsuite/winsup.api/pthread/cancel9.c | 81 - winsup/testsuite/winsup.api/pthread/cleanup2.c | 157 - winsup/testsuite/winsup.api/pthread/cleanup3.c | 160 - winsup/testsuite/winsup.api/pthread/condvar1.c | 65 - winsup/testsuite/winsup.api/pthread/condvar2.c | 80 - winsup/testsuite/winsup.api/pthread/condvar2_1.c | 107 - winsup/testsuite/winsup.api/pthread/condvar3.c | 115 - winsup/testsuite/winsup.api/pthread/condvar3_1.c | 145 - winsup/testsuite/winsup.api/pthread/condvar3_2.c | 139 - winsup/testsuite/winsup.api/pthread/condvar3_3.c | 100 - winsup/testsuite/winsup.api/pthread/condvar4.c | 137 - winsup/testsuite/winsup.api/pthread/condvar5.c | 136 - winsup/testsuite/winsup.api/pthread/condvar6.c | 209 - winsup/testsuite/winsup.api/pthread/condvar7.c | 227 - winsup/testsuite/winsup.api/pthread/condvar8.c | 221 - winsup/testsuite/winsup.api/pthread/condvar9.c | 239 - winsup/testsuite/winsup.api/pthread/count1.c | 62 - winsup/testsuite/winsup.api/pthread/create1.c | 34 - winsup/testsuite/winsup.api/pthread/create2.c | 74 - winsup/testsuite/winsup.api/pthread/equal1.c | 34 - winsup/testsuite/winsup.api/pthread/exit1.c | 18 - winsup/testsuite/winsup.api/pthread/exit2.c | 30 - winsup/testsuite/winsup.api/pthread/exit3.c | 34 - winsup/testsuite/winsup.api/pthread/inherit1.c | 99 - winsup/testsuite/winsup.api/pthread/join0.c | 40 - winsup/testsuite/winsup.api/pthread/join1.c | 51 - winsup/testsuite/winsup.api/pthread/join2.c | 41 - .../testsuite/winsup.api/pthread/mainthreadexits.c | 48 - winsup/testsuite/winsup.api/pthread/mutex1.c | 36 - winsup/testsuite/winsup.api/pthread/mutex1d.c | 42 - winsup/testsuite/winsup.api/pthread/mutex1e.c | 42 - winsup/testsuite/winsup.api/pthread/mutex1n.c | 42 - winsup/testsuite/winsup.api/pthread/mutex1r.c | 42 - winsup/testsuite/winsup.api/pthread/mutex2.c | 34 - winsup/testsuite/winsup.api/pthread/mutex3.c | 43 - winsup/testsuite/winsup.api/pthread/mutex4.c | 67 - winsup/testsuite/winsup.api/pthread/mutex5.c | 30 - winsup/testsuite/winsup.api/pthread/mutex6d.c | 71 - winsup/testsuite/winsup.api/pthread/mutex6e.c | 70 - winsup/testsuite/winsup.api/pthread/mutex6n.c | 72 - winsup/testsuite/winsup.api/pthread/mutex6r.c | 68 - winsup/testsuite/winsup.api/pthread/mutex7.c | 50 - winsup/testsuite/winsup.api/pthread/mutex7d.c | 51 - winsup/testsuite/winsup.api/pthread/mutex7e.c | 70 - winsup/testsuite/winsup.api/pthread/mutex7n.c | 61 - winsup/testsuite/winsup.api/pthread/mutex7r.c | 68 - winsup/testsuite/winsup.api/pthread/mutex8e.c | 35 - winsup/testsuite/winsup.api/pthread/mutex8n.c | 60 - winsup/testsuite/winsup.api/pthread/mutex8r.c | 37 - winsup/testsuite/winsup.api/pthread/once1.c | 45 - winsup/testsuite/winsup.api/pthread/priority1.c | 78 - winsup/testsuite/winsup.api/pthread/priority2.c | 80 - winsup/testsuite/winsup.api/pthread/rwlock1.c | 29 - winsup/testsuite/winsup.api/pthread/rwlock2.c | 34 - winsup/testsuite/winsup.api/pthread/rwlock3.c | 45 - winsup/testsuite/winsup.api/pthread/rwlock4.c | 44 - winsup/testsuite/winsup.api/pthread/rwlock5.c | 47 - winsup/testsuite/winsup.api/pthread/rwlock6.c | 69 - winsup/testsuite/winsup.api/pthread/rwlock7.c | 190 - winsup/testsuite/winsup.api/pthread/self1.c | 26 - winsup/testsuite/winsup.api/pthread/self2.c | 46 - winsup/testsuite/winsup.api/pthread/test.h | 102 - .../winsup.api/pthread/threadidafterfork.c | 50 - winsup/testsuite/winsup.api/pthread/tsd1.c | 170 - winsup/testsuite/winsup.api/resethand.c | 36 - winsup/testsuite/winsup.api/samples/sample-fail.c | 5 - .../winsup.api/samples/sample-miscompile.c | 1 - winsup/testsuite/winsup.api/samples/sample-pass.c | 5 - winsup/testsuite/winsup.api/semtest.c | 348 -- winsup/testsuite/winsup.api/shmtest.c | 293 -- winsup/testsuite/winsup.api/sigchld.c | 22 - .../testsuite/winsup.api/signal-into-win32-api.c | 58 - winsup/testsuite/winsup.api/systemcall.c | 68 - winsup/testsuite/winsup.api/user_malloc.c | 216 - winsup/testsuite/winsup.api/waitpid.c | 24 - winsup/testsuite/winsup.api/winsup.exp | 85 - winsup/utils/COPYING.dumper | 340 -- winsup/utils/ChangeLog | 3897 -------------- winsup/utils/ChangeLog-2000 | 347 -- winsup/utils/ChangeLog.64bit | 85 - winsup/utils/Makefile.in | 186 - winsup/utils/aclocal.m4 | 97 - winsup/utils/autogen.sh | 4 - winsup/utils/bloda.cc | 424 -- winsup/utils/configure | 4474 ---------------- winsup/utils/configure.ac | 40 - winsup/utils/cygcheck.cc | 2467 --------- winsup/utils/cygpath.cc | 1057 ---- winsup/utils/cygwin-console-helper.cc | 13 - winsup/utils/dump_setup.cc | 615 --- winsup/utils/dumper.cc | 950 ---- winsup/utils/dumper.h | 142 - winsup/utils/getconf.c | 605 --- winsup/utils/getfacl.c | 241 - winsup/utils/kill.cc | 288 -- winsup/utils/ldd.cc | 672 --- winsup/utils/ldh.cc | 17 - winsup/utils/loadlib.h | 61 - winsup/utils/locale.cc | 849 ---- winsup/utils/minidumper.cc | 237 - winsup/utils/mkgroup.c | 909 ---- winsup/utils/mkpasswd.c | 837 --- winsup/utils/module_info.cc | 72 - winsup/utils/mount.cc | 557 -- winsup/utils/parse_pe.cc | 105 - winsup/utils/passwd.c | 661 --- winsup/utils/path.cc | 954 ---- winsup/utils/path.h | 32 - winsup/utils/pldd.c | 145 - winsup/utils/ps.cc | 409 -- winsup/utils/regtool.cc | 993 ---- winsup/utils/setfacl.c | 561 --- winsup/utils/setmetamode.c | 120 - winsup/utils/ssp.c | 956 ---- winsup/utils/ssp.txt | 125 - winsup/utils/strace.cc | 1107 ---- winsup/utils/testsuite.cc | 89 - winsup/utils/testsuite.h | 131 - winsup/utils/tzset.c | 721 --- winsup/utils/umount.cc | 145 - winsup/utils/utils.xml | 2127 -------- winsup/utils/wide_path.h | 43 - 493 files changed, 110 insertions(+), 154282 deletions(-) delete mode 100644 winsup/COPYING delete mode 100644 winsup/CYGWIN_LICENSE delete mode 100644 winsup/ChangeLog delete mode 100644 winsup/Makefile.common delete mode 100644 winsup/Makefile.in delete mode 100644 winsup/README delete mode 100644 winsup/acinclude.m4 delete mode 100644 winsup/aclocal.m4 delete mode 100755 winsup/autogen.sh delete mode 100755 winsup/c++wrap delete mode 100755 winsup/ccwrap delete mode 100755 winsup/config.guess delete mode 100755 winsup/config.sub delete mode 100755 winsup/configure delete mode 100755 winsup/configure.ac delete mode 100755 winsup/configure.cygwin delete mode 100644 winsup/cygserver/ChangeLog delete mode 100644 winsup/cygserver/ChangeLog.64bit delete mode 100644 winsup/cygserver/Makefile.in delete mode 100644 winsup/cygserver/README delete mode 100644 winsup/cygserver/aclocal.m4 delete mode 100755 winsup/cygserver/autogen.sh delete mode 100644 winsup/cygserver/bsd_helper.cc delete mode 100644 winsup/cygserver/bsd_helper.h delete mode 100644 winsup/cygserver/bsd_log.cc delete mode 100644 winsup/cygserver/bsd_log.h delete mode 100644 winsup/cygserver/bsd_mutex.cc delete mode 100644 winsup/cygserver/bsd_mutex.h delete mode 100644 winsup/cygserver/client.cc delete mode 100755 winsup/cygserver/configure delete mode 100644 winsup/cygserver/configure.ac delete mode 100755 winsup/cygserver/cygserver-config delete mode 100644 winsup/cygserver/cygserver.cc delete mode 100644 winsup/cygserver/cygserver.conf delete mode 100644 winsup/cygserver/msg.cc delete mode 100644 winsup/cygserver/process.cc delete mode 100644 winsup/cygserver/process.h delete mode 100644 winsup/cygserver/sem.cc delete mode 100644 winsup/cygserver/setpwd.cc delete mode 100644 winsup/cygserver/shm.cc delete mode 100644 winsup/cygserver/sysv_msg.cc delete mode 100644 winsup/cygserver/sysv_sem.cc delete mode 100644 winsup/cygserver/sysv_shm.cc delete mode 100644 winsup/cygserver/threaded_queue.cc delete mode 100644 winsup/cygserver/threaded_queue.h delete mode 100644 winsup/cygserver/transport.cc delete mode 100644 winsup/cygserver/transport.h delete mode 100644 winsup/cygserver/transport_pipes.cc delete mode 100644 winsup/cygserver/transport_pipes.h delete mode 100644 winsup/cygserver/woutsup.h delete mode 100644 winsup/cygwin/release/1.7.29 delete mode 100644 winsup/doc/.cvsignore delete mode 100644 winsup/doc/ChangeLog delete mode 100644 winsup/doc/Makefile.in delete mode 100644 winsup/doc/README delete mode 100644 winsup/doc/Wishlist delete mode 100644 winsup/doc/aclocal.m4 delete mode 100755 winsup/doc/bodysnatcher.pl delete mode 100755 winsup/doc/configure delete mode 100644 winsup/doc/configure.ac delete mode 100644 winsup/doc/cygserver.xml delete mode 100644 winsup/doc/cygwin-api.in.xml delete mode 100644 winsup/doc/cygwin-ug-net.xml delete mode 100644 winsup/doc/cygwin.xsl delete mode 100644 winsup/doc/cygwinenv.xml delete mode 100644 winsup/doc/dll.xml delete mode 100644 winsup/doc/doctool.c delete mode 100644 winsup/doc/doctool.txt delete mode 100644 winsup/doc/effectively.xml delete mode 100644 winsup/doc/faq-api.xml delete mode 100644 winsup/doc/faq-copyright.xml delete mode 100644 winsup/doc/faq-programming.xml delete mode 100644 winsup/doc/faq-resources.xml delete mode 100644 winsup/doc/faq-setup.xml delete mode 100644 winsup/doc/faq-using.xml delete mode 100644 winsup/doc/faq-what.xml delete mode 100644 winsup/doc/faq.xml delete mode 100644 winsup/doc/fhandler-tut.txt delete mode 100644 winsup/doc/filemodes.xml delete mode 100644 winsup/doc/fo.xsl delete mode 100644 winsup/doc/gcc.xml delete mode 100644 winsup/doc/gdb.xml delete mode 100644 winsup/doc/highlights.xml delete mode 100644 winsup/doc/legal.xml delete mode 100644 winsup/doc/new-features.xml delete mode 100644 winsup/doc/ntsec.xml delete mode 100644 winsup/doc/ov-ex-unix.xml delete mode 100644 winsup/doc/ov-ex-win.xml delete mode 100644 winsup/doc/overview.xml delete mode 100644 winsup/doc/pathnames.xml delete mode 100644 winsup/doc/programming.xml delete mode 100644 winsup/doc/setup-env.xml delete mode 100644 winsup/doc/setup-files.xml delete mode 100644 winsup/doc/setup-locale.xml delete mode 100644 winsup/doc/setup-maxmem.xml delete mode 100644 winsup/doc/setup-net.xml delete mode 100644 winsup/doc/specialnames.xml delete mode 100644 winsup/doc/textbinary.xml delete mode 100644 winsup/doc/ug-info.xml delete mode 100644 winsup/doc/using.xml delete mode 100644 winsup/doc/windres.xml delete mode 100755 winsup/doc/xidepend delete mode 100755 winsup/install-sh delete mode 100644 winsup/lsaauth/ChangeLog delete mode 100644 winsup/lsaauth/ChangeLog.64bit delete mode 100644 winsup/lsaauth/Makefile.in delete mode 100644 winsup/lsaauth/aclocal.m4 delete mode 100755 winsup/lsaauth/configure delete mode 100644 winsup/lsaauth/configure.ac delete mode 100755 winsup/lsaauth/cyglsa-config delete mode 100644 winsup/lsaauth/cyglsa.c delete mode 100644 winsup/lsaauth/cyglsa.din delete mode 100644 winsup/lsaauth/cyglsa64.def delete mode 100644 winsup/testsuite/ChangeLog delete mode 100644 winsup/testsuite/Makefile.in delete mode 100644 winsup/testsuite/README delete mode 100644 winsup/testsuite/aclocal.m4 delete mode 100644 winsup/testsuite/config/default.exp delete mode 100644 winsup/testsuite/configure delete mode 100755 winsup/testsuite/configure.ac delete mode 100644 winsup/testsuite/cygrun.c delete mode 100644 winsup/testsuite/libltp/include/dataascii.h delete mode 100644 winsup/testsuite/libltp/include/databin.h delete mode 100644 winsup/testsuite/libltp/include/file_lock.h delete mode 100644 winsup/testsuite/libltp/include/forker.h delete mode 100644 winsup/testsuite/libltp/include/open_flags.h delete mode 100644 winsup/testsuite/libltp/include/pattern.h delete mode 100644 winsup/testsuite/libltp/include/random_range.h delete mode 100644 winsup/testsuite/libltp/include/rmobj.h delete mode 100644 winsup/testsuite/libltp/include/search_path.h delete mode 100644 winsup/testsuite/libltp/include/str_to_bytes.h delete mode 100644 winsup/testsuite/libltp/include/string_to_tokens.h delete mode 100644 winsup/testsuite/libltp/include/test.h delete mode 100644 winsup/testsuite/libltp/include/tlibio.h delete mode 100644 winsup/testsuite/libltp/include/usctest.h delete mode 100644 winsup/testsuite/libltp/include/write_log.h delete mode 100644 winsup/testsuite/libltp/lib/dataascii.c delete mode 100644 winsup/testsuite/libltp/lib/databin.c delete mode 100644 winsup/testsuite/libltp/lib/datapid.c delete mode 100644 winsup/testsuite/libltp/lib/forker.c delete mode 100644 winsup/testsuite/libltp/lib/get_high_address.c delete mode 100644 winsup/testsuite/libltp/lib/libtestsuite.c delete mode 100644 winsup/testsuite/libltp/lib/open_flags.c delete mode 100644 winsup/testsuite/libltp/lib/parse_opts.c delete mode 100644 winsup/testsuite/libltp/lib/pattern.c delete mode 100644 winsup/testsuite/libltp/lib/rmobj.c delete mode 100644 winsup/testsuite/libltp/lib/search_path.c delete mode 100644 winsup/testsuite/libltp/lib/str_to_bytes.c delete mode 100644 winsup/testsuite/libltp/lib/string_to_tokens.c delete mode 100644 winsup/testsuite/libltp/lib/tst_res.c delete mode 100644 winsup/testsuite/libltp/lib/tst_sig.c delete mode 100644 winsup/testsuite/libltp/lib/tst_tmpdir.c delete mode 100644 winsup/testsuite/libltp/lib/write_log.c delete mode 100644 winsup/testsuite/winsup.api/checksignal.c delete mode 100644 winsup/testsuite/winsup.api/crlf.c delete mode 100644 winsup/testsuite/winsup.api/cygload.cc delete mode 100644 winsup/testsuite/winsup.api/cygload.exp delete mode 100644 winsup/testsuite/winsup.api/cygload.h delete mode 100644 winsup/testsuite/winsup.api/devdsp.c delete mode 100644 winsup/testsuite/winsup.api/devdsp_okay.h delete mode 100644 winsup/testsuite/winsup.api/devzero.c delete mode 100644 winsup/testsuite/winsup.api/iospeed.c delete mode 100644 winsup/testsuite/winsup.api/known_bugs.tcl delete mode 100644 winsup/testsuite/winsup.api/ltp/access01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/access03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/access04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/access05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/alarm01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/alarm02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/alarm03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/alarm07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/asyncio02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/chdir02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/chdir04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/chmod01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/chmod02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/chown01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/close01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/close02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/close08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/creat01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/creat03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/creat09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/dup01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/dup02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/dup03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/dup04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/dup05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execl01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execle01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execlp01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execv01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execve01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execvp01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/exit01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/exit02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fchdir01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fchdir02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fchmod01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fchown01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl07B.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl10.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork06.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork10.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork11.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fpathconf01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fstat01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fstat02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fstat03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fstat04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fsync01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/ftruncate01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/ftruncate02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/ftruncate03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getegid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/geteuid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getgid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getgid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getgid03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getgroups01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getgroups02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/gethostid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/gethostname01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getpgid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getpgid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getpgrp01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getpid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getpid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getppid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getppid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getuid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getuid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getuid03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/kill01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/kill02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/kill03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/kill04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/kill09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/link02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/link03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/link04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/link05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek06.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek10.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lstat02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mkdir01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mkdir08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mknod01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap001.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap06.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/munmap01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/munmap02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/nice05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/open02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/open03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pathconf01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pause01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pipe01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pipe08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pipe09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pipe10.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pipe11.c delete mode 100644 winsup/testsuite/winsup.api/ltp/poll01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/read01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/read04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/readdir01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/readlink01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/readlink02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/readlink03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rename01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rename02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rename08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rename10.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rmdir01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rmdir04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rmdir05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/sbrk01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/select01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/select02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/select03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setgid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setgroups01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setpgid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setregid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setreuid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setuid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setuid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/signal03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/stat01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/stat02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/stat03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/stat05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/stat06.c delete mode 100644 winsup/testsuite/winsup.api/ltp/symlink01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/symlink02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/symlink03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/symlink04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/symlink05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/sync01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/sync02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/time01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/time02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/times01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/times02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/times03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/truncate01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/truncate02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/ulimit01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/umask01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/umask02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/umask03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/uname01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/unlink05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/unlink06.c delete mode 100644 winsup/testsuite/winsup.api/ltp/unlink07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/unlink08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/vfork01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/wait02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/wait401.c delete mode 100644 winsup/testsuite/winsup.api/ltp/wait402.c delete mode 100644 winsup/testsuite/winsup.api/ltp/write01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/write02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/write03.c delete mode 100644 winsup/testsuite/winsup.api/mmaptest01.c delete mode 100644 winsup/testsuite/winsup.api/mmaptest02.c delete mode 100644 winsup/testsuite/winsup.api/mmaptest03.c delete mode 100644 winsup/testsuite/winsup.api/mmaptest04.c delete mode 100644 winsup/testsuite/winsup.api/msgtest.c delete mode 100644 winsup/testsuite/winsup.api/nullgetcwd.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel10.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel11.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel12.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel4.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel5.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel6.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel7.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel8.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel9.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cleanup2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cleanup3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar2_1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar3_1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar3_2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar3_3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar4.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar5.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar6.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar7.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar8.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar9.c delete mode 100644 winsup/testsuite/winsup.api/pthread/count1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/create1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/create2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/equal1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/exit1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/exit2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/exit3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/inherit1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/join0.c delete mode 100644 winsup/testsuite/winsup.api/pthread/join1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/join2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mainthreadexits.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex1d.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex1e.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex1n.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex1r.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex4.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex5.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex6d.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex6e.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex6n.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex6r.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex7.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex7d.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex7e.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex7n.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex7r.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex8e.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex8n.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex8r.c delete mode 100644 winsup/testsuite/winsup.api/pthread/once1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/priority1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/priority2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock4.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock5.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock6.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock7.c delete mode 100644 winsup/testsuite/winsup.api/pthread/self1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/self2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/test.h delete mode 100644 winsup/testsuite/winsup.api/pthread/threadidafterfork.c delete mode 100644 winsup/testsuite/winsup.api/pthread/tsd1.c delete mode 100644 winsup/testsuite/winsup.api/resethand.c delete mode 100644 winsup/testsuite/winsup.api/samples/sample-fail.c delete mode 100644 winsup/testsuite/winsup.api/samples/sample-miscompile.c delete mode 100644 winsup/testsuite/winsup.api/samples/sample-pass.c delete mode 100644 winsup/testsuite/winsup.api/semtest.c delete mode 100644 winsup/testsuite/winsup.api/shmtest.c delete mode 100644 winsup/testsuite/winsup.api/sigchld.c delete mode 100755 winsup/testsuite/winsup.api/signal-into-win32-api.c delete mode 100644 winsup/testsuite/winsup.api/systemcall.c delete mode 100644 winsup/testsuite/winsup.api/user_malloc.c delete mode 100644 winsup/testsuite/winsup.api/waitpid.c delete mode 100644 winsup/testsuite/winsup.api/winsup.exp delete mode 100644 winsup/utils/COPYING.dumper delete mode 100644 winsup/utils/ChangeLog delete mode 100644 winsup/utils/ChangeLog-2000 delete mode 100644 winsup/utils/ChangeLog.64bit delete mode 100644 winsup/utils/Makefile.in delete mode 100644 winsup/utils/aclocal.m4 delete mode 100755 winsup/utils/autogen.sh delete mode 100644 winsup/utils/bloda.cc delete mode 100755 winsup/utils/configure delete mode 100644 winsup/utils/configure.ac delete mode 100644 winsup/utils/cygcheck.cc delete mode 100644 winsup/utils/cygpath.cc delete mode 100644 winsup/utils/cygwin-console-helper.cc delete mode 100644 winsup/utils/dump_setup.cc delete mode 100644 winsup/utils/dumper.cc delete mode 100644 winsup/utils/dumper.h delete mode 100644 winsup/utils/getconf.c delete mode 100644 winsup/utils/getfacl.c delete mode 100644 winsup/utils/kill.cc delete mode 100644 winsup/utils/ldd.cc delete mode 100644 winsup/utils/ldh.cc delete mode 100644 winsup/utils/loadlib.h delete mode 100644 winsup/utils/locale.cc delete mode 100644 winsup/utils/minidumper.cc delete mode 100644 winsup/utils/mkgroup.c delete mode 100644 winsup/utils/mkpasswd.c delete mode 100644 winsup/utils/module_info.cc delete mode 100644 winsup/utils/mount.cc delete mode 100644 winsup/utils/parse_pe.cc delete mode 100644 winsup/utils/passwd.c delete mode 100644 winsup/utils/path.cc delete mode 100644 winsup/utils/path.h delete mode 100644 winsup/utils/pldd.c delete mode 100644 winsup/utils/ps.cc delete mode 100644 winsup/utils/regtool.cc delete mode 100644 winsup/utils/setfacl.c delete mode 100644 winsup/utils/setmetamode.c delete mode 100644 winsup/utils/ssp.c delete mode 100644 winsup/utils/ssp.txt delete mode 100644 winsup/utils/strace.cc delete mode 100644 winsup/utils/testsuite.cc delete mode 100644 winsup/utils/testsuite.h delete mode 100644 winsup/utils/tzset.c delete mode 100644 winsup/utils/umount.cc delete mode 100644 winsup/utils/utils.xml delete mode 100644 winsup/utils/wide_path.h diff --git a/winsup/COPYING b/winsup/COPYING deleted file mode 100644 index 94a9ed024..000000000 --- a/winsup/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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 3 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 . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/winsup/CYGWIN_LICENSE b/winsup/CYGWIN_LICENSE deleted file mode 100644 index d1bf9d9f6..000000000 --- a/winsup/CYGWIN_LICENSE +++ /dev/null @@ -1,70 +0,0 @@ -Cygwin is free software. Red Hat, Inc. licenses Cygwin to you under the -terms of the GNU General Public License as published by the Free Software -Foundation; you can redistribute it and/or modify it under the terms of -the GNU General Public License either version 3 of the license, or (at your -option) any later version (GPLv3+), along with the additional permissions -given below. - -There is NO WARRANTY for this software, express or implied, including -the implied warranties 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 . - - -Additional Permissions: - - -1. Linking Exception. - -As a special exception to GPLv3+, Red Hat grants you permission to link -software whose sources are distributed under a license that satisfies -the Open Source Definition with libcygwin.a, without libcygwin.a -itself causing the resulting program to be covered by GPLv3+. - -This means that you can port an Open Source application to Cygwin, and -distribute that executable as if it didn't include a copy of -libcygwin.a linked into it. Note that this does not apply to the -Cygwin DLL itself. If you distribute a (possibly modified) version of -the Cygwin DLL, you must adhere to the terms of GPLv3+, including the -requirement to provide sources for the Cygwin DLL, unless you have obtained -a special Cygwin license to distribute the Cygwin DLL in only its binary -form (see below). - -See http://www.opensource.org/docs/osd/ for the precise Open Source -Definition referenced above. - - -2. Files Excluded from GPL Coverage. - -Red Hat grants you permission to distribute Cygwin with the following -files, which are not considered part of Cygwin and are not governed by -GPLv3+, in source or binary form. - -winsup\testsuite\winsup.api\msgtest.c -winsup\testsuite\winsup.api\semtest.c -winsup\testsuite\winsup.api\shmtest.c - -Red Hat grants you permission to link or combine code in Cygwin with -code in or corresponding to the following files, which are not -considered part of Cygwin and are not governed by GPLv3+, and to -distribute such combinations under terms of your choice, provided that -such terms are otherwise consistent with the application of GPLv3+ to -Cygwin itself. You must comply with GPLv3+ with respect to all -portions of such combinations other than those that correspond to or -are derived from such non-Cygwin code but which do not correspond to -or are not derived from Cygwin itself. - -winsup\cygserver\sysv_shm.cc - - -3. Alternative License. - -Red Hat sells a special Cygwin License for customers who are unable to -provide their application in open source code form. For more -information, please see: http://www.redhat.com/software/cygwin/, or call -+1-866-2REDHAT ext. 45300 (toll-free in the US). - -Outside the US call your regional Red Hat office, see -http://www.redhat.com/about/contact/ww/ diff --git a/winsup/ChangeLog b/winsup/ChangeLog deleted file mode 100644 index ce7df517a..000000000 --- a/winsup/ChangeLog +++ /dev/null @@ -1,626 +0,0 @@ -2014-02-18 Christopher Faylor - - * Makefile.in: Ignore errors on doc install. - -2013-01-22 Corinna Vinschen - - * Makefile.common: Don't drop -gFOO switches when filtering CFLAGS - and CXXFLAGS. - -2013-11-06 Christopher Faylor - - * Makefile.in: Properly cd to directory sans install_ prefix. Report - on errors on doc install. Only 'all' is special. - -2013-11-06 Christopher Faylor - - * configure.ac: Detect windows headers/libs after we've figured out the - C compiler. - * configure: Regenerate. - * aclocal.m4: Regenerate. - * configure.cygwin: Default to '.' if can't find a winsup directory. - -2013-11-06 Christopher Faylor - - * Makefile.in: Reinstate ignoring of errors for doc target. - -2013-06-18 Corinna Vinschen - - * Makefile.common: Add rule to build assembler code. - (.SUFFIXES): Add .S. - -2012-11-26 Christopher Faylor - - * Makefile.in (Makefile): Rely on 'configure' not 'configure.in'. - -2012-11-26 Christopher Faylor - - * configure.ac: Rename from configure.in. - * configure.in: Delete. - * configure: Regenerate. - -2012-11-26 Christopher Faylor - - * ccwrap: Don't drop mingw header file paths unless we've specified - them with --with-windows-headers. - -2012-11-12 Christopher Faylor - - * Makefile.common: Revamp for new configury. Add default compilation - targets, include .E processing. Add magic for allowing "CFLAGS" to - control optimization options in "CXXFLAGS". - * configure.cygwin: New include for Cygwin configure.in's. - * acinclude.m4: Delete old definitions. Implement AC_WINDOWS_HEADERS, - AC_WINDOWS_LIBS, AC_CYGWIN_INCLUDES, target_builddir, winsup_srcdir. - * aclocal.m4: Regenerate. - * autogen.sh: New file. - * ccwrap: New script. - * c++wrap: New script. - * config.guess: New script. - * config.sub: New script. - * configure: Regenerate. - * configure.in: Eliminate LIB_AC_PROG_* calls in favor of standard. - Delete ancient target test. - * install-sh: New script. - -2012-11-07 Christopher Faylor - - * mingw: Delete obsolete directory. - * w32api: Ditto. - -2012-11-07 Corinna Vinschen - - * Makefile.common (zlib_source): Remove. - (zlib_build): Remove. - (bz2lib_source): Remove. - (bz2lib_build): Remove. - (w32api_source): Remove. - (w32api_build): Remove. - (w32api_lib): Remove. - (mingw_build): Remove. - (mingw_source): Remove. - ($(w32api_lib)/%.a): Remove rule. - * Makefile.in (ZLIB): Remove. - ($(SUBDIRS)): Drop mingw check. - (mingw): Remove rule. - (install_mingw): Ditto. - * configure.in: Remove support for mingw as build target. - * configure: Regenerate. - -2012-10-24 Kai Tietz - Yaakov Selkowitz - Corinna Vinschen - - * configure.in [cygwin*]: Always build cygserver, lsaauth, - utils, and doc. Do not build mingw or w32api. - [mingw*]: Build w32api if present. - * configure: Regenerate. - * Makefile.common: Remove references to mingw and w32api - directories. - (MINGW_LDFLAGS): Redefine as -static to force static linking - with libgcc and libstdc++. - * Makefile.in: Remove references to mingw and w32api directories - from Cygwin targets. - -2012-07-30 Christopher Faylor - - * Makefile.common (CFLAGS_COMMON): Add temporary define to work around - w32api problem. - -2012-07-06 Corinna Vinschen - - * Makefile.common (ALL_CFLAGS): Change := to = to allow overriding in - dependent Makefiles. - -2012-01-09 Corinna Vinschen - - * Makefile.common (MINGW_LDFLAGS): Correctly use -L rather than -B here. - -2011-04-19 Corinna Vinschen - - * COPYING: Replace with the GPLv3 definition. - * CYGWIN_LICENSE: Move Cygwin to GPLv3+. Align text to FSF speak. - -2011-01-28 Peter Foley - - * configure.in: Configure winsup/cygserver regardless of cross_host. - * configure: Regenerate. - -2009-07-07 Dave Korn - - * Makefile.common (COMPILE_CXX): Add support for per-file overrides - to exclude $(nostdinc) and $(nostdincxx) from compiler flags. - (COMPILE_CC): Likewise for $(nostdinc). - -2009-02-23 Sjors Gielen - - * Makefile.in: Add DESTDIR functionality. - -2009-01-21 Corinna Vinschen - - * configure.in: Remove --enable-server option. Allways add the - cygserver directory to $SUBDIRS. - * configure: Regenerate. - -2008-10-12 Christopher Faylor - - * Makefile.in: Revert erroneous checkin. - * Makefile.common: Tweak to work better with new utils/mingw front-end. - -2008-10-11 Christopher Faylor - - * Makefile.in: Tweak to work better with new utils/mingw front-end. - -2008-05-16 Corinna Vinschen - - * Makefile.in (install-license): Install COPYING file as well. - -2008-05-16 Corinna Vinschen - - * CYGWIN_LICENSE: New text. - -2007-08-31 Christopher Faylor - - * configure: Regenerate. - -2007-07-06 Corinna Vinschen - - * CYGWIN_LICENSE: Fix URL to world-wide offices. - -2007-07-06 Corinna Vinschen - - * CYGWIN_LICENSE: Fix URL to open source definition. - -2006-12-12 Corinna Vinschen - - * Makefile.in (subauth): Drop rule. - * configure.in: Remove subauth related check. - * configure: Regenerate. - -2006-11-27 Corinna Vinschen - - * Makefile.in: Add dependencies for lsaauth. - * configure.in: Disable building subauth. Add building lsaauth. - * configure: Regenerate. - -2006-08-30 Christopher Faylor - - * Makefile.in: Make install-license .PHONY. Make sure that doc - directory is created before copying to it. - -2006-08-30 Corinna Vinschen - - * Makefile.in: Make installation of CYGWIN_LICENSE configurable. - * aclocal.m4: Regenerate. - * configure.in: Add GCC_NO_EXECUTABLES call. Add configuration for - INSTALL_LICENSE. Make cygwin subdirectory optional. Add sanity - check for cygwin resp. mingw subdirectories dependent of the target. - * configure: Regenerate. - -2006-08-02 Christopher Faylor - - * Makefile.in (subauth): Add dependency on mingw. - -2006-07-23 Christopher Faylor - - * Makefile.in: Update copyright. Fix 'check' target so that it will - once-again create a working testsuite directory. Add a comment this - time to explain the unusual behavior. - -2006-07-14 Corinna Vinschen - - * configure.in: Reenable building the subauth subdir. - * configure: Regenerate. - -2006-05-24 Christopher Faylor - - * configure.in: Update to newer autoconf. - (thanks to Steve Ellcey) - * Makefile.in: Ditto. - * configure: Regenerate. - * acinclude.m4: New file. - * aclocal.m4: Ditto. - -2006-01-29 Christopher Faylor - - * CYGWIN_LICENSE: Restrict to v2. - * COPYING: Add. - -2006-01-16 Corinna Vinschen - - * configure.in: Add AC_PROG_INSTALL handling. - * configure: Regenerate. - * Makefile.in (install): Install CYGWIN_LICENSE. - -2006-01-16 Corinna Vinschen - - * CYGWIN_LICENSE: Fix contact information. - -2005-10-11 Christopher Faylor - - * Makefile.common (CFLAGS_COMMON): Add -Wstrict-aliasing. - -2005-03-22 Christopher Faylor - - * Makefile.common: Add -dD to options when creating preprocess files. - -2003-11-23 Corinna Vinschen - - * Makefile.in: Make cygserver depending on cygwin. - -2003-11-20 Christopher Faylor - - * configure.in: Make --use-server the default. - * configure: Regenerate. - -2003-08-05 Christopher Faylor - - * Makefile.common: Hmm. Older compilers seem to need -nostdinc. - -2003-08-05 Christopher Faylor - - * Makefile.common: Don't use -nostdinc with g++. - -2003-07-25 Christopher Faylor - - * Makefile.in: Only use localhost when building mingw with distcc or - gcc won't be able to find .exp files on other hosts. - -2003-07-18 Vaclav Haisman - - * Makefile.common (CFLAGS_COMMON): Remove -march=i386. - -2003-07-01 Christopher Faylor - - * configure.in: Add --enable-server option. - * configure: Regenerate. - -2003-07-01 Christopher Faylor - - * Makefile.common (CFLAGS_COMMON): Remove -Winline since it is too - noisy on newer versions of gcc. - -2003-07-01 Christopher Faylor - - * configure.in: Add cygserver subdir. - * Makefile.in: Ditto. - * configure: Regenerate. - - * Makefile.common: Remove debugging statements. - -2003-05-12 Corinna Vinschen - - * Makefile.common: Remove newlib_sys_include and - newlib_sys_include_include entirely. Set CRT0 to cygwin/crt0.o. - -2003-04-18 Christopher Faylor - - * Makefile.in: Reorganize to try to allow lack of mingw/w32api to work. - -2003-04-11 Christopher Faylor - - * Makefile.common (w32api_lib): Fix w32api detection. - -2003-03-28 Christopher Faylor - - * Makefile.common (ALL_CXXFLAGS): Make normal '=' type variable so that - CXXFLAGS is properly interpreted. - -2003-03-17 Christopher Faylor - - * Makefile.common (w32api_lib): Default to system w32api directory if - w32api is missing from source. - -2003-03-17 Christopher Faylor - - * Makefile.common: Fix typo from previous checkin. - -2003-03-17 Christopher Faylor - - * configure.in: w32api directory was already optional. Semi-revert - 2003-02-06 change. - * configure: Regenerate. - * Makefile.common: Don't specific -nostdinc if there is no w32api - directory. - -2003-03-09 Christopher Faylor - - * Makefile.common: Avoid double slashes in GCC_INCLUDE. - -2003-02-12 Christopher Faylor - - * MAINTAINERS: Remove out-of-date file. - -2003-02-06 Christopher Faylor - - * configure.in: Make w32api directory optional. - * configure: Regenerate. - -2003-01-22 Corinna Vinschen - - * Makefile.common (MINGW_LDFLAGS): Add mingw/mingwex builddir. - -2002-12-21 Christopher Faylor - - * Makefile.common: Don't attempt to pretty-print c++ errors. - -2002-12-12 Corinna Vinschen - - * Makefile.common: Define MINGW_LDFLAGS. - * configure.in: Reorder SUBDIRS to have mingw before cygwin. - * configure: Regenerate from configure.in. - -2002-09-27 Christopher Faylor - - * Makefile.in (check): Be more defensive when creating testsuite - config.status. - -2002-08-16 Christopher Faylor - - * Makefile.in: Change COMPILE_C* definitions. - -2002-08-10 Earnie Boyd - - * w32sdk: New winsup module. - -2002-07-06 Christopher Faylor - - * Makefile.common (MINGW_INCLUDES): Simplify. - (MINGW_CFLAGS): New. - (MINGW_CXXFLAGS): Ditto. - -2002-06-02 Christopher Faylor - - * configure.in: Complain about lack of w32api directory. - * configure: Regenerate. - -2002-04-25 Christopher Faylor - - * configure.in: Remove cinstall target. - * Makefile.in: Ditto. - * configure: Regenerate. - -2002-02-19 Christopher Faylor - - * configure.in: Avoid building w32api or mingw if they don't exist. - * configure: Regenerate. - -2001-12-18 Christopher Faylor - - * Makefile.in: Don't attempt to use zlib directory as a dependency if - it doesn't exist. - -2001-12-14 Christopher Faylor - - * configure.in: Detect zlib subdirectory. - * configure: Regenerate - * Makefile.in: Exit immediately if a sub-make fails. - * Makefile.common: Add automatic rules for bz2lib and zlib. - -2001-11-04 Christopher Faylor - - * Makefile.in: Force configure in testsuite directory if config.status - does not exist. - -2001-11-03 Christopher Faylor - - * configure.in: Disable subauth directory test. - * configure: Regenerate. - * Makefile.in: Use MAKE variable in directory builds. - -2001-11-03 Christopher Faylor - - * Makefile.in: Add directory dependencies to ensure ordering when using - 'make -jN'. - -2001-11-03 Christopher Faylor - - * Makefile.common: Remove preferred-stack-boundary setting since gcc - 2.95.3 doesn't work well with it. - -2001-11-01 Christopher Faylor - - * Makefile.common: Add some stuff to common CFLAGS. - -2001-10-29 Egor Duda - - * Makefile.in: Propagate 'clean' to subdirs properly. - -2001-10-26 Corinna Vinschen - - * configure: Regenerate, removing erroneous SUBDIRS substitution. - -2001-10-24 Christopher Faylor - - * Makefile.in: Only build testsuite directory on first 'make check'. - * configure.in: Remove testsuite from SUBDIRS. - * configure: Regenerate. - -2001-10-12 Christopher Faylor - - * Makefile.in: Add -nostdinc to CXXFLAGS. - -2001-10-12 Christopher Faylor - - * Makefile.common: Perform more include file testing trickery. - -Sun Oct 7 23:08:46 2001 Christopher Faylor - - * Makefile.common: Avoid adding -I options to compile if they already - exist in CC or C*FLAGS. This prevents warnings from newer versions of - gcc. - -Tue May 15 01:09:56 2001 Christopher Faylor - - * Makefile.common: Change method for finding current directory. - -Sat May 5 00:14:03 2001 Christopher Faylor - - * configure.in: Fix typo. - * configure: Regenerate. - -Fri May 4 11:24:53 2001 Christopher Faylor - - * configure.in: Make subauth configuration optional. - * configure: Regenerate. - -Fri May 4 15:06:00 Corinna Vinschen - - * subauth: New subdirectory. - * configure.in: Add subauth to the list of subdirectories. - * configure: Regenerated from configure.in. - -Wed Apr 18 18:45:07 2001 Christopher Faylor - - * configure.in: Add bz2lib. - -2001-03-19 DJ Delorie - - * configure: fix regeneration bug. - -Thu Feb 22 13:36:00 2000 Corinna Vinschen - - * Makefile.common: Revert previous change. - -Wed Feb 21 22:41:00 2000 Corinna Vinschen - - * Makefile.common: Add `-fvtable-thunks' to COMPILE_CXX. - -Sun Dec 3 00:21:31 2000 Christopher Faylor - - * Makefile.common: Eliminate checks for libgcc.a and libstdc++.a. Use - CXX for g++ compiles. - * configure.in: Find correct c++ compiler. - * configure: Regenerate. - -Mon Oct 23 00:50:02 2000 Christopher Faylor - - * Makefile.common (LIBGCC): Acommodate older gcc's that don't need - libstdc++.a. - -Sat Oct 21 18:01:22 2000 Christopher Faylor - - * Makefile.common (LIBGCC): Find libstdc++.a as well as libc.a since - builtin functions are in this library in newer gcc's. - -Sun Oct 1 22:02:38 2000 Christopher Faylor - - * Makefile.common: Extend VERBOSE default. - * Makefile.in: Don't clean the testsuite separately. It's already part - of CLEAN_SUBDIRS. - -2000-09-30 Christopher Faylor - - * Makefile.common: Default to VERBOSE when part of overall source - tree build. - -2000-09-02 Egor Duda - - * Makefile.in: Add new goal "check" - * configure.in: When doing native build do configure in - testsuite subdirectory - * configure: Regenerate. - -Fri Sep 1 10:15:37 2000 Christopher Faylor - - * Makefile.in: More normalization. - -Thu Aug 31 16:37:31 2000 Christopher Faylor - - * Makefile.in: Normalize 'pwd' based on location of winsup. - -Thu Aug 24 15:02:26 2000 Christopher Faylor - - * Makefile.common: Add bupdir2 to reference above the i686-pc-cygwin - directory. - -Thu Jun 22 18:28:06 2000 Christopher Faylor - - * Makefile.in: Add dummy info targets. - -Tue Jun 20 13:36:23 2000 Christopher Faylor - - * configure.in: Bow to necessity and build w32api before anything else. - * configure: Regenerate. - -Sat Jun 17 13:50:04 2000 Christopher Faylor - - * configure.in: Detect "cross-hosting" situation and add a subset of - directories to SUBDIRS. - * configure: Regenerate. - -Thu May 25 18:39:24 2000 Christopher Faylor - - * configure.in: Don't assume that cinstall directory exists. - * configure: Regenerate - -2000-05-24 DJ Delorie - - * Makefile.common (%.o): further simplify, add "..." to make it obvious - it's an abbreviated command line. - -Thu May 18 14:33:05 2000 Christopher Faylor - - * MAINTAINERS: Add Corinna to general list. - -2000-04-17 DJ Delorie - - * Makefile.common (srcdir): remove dependence on where pwd is - -Sun Apr 9 23:47:45 2000 Christopher Faylor - - * Makefile.common: Resolve srcdir to absolute path or it will confuse - usages when passed to submakes. Eliminate vestigal use of - MAKEOVERRIDES. - -Sun Apr 9 02:06:49 2000 Christopher Faylor - - * Makefile.in: Work around MAKEOVERRIDES problem with older versions - of make. - * Makefile.common: Ditto. - -Fri Apr 7 17:04:02 Ron Parker - - * configure.in: Added cinstall to the list of subdirs. - * configure: Regenerate. - -Thu Mar 30 23:45:00 2000 Christopher Faylor - - * MAINTAINERS: Add Ron Parker as maintainer of cinstall stuff. - -Sun Feb 6 18:15:44 2000 Christopher Faylor - - * configure.in: Do the standard CC/CFLAGS stuff for propagation to - sub-configures. - * configure: Regenerate. - -2000-01-26 DJ Delorie - - * doc/Makefile.in: fix doctool -d options - -Fri Jan 21 12:51:32 2000 Christopher Faylor - - * Makefile.common: No need to rerun Makefile if config.status changes. - That should happen automatically. - * Makefile.in: Ditto. - -Sat Jan 8 14:40:01 2000 Christopher Faylor - - * Makefile.common: Remove cygwin DLL specific stuff. Make Makefile - target PRECIOUS. - * Makefile.in: Make Makefile target PRECIOUS. - -Fri Jan 7 21:00:49 2000 Christopher Faylor - - * Makefile.common: Remove cygwin DLL specific stuff. Correctly deal - with updir stuff when building in the same directory as the source. - -Thu Jan 6 19:04:35 2000 Christopher Faylor - - Create new directory structure - * Makefile.in: New file. - * configure.in: New file. - * configure: New file. - * Makefile.common: New file. - * cygwin: New directory. - * w32api: New directory. diff --git a/winsup/Makefile.common b/winsup/Makefile.common deleted file mode 100644 index d97ecb08a..000000000 --- a/winsup/Makefile.common +++ /dev/null @@ -1,55 +0,0 @@ -# Makefile.common - common definitions for the winsup directory -# -# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2009, 2012 Red Hat, Inc. -# -# This file is part of Cygwin. -# -# This software is a copyrighted work licensed under the terms of the -# Cygwin license. Please consult the file "CYGWIN_LICENSE" for -# details. - -define justdir -$(patsubst %/,%,$(dir $1)) -endef - -define libname -$(realpath $(shell ${CC} --print-file-name=$1 $2)) -endef - -export PATH:=${winsup_srcdir}:${PATH} - -# Allow CFLAGS=-O,-g to control CXXFLAGS too -opt=$(filter -O%,${CFLAGS}) $(filter -g%,${CFLAGS}) -override CXXFLAGS:=${filter-out -g%,$(filter-out -O%,${CXXFLAGS})} ${opt} - -cflags_common:=-Wall -Wstrict-aliasing -Wwrite-strings -fno-common -pipe -fbuiltin -fmessage-length=0 -COMPILE.cc=c++wrap ${CXXFLAGS} -fno-rtti -fno-exceptions ${cflags_common} -COMPILE.c=ccwrap ${CFLAGS} ${cflags_common} - -top_srcdir:=$(call justdir,${winsup_srcdir}) -top_builddir:=$(call justdir,${target_builddir}) - -cygwin_build:=${target_builddir}/winsup/cygwin -newlib_build:=${target_builddir}/newlib - -nostdlib:=-nostdlib - -VPATH:=${srcdir} - -.SUFFIXES: -.SUFFIXES: .c .cc .def .S .a .o .d .s .E - -%.o: %.cc - $(strip ${COMPILE.cc} -c -o $@ $<) - -%.o: %.c - $(strip ${COMPILE.c} -c -o $@ $<) - -%.E: %.cc - $(strip ${COMPILE.cc} -E -dD -o $@ $<) - -%.E: %.c - $(strip ${COMPILE.c} -E -dD -o $@ $<) - -%.o: %.S - $(strip ${COMPILE.S} -c -o $@ $<) diff --git a/winsup/Makefile.in b/winsup/Makefile.in deleted file mode 100644 index 29ef22abe..000000000 --- a/winsup/Makefile.in +++ /dev/null @@ -1,129 +0,0 @@ -# Makefile.in for windows stuff -# Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007, -# 2008, 2009, 2012, 2013 Red Hat, Inc. -# -# This file is part of Cygwin. -# -# This software is a copyrighted work licensed under the terms of the -# Cygwin license. Please consult the file "CYGWIN_LICENSE" for -# details. - -# This makefile requires GNU make. - -SHELL:=@SHELL@ -VPATH:=@srcdir@ -srcdir:=@srcdir@ -objdir:=. - -target_alias:=@target_alias@ -build_alias:=@build_alias@ -host_alias:=@host_alias@ -prefix:=@prefix@ - -program_transform_name:=@program_transform_name@ -exec_prefix:=@exec_prefix@ -bindir:=@bindir@ -libdir:=@libdir@ -ifeq ($(target_alias),$(host_alias)) -ifeq ($(build_alias),$(host_alias)) -tooldir:=$(exec_prefix) -else -tooldir:=$(exec_prefix)/$(target_alias) -endif -else -tooldir:=$(exec_prefix)/$(target_alias) -endif -datadir:=@datadir@ -infodir:=@infodir@ -includedir:=@includedir@ - -INSTALL:=@INSTALL@ -INSTALL_PROGRAM:=@INSTALL_PROGRAM@ -INSTALL_DATA:=@INSTALL_DATA@ - -SUBDIRS=@subdirs@ -INSTALL_SUBDIRS=${patsubst %,install_%,$(SUBDIRS)} -CLEAN_SUBDIRS=${patsubst %,clean_%,$(SUBDIRS)} - -INSTALL_LICENSE:=@INSTALL_LICENSE@ - -.PHONY: all install clean all-info info install-info install-license check \ - $(SUBDIRS) $(INSTALL_SUBDIRS) $(CLEAN_SUBDIRS) - -.SUFFIXES: - -MAKEOVERRIDES_WORKAROUND=${wordlist 2,1,a b c} - -ifneq ($(MAKEOVERRIDES_WORKAROUND),) - override MAKE:=$(MAKE) $(MAKEOVERRIDES) - MAKEOVERRIDES:= - export MAKEOVERRIDES -endif - -all: Makefile $(SUBDIRS) - -install-license: CYGWIN_LICENSE COPYING - ${INSTALL} -d $(DESTDIR)$(prefix)/share/doc/Cygwin - for i in $^; do \ - ${INSTALL} $$i $(DESTDIR)$(prefix)/share/doc/Cygwin ; \ - done - -install: Makefile $(INSTALL_LICENSE) $(INSTALL_SUBDIRS) - -clean: $(CLEAN_SUBDIRS) - -all-info: - -install-info: - -info: - -$(SUBDIRS): - @${MAKE} -C $@ all || ([ "$@" == doc ] && echo "*** error ignored") - -$(INSTALL_SUBDIRS): - @${MAKE} -C $(patsubst install_%,%,$@) install || ([ "$@" == install_doc ] && echo "*** error ignored") - -$(CLEAN_SUBDIRS): - @if cd $(patsubst clean_%,%,$@) 2>/dev/null; then \ - $(MAKE) clean || exit 1; \ - fi || exit 0 - -.PRECIOUS: Makefile - -Makefile: Makefile.in $(srcdir)/configure config.status - $(SHELL) config.status - -config.status: configure - $(SHELL) config.status --recheck - -# The below rule is intended to run configure only when "make check" is -# actually specified, i.e., not in a cross-compilation environment. The -# cygwin configuration is copied and modified to ensure that the same configuration -# parameters are passed when the testsuite is configured as when cygwin was configured. -check: cygwin - @if [ -f testsuite/config.status ]; then \ - cd testsuite; \ - else \ - (mkdir testsuite 2>/dev/null || exit 0); \ - cd testsuite; \ - sed -e 's%winsup/cygwin\>%winsup/testsuite%g' ../cygwin/config.status > config.status; \ - chmod a+x config.status; \ - sh ./config.status --recheck; \ - sh ./config.status; \ - fi; \ - $(MAKE) check - -utils: cygwin - -cygwin: - -cygserver: cygwin - -install_utils: cygwin - -install_cygwin: - -install_cygserver: cygwin - -lsaauth: diff --git a/winsup/README b/winsup/README deleted file mode 100644 index 290275cd7..000000000 --- a/winsup/README +++ /dev/null @@ -1,9 +0,0 @@ -THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -Cygwin documentation is available on the net at http://cygwin.com -You might especially be interested in - -http://cygwin.com/faq/faq.programming.html#faq.programming.building-cygwin - diff --git a/winsup/acinclude.m4 b/winsup/acinclude.m4 deleted file mode 100644 index 80c920e8c..000000000 --- a/winsup/acinclude.m4 +++ /dev/null @@ -1,83 +0,0 @@ -dnl This provides configure definitions used by all the cygwin -dnl configure.in files. - -AC_DEFUN([AC_WINDOWS_HEADERS],[ -AC_ARG_WITH( - [windows-headers], - [AS_HELP_STRING([--with-windows-headers=DIR], - [specify where the windows includes are located])], - [test -z "$withval" && AC_MSG_ERROR([must specify value for --with-windows-headers])] -) -]) - -AC_DEFUN([AC_WINDOWS_LIBS],[ -AC_ARG_WITH( - [windows-libs], - [AS_HELP_STRING([--with-windows-libs=DIR], - [specify where the windows libraries are located])], - [test -z "$withval" && AC_MSG_ERROR([must specify value for --with-windows-libs])] -) -windows_libdir=$(realdirpath "$with_windows_libs") -if test -z "$windows_libdir"; then - windows_libdir=$(realdirpath $(${ac_cv_prog_CC:-$CC} -xc /dev/null -Wl,--verbose=1 -lntdll 2>&1 | sed -rn 's%^.*\s(\S+)/libntdll\..*succeeded%\1%p')) - if test -z "$windows_libdir"; then - AC_MSG_ERROR([cannot find windows library files]) - fi -fi -AC_SUBST(windows_libdir) -] -) - -AC_DEFUN([AC_CYGWIN_INCLUDES], [ -addto_CPPFLAGS -nostdinc -: ${ac_cv_prog_CXX:=$CXX} -: ${ac_cv_prog_CC:=$CC} - -cygwin_headers=$(realdirpath "$winsup_srcdir/cygwin/include") -if test -z "$cygwin_headers"; then - AC_MSG_ERROR([cannot find $winsup_srcdir/cygwin/include directory]) -fi - -newlib_headers=$(realdirpath $winsup_srcdir/../newlib/libc/include) -if test -z "$newlib_headers"; then - AC_MSG_ERROR([cannot find newlib source directory: $winsup_srcdir/../newlib/libc/include]) -fi -newlib_headers="$target_builddir/newlib/targ-include $newlib_headers" - -if test -n "$with_windows_headers"; then - if test -e "$with_windows_headers/windef.h"; then - windows_headers="$with_windows_headers" - else - AC_MSG_ERROR([cannot find windef.h in specified --with-windows-headers path: $saw_windows_headers]); - fi -elif test -d "$winsup_srcdir/w32api/include/windef.h"; then - windows_headers="$winsup_srcdir/w32api/include" -else - windows_headers=$(cd $($ac_cv_prog_CC -xc /dev/null -E -include windef.h 2>/dev/null | sed -n 's%^# 1 "\([^"]*\)/windef\.h".*$%\1%p' | head -n1) 2>/dev/null && pwd) - if test -z "$windows_headers" -o ! -d "$windows_headers"; then - AC_MSG_ERROR([cannot find windows header files]) - fi -fi -CC=$ac_cv_prog_CC -CXX=$ac_cv_prog_CXX -export CC -export CXX -AC_SUBST(windows_headers) -AC_SUBST(newlib_headers) -AC_SUBST(cygwin_headers) -]) - -AC_DEFUN([AC_CONFIGURE_ARGS], [ -configure_args=X -for f in $ac_configure_args; do - case "$f" in - *--srcdir*) ;; - *) configure_args="$configure_args $f" ;; - esac -done -configure_args=$(/usr/bin/expr "$configure_args" : 'X \(.*\)') -AC_SUBST(configure_args) -]) - -AC_SUBST(target_builddir) -AC_SUBST(winsup_srcdir) diff --git a/winsup/aclocal.m4 b/winsup/aclocal.m4 deleted file mode 100644 index e798741a7..000000000 --- a/winsup/aclocal.m4 +++ /dev/null @@ -1,15 +0,0 @@ -# generated automatically by aclocal 1.11.6 -*- 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_include([acinclude.m4]) diff --git a/winsup/autogen.sh b/winsup/autogen.sh deleted file mode 100755 index 12373891e..000000000 --- a/winsup/autogen.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -e -if ! /usr/bin/test -e config.guess; then - /usr/bin/wget -q -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' - /bin/chmod a+x config.guess -fi -if ! /usr/bin/test -e config.sub; then - /usr/bin/wget -q -O config.sub 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' - /bin/chmod a+x config.sub -fi -/usr/bin/aclocal --force -/usr/bin/autoconf -f -/bin/rm -rf autom4te.cache -res=0 -for d in cygwin utils cygserver; do - (cd $d && exec ./autogen.sh) || res=1 -done -exit $res diff --git a/winsup/c++wrap b/winsup/c++wrap deleted file mode 100755 index 987acb8c5..000000000 --- a/winsup/c++wrap +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/perl -use strict; -use File::Basename; -my $pgm = basename($0); -(my $wrapper = $pgm) =~ s/\+\+/c/o; -exec $wrapper, '++', @ARGV; diff --git a/winsup/ccwrap b/winsup/ccwrap deleted file mode 100755 index 7580e7a3b..000000000 --- a/winsup/ccwrap +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl -use Cwd; -use strict; -my $cxx; -my $ccorcxx; -if ($ARGV[0] ne '++') { - $ccorcxx = 'CC'; - $cxx = 0; -} else { - shift @ARGV; - $ccorcxx = 'CXX'; - $cxx = 1; -} -die "$0: $ccorcxx environment variable does not exist\n" unless exists $ENV{$ccorcxx}; -my @compiler = split ' ', $ENV{$ccorcxx}; -if ("@ARGV" !~ / -nostdinc/o) { - my $fd; - push @compiler, ($cxx ? '-xc++' : '-xc'); - if (!open $fd, '-|') { - open STDERR, '>&', \*STDOUT; - exec @compiler, '/dev/null', '-v', '-E', '-o', '/dev/null' or die "*** error execing $compiler[0] - $!\n"; - } - $compiler[1] =~ s/xc/nostdinc/o; - push @compiler, '-nostdinc' if $cxx; - push @compiler, '-I' . $_ for split ' ', $ENV{CCWRAP_HEADERS}; - push @compiler, '-isystem', $_ for split ' ', $ENV{CCWRAP_SYSTEM_HEADERS}; - my $finding_paths = 0; - my $mingw_compiler = $compiler[0] =~ /mingw/o; - my @dirafters; - for my $d (split ' ', $ENV{CCWRAP_DIRAFTER_HEADERS}) { - push @dirafters, '-isystem', $d if !$mingw_compiler || $d !~ /w32api/o; - } - while (<$fd>) { - if (/^\*\*\*/o) { - print; - } elsif ($_ eq "#include <...> search starts here:\n") { - $finding_paths = 1; - } elsif (!$finding_paths) { - next; - } elsif ($_ eq "End of search list.\n") { - last; - } elsif (!@dirafters || !m%w32api|mingw.*/include%o) { - chomp; - s/^\s+//; - push @compiler, '-isystem', Cwd::abs_path($_); - } - } - push @compiler, @dirafters; - close $fd; -} - -push @compiler, @ARGV; - -print join(' ', '+', @compiler), "\n" if $ENV{CCWRAP_VERBOSE}; -exec @compiler or die "$0: $compiler[0] failed to execute\n"; diff --git a/winsup/config.guess b/winsup/config.guess deleted file mode 100755 index 872b96a16..000000000 --- a/winsup/config.guess +++ /dev/null @@ -1,1537 +0,0 @@ -#! /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-09-25' - -# 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 ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_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 ;; - *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - 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 ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-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 - -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: diff --git a/winsup/config.sub b/winsup/config.sub deleted file mode 100755 index 89b128630..000000000 --- a/winsup/config.sub +++ /dev/null @@ -1,1789 +0,0 @@ -#! /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-10-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-musl* | 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*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -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[2-8] | armv[3-8][lb] | armv7[arm] \ - | 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 | microblazeel | 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-* | microblazeel-* \ - | 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 - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - 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* \ - | -bitrig* | -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* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -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 - ;; - hexagon-*) - os=-elf - ;; - 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: diff --git a/winsup/configure b/winsup/configure deleted file mode 100755 index bccc6c38d..000000000 --- a/winsup/configure +++ /dev/null @@ -1,4776 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69. -# -# -# Copyright (C) 1992-1996, 1998-2012 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 - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # 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 -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+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -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 -test -x / || 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" - 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 : - export CONFIG_SHELL - # 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 -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+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -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 about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a 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_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_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; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # 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 -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -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 - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# 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'" - - -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= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="Makefile.in" -ac_no_link=no -enable_option_checking=no -ac_subst_vars='LTLIBOBJS -LIBOBJS -SET_MAKE -INSTALL_LICENSE -subdirs -cygwin_headers -newlib_headers -windows_headers -windows_libdir -CPP -ac_ct_CXX -CXXFLAGS -CXX -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -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 -winsup_srcdir -target_builddir' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -with_windows_headers -with_windows_libs -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CXX -CXXFLAGS -CCC -CPP' -ac_subdirs_all='cygwin utils cygserver lsaauth doc' - -# 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}' -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 - 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 this package 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/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-windows-headers=DIR - specify where the windows includes are located - --with-windows-libs=DIR specify where the windows libraries are located - -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 - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CPP C preprocessor - -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 the package provider. -_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 -configure -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 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_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_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_cxx_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_cxx_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 -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 $as_me, which was -generated by GNU Autoconf 2.69. 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 - -# 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 - - -ac_aux_dir= -for ac_dir in .. "$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\"/.." "$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. - - - -. ${srcdir}/configure.cygwin - -# 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 as_fn_executable_p "$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' - - -# 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 - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if ${ac_cv_target+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - -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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 -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 - ac_no_link=no - 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 - -else - rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.o conftest.obj conftest.dSYM - ac_no_link=yes - # Setting cross_compile will disable run tests; it will - # also disable AC_CHECK_FILE but that's generally - # correct if we can't link. - cross_compiling=yes - EXEEXT= - # 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; } - -fi -{ $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 -struct stat; -/* 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 - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - 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_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$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 -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -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_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$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_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - 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 - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# 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_cxx_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_cxx_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_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -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 - -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 - -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 - - - - -# Check whether --with-windows-headers was given. -if test "${with_windows_headers+set}" = set; then : - withval=$with_windows_headers; test -z "$withval" && as_fn_error $? "must specify value for --with-windows-headers" "$LINENO" 5 - -fi - - - - -# Check whether --with-windows-libs was given. -if test "${with_windows_libs+set}" = set; then : - withval=$with_windows_libs; test -z "$withval" && as_fn_error $? "must specify value for --with-windows-libs" "$LINENO" 5 - -fi - -windows_libdir=$(realdirpath "$with_windows_libs") -if test -z "$windows_libdir"; then - windows_libdir=$(realdirpath $(${ac_cv_prog_CC:-$CC} -xc /dev/null -Wl,--verbose=1 -lntdll 2>&1 | sed -rn 's%^.*\s(\S+)/libntdll\..*succeeded%\1%p')) - if test -z "$windows_libdir"; then - as_fn_error $? "cannot find windows library files" "$LINENO" 5 - fi -fi - - - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - -addto_CPPFLAGS -nostdinc -: ${ac_cv_prog_CXX:=$CXX} -: ${ac_cv_prog_CC:=$CC} - -cygwin_headers=$(realdirpath "$winsup_srcdir/cygwin/include") -if test -z "$cygwin_headers"; then - as_fn_error $? "cannot find $winsup_srcdir/cygwin/include directory" "$LINENO" 5 -fi - -newlib_headers=$(realdirpath $winsup_srcdir/../newlib/libc/include) -if test -z "$newlib_headers"; then - as_fn_error $? "cannot find newlib source directory: $winsup_srcdir/../newlib/libc/include" "$LINENO" 5 -fi -newlib_headers="$target_builddir/newlib/targ-include $newlib_headers" - -if test -n "$with_windows_headers"; then - if test -e "$with_windows_headers/windef.h"; then - windows_headers="$with_windows_headers" - else - as_fn_error $? "cannot find windef.h in specified --with-windows-headers path: $saw_windows_headers" "$LINENO" 5; - fi -elif test -d "$winsup_srcdir/w32api/include/windef.h"; then - windows_headers="$winsup_srcdir/w32api/include" -else - windows_headers=$(cd $($ac_cv_prog_CC -xc /dev/null -E -include windef.h 2>/dev/null | sed -n 's%^# 1 "\([^"]*\)/windef\.h".*$%\1%p' | head -n1) 2>/dev/null && pwd) - if test -z "$windows_headers" -o ! -d "$windows_headers"; then - as_fn_error $? "cannot find windows header files" "$LINENO" 5 - fi -fi -CC=$ac_cv_prog_CC -CXX=$ac_cv_prog_CXX -export CC -export CXX - - - - - - - -subdirs="$subdirs cygwin utils cygserver lsaauth doc" - -INSTALL_LICENSE="install-license" - - - -{ $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 - - -ac_config_files="$ac_config_files 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}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.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 - - - -: "${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 -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -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 - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# 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 $as_me, which was -generated by GNU Autoconf 2.69. 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 - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_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 - -Configuration files: -$config_files - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 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' -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;; - --he | --h | --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 -_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 - "Makefile") CONFIG_FILES="$CONFIG_FILES 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 -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" - - -eval set X " :F $CONFIG_FILES " -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 -_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 -$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 - ;; - - - - 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 - -# -# CONFIG_SUBDIRS section. -# -if test "$no_recursion" != yes; then - - # Remove --cache-file, --srcdir, and --disable-option-checking arguments - # so they do not pile up. - ac_sub_configure_args= - ac_prev= - eval "set x $ac_configure_args" - shift - for ac_arg - do - if test -n "$ac_prev"; then - ac_prev= - continue - fi - case $ac_arg in - -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=*) - ;; - --config-cache | -C) - ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - ;; - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - ;; - --disable-option-checking) - ;; - *) - case $ac_arg in - *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append ac_sub_configure_args " '$ac_arg'" ;; - esac - done - - # Always prepend --prefix to ensure using the same prefix - # in subdir configurations. - ac_arg="--prefix=$prefix" - case $ac_arg in - *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" - - # Pass --silent - if test "$silent" = yes; then - ac_sub_configure_args="--silent $ac_sub_configure_args" - fi - - # Always prepend --disable-option-checking to silence warnings, since - # different subdirs can have different --enable and --with options. - ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" - - ac_popdir=`pwd` - for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue - - # Do not complain, so a configure script can configure whichever - # parts of a large source tree are present. - test -d "$srcdir/$ac_dir" || continue - - ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" - $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 - $as_echo "$ac_msg" >&6 - 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 - - - cd "$ac_dir" - - # Check for guested configure; otherwise get Cygnus style configure. - if test -f "$ac_srcdir/configure.gnu"; then - ac_sub_configure=$ac_srcdir/configure.gnu - elif test -f "$ac_srcdir/configure"; then - ac_sub_configure=$ac_srcdir/configure - elif test -f "$ac_srcdir/configure.in"; then - # This should be Cygnus configure. - ac_sub_configure=$ac_aux_dir/configure - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 -$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} - ac_sub_configure= - fi - - # The recursion is here. - if test -n "$ac_sub_configure"; then - # Make the cache file name correct relative to the subdirectory. - case $cache_file in - [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; - *) # Relative name. - ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 -$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} - # The eval makes quoting arguments work. - eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ - --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || - as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 - fi - - cd "$ac_popdir" - done -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 - diff --git a/winsup/configure.ac b/winsup/configure.ac deleted file mode 100755 index 2e21f39b6..000000000 --- a/winsup/configure.ac +++ /dev/null @@ -1,42 +0,0 @@ -dnl Autoconf configure script for Cygwin. -dnl Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2009, 2010, -dnl 2011, 2012 Red Hat, Inc. -dnl -dnl This file is part of Cygwin. -dnl -dnl This software is a copyrighted work licensed under the terms of the -dnl Cygwin license. Please consult the file "CYGWIN_LICENSE" for -dnl details. -dnl -dnl Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59)dnl -AC_INIT(Makefile.in) -AC_CONFIG_AUX_DIR(..) - -. ${srcdir}/configure.cygwin - -AC_PROG_INSTALL -AC_NO_EXECUTABLES -AC_CANONICAL_SYSTEM - -AC_PROG_CC -AC_PROG_CXX -AC_PROG_CPP -AC_LANG(C) - -AC_WINDOWS_HEADERS -AC_WINDOWS_LIBS - -AC_LANG(C++) - -AC_CYGWIN_INCLUDES - -AC_CONFIG_SUBDIRS(cygwin utils cygserver lsaauth doc) -INSTALL_LICENSE="install-license" - -AC_SUBST(INSTALL_LICENSE) - -AC_PROG_MAKE_SET - -AC_OUTPUT(Makefile) diff --git a/winsup/configure.cygwin b/winsup/configure.cygwin deleted file mode 100755 index 06df92211..000000000 --- a/winsup/configure.cygwin +++ /dev/null @@ -1,48 +0,0 @@ -addto_CPPFLAGS() { - local f - for f; do - case " $CPPFLAGS " in - *\ $f\ *) ;; - *) CPPFLAGS="$CPPFLAGS $f" ;; - esac - done -} - -realdirpath() { - [ -z "$1" ] && return 1 - (cd "$1" 2>/dev/null && pwd) - if test $? -ne 0; then - return 1 - else - return 0 - fi -} - -for d in . .. ../.. ../../..; do - if test -e "$srcdir/$d/configure.cygwin"; then - winsup_srcdir=$(realdirpath "$srcdir/$d") - break - fi -done - -if test -z "$winsup_srcdir"; then - echo "cannot find directory containing configure.cygwin" 1>&2 - exit 1 -fi - -case "$srcdir" in - */newlib*) lookfor=newlib ;; - */winsup*) lookfor=winsup ;; - *) lookfor=. ;; -esac - -for d in . .. ../.. ../../..; do - if test -d "$d/$lookfor"; then - target_builddir=$(realdirpath "$d") - break - fi -done - -if test -z "$target_builddir"; then - target_builddir=$(pwd) -fi diff --git a/winsup/cygserver/ChangeLog b/winsup/cygserver/ChangeLog deleted file mode 100644 index 5a4975746..000000000 --- a/winsup/cygserver/ChangeLog +++ /dev/null @@ -1,743 +0,0 @@ -2013-11-06 Christopher Faylor - - * configure.ac: Detect windows headers/libs after we've figured out the - C compiler. - * configure: Regenerate. - * aclocal.m4: Regenerate. - -2013-04-23 Corinna Vinschen - - * Merge in cygwin-64bit-branch. See ChangeLog.64bit for details. - -2012-11-27 Christopher Faylor - - * Makefile.in: Remove old from CFLAGS and move C*FLAGS so that they can - be manipulated by Makefile.common. - -2012-11-26 Christopher Faylor - - * configure.ac: Rename from configure.in. - * configure.in: Delete. - * configure: Regenerate. - -2012-11-26 Corinna Vinschen - - * transport_pipes.cc (pipe_instance_lock_once): Remove. - (pipe_instance_lock): Remove. - (pipe_instance): Remove. - (initialise_pipe_instance_lock): Remove. - (transport_layer_pipes::accept): Drop entire pipe_instance handling. - (transport_layer_pipes::close): Ditto. - -2012-11-23 Corinna Vinschen - - * cygserver.cc (main): Call listen right after creating the - transport. - * transport_pipes.cc (transport_layer_pipes::listen): Create - first instance of the named pipe here. Connect the client side - to block it for further use by the system. - (transport_layer_pipes::accept): Don't handle first pipe instance - here. Change debug output accordingly. - -2012-11-23 Christopher Faylor - - * Makefile.in: Use /bin/mkdir to make install directories. - -2012-11-23 Corinna Vinschen - - * sysv_sem.cc (semundo_clear): Move condition to break from - inner loop to the right spot. - -2012-11-12 Christopher Faylor - - * Makefile.in: Revamp for new configury. - * configure.in: Revamp for new configury. - * aclocal.m4: Regenerate. - * configure: Ditto. - * autogen.sh: New script. - -2012-10-25 Corinna Vinschen - - * bsd_helper.cc (adjust_identity_info): Fix typo in log message. - -2012-07-19 Corinna Vinschen - - * woutsup.h: Just include winlean.h. - -2012-03-19 Christopher Faylor - - * client.cc: Revert sigproc.h inclusion since it was fixed elsewhere. - -2012-03-19 Corinna Vinschen - - * client.cc: Include sigproc.h if __INSIDE_CYGWIN__ is defined. - -2012-03-19 Christopher Faylor - - * client.cc: Remove unneeded #include "sigproc.h". - -2012-02-14 Corinna Vinschen - - * transport_pipes.cc (transport_layer_pipes::transport_layer_pipes): - Always use cygwin_internal to fetch installation key. - -2011-10-10 Corinna Vinschen - - * cygserver.cc (print_usage): Align output to utilities in utils - directory. - (print_version): Ditto. - -2011-08-18 Yaakov Selkowitz - - * sysv_shm.cc (ACCESSPERMS): Remove to fix redefined warning, as - this is now defined in . - -2011-02-07 Corinna Vinschen - - * configure.in: Remove AC_ALLOCA test and test for __builtin_memset. - * configure: Regenerate. - -2010-04-19 Christopher Faylor - - * transport_pipes.cc: Include ntdef.h to accommodate cygerrno.h. - -2009-11-16 Corinna Vinschen - - * Makefile.in (cygserver.exe): Link with -static to avoid linking - against cygstdc++-6.dll due to references to __cxa_pure_virtual. - -2009-11-06 Corinna Vinschen - - * transport_pipes.cc (transport_layer_pipes::transport_layer_pipes): - Check cygwin_internal for returning 0 rather than for != 0. - (transport_layer_pipes::accept): Add debug output. - (transport_layer_pipes::connect): Ditto. - -2009-10-31 Corinna Vinschen - - * transport_pipes.h (PIPE_NAME_PREFIX): New define. - (PIPE_NAME_SUFFIX): Ditto. - (class transport_layer_pipes): Convert _pipe_name from char pointer - to wchar_t array. - * transport_pipes.cc (transport_layer_pipes::transport_layer_pipes): - Accommodate the fact that _pipe_name is a wchar_t array, rather than - a char pointer. - (transport_layer_pipes::transport_layer_pipes): Initialize _pipe_name - with variable pipe name based in installation key fetched from Cygwin - DLL. - (transport_layer_pipes::accept): Call CreateNamedPipeW explicitely. - (transport_layer_pipes::connect): Call CreateFileW and WaitNamedPipeW - explicitely. - -2009-08-18 Corinna Vinschen - - * Makefile.in (CXXFLAGS): Allow override. - -2009-03-26 Yaakov Selkowitz - - * README: Remove "How to use" section, as CYGWIN="server" is - no longer required. - -2009-03-20 Corinna Vinschen - - * cygserver-config: Remove misleading text describing the - "CYGWIN=server" setting for the client. - -2009-02-23 Sjors Gielen - - * Makefile.in: Add DESTDIR functionality. - -2009-01-21 Corinna Vinschen - - * client.cc (allow_server): Remove variable. - (client_request_get_version::client_request_get_version): Drop checking - allow_server. - -2009-01-03 Christopher Faylor - - * Makefile.in (CFLAGS): Look in cygwin's build directory for header - files. - -2008-12-15 Corinna Vinschen - - * setpwd.cc (client_request_setpwd::serve): Don't treat removing - non-existant private data as error. - -2008-12-15 Corinna Vinschen - - * setpwd.cc (client_request_setpwd::serve): Explicitely erase password - buffer content after usage. - -2008-11-26 Corinna Vinschen - - * Makefile.in (OBJS): Add setpwd.o. - * README: Explain new service to store passwords in the LSA registry - area. - * bsd_helper.cc (get_token_info): Make externally available. - * bsd_helper.h (get_token_info): Declare. - * client.cc (client_request::handle_request): Add case for - CYGSERVER_REQUEST_SETPWD request. - * setpwd.cc: New file implementing the CYGSERVER_REQUEST_SETPWD - request. - -2008-10-30 Christopher Faylor - - * Makefile.in: Use -static-libgcc when creating cygserver.exe. - -2008-04-30 Corinna Vinschen - - * sysv_msg.cc: Add fix from upstream version 1.65. - (msgsnd): Call msleep with timeout value. Handle EWOULDBLOCK. Make - sure it's clear from where msleep has been called in debug output. - (msgrcv): Make sure it's clear from where msleep has been called in - debug output. - -2008-02-06 Corinna Vinschen - - * bsd_helper.cc: Replace %E __small_printf format specifier with %lu - and call to GetLastError throughout. - * bsd_mutex.cc: Ditto. - * sysv_sem.cc (semget): Replace %X __small_printf format specifier - with %llx. - -2008-02-06 Corinna Vinschen - - Remove dependency from Cygwin internal code. - * Makefile.in (CYGWIN_OBJS): Remove smallprint.o. - (cygserver.exe): Remove strfuncs.o - (strfuncs.o): Drop rule. - * bsd_log.cc (_vlog): Use snprintf/vsnprintf instead of - __small_sprintf/__small_vsprintf. - * sysv_sem.cc (seminit): Use sys_malloc instead of malloc. Use - snprintf instead of __small_sprintf. - (semunload): Free the above allocated sema_mtx names here. - -2008-02-03 Brian Dessent - - * Makefile.in: Don't link strfuncs.o from the Cygwin build dir. - Build it again with __OUTSIDE_CYGWIN__ defined. - -2007-11-05 Corinna Vinschen - - * bsd_helper.cc (tunable_params): Add kern.ipc.shm_allow_removed as - bool parameter. - * cygserver.conf: Add a description for the kern.ipc.shm_allow_removed - parameter. - * sysv_shm.cc (shminit): Set shm_allow_removed variable according to - kern.ipc.shm_allow_removed setting. - -2007-08-02 Corinna Vinschen - - * smallprint.c: Remove. - -2007-08-02 Christopher Faylor - - * Makefile.in: Add -lntdll to link line. - (CYGWIN_OBJS): Include strfuncs.o. - -2007-08-02 Corinna Vinschen - - * smallprint.c: New file. - * Makefile.in (OBJS): Add smallprint.o. - (CYGWIN_OBJS): Remove smallprint.o from Cygwin dir. - -2007-07-21 Corinna Vinschen - - * bsd_helper.cc: Drop unnecessary security.h include. - -2007-02-23 Corinna Vinschen - - Throughout remove using wincap. - * Makefile.in (OBJS): Remove wincap.o. - * README: Don't mention 9x. - * bsd_mutex.cc (_mtx_unlock): Drop checking for 9x error codes. - * cygserver.cc (server_submission_loop::request_loop): Add FIXME - comment. - * wincap.cc: Remove. - * wincap.h: Remove. - * woutsup.h: Don't include wincap.h. - -2007-02-22 Corinna Vinschen - - * Makefile.in (OBJS): Drop transport_sockets.o. - * sysv_shm.cc (shmget_allocate_segment): Remove spurious cast. - * transport.cc: Don't include transport_sockets.h. - (create_server_transport): Always create transport_layer_pipes. - * transport_sockets.cc: Remove. - * transport_sockets.h: Remove. - -2006-05-24 Christopher Faylor - - * configure.in: Update to newer autoconf. - (thanks to Steve Ellcey) - * configure: Regenerate. - * aclocal.m4: New file. - -2006-01-12 Corinna Vinschen - - * wincap.cc: New file. - * wincap.h: New file. - * Makefile.in: Accomodate having our own wincap implementation now. - -2006-01-09 Corinna Vinschen - - Check FreeBSD upstream changes and apply important patches. - * sysv_sem.cc (__semctl): Check copyin return value (from 1.76). - * sysv_shm.cc (shminit): Actually use the iterating variable in the - for loop when trying to avoid overflow (from 1.102). - -2005-11-10 Corinna Vinschen - - * bsd_helper.cc (securityinit): New function. Move initialization - of security related variables from ipcinit here. - * bsd_helper.h (securityinit): Add prototype. - * cygserver.cc (main): Call securityinit right after wincap.init. - -2005-11-10 Corinna Vinschen - - * bsd_log.cc (_vpanic): LOG_EMERG is overkill, use LOG_CRIT. - -2005-11-09 Corinna Vinschen - - * process.cc (process_cache::process): Fix maximum process condition. - -2005-10-24 Corinna Vinschen - - * README: Add description for new -p/--process-cache option. - * bsd_helper.cc (default_tun_check): Add kern.srv.process_cache_size - entry to tunable_params. Set max value of kern.srv.request_threads - to 310. - * cygserver.cc (SERVER_VERSION): Set to 1.20. - (print_usage): Print usage of new parameter -p. - (main): Add process cache parameter handling. Accomodate new max - value of request threads. - * cygserver.conf: Add kern.srv.process_cache_size tunable parameter. - Accomodate new max value of kern.srv.request_threads. - * process.cc: Fix a comment. - (process_cache::process_cache): Add max process cache size parameter. - Change _cache_add_trigger to manual reset event. - (struct pcache_wait_t): New struct used as parameter to - pcache_wait_thread. - (pcache_wait_thread): New thread function used for threaded process - cache. - (process_cache::wait_for_processes): Use threaded waiting if number - of processes to wait for is bigger than 62. Always check all processes - to avoid race under heavy load. - (process_cache::sync_wait_array): Remove useless assert. Reset - _cache_add_trigger right at the start since it's manual reset now. - Accomodate threaded waiting. - * process.h (process_cache::process_cache): Add max_procs parameter. - (process_cache::_max_process_count): New member. - (process_cache::_wait_array: Raise to allow up to 5 wait threads. - (process_cache::_process_array): Ditto. - -2005-08-08 Christopher Faylor - - * cygserver.cc (main): Call wincap.init() earlier to avoid a NULL - dereference. - -2005-06-14 Corinna Vinschen - - * sysv_sem.cc (semu_list): Define static to avoid gcc 4.x compiler - warning. - -2005-04-08 Corinna Vinschen - - * bsd_mutex.cc (msleep_cnt): Remove. - (msleep_max_cnt): Remove. - (msleep_arr): Remove. - (class msleep_sync_array): New class to encapsulate msleep/wakeup - thread synchronization. - (msleep_sync): New object pointer. - (msleep_init): Initialize new msleep_sync object. - (_mutex): Just call msleep_sync->enter() and msleep_sync->leave() for - thread synchronization. Improve debug output a bit more. - (wakeup): Just call msleep_sync->wakeup(). - (wakeup_all): Whitespace fix. - -2005-04-06 Corinna Vinschen - - * bsd_helper.cc (ipcexit_hookthread): Fix whitespace and handle leak. - * bsd_mutex.cc: Include stdlib.h, sys/msg.h and sys/sem.h. - (mtx_init): Initialize lock counter to 0. - (_mtx_lock): Increment and log mutex lock counter. - (mtx_owned): Add winpid argument. Return true only if mutex is - actually owned by process winpid. - (_mtx_assert): Add winpid argument accordingly. - (_mtx_unlock): Log owner and lock count. - (MSLEEP_MUTEX): Remove. - (MSLEEP_SEM): Ditto. - (MSLEEP_EVENT): Ditto. - (msleep_event_name): Ditto. - (msleep_cs): New global critical section. - (msleep_cnt): New global variable indicating msleep record usage. - (msleep_max_cnt): New global variable indicating msleep record size. - (msleep_arr): New global pointer to msleep records. - (msleep_init): Initialize msleep_cs. Allocate msleep_arr array. - (_msleep): Rewrite using new msleep_cs/msleep_arr based thread - synchronization. Don't be shy with debug output. - (wakeup): Rewrite using new msleep_cs/msleep_arr based thread - synchronization. - * bsd_mutex.h (struct mtx): Add lock counter for better debugging. - (mtx_owned): Declare with winpid argument. - (_mtx_assert): Ditto. - (mtx_assert): Define with winpid argument. - * cygserver.cc (version): Remove. - (SERVER_VERSION): New define, decoupling server version information - from source code control system. - (print_version): Simplify printing server version. - * process.cc (process::process): Fix wrong bracketing (and handle leak). - (process::~process): Only try to close _signal_arrived if valid. - * sysv_sem.cc: Include sys/smallprint.h. - (semundo_clear): Define with additional struct thread pointer argument. - Accomodate throughout. - (SEMUNDO_LOCKASSERT): Define with winpid argument. Accomodate - throughout. - (struct sem_undo): Define un_proc as pid_t on Cygwin. Accomodate - throughout. - (seminit): Improve debugging by adding the semid to the mutex name. - (semget): Correctly print key value as 64 bit hex value in debug - output. - (semexit_myhook): Remove Cygwin specific unlocking of mutexes owned - by exiting process. Keep semaphore global lock throughout whole - function to avoid races. - * sysv_shm.cc (GIANT_REQUIRED): Define empty on Cygwin. We know that - Giant is locked. - -2005-04-01 Corinna Vinschen - - * bsd_mutex.cc (_msleep): Whitespace fix. - * process.cc (process::process): Handle invalid signal_arrived values - more gracefully. - -2004-12-30 Corinna Vinschen - - * bsd_mutex.cc: Include limits.h. - (MSLEEP_MUTEX): New define for third parameter to msleep_event_name. - (MSLEEP_SEM): Ditto. - (MSLEEP_EVENT): Ditto. - (msleep_event_name): Add third parameter to allow multiple - synchronization objects per ident. - (_msleep): Implement new synchronization technique to make sure - that all threads have been woken up by a corresponding wakeup call. - (wakeup): Ditto. - -2004-10-18 Corinna Vinschen - - * sysv_sem.cc: Redefine offsetof to circumvent build problems with - gcc 3.4. - -2004-10-04 Corinna Vinschen - - * bsd_mutex.cc (_msleep): Simplify event creation. Revert change from - 2004-08-24. It should be unnecessary now. - * msg.cc (client_request_msg::serve): Release process critical - section as early as possible. - * sem.cc (client_request_sem::serve): Ditto. - * shm.cc (client_request_shm::serve): Ditto. - * process.cc: Use hold and release method calls instead of - EnterCriticalSection/LeaveCriticalSection calls throughout. - * process.h (_hold): Rename from hold. Take filename and linenumber - parameter for logging. Define matching hold macro. - (release): Ditto. - -2004-10-01 Corinna Vinschen - - * sysv_sem.cc: Update to FreeBSD version 1.69. - 1.68: Reduce the overhead of semop() by using the kernel stack - instead of malloc'd memory to store the operations array if it - is small enough to fit. - 1.69: Adjust the number of processes waiting on a semaphore properly - if we're woken up in the middle of sleeping. - -2004-09-23 Corinna Vinschen - - * sysv_shm.cc (kern_shmat): Avoid compiler warning. - -2004-09-21 Corinna Vinschen - - * sysv_shm.cc (vm_object_reference): remove Cygwin specific define. - (vm_map_find): Ditto. - (vm_map_inherit): Ditto. - (kern_shmat): On Cygwin, take shmaddr just as is. Don't call vm - system calls on Cygwin. Add comment. - -2004-09-15 Corinna Vinschen - - Fix copyright throughout. - Eliminate use of _impure_ptr outside Cygwin. - * bsd_helper.cc: Include errno.h instead of cygerrno.h. - * bsd_mutex.cc : Ditto. - * client.cc: Ditto. - * cygserver.cc: Ditto. - * process.cc: Don't build functions inside Cygwin. Don't include - cygerrno.h. Don't set errno. - * transport_pipes.cc (SET_ERRNO): New define. Use througout. - * transport_sockets.cc (SET_ERRNO): Ditto. - (GET_ERRNO): Ditto. - -2004-09-06 Corinna Vinschen - - * bsd_mutex.cc (_msleep): Disable resetting event object for now. - -2004-08-31 Corinna Vinschen - - * sysv_shm.cc (kern_shmat): Add debug_printf's. - -2004-08-24 Corinna Vinschen - - * bsd_mutex.cc (_msleep): Release process object while waiting. - -2004-08-03 Corinna Vinschen - - * transport.cc (transport_layer_base::~transport_layer_base): Resurrect. - * transport.h (transport_layer_base::~transport_layer_base): Ditto. - -2004-07-30 Corinna Vinschen - - * bsd_mutex.cc (_msleep): Reset event object and close it before - entering mutex. Turn order of conditional for better readability. - -2004-07-26 Corinna Vinschen - - * cygserver.conf: Describe relation between shmmaxpgs and SHMMAX. - -2004-07-20 Corinna Vinschen - - * bsd_helper.cc: Whitespace fixes. - * bsd_mutex.cc: Ditto. - -2004-07-19 Corinna Vinschen - - * transport.cc (transport_layer_base::~transport_layer_base): Remove. - * transport.h (transport_layer_base::~transport_layer_base): Ditto. - -2004-07-19 Corinna Vinschen - - * bsd_mutex.cc (win_priority): Actually calculate p from priority. - -2004-06-03 Corinna Vinschen - - * shm.cc (shmget): Explicitely set td_retval[0] to -1 on error. - -2004-03-30 Corinna Vinschen - - * sysv_shm.cc (shmget): Allow to retrieve shared memory segments - by shmid when IPC_KEY_IS_SHMID is set. - -2004-03-02 Corinna Vinschen - - * sysv_sem.cc (semundo_adjust): Check for process id instead of - process struct pointer, which isn't fixed under Cygwin. - (semexit_myhook): Ditto. Adjust debug print statements to print - Cygwin and Windows PIDs instead of process pointer under Cygwin. - -2004-02-07 Corinna Vinschen - - * bsd_mutex.cc (win_priority): Move to msleep helper function section. - (set_priority): Ditto. Fix formatting. - (_msleep): Cleanup obj formatting. Rearrange obj order. - -2004-02-06 Corinna Vinschen - - * bsd_mutex.cc (_msleep): Handle PCATCH using signal_arrived event. - * client.cc: Include sigproc.h. - * msg.cc (client_request_msg::serve): Accomodate third parameter to - process::process. - * sem.cc (client_request_sem::serve): Ditto. - * shm.cc (client_request_shm::serve): Ditto. - * process.cc (process::process): Duplicate signal_arrived into - Cygserver process space. - (process::~process): Close _signal_arrived handle. - (process_cache::process): Add signal_arrived handling. - * process.h (process::process): Add signal_arrived parameter. - (process:signal_arrived): New read accessor. - (process:_signal_arrived): New member. - (process_cache::process): Add signal_arrived parameter. - -2004-01-16 Corinna Vinschen - - * process.h (cleanup_routine::~cleanup_routine): Make pure virtual - function to avoid miscompilation with certain versions of gcc. - * process.cc (cleanup_routine::~cleanup_routine): Remove. - -2003-12-26 Christopher Faylor - - * Makefile.in (CFLAGS, CXXFLAGS): Remove unneeded include. - (CYGWIN_LIB): Delete. - (cygserver.exe target): Add -L$(cygwin_build) to the link line to force - linker to use build tree version of the library. Remove specific - inclusion of libcygwin.a from the link line. - -2003-12-16 Corinna Vinschen - - * bsd_helper.cc (tunable_params): Add entries for kern.ipc.msgmnb and - kern.ipc.msgtql. Raise max value for kern.ipc.msgseg to 65535. - * cygserver.conf: Add kern.ipc.msgmnb and kern.ipc.msgtql. - * sysv_msg.cc (msginit): Add TUNABLE_INT_FETCH call for - kern.ipc.msgmnb and kern.ipc.msgtql. - -2003-11-26 Corinna Vinschen - - * cygserver.cc (main): Move call to ipcinit() up before installing - any threads. - * sysv_sem.cc: Update to FreeBSD version 1.67. - (seminit): Initialize semaphore sequence numbers to 0. - -2003-11-26 Corinna Vinschen - - * Makefile.in (CYGWIN_LIB): Variable pointing to libcygwin.a in - the parallel cygwin dir. - (cygserver.exe): Depend on and link against $CYGWIN_LIB. - -2003-11-25 Christopher Faylor - - * Makefile.in (CXXFLAGS): Remove duplicate options handled in - Makefile.common. - -2003-11-22 Corinna Vinschen - - * msg.cc (client_request_msg::serve): Add default case to msgop switch. - * sem.cc (client_request_sem::serve): Add default case to semop switch. - * shm.cc (client_request_shm::serve): Add default case to shmop switch. - -2003-11-21 Corinna Vinschen - - * Makefile.in (install): Explicitely create directories. Install - README to $(prefix)/share/doc/Cygwin. - * README: New file. - -2003-11-21 Corinna Vinschen - - * cygserver.cc (print_usage): Fix scrambled output. - -2003-11-20 Corinna Vinschen - - * cygserver-config: Slightly modify printed message. - -2003-11-20 Corinna Vinschen - - * Makefile.in (install): Install cygserver-config script to bindir. - * cygserver-config: New script. - -2003-11-19 Corinna Vinschen - - Don't use safe_new but new throughout. Fix copyright dates - throughout. - * Makefile.in: Accomodate all new files and name changes. - Add a *.d dependency. - (sbindir): Add. - (etcdir): Drop in favor of more appropriate sysconfdir definition. - (sysconfdir): Add. - (CXXFLAGS): Add -MMD flag. Add SYSCONFDIR definition. - (.SUFFIXES): Add. - (install): Add action items. - (libclean): New target. - (fullclean): Ditto. - * bsd_helper.cc: New file. - * bsd_helper.h: Ditto. - * bsd_log.cc: Ditto. - * bsd_log.h: Ditto. - * bsd_mutex.cc: Ditto. - * bsd_mutex.h: Ditto. - * client.cc: Rearrange to build as less as possible if - __INSIDE_CYGWIN__. - (client_request::handle_request): Add Message Queue and Semaphore - handling. - * cygserver.cc: Rearrange to build as less as possible if - __INSIDE_CYGWIN__. Use new debug/log/panic logging functions. - (DEF_CONFIG_FILE): New definition for configuration file. Use - throughout. - (getfunc): Remove. - (__cygserver__printf): Remove. - (client_request_attach_tty::serve): Return error if impersonation - fails. - (print_usage): Pump up help message. - (print_version): Add output of default configuration file. - (main): Accommodate new options. Allow overwrite of threading options - from config file. Call several new initialization functions. Drop - printing dots. Don't define SIGHANDLE inline. - * cygserver.conf: New file. - * cygserver_process.h: Rename to process.h. - * cygserver_transport.h: Rename to transport.h. - * cygserver_transport_pipes.h: Rename to transport_pipes.h. - * cygserver_transport_sockets.h: Rename to transport_sockets.h. - * msg.cc: Rewrite. - * sem.cc: Rewrite. - * shm.cc: Rewrite. - * sysv_msg.cc: New file, derived from FreeBSD version 1.52. - * sysv_sem.cc: New file, derived from FreeBSD version 1.66. - * sysv_shm.cc: New file, derived from FreeBSD version 1.89. - * threaded_queue.cc: Rearrange to build as less as possible if - __INSIDE_CYGWIN__. - * transport.cc (transport_layer_base::impersonate_client): Define bool. - (transport_layer_base::revert_to_self): Ditto. - * transport.h (transport_layer_base::impersonate_client): Declare bool. - (transport_layer_base::revert_to_self): Ditto. - * transport_pipes.cc (transport_layer_pipes::transport_layer_pipes): - Don't call init_security. - (init_security): Remove. - (transport_layer_pipes::accept): Use global sec_all_nih. - (transport_layer_pipes::connect): Ditto. - (transport_layer_pipes::impersonate_client): Define bool. - (transport_layer_pipes::revert_to_self): Ditt. - * transport_pipes.h (transport_layer_pipes::impersonate_client): Declare - bool. - (transport_layer_pipes::revert_to_self): Ditto. - * woutsup.h: Include bsd compatibility headers. - (SIGHANDLE): Add definition. - (__cygserver__printf): Remove definition. - (__noop_printf): Ditto. - (debug_printf): Define using debug. - (syscall_printf): Define using log. - (system_printf): Ditto. - Drop all other _printf definitions. - -2003-10-22 Corinna Vinschen - - Accomodate moving cygserver header files from cygwin/include/cygwin - to here and cygwin dir. - * Makefile.in (EXEEXT): Drop as unused. - (EXEEXT_FOR_BUILD): Ditto. - (all): Don't build libcygserver.a. - * cygserver_process.h: Moved from cygwin/include/cygwin to here. - * cygserver_transport.h: Ditto. - * cygserver_transport_pipes.h: Ditto. - * cygserver_transport_sockets.h: Ditto. - * ipc.h: Moved to ../cygwin and renamed to cygserver_ipc.h. - * shm.h: Moved to ../cygwin and renamed to cygserver_shm.h. - -2003-08-30 Christopher Faylor - - * msg.cc: New file. - * sem.cc: Ditto. - -2003-08-30 Christopher Faylor - - * threaded_queue.h: New file. - -2003-08-25 Christopher Faylor - - * Makefile.in: Build libcygserver.a. - * client.cc: Rename allow_daemon to allow_server. - -2003-07-25 Christopher Faylor - - * configure.in: Use 'install-sh -c'. - * configure: Regenerate. - -2003-07-25 Christopher Faylor - - * configure.in: Always use install-sh. - * configure: Regenerate. - -2003-07-01 Christopher Faylor - - * Makefile.in (OBJS): Move some more files from cygwin directory. - * woutsup.h: Define _MT_SAFE. - -2003-07-01 Christopher Faylor - - * configure.in: First pass. - * Makefile.in: Ditto. - * configure: Generate. diff --git a/winsup/cygserver/ChangeLog.64bit b/winsup/cygserver/ChangeLog.64bit deleted file mode 100644 index 7ab21bf54..000000000 --- a/winsup/cygserver/ChangeLog.64bit +++ /dev/null @@ -1,87 +0,0 @@ -2013-03-07 Corinna Vinschen - - * msg.cc (client_request_msg::serve): Revert change to refuse 64 bit - processes on 32 bit systems. - * sem.cc (client_request_sem::serve): Ditto. - * shm.cc (client_request_shm::serve): Ditto. - -2013-03-01 Corinna Vinschen - - * client.cc: Revert changes to handle 32 bit processes on 64 bit - systems. - * sysv_msg.cc: Ditto. - * sysv_sem.cc: Ditto. - * sysv_shm.cc: Ditto. - -2013-02-13 Corinna Vinschen - - * Makefile.in (cygserver.exe): Make cygwin_build a tooldir (-B instead - of -L) to support bootstrapping. - -2013-02-09 Corinna Vinschen - - * configure: Regenerate to fix wrong ac_unique_file dependency. - -2012-12-06 Corinna Vinschen - - * sysv_msg.cc (conv_timespec32_to_timespec): Move implementation to - cygserver_ipc.h. - (conv_timespec_to_timespec32): Ditto. - (conv_msqid_ds32_to_msqid_ds): Drop and move code into copyin_msqid_ds. - (conv_msqid_ds_to_msqid_ds32): Drop and move code into copyout_msqid_ds. - * sysv_sem.cc (copyin_semid_ds): New inline function on Cygwin. - (copyout_semid_ds): Ditto. - (__semctl): Use a conditional arg_size value rather than a fixed - sizeof(real_arg) throughout, to accommodate 64/32 bit conversion. - Use copyout_semid_ds and copyin_semid_ds to copy semid_ds - structures from cygserver to client and vice versa on Cygwin. - * sysv_shm.cc (copyin_shmid_ds): New inline function on Cygwin. - (copyout_shmid_ds): Ditto. - (shmctl): Use copyout_shmid_ds and copyin_shmid_ds to copy shmid_ds - structures from cygserver to client and vice versa on Cygwin. - -2012-12-05 Corinna Vinschen - - * client.cc (client_request::header_t::header_t): Accommodate changes - to msglen member. - (client_request::handle_request): Ditto. - (client_request::client_request): Zero out entire parameter block. - Explain why. - * sysv_msg.cc (conv_timespec32_to_timespec): New inline function on - 64 bit Cygwin. - (conv_timespec_to_timespec32): Ditto. - (conv_msqid_ds32_to_msqid_ds): Ditto. - (conv_msqid_ds_to_msqid_ds32): Ditto. - (copyin_msqid_ds): New inline function on Cygwin. - (copyout_msqid_ds): Ditto. - (msgctl): Use copyout_msqid_ds and copyin_msqid_ds to copy msqid_ds - structures from cygserver to client and vice versa on Cygwin. - (msgsnd): Special case copyin of msg_type on 64 bit Cygwin. - (msgrcv): Special case copyout of msg_type on 64 bit Cygwin. - -2012-12-04 Corinna Vinschen - - * bsd_helper.cc (tunable_int_fetch): Convert 2nd parameter to - int32_t. - * bsd_helper.h (tunable_int_fetch): Fix declaration accordingly. - * bsd_log.cc (log_level): Change type to int32_t. - * bsd_log.h (log_level): Fix declaration accordingly. - * bsd_mutex.cc (msgmni): Change type to int32_t. - (semmni): Ditto. - * cygserver.cc: Fix debug output to be target agnostic. Use same - style throughout. - * msg.cc (client_request_msg::serve): Refuse to serve 64 bit processes - from 32 bit cygserver. - * sem.cc (client_request_sem::serve): Ditto. - * shm.cc (client_request_shm::serve): Ditto. - * sysv_shm.cc (shm_delete_mapping): Mark size as unused to make gcc - happy. - (kern_shmat): Ditto with flags. - * process.h (class process): Change type of _cleaning_up member to LONG. - * threaded_queue.h (class threaded_queue): Ditto for _workers_count. - -2012-08-14 Corinna Vinschen - - * configure.in: Add AC_NO_EXECUTABLES to allow bootstrap. - * configure: Regenerate. - diff --git a/winsup/cygserver/Makefile.in b/winsup/cygserver/Makefile.in deleted file mode 100644 index e2fe30992..000000000 --- a/winsup/cygserver/Makefile.in +++ /dev/null @@ -1,94 +0,0 @@ -# Makefile for Cygwin server -# Copyright 2003, 2006, 2007, 2008, 2009 Red Hat, Inc. - -# This file is part of Cygwin. - -# This software is a copyrighted work licensed under the terms of the -# Cygwin license. Please consult the file "CYGWIN_LICENSE" for -# details. - -srcdir:=@srcdir@ -target_builddir:=@target_builddir@ -winsup_srcdir:=@winsup_srcdir@ -configure_args=@configure_args@ - -export CC:=@CC@ -export CXX:=@CXX@ - -CFLAGS:=@CFLAGS@ -override CXXFLAGS=@CXXFLAGS@ -override CXXFLAGS+=-MMD -D__OUTSIDE_CYGWIN__ -DSYSCONFDIR="\"$(sysconfdir)\"" - -include ${srcdir}/../Makefile.common - -cygwin_build:=${target_builddir}/winsup/cygwin - -# environment variables used by ccwrap -export CCWRAP_HEADERS:=$(dir ${srcdir})/cygwin ${cygwin_build} -export CCWRAP_SYSTEM_HEADERS:=@cygwin_headers@ @newlib_headers@ -export CCWRAP_DIRAFTER_HEADERS:=@windows_headers@ - -DESTDIR= -prefix:=${DESTDIR}@prefix@ -exec_prefix:=${DESTDIR}@exec_prefix@ -bindir:=${DESTDIR}@bindir@ -sbindir:=${DESTDIR}@sbindir@ -sysconfdir:=${DESTDIR}@sysconfdir@ -program_transform_name:=@program_transform_name@ - -INSTALL:=@INSTALL@ -INSTALL_PROGRAM:=@INSTALL_PROGRAM@ -INSTALL_DATA:=@INSTALL_DATA@ - -AR:=@AR@ - - -OBJS:= cygserver.o client.o process.o msg.o sem.o shm.o threaded_queue.o \ - transport.o transport_pipes.o \ - bsd_helper.o bsd_log.o bsd_mutex.o \ - sysv_msg.o sysv_sem.o sysv_shm.o setpwd.o -LIBOBJS:=${patsubst %.o,lib%.o,$(OBJS)} - -CYGWIN_OBJS:=$(cygwin_build)/version.o - -CYGWIN_LIB:=$(cygwin_build)/libcygwin.a - -all: cygserver.exe - -install: all cygserver.conf cygserver-config README - /bin/mkdir -p $(DESTDIR)$(sbindir) $(DESTDIR)$(bindir) $(DESTDIR)$(sysconfdir)/defaults/etc $(DESTDIR)$(prefix)/share/doc/Cygwin - $(INSTALL_PROGRAM) cygserver.exe $(DESTDIR)$(sbindir)/cygserver.exe - $(INSTALL_PROGRAM) $(srcdir)/cygserver-config $(DESTDIR)$(bindir)/cygserver-config - $(INSTALL_DATA) $(srcdir)/cygserver.conf $(DESTDIR)$(sysconfdir)/defaults/etc/cygserver.conf - $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(prefix)/share/doc/Cygwin/cygserver.README - -clean: - rm -f $(OBJS) ${patsubst %.o,%.d,$(OBJS)} cygserver.exe - -libclean: - rm -f $(LIBOBJS) ${patsubst %.o,%.d,$(LIBOBJS)} libcygserver.a - -fullclean: clean libclean - -cygserver.exe: $(CYGWIN_LIB) $(OBJS) $(CYGWIN_OBJS) - $(CXX) -o $@ ${wordlist 2,999,$^} -static -static-libgcc -B$(cygwin_build) -lntdll - -$(cygwin_build)/%.o: $(cygwin_source)/%.cc - @$(MAKE) -C $(@D) $(@F) - -$(cygwin_build)/%.o: $(cygwin_source)/%.c - @$(MAKE) -C $(@D) $(@F) - -Makefile: Makefile.in configure - ./config.status - -lib%.o: %.cc - ${filter-out -D__OUTSIDE_CYGWIN__, $(COMPILE.cc)} -c -o $(@D)/${basename $(@F)}.o $< - -libcygserver.a: $(LIBOBJS) - $(AR) crus $@ $? - -deps:=${wildcard *.d} -ifneq (,$(deps)) -include $(deps) -endif diff --git a/winsup/cygserver/README b/winsup/cygserver/README deleted file mode 100644 index b667cb08a..000000000 --- a/winsup/cygserver/README +++ /dev/null @@ -1,198 +0,0 @@ -What is Cygserver? - - Cygserver is a program which is designed to run as a background service. - It provides Cygwin applications with services which require security - arbitration or which need to persist while no other cygwin application - is running. - - The implemented services so far are: - - - Control slave tty/pty handle dispersal from tty owner to other - processes without compromising the owner processes' security. - - XSI IPC Message Queues. - - XSI IPC Semaphores. - - XSI IPC Shared Memory. - - Allows non-privileged users to store obfuscated passwords in the - registry to be used for setuid(2) to create user tokens with network - credentials. This service is used by `passwd -R'. Using the stored - passwords in setuid(2) does not require running cygserver. The - registry storage is the same as Windows uses to store passwords for - accounts running Windows services. - - -Cygserver command line options: - - Options to Cygserver take the normal UNIX-style `-X' or `--longoption' form. - Nearly all options have a counterpart in the configuration file (see below) - so setting them on the command line isn't really necessary. Command line - options override settings from the Cygserver configuration file. - - The one-character options are prepended by a single dash, the long variants - are prepended with two dashes. Arguments to options are marked in angle - brackets below. These are not part of the actual syntax but are used only to - denote the arguments. Note that all arguments are required. Cygserver - has no options with optional arguments. - - The options recognized are: - - -f, --config-file - - Use as configuration file instead of the default configuration - line. The default configuration file is /etc/cygserver.conf, typically. - The --help and --version options will print the default configuration - pathname. - - This option has no counterpart in the configuration file, for obvious - reasons. - - -c, --cleanup-threads - - Number of threads started to perform cleanup tasks. Default is 2. - Configuration file option: kern.srv.cleanup_threads - - -r, --request-threads - - Number of threads started to serve application requests. Default is 10. - The -c and -r options can be used to play with Cygserver's performance - under heavy load conditions or on slow machines. - Configuration file option: kern.srv.request_threads - - -p, --process-cache - - Number of processes which can connect concurrently to cygserver. - Default is 62. Each process connected to cygserver is a synchronization - object which has to be maintained. The data structure to maintain these - processes is the so-called "process cache". In theory, an arbitrary - number of processes could connect to cygserver, but due to the need to - synchronize, the higher the number of connected processes, the more - synchronization overhead exists. By using this option, you can set an - upper limit to the synchronization effort. If more than 62 processes - try to connect to cygserver concurrently, two additional synchronization - threads are necessary, and one for each further 62 concurrent - processes. So, useful values for the --process-cache option are 62, 124, - 186, 248, 310. 310 is the maximum value. - Configuration file option: kern.srv.process_cache_size - - NOTE: The number of child processes of a single parent process is limited - to 256. So in case of taking advantage of a process cache size beyond 256, - keep in mind that not all of these processes can be child processes of one - single parent process. - - -d, --debug - - Log debug messages to stderr. These will clutter your stderr output with - a lot of information, typically only useful to developers. - - -e, --stderr - - Force logging to stderr. This is the default if stderr is connected to - a tty. Otherwise, the default is logging to the system log. By using - the -e, -E, -y, -Y options (or the appropriate settings in the - configuration file), you can explicitely set the logging output as you - like, even to both, stderr and syslog. - Configuration file option: kern.log.stderr - - -E, --no-stderr - - Don't log to stderr. Configuration file option: kern.log.stderr - - -y, --syslog - - Force logging to the system log. This is the default, if stderr is not - connected to a tty, e. g. redirected to a file. - - -Y, --no-syslog - - Don't log to syslog. Configuration file option: kern.log.syslog - - -l, --log-level - - Set the verbosity level of the logging output. Valid values are between - 1 and 7. The default level is 6, which is relatively chatty. If you set - it to 1, you will get only messages which are printed under severe conditions, - which will result in stopping Cygserver itself. - Configuration file option: kern.log.level - - -m, --no-sharedmem - - Don't start XSI IPC Shared Memory support. If you don't need XSI IPC - Shared Memory support, you can switch it off here. - Configuration file option: kern.srv.sharedmem - - -q, --no-msgqueues - - Don't start XSI IPC Message Queues. - Configuration file option: kern.srv.msgqueues - - -s, --no-semaphores - - Don't start XSI IPC Semaphores. - Configuration file option: kern.srv.semaphores - - -S, --shutdown - - Shutdown a running daemon and exit. Other methods are sending a SIGHUP - to the Cygserver PID or, if running as service under NT, calling - `net stop cygserver' or `cygrunsrv -E cygserver'. - - -h, --help - - Output usage information and exit. - - -v, --version - - Output version information and exit. - - -How to start Cygserver: - - Before you run Cygserver for the first time, you should run the - /usr/bin/cygserver-config script once. It creates the default - configuration file and, upon request, installs Cygserver as service - when running under NT. The script only performs a default install, - with no further options given to Cygserver when running as service. - Due to the wide configurability by changing the configuration file, - that's typically not necessary. - - It's best practice to run Cygserver as a service under LocalSystem - account. This is the way it is installed for you by the - /usr/bin/cygserver-config script. - - -The Cygserver configuration file: - - Cygserver has many options, which allow to customize the server - to your needs. Customization is accomplished by editing the configuration - file, which is by default /etc/cygserver.conf. This file is read only - once on startup of Cygserver. There's no option to re-read the file on - runtime by, say, sending a signal to Cygserver. - - The configuration file determines how Cygserver operates. There are - options which set the number of threads running in parallel, options - for setting how and what to log and options to set various maximum - values for the IPC services. - - The default configuration file delivered with Cygserver is installed - to /etc/defaults/etc. The /usr/bin/cygserver-config script copies it to - /etc, giving you the option to overwrite an already existing file or to - leave it alone. Therefore, the /etc file is safe to be changed by you, - since it will not be overwritten by a later update installation. - - The default configuration file contains many comments which describe - everything needed to understand the settings. A comment at the start of the - file describes the syntax rules for the file. The default options are shown - in the file but are commented out. - - It is generally a good idea to uncomment only options which you intend to - change from the default values. Since reading the options file on Cygserver - startup doesn't take much time, it's also considered good practice to keep - all other comments in the file. This keeps you from searching for clues - in other sources. - - -If you have problems with Cygserver, or you have found a bug, or you -think you have found a bug, or you don't understand configuration file -options, the mailing list is the right place to ask -questions. - -Have fun! diff --git a/winsup/cygserver/aclocal.m4 b/winsup/cygserver/aclocal.m4 deleted file mode 100644 index 5bf14e574..000000000 --- a/winsup/cygserver/aclocal.m4 +++ /dev/null @@ -1,98 +0,0 @@ -# generated automatically by aclocal 1.11.6 -*- 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. - -dnl This provides configure definitions used by all the cygwin -dnl configure.in files. - -AC_DEFUN([AC_WINDOWS_HEADERS],[ -AC_ARG_WITH( - [windows-headers], - [AS_HELP_STRING([--with-windows-headers=DIR], - [specify where the windows includes are located])], - [test -z "$withval" && AC_MSG_ERROR([must specify value for --with-windows-headers])] -) -]) - -AC_DEFUN([AC_WINDOWS_LIBS],[ -AC_ARG_WITH( - [windows-libs], - [AS_HELP_STRING([--with-windows-libs=DIR], - [specify where the windows libraries are located])], - [test -z "$withval" && AC_MSG_ERROR([must specify value for --with-windows-libs])] -) -windows_libdir=$(realdirpath "$with_windows_libs") -if test -z "$windows_libdir"; then - windows_libdir=$(realdirpath $(${ac_cv_prog_CC:-$CC} -xc /dev/null -Wl,--verbose=1 -lntdll 2>&1 | sed -rn 's%^.*\s(\S+)/libntdll\..*succeeded%\1%p')) - if test -z "$windows_libdir"; then - AC_MSG_ERROR([cannot find windows library files]) - fi -fi -AC_SUBST(windows_libdir) -] -) - -AC_DEFUN([AC_CYGWIN_INCLUDES], [ -addto_CPPFLAGS -nostdinc -: ${ac_cv_prog_CXX:=$CXX} -: ${ac_cv_prog_CC:=$CC} - -cygwin_headers=$(realdirpath "$winsup_srcdir/cygwin/include") -if test -z "$cygwin_headers"; then - AC_MSG_ERROR([cannot find $winsup_srcdir/cygwin/include directory]) -fi - -newlib_headers=$(realdirpath $winsup_srcdir/../newlib/libc/include) -if test -z "$newlib_headers"; then - AC_MSG_ERROR([cannot find newlib source directory: $winsup_srcdir/../newlib/libc/include]) -fi -newlib_headers="$target_builddir/newlib/targ-include $newlib_headers" - -if test -n "$with_windows_headers"; then - if test -e "$with_windows_headers/windef.h"; then - windows_headers="$with_windows_headers" - else - AC_MSG_ERROR([cannot find windef.h in specified --with-windows-headers path: $saw_windows_headers]); - fi -elif test -d "$winsup_srcdir/w32api/include/windef.h"; then - windows_headers="$winsup_srcdir/w32api/include" -else - windows_headers=$(cd $($ac_cv_prog_CC -xc /dev/null -E -include windef.h 2>/dev/null | sed -n 's%^# 1 "\([^"]*\)/windef\.h".*$%\1%p' | head -n1) 2>/dev/null && pwd) - if test -z "$windows_headers" -o ! -d "$windows_headers"; then - AC_MSG_ERROR([cannot find windows header files]) - fi -fi -CC=$ac_cv_prog_CC -CXX=$ac_cv_prog_CXX -export CC -export CXX -AC_SUBST(windows_headers) -AC_SUBST(newlib_headers) -AC_SUBST(cygwin_headers) -]) - -AC_DEFUN([AC_CONFIGURE_ARGS], [ -configure_args=X -for f in $ac_configure_args; do - case "$f" in - *--srcdir*) ;; - *) configure_args="$configure_args $f" ;; - esac -done -configure_args=$(/usr/bin/expr "$configure_args" : 'X \(.*\)') -AC_SUBST(configure_args) -]) - -AC_SUBST(target_builddir) -AC_SUBST(winsup_srcdir) - diff --git a/winsup/cygserver/autogen.sh b/winsup/cygserver/autogen.sh deleted file mode 100755 index 87a0d9c06..000000000 --- a/winsup/cygserver/autogen.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -e -/usr/bin/aclocal --acdir=.. -/usr/bin/autoconf -f -exec /bin/rm -rf autom4te.cache diff --git a/winsup/cygserver/bsd_helper.cc b/winsup/cygserver/bsd_helper.cc deleted file mode 100644 index 718c587c3..000000000 --- a/winsup/cygserver/bsd_helper.cc +++ /dev/null @@ -1,691 +0,0 @@ -/* bsd_helper.cc - - Copyright 2003, 2004, 2005, 2007, 2012 Red Hat Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" -#include -#define _KERNEL 1 -#define __BSD_VISIBLE 1 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cygserver.h" -#include "process.h" -#include "cygserver_ipc.h" -#include "cygserver_msg.h" -#include "cygserver_sem.h" -#include "cygserver_shm.h" - -/* - * Copy a piece of memory from the client process into the server process. - * Returns an error code. - */ -int -win_copyin (struct thread *td, const void *client_src, - void *server_tgt, size_t len) -{ - if (!ReadProcessMemory (td->client->handle (), client_src, server_tgt, - len, NULL)) - return cygwin_internal (CW_GET_ERRNO_FROM_WINERROR, - GetLastError (), EINVAL); - return 0; -} - -/* - * Copy a piece of memory from the server process into the client process. - * Returns an error code. - */ -int -win_copyout (struct thread *td, const void *server_src, - void *client_tgt, size_t len) -{ - if (!WriteProcessMemory (td->client->handle (), client_tgt, server_src, - len, NULL)) - return cygwin_internal (CW_GET_ERRNO_FROM_WINERROR, - GetLastError (), EINVAL); - return 0; -} - -#define enter_critical_section(c) _enter_critical_section((c),__FILE__,__LINE__) -static void -_enter_critical_section (LPCRITICAL_SECTION pcs, const char *file, int line) -{ - _log (file, line, LOG_DEBUG, "Try enter critical section(%p)", pcs); - EnterCriticalSection (pcs); - _log (file, line, LOG_DEBUG, "Entered critical section(%p)", pcs); -} - -#define leave_critical_section(c) _leave_critical_section((c),__FILE__,__LINE__) -static void -_leave_critical_section (LPCRITICAL_SECTION pcs, const char *file, int line) -{ - LeaveCriticalSection (pcs); - _log (file, line, LOG_DEBUG, "Left critical section(%p)", pcs); -} - -CRITICAL_SECTION ipcht_cs; - -struct ipc_hookthread_storage { - HANDLE process_hdl; - proc ipcblk; -}; - -struct ipc_hookthread { - SLIST_ENTRY (ipc_hookthread) sht_next; - HANDLE thread; - DWORD winpid; - struct vmspace vmspace; -}; -static SLIST_HEAD (, ipc_hookthread) ipcht_list; /* list of hook threads */ - -static HANDLE ipcexit_event; - -struct vmspace * -ipc_p_vmspace (struct proc *proc) -{ - struct vmspace *ret = NULL; - ipc_hookthread *ipcht_entry; - enter_critical_section (&ipcht_cs); - SLIST_FOREACH (ipcht_entry, &ipcht_list, sht_next) - { - if (ipcht_entry->winpid == proc->winpid) - { - ret = proc->p_vmspace = &ipcht_entry->vmspace; - break; - } - } - leave_critical_section (&ipcht_cs); - return ret; -} - -static DWORD WINAPI -ipcexit_hookthread (const LPVOID param) -{ - ipc_hookthread_storage *shs = (ipc_hookthread_storage *) param; - HANDLE obj[2] = { ipcexit_event, shs->process_hdl }; - switch (WaitForMultipleObjects (2, obj, FALSE, INFINITE)) - { - case WAIT_OBJECT_0: - /* Cygserver shutdown. */ - /*FALLTHRU*/ - case WAIT_OBJECT_0 + 1: - /* Process exited. Call semexit_myhook to handle SEM_UNDOs for the - exiting process and shmexit_myhook to keep track of shared - memory. */ - if (Giant.owner == shs->ipcblk.winpid) - mtx_unlock (&Giant); - if (support_semaphores == TUN_TRUE) - semexit_myhook (NULL, &shs->ipcblk); - if (support_sharedmem == TUN_TRUE) - { - _mtx_lock (&Giant, shs->ipcblk.winpid, __FILE__, __LINE__); - ipc_p_vmspace (&shs->ipcblk); - shmexit_myhook (shs->ipcblk.p_vmspace); - mtx_unlock (&Giant); - } - break; - default: - /* FIXME: Panic? */ - break; - } - CloseHandle (shs->process_hdl); - ipc_hookthread *ipcht_entry, *sav_entry; - enter_critical_section (&ipcht_cs); - SLIST_FOREACH_SAFE (ipcht_entry, &ipcht_list, sht_next, sav_entry) - { - if (ipcht_entry->winpid == shs->ipcblk.winpid) - { - SLIST_REMOVE (&ipcht_list, ipcht_entry, ipc_hookthread, sht_next); - CloseHandle (ipcht_entry->thread); - delete ipcht_entry; - } - } - leave_critical_section (&ipcht_cs); - delete shs; - return 0; -} - -/* Deletes all pending hook threads. Called by ipcunload() which in turn - is called by the cygserver main routine. */ -static void -ipcexit_dispose_hookthreads (void) -{ - SetEvent (ipcexit_event); - ipc_hookthread *ipcht_entry; - enter_critical_section (&ipcht_cs); - SLIST_FOREACH (ipcht_entry, &ipcht_list, sht_next) - { - WaitForSingleObject (ipcht_entry->thread, 1000); - /* Don't bother removing the linked list on cygserver shutdown. */ - /* FIXME: Error handling? */ - } - leave_critical_section (&ipcht_cs); -} - -/* Creates the per process wait thread. Called by semget() under locked - Giant mutex condition. */ -int -ipcexit_creat_hookthread (struct thread *td) -{ - ipc_hookthread *ipcht_entry; - int ret = -1; - enter_critical_section (&ipcht_cs); - SLIST_FOREACH (ipcht_entry, &ipcht_list, sht_next) - { - if (ipcht_entry->winpid == td->ipcblk->winpid) - ret = 0; - } - leave_critical_section (&ipcht_cs); - if (!ret) - return 0; - - DWORD tid; - ipc_hookthread_storage *shs = new ipc_hookthread_storage; - if (!DuplicateHandle (GetCurrentProcess (), td->client->handle (), - GetCurrentProcess (), &shs->process_hdl, - 0, FALSE, DUPLICATE_SAME_ACCESS)) - { - log (LOG_CRIT, "failed to duplicate process handle, error = %lu", - GetLastError ()); - return cygwin_internal (CW_GET_ERRNO_FROM_WINERROR, - GetLastError (), ENOMEM); - } - shs->ipcblk = *td->ipcblk; - HANDLE thread = CreateThread (NULL, 0, ipcexit_hookthread, shs, 0, &tid); - if (!thread) - { - log (LOG_CRIT, "failed to create thread, error = %lu", GetLastError ()); - return cygwin_internal (CW_GET_ERRNO_FROM_WINERROR, - GetLastError (), ENOMEM); - } - ipcht_entry = new ipc_hookthread; - ipcht_entry->thread = thread; - ipcht_entry->winpid = td->ipcblk->winpid; - ipcht_entry->vmspace.vm_map = NULL; - ipcht_entry->vmspace.vm_shm = NULL; - enter_critical_section (&ipcht_cs); - SLIST_INSERT_HEAD (&ipcht_list, ipcht_entry, sht_next); - leave_critical_section (&ipcht_cs); - return 0; -} - -/* - * Need the admins group SID to compare with groups in client token. - */ -PSID admininstrator_group_sid; - -static void -init_admin_sid (void) -{ - SID_IDENTIFIER_AUTHORITY nt_auth = {SECURITY_NT_AUTHORITY}; - if (! AllocateAndInitializeSid (&nt_auth, 2, 32, 544, 0, 0, 0, 0, 0, 0, - &admininstrator_group_sid)) - panic ("failed to create well known sids, error = %lu", - GetLastError ()); -} - -SECURITY_DESCRIPTOR sec_all_nih_sd; -SECURITY_ATTRIBUTES sec_all_nih = { sizeof (SECURITY_ATTRIBUTES), - &sec_all_nih_sd, - FALSE }; - -void -securityinit () -{ - InitializeSecurityDescriptor (&sec_all_nih_sd, SECURITY_DESCRIPTOR_REVISION); - SetSecurityDescriptorDacl (&sec_all_nih_sd, TRUE, 0, FALSE); - init_admin_sid (); -} - -/* Global vars, determining whether the IPC stuff should be started or not. */ -tun_bool_t support_sharedmem = TUN_UNDEF; -tun_bool_t support_msgqueues = TUN_UNDEF; -tun_bool_t support_semaphores = TUN_UNDEF; - -void -ipcinit () -{ - mtx_init (&Giant, "Giant", NULL, MTX_DEF); - msleep_init (); - ipcexit_event = CreateEvent (NULL, TRUE, FALSE, NULL); - if (!ipcexit_event) - panic ("Failed to create ipcexit event object"); - InitializeCriticalSection (&ipcht_cs); - if (support_msgqueues == TUN_TRUE) - msginit (); - if (support_semaphores == TUN_TRUE) - seminit (); - if (support_sharedmem == TUN_TRUE) - shminit (); -} - -int -ipcunload () -{ - ipcexit_dispose_hookthreads (); - CloseHandle (ipcexit_event); - wakeup_all (); - if (support_semaphores == TUN_TRUE) - semunload (); - if (support_sharedmem == TUN_TRUE) - shmunload (); - if (support_msgqueues == TUN_TRUE) - msgunload (); - mtx_destroy (&Giant); - return 0; -} - -/* - * Helper function to find a gid in a list of gids. - */ -static bool -is_grp_member (gid_t grp, gid_t *grplist, int listsize) -{ - if (grplist) - for (; listsize > 0; --listsize) - if (grp == grplist[listsize - 1]) - return true; - return false; -} - -/* - * Helper function to get a specific token information from a token. - * This function mallocs the necessary buffer spcae by itself. It - * must be free'd by the calling function. - */ -void * -get_token_info (HANDLE tok, TOKEN_INFORMATION_CLASS tic) -{ - void *buf; - DWORD size; - - if (!GetTokenInformation (tok, tic, NULL, 0, &size) - && GetLastError () != ERROR_INSUFFICIENT_BUFFER) - return NULL; - if (!(buf = malloc (size))) - return NULL; - if (!GetTokenInformation (tok, tic, buf, size, &size)) - { - free (buf); - return NULL; - } - return buf; -} - -/* - * Check if client user helds "mode" permission when accessing object - * associated with "perm" permission record. - * Returns an error code. - */ -int -ipcperm (struct thread *td, ipc_perm *perm, unsigned int mode) -{ - proc *p = td->ipcblk; - - if (!suser (td)) - return 0; - if (mode & IPC_M) - { - return (p->uid != perm->cuid && p->uid != perm->uid) - ? EACCES : 0; - } - if (p->uid != perm->cuid && p->uid != perm->uid) - { - /* If the user is a member of the creator or owner group, test - against group bits, otherwise against other bits. */ - mode >>= p->gid != perm->gid && p->gid != perm->cgid - && !is_grp_member (perm->gid, p->gidlist, p->gidcnt) - && !is_grp_member (perm->cgid, p->gidlist, p->gidcnt) - ? 6 : 3; - } - return (mode & perm->mode) != mode ? EACCES : 0; -} - -/* - * Check for client user being superuser. - * Returns an error code. - */ -int -suser (struct thread *td) -{ - /* This value has been set at ImpersonateNamedPipeClient() time - using the token information. See adjust_identity_info() below. */ - return td->ipcblk->is_admin ? 0 : EACCES; -} - -/* - * Retrieves user and group info from impersonated token and creates the - * correct uid, gid, gidlist and is_admin entries in p from that. - */ -bool -adjust_identity_info (struct proc *p) -{ - HANDLE tok; - - if (!OpenThreadToken (GetCurrentThread (), TOKEN_READ, TRUE, &tok)) - { - debug ("Failed to open worker thread access token for pid %d, winpid %d", - p->cygpid, p->winpid); - return false; - } - - /* Get uid from user SID in token. */ - PTOKEN_USER user; - if (!(user = (PTOKEN_USER)get_token_info (tok, TokenUser))) - goto faulty; - p->uid = cygwin_internal (CW_GET_UID_FROM_SID, user->User.Sid); - free (user); - if (p->uid == (uid_t)-1) - log (LOG_WARNING, "WARNING: User not found in /etc/passwd! Using uid -1!"); - - /* Get gid from primary group SID in token. */ - PTOKEN_PRIMARY_GROUP pgrp; - if (!(pgrp = (PTOKEN_PRIMARY_GROUP)get_token_info (tok, TokenPrimaryGroup))) - goto faulty; - p->gid = cygwin_internal (CW_GET_GID_FROM_SID, pgrp->PrimaryGroup); - free (pgrp); - if (p->gid == (gid_t)-1) - log (LOG_WARNING,"WARNING: Group not found in /etc/group! Using gid -1!"); - - /* Generate gid list from token group's SID list. Also look if the token - has an enabled admin group SID. That means, the process has admin - privileges. That knowledge is used in suser(). */ - PTOKEN_GROUPS gsids; - if (!(gsids = (PTOKEN_GROUPS)get_token_info (tok, TokenGroups))) - goto faulty; - if (gsids->GroupCount) - { - p->gidlist = (gid_t *) calloc (gsids->GroupCount, sizeof (gid_t)); - if (p->gidlist) - p->gidcnt = gsids->GroupCount; - } - for (DWORD i = 0; i < gsids->GroupCount; ++i) - { - if (p->gidlist) - p->gidlist[i] = cygwin_internal (CW_GET_GID_FROM_SID, - gsids->Groups[i].Sid); - if (EqualSid (gsids->Groups[i].Sid, admininstrator_group_sid) - && (gsids->Groups[i].Attributes & SE_GROUP_ENABLED)) - p->is_admin = true; - } - free (gsids); - - CloseHandle (tok); - return true; - -faulty: - CloseHandle (tok); - log (LOG_CRIT, "Failed to get token information for pid %d, winpid %d", - p->cygpid, p->winpid); - return false; -} - -/* - * Windows wrapper implementation of the VM functions called by sysv_shm.cc. - */ - -vm_object_t -_vm_pager_allocate (int size, int shmflg) -{ - /* Create the file mapping object with full access for everyone. This is - necessary to allow later calls to shmctl(..., IPC_SET,...) to - change the access rights and ownership of a shared memory region. - The access rights are tested at the beginning of every shm... function. - Note that this does not influence the actual read or write access - defined in a call to shmat. */ - vm_object_t object = CreateFileMapping (INVALID_HANDLE_VALUE, &sec_all_nih, - PAGE_READWRITE, 0, size, NULL); - if (!object) - panic ("CreateFileMapping in _vm_pager_allocate failed, %lu", GetLastError ()); - return object; -} - -vm_object_t -vm_object_duplicate (struct thread *td, vm_object_t object) -{ - vm_object_t dup_object; - if (!DuplicateHandle (GetCurrentProcess (), object, - td->client->handle (), &dup_object, - 0, TRUE, DUPLICATE_SAME_ACCESS)) - panic ("!DuplicateHandle in vm_object_duplicate failed, %lu", GetLastError ()); - return dup_object; -} - -void -vm_object_deallocate (vm_object_t object) -{ - if (object) - CloseHandle (object); -} - -/* - * Tunable parameters are read from a system wide cygserver.conf file. - * On the first call to tunable_int_fetch, the file is read and the - * parameters are set accordingly. Each parameter has default, max and - * min settings. - */ - -enum tun_params_type { - TUN_NULL, - TUN_INT, - TUN_BOOL -}; - -union tun_value { - long ival; - tun_bool_t bval; -}; - -struct tun_struct { - const char *name; - tun_params_type type; - union tun_value value; - union tun_value min; - union tun_value max; - void (*check_func)(tun_struct *, char *, const char *); -}; - -static void -default_tun_check (tun_struct *that, char *value, const char *fname) -{ - char *c = NULL; - tun_value val; - switch (that->type) - { - case TUN_INT: - val.ival = strtoul (value, &c, 10); - if (!val.ival || (c && *c)) - panic ("Error in config file %s: Value of parameter %s malformed", - fname, that->name); - if (val.ival < that->min.ival || val.ival > that->max.ival) - panic ("Error in config file %s: Value of parameter %s must be " - "between %lu and %lu", - fname, that->name, that->min.ival, that->max.ival); - if (that->value.ival) - panic ("Error in config file %s: Parameter %s set twice.\n", - fname, that->name); - that->value.ival = val.ival; - break; - case TUN_BOOL: - if (!strcasecmp (value, "no") || !strcasecmp (value, "n") - || !strcasecmp (value, "false") || !strcasecmp (value, "f") - || !strcasecmp (value, "0")) - val.bval = TUN_FALSE; - else if (!strcasecmp (value, "yes") || !strcasecmp (value, "y") - || !strcasecmp (value, "true") || !strcasecmp (value, "t") - || !strcasecmp (value, "1")) - val.bval = TUN_TRUE; - else - panic ("Error in config file %s: Value of parameter %s malformed\n" - "Allowed values: \"yes\", \"no\", \"y\", \"n\", \"true\", \"false\", \"t\", \"f\", \"1\" and \"0\"", fname, that->name); - that->value.bval = val.bval; - break; - default: - /* Shouldn't happen. */ - panic ("Internal error: Wrong type of tunable parameter"); - break; - } -} - -static tun_struct tunable_params[] = -{ - /* SRV */ - { "kern.srv.cleanup_threads", TUN_INT, {0}, {1}, {32}, default_tun_check}, - { "kern.srv.request_threads", TUN_INT, {0}, {1}, {310}, default_tun_check}, - { "kern.srv.process_cache_size", TUN_INT, {0}, {1}, {310}, default_tun_check}, - { "kern.srv.sharedmem", TUN_BOOL, {TUN_UNDEF}, {TUN_FALSE}, {TUN_TRUE}, default_tun_check}, - { "kern.srv.msgqueues", TUN_BOOL, {TUN_UNDEF}, {TUN_FALSE}, {TUN_TRUE}, default_tun_check}, - { "kern.srv.semaphores", TUN_BOOL, {TUN_UNDEF}, {TUN_FALSE}, {TUN_TRUE}, default_tun_check}, - - /* LOG */ - { "kern.log.syslog", TUN_BOOL, {TUN_UNDEF}, {TUN_FALSE}, {TUN_TRUE}, default_tun_check}, - { "kern.log.stderr", TUN_BOOL, {TUN_UNDEF}, {TUN_FALSE}, {TUN_TRUE}, default_tun_check}, - { "kern.log.debug", TUN_BOOL, {TUN_UNDEF}, {TUN_FALSE}, {TUN_TRUE}, default_tun_check}, - { "kern.log.level", TUN_INT, {0}, {1}, {7}, default_tun_check}, - - /* MSG */ - { "kern.ipc.msgseg", TUN_INT, {0}, {256}, {65535}, default_tun_check}, - { "kern.ipc.msgssz", TUN_INT, {0}, {8}, {1024}, default_tun_check}, - { "kern.ipc.msgmnb", TUN_INT, {0}, {1}, {65535}, default_tun_check}, - { "kern.ipc.msgmni", TUN_INT, {0}, {1}, {1024}, default_tun_check}, - { "kern.ipc.msgtql", TUN_INT, {0}, {1}, {1024}, default_tun_check}, - - /* SEM */ - //{ "kern.ipc.semmap", TUN_INT, {0}, {1}, {1024}, default_tun_check}, - { "kern.ipc.semmni", TUN_INT, {0}, {1}, {1024}, default_tun_check}, - { "kern.ipc.semmns", TUN_INT, {0}, {1}, {1024}, default_tun_check}, - { "kern.ipc.semmnu", TUN_INT, {0}, {1}, {1024}, default_tun_check}, - { "kern.ipc.semmsl", TUN_INT, {0}, {1}, {1024}, default_tun_check}, - { "kern.ipc.semopm", TUN_INT, {0}, {1}, {1024}, default_tun_check}, - { "kern.ipc.semume", TUN_INT, {0}, {1}, {1024}, default_tun_check}, - //{ "kern.ipc.semusz", TUN_INT, {0}, {1}, {1024}, default_tun_check}, - { "kern.ipc.semvmx", TUN_INT, {0}, {1}, {32767}, default_tun_check}, - { "kern.ipc.semaem", TUN_INT, {0}, {1}, {32767}, default_tun_check}, - - /* SHM */ - { "kern.ipc.shmmaxpgs", TUN_INT, {0}, {1}, {32767}, default_tun_check}, - //{ "kern.ipc.shmmin", TUN_INT, {0}, {1}, {32767}, default_tun_check}, - { "kern.ipc.shmmni", TUN_INT, {0}, {1}, {32767}, default_tun_check}, - { "kern.ipc.shmseg", TUN_INT, {0}, {1}, {32767}, default_tun_check}, - { "kern.ipc.shm_allow_removed", TUN_BOOL, {TUN_UNDEF}, {TUN_FALSE}, {TUN_TRUE}, default_tun_check}, - //{ "kern.ipc.shm_use_phys", TUN_INT, {0}, {1}, {32767}, default_tun_check}, - { NULL, TUN_NULL, {0}, {0}, {0}, NULL} -}; - -#define skip_whitespace(c) while (*(c) && isspace (*(c))) ++(c) -#define skip_nonwhitespace(c) while (*(c) && !isspace (*(c)) && *(c) != '#') ++(c) -#define end_of_content(c) (!*(c) || *(c) == '#') - -void -tunable_param_init (const char *config_file, bool force) -{ - FILE *fp = fopen (config_file, "rt"); - if (!fp) - { - if (force) - panic ("can't open config file %s\n", config_file); - return; - } - char line[1024]; - while (fgets (line, 1024, fp)) - { - char *c = strrchr (line, '\n'); - if (!c) - panic ("Line too long in confg file %s\n", config_file); - /* Overwrite trailing NL. */ - *c = '\0'; - c = line; - skip_whitespace (c); - if (end_of_content (c)) - continue; - /* So we are on the first character of a parameter name. */ - char *name = c; - /* Find end of name. */ - skip_nonwhitespace (c); - if (end_of_content (c)) - { - *c++ = '\0'; - panic ("Error in config file %s: Parameter %s has no value.\n", - config_file, name); - } - /* Mark end of name. */ - *c++ = '\0'; - skip_whitespace (c); - if (end_of_content (c)) - panic ("Error in config file %s: Parameter %s has no value.\n", - config_file, name); - /* Now we are on the first character of a parameter's value. */ - char *value = c; - /* This only works for simple parameters. If complex string parameters - are added at one point, the scanning routine must be changed here. */ - /* Find end of value. */ - skip_nonwhitespace (c); - /* Mark end of value. */ - *c++ = '\0'; - /* Now look if name is one from our list. */ - tun_struct *s; - for (s = &tunable_params[0]; s->name; ++s) - if (!strcmp (name, s->name)) - { - /* Now read value and check for validity. check_func doesn't - return on error. */ - s->check_func (s, value, config_file); - break; - } - if (!s->name) - panic ("Error in config file %s: Unknown parameter %s.\n", - config_file, name); - } - fclose (fp); -} - -void -tunable_int_fetch (const char *name, int32_t *tunable_target) -{ - tun_struct *s; - for (s = &tunable_params[0]; s->name; ++s) - if (!strcmp (name, s->name)) - break; - if (!s) /* Not found */ - return; - if (s->type != TUN_INT) /* Wrong type */ - return; - if (!s->value.ival) /* Not set in config file */ - return; - *tunable_target = s->value.ival; - debug ("\nSet %s to %lu\n", name, *tunable_target); -} - -void -tunable_bool_fetch (const char *name, tun_bool_t *tunable_target) -{ - tun_struct *s; - const char *tun_bool_val_string[] = { "undefined", "no", "yes" }; - for (s = &tunable_params[0]; s->name; ++s) - if (!strcmp (name, s->name)) - break; - if (!s) /* Not found */ - return; - if (s->type != TUN_BOOL) /* Wrong type */ - return; - if (!s->value.ival) /* Not set in config file */ - return; - *tunable_target = s->value.bval; - debug ("\nSet %s to %s\n", name, tun_bool_val_string[*tunable_target]); -} -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/bsd_helper.h b/winsup/cygserver/bsd_helper.h deleted file mode 100644 index bc8d22810..000000000 --- a/winsup/cygserver/bsd_helper.h +++ /dev/null @@ -1,66 +0,0 @@ -/* bsd_helper.h: Helps integrating BSD kernel code - - Copyright 2003, 2012 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ -#ifndef _BSD_HELPER_H -#define _BSD_HELPER_H - -#include -#include - -enum tun_bool_t { - TUN_UNDEF = 0, - TUN_FALSE = 1, - TUN_TRUE = 2 -}; - -#define TUNABLE_INT_FETCH(a,b) tunable_int_fetch((a),(b)) -#define TUNABLE_BOOL_FETCH(a,b) tunable_bool_fetch((a),(b)) - -#define sys_malloc(a,b,c) (malloc(a)?:(panic("malloc failed in %s, line %d"),(void*)NULL)) -#define sys_free(a,b) free(a) - -#define jail_sysvipc_allowed true -#define jailed(a) false - -extern const char *__progname; - -/* Global vars, determining whether the IPC stuff should be started or not. */ -extern tun_bool_t support_sharedmem; -extern tun_bool_t support_msgqueues; -extern tun_bool_t support_semaphores; - -extern SECURITY_ATTRIBUTES sec_all_nih; - -void securityinit (void); - -int win_copyin (struct thread *, const void *, void *, size_t); -int win_copyout (struct thread *, const void *, void *, size_t); -#define copyin(a,b,c) win_copyin((td),(a),(b),(c)) -#define copyout(a,b,c) win_copyout((td),(a),(b),(c)) - -void *get_token_info (HANDLE, TOKEN_INFORMATION_CLASS); -int ipcperm (struct thread *, struct ipc_perm *, unsigned int); -int suser (struct thread *); -bool adjust_identity_info (struct proc *p); - -struct vmspace *ipc_p_vmspace (struct proc *); -int ipcexit_creat_hookthread(struct thread *); -void ipcinit (void); -int ipcunload (void); - -vm_object_t _vm_pager_allocate (int, int); -#define vm_pager_allocate(a,b,s,c,d) _vm_pager_allocate((s),(mode)) -vm_object_t vm_object_duplicate (struct thread *td, vm_object_t object); -void vm_object_deallocate (vm_object_t object); - -void tunable_param_init (const char *, bool); -void tunable_int_fetch (const char *, int32_t *); -void tunable_bool_fetch (const char *, tun_bool_t *); - -#endif /* _BSD_HELPER_H */ diff --git a/winsup/cygserver/bsd_log.cc b/winsup/cygserver/bsd_log.cc deleted file mode 100644 index 18dc1a53b..000000000 --- a/winsup/cygserver/bsd_log.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* bsd_log.cc - - Copyright 2003, 2004, 2012 Red Hat Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" -#define _KERNEL 1 -#define __BSD_VISIBLE 1 -#include -#include - -int32_t log_level = 8; /* Illegal value. Don't change! */ -tun_bool_t log_debug = TUN_UNDEF; -tun_bool_t log_syslog = TUN_UNDEF; -tun_bool_t log_stderr = TUN_UNDEF; - -void -loginit (tun_bool_t opt_stderr, tun_bool_t opt_syslog) -{ - if (log_debug == TUN_UNDEF) - TUNABLE_BOOL_FETCH ("kern.log.debug", &log_debug); - if (log_debug == TUN_UNDEF) - log_debug = TUN_FALSE; - - if (opt_stderr != TUN_UNDEF) - log_stderr = opt_stderr; - else - TUNABLE_BOOL_FETCH ("kern.log.stderr", &log_stderr); - if (log_stderr == TUN_UNDEF) - log_stderr = TUN_FALSE; - - if (opt_syslog != TUN_UNDEF) - log_syslog = opt_syslog; - else - TUNABLE_BOOL_FETCH ("kern.log.syslog", &log_syslog); - if (log_syslog == TUN_UNDEF) - log_syslog = TUN_FALSE; - - if (log_level == 8) - TUNABLE_INT_FETCH ("kern.log.level", &log_level); - if (log_level == 8) - log_level = 6; -} - -void -_vlog (const char *file, int line, int level, - const char *fmt, va_list ap) -{ - char buf[16384]; - char *pos; - - if ((level == LOG_DEBUG && log_debug != TUN_TRUE) - || (level != LOG_DEBUG && level >= log_level)) - return; - pos = stpcpy (buf, "cygserver: "); - if (file && log_debug == TUN_TRUE) - pos += snprintf (pos, 16384 - (pos - buf), "%s, line %d: ", file, line); - vsnprintf (pos, 16384 - (pos - buf), fmt, ap); - if (log_syslog == TUN_TRUE && level != LOG_DEBUG) - syslog (level, buf); - if (log_stderr == TUN_TRUE || level == LOG_DEBUG) - { - fputs (buf, stderr); - fputc ('\n', stderr); - } -} - -void -_log (const char *file, int line, int level, const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); - _vlog (file, line, level, fmt, ap); -} - -void -_vpanic (const char *file, int line, const char *fmt, va_list ap) -{ - _vlog (file, line, LOG_CRIT, fmt, ap); - exit (1); -} - -void -_panic (const char *file, int line, const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); - _vpanic (file, line, fmt, ap); -} -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/bsd_log.h b/winsup/cygserver/bsd_log.h deleted file mode 100644 index 0027d4ff5..000000000 --- a/winsup/cygserver/bsd_log.h +++ /dev/null @@ -1,33 +0,0 @@ -/* bsd_log.h: Helps integrating BSD kernel code - - Copyright 2003, 2012 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ -#ifndef _BSD_LOG_H -#define _BSD_LOG_H - -#include -#include - -extern int32_t log_level; -extern tun_bool_t log_debug; -extern tun_bool_t log_syslog; -extern tun_bool_t log_stderr; - -void loginit (tun_bool_t, tun_bool_t); -void _vlog (const char *, int, int, const char *, va_list); -void _log (const char *, int, int, const char *, ...); -void _vpanic (const char *, int, const char *, va_list) __attribute__ ((noreturn)); -void _panic (const char *, int, const char *, ...) __attribute__ ((noreturn)); -#define vlog(l,f,a) _vlog(NULL,0,(l),(f),(a)) -#define log(l,f,...) _log(NULL,0,(l),(f),##__VA_ARGS__) -#define vdebug(f,a) _vlog(__FILE__,__LINE__,LOG_DEBUG,(f),(a)) -#define debug(f,...) _log(__FILE__,__LINE__,LOG_DEBUG,(f),##__VA_ARGS__) -#define vpanic(f,a) _vpanic(__FILE__,__LINE__,(f),(a)) -#define panic(f,...) _panic(__FILE__,__LINE__,(f),##__VA_ARGS__) - -#endif /* _BSD_LOG_H */ diff --git a/winsup/cygserver/bsd_mutex.cc b/winsup/cygserver/bsd_mutex.cc deleted file mode 100644 index a13cfe07d..000000000 --- a/winsup/cygserver/bsd_mutex.cc +++ /dev/null @@ -1,386 +0,0 @@ -/* bsd_mutex.cc - - Copyright 2003, 2004, 2005, 2007, 2012 Red Hat Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" -#include -#define _KERNEL 1 -#define __BSD_VISIBLE 1 -#include -#include -#include -#include -#include - -#include "process.h" -#include "cygserver_ipc.h" - -/* A BSD kernel global mutex. */ -struct mtx Giant; - -void -mtx_init (mtx *m, const char *name, const void *, int) -{ - m->name = name; - m->owner = 0; - m->cnt = 0; - /* Can't use Windows Mutexes here since Windows Mutexes are only - unlockable by the lock owner. */ - m->h = CreateSemaphore (NULL, 1, 1, NULL); - if (!m->h) - panic ("couldn't allocate %s mutex, %lu\n", name, GetLastError ()); -} - -void -_mtx_lock (mtx *m, DWORD winpid, const char *file, int line) -{ - _log (file, line, LOG_DEBUG, "Try locking mutex %s (%u) (hold: %u)", - m->name, winpid, m->owner); - if (WaitForSingleObject (m->h, INFINITE) != WAIT_OBJECT_0) - _panic (file, line, "wait for %s in %d failed, %lu", m->name, winpid, - GetLastError ()); - m->owner = winpid; - _log (file, line, LOG_DEBUG, "Locked mutex %s/%u (%u)", - m->name, ++m->cnt, winpid); -} - -int -mtx_owned (mtx *m, DWORD winpid) -{ - return m->owner == winpid; -} - -void -_mtx_assert (mtx *m, int what, DWORD winpid, const char *file, int line) -{ - switch (what) - { - case MA_OWNED: - if (!mtx_owned (m, winpid)) - _panic (file, line, "Mutex %s not owned", m->name); - break; - case MA_NOTOWNED: - if (mtx_owned (m, winpid)) - _panic (file, line, "Mutex %s is owned", m->name); - break; - default: - break; - } -} - -void -_mtx_unlock (mtx *m, const char *file, int line) -{ - DWORD owner = m->owner; - unsigned long cnt = m->cnt; - m->owner = 0; - /* Cautiously check if mtx_destroy has been called (shutdown). - In that case, m->h is NULL. */ - if (m->h && !ReleaseSemaphore (m->h, 1, NULL)) - { - /* Check if the semaphore was already on it's max value. */ - if (GetLastError () != ERROR_TOO_MANY_POSTS) - _panic (file, line, "release of mutex %s failed, %lu", m->name, - GetLastError ()); - } - _log (file, line, LOG_DEBUG, "Unlocked mutex %s/%u (owner: %u)", - m->name, cnt, owner); -} - -void -mtx_destroy (mtx *m) -{ - HANDLE tmp = m->h; - m->h = NULL; - if (tmp) - CloseHandle (tmp); -} - -/* - * Helper functions for msleep/wakeup. - */ - -static int -win_priority (int priority) -{ - int p = (int)((priority) & PRIO_MASK) - PZERO; - /* Generating a valid priority value is a bit tricky. The only valid - values on NT4 are -15, -2, -1, 0, 1, 2, 15. */ - switch (p) - { - case -15: case -14: case -13: case -12: case -11: - return THREAD_PRIORITY_IDLE; - case -10: case -9: case -8: case -7: case -6: - return THREAD_PRIORITY_LOWEST; - case -5: case -4: case -3: case -2: case -1: - return THREAD_PRIORITY_BELOW_NORMAL; - case 0: - return THREAD_PRIORITY_NORMAL; - case 1: case 2: case 3: case 4: case 5: - return THREAD_PRIORITY_ABOVE_NORMAL; - case 6: case 7: case 8: case 9: case 10: - return THREAD_PRIORITY_HIGHEST; - case 11: case 12: case 13: case 14: case 15: - return THREAD_PRIORITY_TIME_CRITICAL; - } - return THREAD_PRIORITY_NORMAL; -} - -/* - * Sets the thread priority, returns the old priority. - */ -static int -set_priority (int priority) -{ - int old_prio = GetThreadPriority (GetCurrentThread ()); - if (!SetThreadPriority (GetCurrentThread (), win_priority (priority))) - log (LOG_WARNING, - "Warning: Setting thread priority to %d failed with error %lu\n", - win_priority (priority), GetLastError ()); - return old_prio; -} - -/* - * Original description from BSD code: - * - * General sleep call. Suspends the current process until a wakeup is - * performed on the specified identifier. The process will then be made - * runnable with the specified priority. Sleeps at most timo/hz seconds - * (0 means no timeout). If pri includes PCATCH flag, signals are checked - * before and after sleeping, else signals are not checked. Returns 0 if - * awakened, EWOULDBLOCK if the timeout expires. If PCATCH is set and a - * signal needs to be delivered, ERESTART is returned if the current system - * call should be restarted if possible, and EINTR is returned if the system - * call should be interrupted by the signal (return EINTR). - * - * The mutex argument is exited before the caller is suspended, and - * entered before msleep returns. If priority includes the PDROP - * flag the mutex is not entered before returning. - */ -static HANDLE msleep_glob_evt; - -class msleep_sync_array -{ - enum msleep_action { - MSLEEP_ENTER = 0, - MSLEEP_LEAVE, - MSLEEP_WAKEUP - }; - - CRITICAL_SECTION cs; - long cnt; - long max_cnt; - struct msleep_record { - void *ident; - HANDLE wakeup_evt; - LONG threads; - } *a; - - int find_ident (void *ident, msleep_action action) - { - int i; - for (i = 0; i < cnt; ++i) - if (a[i].ident == ident) - return i; - if (i >= max_cnt) - panic ("ident %x not found and run out of slots.", ident); - if (i >= cnt && action == MSLEEP_LEAVE) - panic ("ident %x not found (%d).", ident, action); - return i; - } - - HANDLE first_entry (int i, void *ident) - { - debug ("New ident %x, index %d", ident, i); - a[i].ident = ident; - a[i].wakeup_evt = CreateEvent (NULL, TRUE, FALSE, NULL); - if (!a[i].wakeup_evt) - panic ("CreateEvent failed: %lu", GetLastError ()); - debug ("i = %d, CreateEvent: %x", i, a[i].wakeup_evt); - a[i].threads = 1; - ++cnt; - return a[i].wakeup_evt; - } - - HANDLE next_entry (int i) - { - if (a[i].ident && WaitForSingleObject (a[i].wakeup_evt, 0) != WAIT_OBJECT_0) - { - ++a[i].threads; - return a[i].wakeup_evt; - } - return NULL; - } - -public: - - msleep_sync_array (int count) : cnt (0), max_cnt (count) - { - InitializeCriticalSection (&cs); - if (!(a = new msleep_record[count])) - panic ("Allocating msleep records failed: %d", errno); - } - - HANDLE enter (void *ident) - { - HANDLE evt = NULL; - while (!evt) - { - EnterCriticalSection (&cs); - int i = find_ident (ident, MSLEEP_ENTER); - if (i >= cnt) - evt = first_entry (i, ident); - else if (!(evt = next_entry (i))) - { - /* wakeup has been called, so sleep to wait until all - formerly waiting threads have left and retry. */ - LeaveCriticalSection (&cs); - Sleep (1L); - } - } - LeaveCriticalSection (&cs); - return evt; - } - - void leave (void *ident) - { - EnterCriticalSection (&cs); - int i = find_ident (ident, MSLEEP_LEAVE); - if (--a[i].threads == 0) - { - debug ("i = %d, CloseEvent: %x", i, a[i].wakeup_evt); - CloseHandle (a[i].wakeup_evt); - a[i].ident = NULL; - --cnt; - if (i < cnt) - a[i] = a[cnt]; - } - LeaveCriticalSection (&cs); - } - - void wakeup (void *ident) - { - EnterCriticalSection (&cs); - int i = find_ident (ident, MSLEEP_WAKEUP); - if (i < cnt && a[i].ident) - SetEvent (a[i].wakeup_evt); - LeaveCriticalSection (&cs); - } -}; - -static msleep_sync_array *msleep_sync; - -void -msleep_init (void) -{ - extern struct msginfo msginfo; - extern struct seminfo seminfo; - - msleep_glob_evt = CreateEvent (NULL, TRUE, FALSE, NULL); - if (!msleep_glob_evt) - panic ("CreateEvent in msleep_init failed: %lu", GetLastError ()); - int32_t msgmni = support_msgqueues ? msginfo.msgmni : 0; - int32_t semmni = support_semaphores ? seminfo.semmni : 0; - TUNABLE_INT_FETCH ("kern.ipc.msgmni", &msgmni); - TUNABLE_INT_FETCH ("kern.ipc.semmni", &semmni); - debug ("Try allocating msgmni (%d) + semmni (%d) msleep records", - msgmni, semmni); - msleep_sync = new msleep_sync_array (msgmni + semmni); - if (!msleep_sync) - panic ("Allocating msleep records in msleep_init failed: %d", errno); -} - -int -_msleep (void *ident, struct mtx *mtx, int priority, - const char *wmesg, int timo, struct thread *td) -{ - int ret = -1; - - HANDLE evt = msleep_sync->enter (ident); - - if (mtx) - mtx_unlock (mtx); - int old_priority = set_priority (priority); - HANDLE obj[4] = - { - evt, - msleep_glob_evt, - td->client->handle (), - td->client->signal_arrived () - }; - /* PCATCH handling. If PCATCH is given and signal_arrived is a valid - handle, then it's used in the WaitFor call and EINTR is returned. */ - int obj_cnt = 3; - if ((priority & PCATCH) - && td->client->signal_arrived () != INVALID_HANDLE_VALUE) - obj_cnt = 4; - switch (WaitForMultipleObjects (obj_cnt, obj, FALSE, timo ?: INFINITE)) - { - case WAIT_OBJECT_0: /* wakeup() has been called. */ - ret = 0; - debug ("msleep wakeup called for %d", td->td_proc->winpid); - break; - case WAIT_OBJECT_0 + 1: /* Shutdown event (triggered by wakeup_all). */ - priority |= PDROP; - /*FALLTHRU*/ - case WAIT_OBJECT_0 + 2: /* The dependent process has exited. */ - debug ("msleep process exit or shutdown for %d", td->td_proc->winpid); - ret = EIDRM; - break; - case WAIT_OBJECT_0 + 3: /* Signal for calling process arrived. */ - debug ("msleep process got signal for %d", td->td_proc->winpid); - ret = EINTR; - break; - case WAIT_TIMEOUT: - ret = EWOULDBLOCK; - break; - default: - /* There's a chance that a process has been terminated before - WaitForMultipleObjects has been called. In this case the handles - might be invalid. The error code returned is ERROR_INVALID_HANDLE. - Since we can trust the values of these handles otherwise, we - treat an ERROR_INVALID_HANDLE as a normal process termination and - hope for the best. */ - if (GetLastError () != ERROR_INVALID_HANDLE) - panic ("wait in msleep (%s) failed, %lu", wmesg, GetLastError ()); - debug ("wait in msleep (%s) failed for %d, %lu", wmesg, - td->td_proc->winpid, GetLastError ()); - ret = EIDRM; - break; - } - - msleep_sync->leave (ident); - - set_priority (old_priority); - - if (mtx && !(priority & PDROP)) - mtx_lock (mtx); - return ret; -} - -/* - * Make all threads sleeping on the specified identifier runnable. - */ -int -wakeup (void *ident) -{ - msleep_sync->wakeup (ident); - return 0; -} - -/* - * Wakeup all sleeping threads. Only called in the context of cygserver - * shutdown. - */ -void -wakeup_all (void) -{ - SetEvent (msleep_glob_evt); -} -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/bsd_mutex.h b/winsup/cygserver/bsd_mutex.h deleted file mode 100644 index c9f501576..000000000 --- a/winsup/cygserver/bsd_mutex.h +++ /dev/null @@ -1,52 +0,0 @@ -/* bsd_mutex.h: BSD Mutex helper - - Copyright 2003, 2005 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ -#ifndef _BSD_MUTEX_H -#define _BSD_MUTEX_H - -#define MTX_DEF 0 - -#define MA_OWNED 1 -#define MA_NOTOWNED 2 - -#define PZERO (0x20) -#define PRIO_MASK (0x1f) -#define PDROP 0x1000 -#define PCATCH 0x2000 -#define PLOCK 0x3000 - -struct mtx { - HANDLE h; - const char *name; - DWORD owner; - unsigned long cnt; -}; - -/* Some BSD kernel global mutex. */ -extern struct mtx Giant; - -void mtx_init (mtx *, const char *, const void *, int); -void _mtx_lock (mtx *, DWORD winpid, const char *, int); -#define mtx_lock(m) _mtx_lock((m), (td->ipcblk->winpid), __FILE__, __LINE__) -int mtx_owned (mtx *, DWORD); -void _mtx_assert(mtx *, int, DWORD winpid, const char *, int); -#define mtx_assert(m,w,p) _mtx_assert((m),(w),(p),__FILE__,__LINE__) -void _mtx_unlock (mtx *, const char *, int); -#define mtx_unlock(m) _mtx_unlock((m),__FILE__,__LINE__) - -void mtx_destroy (mtx *); - -void msleep_init (void); -int _msleep (void *, struct mtx *, int, const char *, int, struct thread *); -#define msleep(i,m,p,w,t) _msleep((i),(m),(p),(w),(t),(td)) -#define tsleep(i,p,w,t) _msleep((i),NULL,(p),(w),(t),(td)) -int wakeup (void *); -void wakeup_all (void); - -#endif /* _BSD_MUTEX_H */ diff --git a/winsup/cygserver/client.cc b/winsup/cygserver/client.cc deleted file mode 100644 index 63ce421c9..000000000 --- a/winsup/cygserver/client.cc +++ /dev/null @@ -1,536 +0,0 @@ -/* client.cc - - Copyright 2001, 2002, 2003, 2004, 2008, 2009, 2012, 2013 Red Hat Inc. - - Written by Egor Duda - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -/* to allow this to link into cygwin and the .dll, a little magic is needed. */ -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" -#else -#include "winsup.h" -#endif - -#include -#include -#include -#include - -#include "cygserver_msg.h" -#include "cygserver_sem.h" -#include "cygserver_shm.h" -#include "cygserver_setpwd.h" - -#include "cygserver.h" -#include "transport.h" - -int cygserver_running = CYGSERVER_UNKNOWN; // Nb: inherited by children. - -client_request_get_version::client_request_get_version () - : client_request (CYGSERVER_REQUEST_GET_VERSION, &version, sizeof (version)) -{ - msglen (0); // No parameters for request. - - // verbose: syscall_printf ("created"); -} - -/* - * client_request_get_version::check_version () - * - * The major version and API version numbers must match exactly. An - * older than expected minor version number is accepted (as long as - * the first numbers match, that is). - */ - -#ifdef __INSIDE_CYGWIN__ - -bool -client_request_get_version::check_version () const -{ - const bool ok = (version.major == CYGWIN_SERVER_VERSION_MAJOR - && version.api == CYGWIN_SERVER_VERSION_API - && version.minor <= CYGWIN_SERVER_VERSION_MINOR); - - if (!ok) - syscall_printf (("incompatible version of cygwin server: " - "client version %d.%d.%d.%d, " - "server version %ld.%ld.%ld.%ld"), - CYGWIN_SERVER_VERSION_MAJOR, - CYGWIN_SERVER_VERSION_API, - CYGWIN_SERVER_VERSION_MINOR, - CYGWIN_SERVER_VERSION_PATCH, - version.major, - version.api, - version.minor, - version.patch); - - return ok; -} - -client_request_attach_tty::client_request_attach_tty (DWORD nmaster_pid, - HANDLE nfrom_master, - HANDLE nto_master) - : client_request (CYGSERVER_REQUEST_ATTACH_TTY, &req, sizeof (req)) -{ - req.pid = GetCurrentProcessId (); - req.master_pid = nmaster_pid; - req.from_master = nfrom_master; - req.to_master = nto_master; - - syscall_printf (("created: pid = %lu, master_pid = %lu, " - "from_master = %lu, to_master = %lu"), - req.pid, req.master_pid, req.from_master, req.to_master); -} -#endif /* __INSIDE_CYGWIN__ */ - -/* - * client_request_attach_tty::send () - * - * Wraps the base method to provide error handling support. If the - * reply contains a body but is flagged as an error, close any handles - * that have been returned by cygserver and then discard the message - * body, i.e. the client either sees a successful result with handles - * or an unsuccessful result with no handles. - */ - -void -client_request_attach_tty::send (transport_layer_base * const conn) -{ - client_request::send (conn); - - if (msglen () && error_code ()) - { - if (from_master ()) - CloseHandle (from_master ()); - if (to_master ()) - CloseHandle (to_master ()); - msglen (0); - } -} - -client_request::header_t::header_t (const request_code_t request_code, - const size_t len) - : request_code (request_code) -{ - assert (request_code >= 0 && request_code < CYGSERVER_REQUEST_LAST); - msglen = len; -} - -// FIXME: also check write and read result for -1. - -void -client_request::send (transport_layer_base * const conn) -{ - assert (conn); - assert (!(msglen () && !_buf)); // i.e., msglen () implies _buf - assert (msglen () <= _buflen); - - { - const ssize_t count = conn->write (&_header, sizeof (_header)); - - if (count != sizeof (_header)) - { - assert (errno); - error_code (errno); - syscall_printf (("request header write failure: " - "only %ld bytes sent of %ld, " - "error = %d(%lu)"), - count, sizeof (_header), - errno, GetLastError ()); - return; - } - } - - if (msglen ()) - { - const ssize_t count = conn->write (_buf, msglen ()); - - if (count == -1 || (size_t) count != msglen ()) - { - assert (errno); - error_code (errno); - syscall_printf (("request body write failure: " - "only %ld bytes sent of %ld, " - "error = %d(%lu)"), - count, msglen (), - errno, GetLastError ()); - return; - } - } - - // verbose: syscall_printf ("request sent (%ld + %ld bytes)", - // sizeof (_header), msglen ()); - - { - const ssize_t count = conn->read (&_header, sizeof (_header)); - - if (count != sizeof (_header)) - { - assert (errno); - error_code (errno); - syscall_printf (("reply header read failure: " - "only %ld bytes received of %ld, " - "error = %d(%lu)"), - count, sizeof (_header), - errno, GetLastError ()); - return; - } - } - - if (msglen () && !_buf) - { - system_printf ("no client buffer for reply body: %ld bytes needed", - msglen ()); - error_code (EINVAL); - return; - } - - if (msglen () > _buflen) - { - system_printf (("client buffer too small for reply body: " - "have %ld bytes and need %ld"), - _buflen, msglen ()); - error_code (EINVAL); - return; - } - - if (msglen ()) - { - const ssize_t count = conn->read (_buf, msglen ()); - - if (count == -1 || (size_t) count != msglen ()) - { - assert (errno); - error_code (errno); - syscall_printf (("reply body read failure: " - "only %ld bytes received of %ld, " - "error = %d(%lu)"), - count, msglen (), - errno, GetLastError ()); - return; - } - } - - // verbose: syscall_printf ("reply received (%ld + %ld bytes)", - // sizeof (_header), msglen ()); -} - -#ifdef __OUTSIDE_CYGWIN__ - -client_request_attach_tty::client_request_attach_tty () - : client_request (CYGSERVER_REQUEST_ATTACH_TTY, &req, sizeof (req)) -{ -} - -/* - * client_request::handle_request () - * - * A server-side method. - * - * This is a factory method for the client_request subclasses. It - * reads the incoming request header and, based on its request code, - * creates an instance of the appropriate class. - * - * FIXME: If the incoming packet is malformed, the server drops it on - * the floor. Should it try and generate some sort of reply for the - * client? As it is, the client will simply get a broken connection. - * - * FIXME: also check write and read result for -1. - */ - -/* static */ void -client_request::handle_request (transport_layer_base *const conn, - process_cache *const cache) -{ - // verbose: debug_printf ("about to read"); - - header_t header; - - { - const ssize_t count = conn->read (&header, sizeof (header)); - - if (count != sizeof (header)) - { - syscall_printf (("request header read failure: " - "only %ld bytes received of %ld, " - "error = %d(%lu)"), - count, sizeof (header), - errno, GetLastError ()); - return; - } - - // verbose: debug_printf ("got header (%ld)", count); - } - - client_request *req = NULL; - - switch (header.request_code) - { - case CYGSERVER_REQUEST_GET_VERSION: - req = new client_request_get_version; - break; - case CYGSERVER_REQUEST_SHUTDOWN: - req = new client_request_shutdown; - break; - case CYGSERVER_REQUEST_ATTACH_TTY: - req = new client_request_attach_tty; - break; - case CYGSERVER_REQUEST_MSG: - req = new client_request_msg; - break; - case CYGSERVER_REQUEST_SEM: - req = new client_request_sem; - break; - case CYGSERVER_REQUEST_SHM: - req = new client_request_shm; - break; - case CYGSERVER_REQUEST_SETPWD: - req = new client_request_setpwd; - break; - default: - syscall_printf ("unknown request code %d received: request ignored", - header.request_code); - return; - } - - assert (req); - - req->msglen (header.msglen); - req->handle (conn, cache); - - delete req; -} - -/* - * client_request::handle () - * - * A server-side method. - * - * At this point, the header of an incoming request has been read and - * an appropriate client_request object constructed. This method has - * to read the request body into its buffer, if there is such a body, - * then perform the request and send back the results to the client. - * - * FIXME: If the incoming packet is malformed, the server drops it on - * the floor. Should it try and generate some sort of reply for the - * client? As it is, the client will simply get a broken connection. - * - * FIXME: also check write and read result for -1. - */ - -void -client_request::handle (transport_layer_base *const conn, - process_cache *const cache) -{ - if (msglen () && !_buf) - { - system_printf ("no buffer for request body: %ld bytes needed", - msglen ()); - error_code (EINVAL); - return; - } - - if (msglen () > _buflen) - { - system_printf (("buffer too small for request body: " - "have %ld bytes and need %ld"), - _buflen, msglen ()); - error_code (EINVAL); - return; - } - - if (msglen ()) - { - const ssize_t count = conn->read (_buf, msglen ()); - - if (count == -1 || (size_t) count != msglen ()) - { - assert (errno); - error_code (errno); - syscall_printf (("request body read failure: " - "only %ld bytes received of %ld, " - "error = %d(%lu)"), - count, msglen (), - errno, GetLastError ()); - return; - } - } - - // verbose: syscall_printf ("request received (%ld + %ld bytes)", - // sizeof (_header), msglen ()); - - error_code (0); // Overwrites the _header.request_code field. - - /* - * This is not allowed to fail. We must return ENOSYS at a minimum - * to the client. - */ - serve (conn, cache); - - { - const ssize_t count = conn->write (&_header, sizeof (_header)); - - if (count != sizeof (_header)) - { - assert (errno); - error_code (errno); - syscall_printf (("reply header write failure: " - "only %ld bytes sent of %ld, " - "error = %d(%lu)"), - count, sizeof (_header), - errno, GetLastError ()); - return; - } - } - - if (msglen ()) - { - const ssize_t count = conn->write (_buf, msglen ()); - - if (count == -1 || (size_t) count != msglen ()) - { - assert (errno); - error_code (errno); - syscall_printf (("reply body write failure: " - "only %ld bytes sent of %ld, " - "error = %d(%lu)"), - count, msglen (), - errno, GetLastError ()); - return; - } - } - - // verbose: syscall_printf ("reply sent (%ld + %ld bytes)", - // sizeof (_header), msglen ()); -} - -/* The server side implementation of make_request. Very simple. */ -int -client_request::make_request () -{ - transport_layer_base *const transport = create_server_transport (); - assert (transport); - if (transport->connect () == -1) - { - if (errno) - error_code (errno); - else - error_code (ENOSYS); - delete transport; - return -1; - } - send (transport); - delete transport; - return 0; -} -#endif /* __OUTSIDE_CYGWIN__ */ - -client_request::client_request (request_code_t const id, - void * const buf, - size_t const buflen) - : _header (id, buflen), - _buf (buf), - _buflen (buflen) -{ - assert ((!_buf && !_buflen) || (_buf && _buflen)); -} - -client_request::~client_request () -{} - -#ifdef __INSIDE_CYGWIN__ -int -client_request::make_request () -{ - assert (cygserver_running == CYGSERVER_UNKNOWN \ - || cygserver_running == CYGSERVER_OK \ - || cygserver_running == CYGSERVER_UNAVAIL); - - if (cygserver_running == CYGSERVER_UNKNOWN) - cygserver_init (); - - assert (cygserver_running == CYGSERVER_OK \ - || cygserver_running == CYGSERVER_UNAVAIL); - - /* Don't retry every request if the server's not there */ - if (cygserver_running == CYGSERVER_UNAVAIL) - { - syscall_printf ("cygserver un-available"); - error_code (ENOSYS); - return -1; - } - - transport_layer_base *const transport = create_server_transport (); - - assert (transport); - - if (transport->connect () == -1) - { - if (errno) - error_code (errno); - else - error_code (ENOSYS); - delete transport; - return -1; - } - - // verbose: debug_printf ("connected to server %p", transport); - - send (transport); - - delete transport; - - return 0; -} - -bool -check_cygserver_available () -{ - assert (cygserver_running == CYGSERVER_UNKNOWN \ - || cygserver_running == CYGSERVER_UNAVAIL); - - cygserver_running = CYGSERVER_OK; // For make_request (). - - client_request_get_version req; - - /* This indicates that we failed to connect to cygserver at all but - * that's fine as cygwin doesn't need it to be running. - */ - if (req.make_request () == -1) - return false; - - /* We connected to the server but something went wrong after that - * (in sending the message, in cygserver itself, or in receiving the - * reply). - */ - if (req.error_code ()) - { - syscall_printf ("failure in cygserver version request: %d", - req.error_code ()); - syscall_printf ("process will continue without cygserver support"); - return false; - } - - return req.check_version (); -} - -void -cygserver_init () -{ - assert (cygserver_running == CYGSERVER_UNKNOWN \ - || cygserver_running == CYGSERVER_OK \ - || cygserver_running == CYGSERVER_UNAVAIL); - - if (cygserver_running == CYGSERVER_OK) - return; - - if (!check_cygserver_available ()) - cygserver_running = CYGSERVER_UNAVAIL; -} -#endif /* __INSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/configure b/winsup/cygserver/configure deleted file mode 100755 index a79f22692..000000000 --- a/winsup/cygserver/configure +++ /dev/null @@ -1,5318 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69. -# -# -# Copyright (C) 1992-1996, 1998-2012 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 - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # 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 -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+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -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 -test -x / || 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" - 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 : - export CONFIG_SHELL - # 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 -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+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -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 about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a 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_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_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; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # 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 -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -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 - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# 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'" - - -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= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="cygserver.cc" -ac_no_link=no -ac_subst_vars='LTLIBOBJS -LIBOBJS -configure_args -SET_MAKE -WINDRES -DLLTOOL -NM -LD -RANLIB -AS -AR -install_host -all_host -cygwin_headers -newlib_headers -windows_headers -windows_libdir -CPP -ac_ct_CXX -CXXFLAGS -CXX -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -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 -winsup_srcdir -target_builddir' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -with_windows_headers -with_windows_libs -enable_debugging -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CXX -CXXFLAGS -CCC -CPP' - - -# 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}' -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 - 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 this package 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/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - 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] - --enable-debugging Build a cygwin DLL which has more consistency checking for debugging - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-windows-headers=DIR - specify where the windows includes are located - --with-windows-libs=DIR specify where the windows libraries are located - -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 - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CPP C preprocessor - -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 the package provider. -_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 -configure -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 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_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_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_cxx_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_cxx_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 -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 $as_me, which was -generated by GNU Autoconf 2.69. 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 - -# 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 - - -ac_aux_dir= -for ac_dir in .. "$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\"/.." "$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. - - - -. ${srcdir}/../configure.cygwin - -# 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 as_fn_executable_p "$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' - - -# 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 - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if ${ac_cv_target+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - -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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 -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 - ac_no_link=no - 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 - -else - rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.o conftest.obj conftest.dSYM - ac_no_link=yes - # Setting cross_compile will disable run tests; it will - # also disable AC_CHECK_FILE but that's generally - # correct if we can't link. - cross_compiling=yes - EXEEXT= - # 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; } - -fi -{ $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 -struct stat; -/* 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 - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - 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_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$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 -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -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_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$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_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - 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 - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# 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_cxx_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_cxx_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_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -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 - -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 - -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 - - - - -# Check whether --with-windows-headers was given. -if test "${with_windows_headers+set}" = set; then : - withval=$with_windows_headers; test -z "$withval" && as_fn_error $? "must specify value for --with-windows-headers" "$LINENO" 5 - -fi - - - - -# Check whether --with-windows-libs was given. -if test "${with_windows_libs+set}" = set; then : - withval=$with_windows_libs; test -z "$withval" && as_fn_error $? "must specify value for --with-windows-libs" "$LINENO" 5 - -fi - -windows_libdir=$(realdirpath "$with_windows_libs") -if test -z "$windows_libdir"; then - windows_libdir=$(realdirpath $(${ac_cv_prog_CC:-$CC} -xc /dev/null -Wl,--verbose=1 -lntdll 2>&1 | sed -rn 's%^.*\s(\S+)/libntdll\..*succeeded%\1%p')) - if test -z "$windows_libdir"; then - as_fn_error $? "cannot find windows library files" "$LINENO" 5 - fi -fi - - - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - -addto_CPPFLAGS -nostdinc -: ${ac_cv_prog_CXX:=$CXX} -: ${ac_cv_prog_CC:=$CC} - -cygwin_headers=$(realdirpath "$winsup_srcdir/cygwin/include") -if test -z "$cygwin_headers"; then - as_fn_error $? "cannot find $winsup_srcdir/cygwin/include directory" "$LINENO" 5 -fi - -newlib_headers=$(realdirpath $winsup_srcdir/../newlib/libc/include) -if test -z "$newlib_headers"; then - as_fn_error $? "cannot find newlib source directory: $winsup_srcdir/../newlib/libc/include" "$LINENO" 5 -fi -newlib_headers="$target_builddir/newlib/targ-include $newlib_headers" - -if test -n "$with_windows_headers"; then - if test -e "$with_windows_headers/windef.h"; then - windows_headers="$with_windows_headers" - else - as_fn_error $? "cannot find windef.h in specified --with-windows-headers path: $saw_windows_headers" "$LINENO" 5; - fi -elif test -d "$winsup_srcdir/w32api/include/windef.h"; then - windows_headers="$winsup_srcdir/w32api/include" -else - windows_headers=$(cd $($ac_cv_prog_CC -xc /dev/null -E -include windef.h 2>/dev/null | sed -n 's%^# 1 "\([^"]*\)/windef\.h".*$%\1%p' | head -n1) 2>/dev/null && pwd) - if test -z "$windows_headers" -o ! -d "$windows_headers"; then - as_fn_error $? "cannot find windows header files" "$LINENO" 5 - fi -fi -CC=$ac_cv_prog_CC -CXX=$ac_cv_prog_CXX -export CC -export CXX - - - - - -case "$with_cross_host" in - ""|*cygwin*) - all_host="all_host" - install_host="install_host" - ;; - *) - all_host= - install_host= - ;; -esac - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - $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 - - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="ar" - $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 - - if test "x$ac_ct_AR" = x; then - AR="ar" - 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 -else - AR="$ac_cv_prog_AR" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; 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_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AS="${ac_tool_prefix}as" - $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 -AS=$ac_cv_prog_AS -if test -n "$AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 -$as_echo "$AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AS"; then - ac_ct_AS=$AS - # Extract the first word of "as", so it can be a program name with args. -set dummy as; 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_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AS"; then - ac_cv_prog_ac_ct_AS="$ac_ct_AS" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AS="as" - $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_AS=$ac_cv_prog_ac_ct_AS -if test -n "$ac_ct_AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 -$as_echo "$ac_ct_AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_AS" = x; then - AS="as" - 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 - AS=$ac_ct_AS - fi -else - AS="$ac_cv_prog_AS" -fi - -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 as_fn_executable_p "$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 as_fn_executable_p "$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="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 - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. -set dummy ${ac_tool_prefix}ld; 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_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LD"; then - ac_cv_prog_LD="$LD" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LD="${ac_tool_prefix}ld" - $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 -LD=$ac_cv_prog_LD -if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LD"; then - ac_ct_LD=$LD - # Extract the first word of "ld", so it can be a program name with args. -set dummy ld; 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_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_LD"; then - ac_cv_prog_ac_ct_LD="$ac_ct_LD" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_LD="ld" - $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_LD=$ac_cv_prog_ac_ct_LD -if test -n "$ac_ct_LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5 -$as_echo "$ac_ct_LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_LD" = x; then - LD="ld" - 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 - LD=$ac_ct_LD - fi -else - LD="$ac_cv_prog_LD" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args. -set dummy ${ac_tool_prefix}nm; 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_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - ac_cv_prog_NM="$NM" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_NM="${ac_tool_prefix}nm" - $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 -NM=$ac_cv_prog_NM -if test -n "$NM"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NM" >&5 -$as_echo "$NM" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NM"; then - ac_ct_NM=$NM - # Extract the first word of "nm", so it can be a program name with args. -set dummy nm; 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_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NM"; then - ac_cv_prog_ac_ct_NM="$ac_ct_NM" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_NM="nm" - $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_NM=$ac_cv_prog_ac_ct_NM -if test -n "$ac_ct_NM"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NM" >&5 -$as_echo "$ac_ct_NM" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_NM" = x; then - NM="nm" - 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 - NM=$ac_ct_NM - fi -else - NM="$ac_cv_prog_NM" -fi - -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 as_fn_executable_p "$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 as_fn_executable_p "$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="dlltool" - 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 - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. -set dummy ${ac_tool_prefix}windres; 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_WINDRES+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$WINDRES"; then - ac_cv_prog_WINDRES="$WINDRES" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_WINDRES="${ac_tool_prefix}windres" - $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 -WINDRES=$ac_cv_prog_WINDRES -if test -n "$WINDRES"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINDRES" >&5 -$as_echo "$WINDRES" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_WINDRES"; then - ac_ct_WINDRES=$WINDRES - # Extract the first word of "windres", so it can be a program name with args. -set dummy windres; 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_WINDRES+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_WINDRES"; then - ac_cv_prog_ac_ct_WINDRES="$ac_ct_WINDRES" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_WINDRES="windres" - $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_WINDRES=$ac_cv_prog_ac_ct_WINDRES -if test -n "$ac_ct_WINDRES"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_WINDRES" >&5 -$as_echo "$ac_ct_WINDRES" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_WINDRES" = x; then - WINDRES="windres" - 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 - WINDRES=$ac_ct_WINDRES - fi -else - WINDRES="$ac_cv_prog_WINDRES" -fi - - -{ $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 - - -# Check whether --enable-debugging was given. -if test "${enable_debugging+set}" = set; then : - enableval=$enable_debugging; case "${enableval}" in -yes) $as_echo "#define DEBUGGING 1" >>confdefs.h - ;; -no) ;; -esac - -fi - - - -configure_args=X -for f in $ac_configure_args; do - case "$f" in - *--srcdir*) ;; - *) configure_args="$configure_args $f" ;; - esac -done -configure_args=$(/usr/bin/expr "$configure_args" : 'X \(.*\)') - - -ac_config_files="$ac_config_files 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}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.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 - - - -: "${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 -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -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 - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# 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 $as_me, which was -generated by GNU Autoconf 2.69. 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 - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_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 - -Configuration files: -$config_files - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 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' -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;; - --he | --h | --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 -_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 - "Makefile") CONFIG_FILES="$CONFIG_FILES 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 -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" - - -eval set X " :F $CONFIG_FILES " -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 -_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 -$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 - ;; - - - - 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 - diff --git a/winsup/cygserver/configure.ac b/winsup/cygserver/configure.ac deleted file mode 100644 index 48fb7c45e..000000000 --- a/winsup/cygserver/configure.ac +++ /dev/null @@ -1,67 +0,0 @@ -dnl Autoconf configure script for Cygwin. -dnl Copyright 2003 Red Hat, Inc. -dnl -dnl This file is part of Cygwin. -dnl -dnl This software is a copyrighted work licensed under the terms of the -dnl Cygwin license. Please consult the file "CYGWIN_LICENSE" for -dnl details. -dnl -dnl Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59)dnl -AC_INIT(cygserver.cc) -AC_CONFIG_AUX_DIR(..) - -. ${srcdir}/../configure.cygwin - -AC_PROG_INSTALL -AC_NO_EXECUTABLES -AC_CANONICAL_SYSTEM - -AC_PROG_CC -AC_PROG_CXX -AC_PROG_CPP -AC_LANG(C) - -AC_WINDOWS_HEADERS -AC_WINDOWS_LIBS - -AC_LANG(C++) - -AC_CYGWIN_INCLUDES - -case "$with_cross_host" in - ""|*cygwin*) - all_host="all_host" - install_host="install_host" - ;; - *) - all_host= - install_host= - ;; -esac - -AC_SUBST(all_host) -AC_SUBST(install_host) - -AC_CHECK_TOOL(AR, ar, ar) -AC_CHECK_TOOL(AS, as, as) -AC_CHECK_TOOL(RANLIB, ranlib, ranlib) -AC_CHECK_TOOL(LD, ld, ld) -AC_CHECK_TOOL(NM, nm, nm) -AC_CHECK_TOOL(DLLTOOL, dlltool, dlltool) -AC_CHECK_TOOL(WINDRES, windres, windres) - -AC_PROG_MAKE_SET - -AC_ARG_ENABLE(debugging, -[ --enable-debugging Build a cygwin DLL which has more consistency checking for debugging], -[case "${enableval}" in -yes) AC_DEFINE(DEBUGGING) ;; -no) ;; -esac -]) - -AC_CONFIGURE_ARGS -AC_OUTPUT(Makefile) diff --git a/winsup/cygserver/cygserver-config b/winsup/cygserver/cygserver-config deleted file mode 100755 index f9515e71e..000000000 --- a/winsup/cygserver/cygserver-config +++ /dev/null @@ -1,202 +0,0 @@ -#!/bin/bash -# -# cygserver-config, Copyright 2003 Red Hat Inc. -# -# This file is part of the Cygwin DLL. - -# Directory where the config files are stored -SYSCONFDIR=/etc -LOCALSTATEDIR=/var - -progname=$0 -auto_answer="" - -request() -{ - if [ "${auto_answer}" = "yes" ] - then - echo "$1 (yes/no) yes" - return 0 - elif [ "${auto_answer}" = "no" ] - then - echo "$1 (yes/no) no" - return 1 - fi - - answer="" - while [ "X${answer}" != "Xyes" -a "X${answer}" != "Xno" ] - do - echo -n "$1 (yes/no) " - read -e answer - done - if [ "X${answer}" = "Xyes" ] - then - return 0 - else - return 1 - fi -} - -# Check options - -while : -do - case $# in - 0) - break - ;; - esac - - option=$1 - shift - - case "${option}" in - -d | --debug ) - set -x - ;; - - -y | --yes ) - auto_answer=yes - ;; - - -n | --no ) - auto_answer=no - ;; - - *) - echo "usage: ${progname} [OPTION]..." - echo - echo "This script creates an Cygserver service configuration." - echo - echo "Options:" - echo " --debug -d Enable shell's debug output." - echo " --yes -y Answer all questions with \"yes\" automatically." - echo " --no -n Answer all questions with \"no\" automatically." - echo - exit 1 - ;; - - esac -done - -# Check if running on NT -_sys="`uname`" -_nt=`expr "${_sys}" : "CYGWIN_NT"` - -# Check for running cygserver processes first. -if ps -ef | grep -v grep | grep -q cygserver -then - echo - echo "There is a cygserver already running. Nothing to do, apparently." - echo - exit 1 -fi - -# Check for ${SYSCONFDIR} directory -if [ -e "${SYSCONFDIR}" -a ! -d "${SYSCONFDIR}" ] -then - echo - echo "${SYSCONFDIR} is existant but not a directory." - echo "Cannot create global configuration file." - echo - exit 1 -fi - -# Create it if necessary -if [ ! -e "${SYSCONFDIR}" ] -then - mkdir "${SYSCONFDIR}" - if [ ! -e "${SYSCONFDIR}" ] - then - echo - echo "Creating ${SYSCONFDIR} directory failed" - echo - exit 1 - fi -fi - -# Create /var/log if not already existing -if [ -f ${LOCALSTATEDIR}/log ] -then - echo "Creating ${LOCALSTATEDIR}/log failed!" -else - if [ ! -d ${LOCALSTATEDIR}/log ] - then - mkdir -p ${LOCALSTATEDIR}/log - fi -fi - -# Check if cygserver.conf exists. If yes, ask for overwriting -if [ -f "${SYSCONFDIR}/cygserver.conf" ] -then - if request "Overwrite existing ${SYSCONFDIR}/cygserver.conf file?" - then - rm -f "${SYSCONFDIR}/cygserver.conf" - if [ -f "${SYSCONFDIR}/cygserver.conf" ] - then - echo - echo "Can't overwrite. ${SYSCONFDIR}/cygserver.conf is write protected." - echo - exit 1 - fi - fi -fi - -# Create default cygserver.conf from skeleton files in /etc/defaults/etc -if [ ! -f "${SYSCONFDIR}/cygserver.conf" ] -then - echo "Generating ${SYSCONFDIR}/cygserver.conf file" - cp "${SYSCONFDIR}/defaults/etc/cygserver.conf" "${SYSCONFDIR}/cygserver.conf" - if [ ! -f "${SYSCONFDIR}/cygserver.conf" ] - then - echo - echo "Couldn't create ${SYSCONFDIR}/cygserver.conf." - echo "Perhaps there's no default file in ${SYSCONFDIR}/defaults/etc?" - echo "Reinstalling Cygwin might help." - echo - exit 1 - fi - chmod 664 "${SYSCONFDIR}/cygserver.conf" - chown system.544 "${SYSCONFDIR}/cygserver.conf" -fi - -# On NT ask if cygserver should be installed as service -if [ ${_nt} -gt 0 ] -then - # But only if it is not already installed - if ! cygrunsrv -Q cygserver > /dev/null 2>&1 - then - echo - echo - echo "Warning: The following function requires administrator privileges!" - echo - echo "Do you want to install cygserver as service?" - if request "(Say \"no\" if it's already installed as service)" - then - if ! cygrunsrv -I cygserver -d "CYGWIN cygserver" -p /usr/sbin/cygserver - then - echo - echo "Installation of cygserver as service failed. Please check the" - echo "error messages you got. They might give a clue why it failed." - echo - echo "A good start is either you don't have administrator privileges" - echo "or a missing cygrunsrv binary. Please check for both." - echo - exit 1 - fi - echo - echo "The service has been installed under LocalSystem account." - echo "To start it, call \`net start cygserver' or \`cygrunsrv -S cygserver'." - fi - touch "${LOCALSTATEDIR}/log/cygserver.log" - chown system.544 "${LOCALSTATEDIR}/log/cygserver.log" - fi -fi - -echo -echo "Further configuration options are available by editing the configuration" -echo "file ${SYSCONFDIR}/cygserver.conf. Please read the inline information in that" -echo "file carefully. The best option for the start is to just leave it alone." -echo -echo "Basic Cygserver configuration finished. Have fun!" -echo diff --git a/winsup/cygserver/cygserver.cc b/winsup/cygserver/cygserver.cc deleted file mode 100644 index bf78e9daf..000000000 --- a/winsup/cygserver/cygserver.cc +++ /dev/null @@ -1,762 +0,0 @@ -/* cygserver.cc - - Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2011, 2012 Red Hat Inc. - - Written by Egor Duda - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cygwin_version.h" - -#include "cygserver.h" -#include "process.h" -#include "transport.h" - -#include "cygserver_ipc.h" -#include "cygserver_msg.h" -#include "cygserver_sem.h" - -#define DEF_CONFIG_FILE "" SYSCONFDIR "/cygserver.conf" - -#define SERVER_VERSION "1.20" - -GENERIC_MAPPING access_mapping; - -static bool -setup_privileges () -{ - BOOL rc, ret_val; - HANDLE hToken = NULL; - TOKEN_PRIVILEGES sPrivileges; - - rc = OpenProcessToken (GetCurrentProcess () , TOKEN_ALL_ACCESS , &hToken) ; - if (!rc) - { - debug ("error opening process token (err %u)", GetLastError ()); - return false; - } - rc = LookupPrivilegeValue (NULL, SE_DEBUG_NAME, &sPrivileges.Privileges[0].Luid); - if (!rc) - { - debug ("error getting privilege luid (err %u)", GetLastError ()); - ret_val = false; - goto out; - } - sPrivileges.PrivilegeCount = 1 ; - sPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED ; - rc = AdjustTokenPrivileges (hToken, FALSE, &sPrivileges, 0, NULL, NULL) ; - if (!rc) - { - debug ("error adjusting privilege level. (err %u)", GetLastError ()); - ret_val = false; - goto out; - } - - access_mapping.GenericRead = FILE_READ_DATA; - access_mapping.GenericWrite = FILE_WRITE_DATA; - access_mapping.GenericExecute = 0; - access_mapping.GenericAll = FILE_READ_DATA | FILE_WRITE_DATA; - - ret_val = true; - -out: - CloseHandle (hToken); - return ret_val; -} - -int -check_and_dup_handle (HANDLE from_process, HANDLE to_process, - HANDLE from_process_token, - DWORD access, - HANDLE from_handle, - HANDLE *to_handle_ptr, BOOL bInheritHandle = FALSE) -{ - HANDLE local_handle = NULL; - int ret_val = EACCES; - char sd_buf [1024]; - PSECURITY_DESCRIPTOR sd = (PSECURITY_DESCRIPTOR) &sd_buf; - DWORD bytes_needed; - PRIVILEGE_SET ps; - DWORD ps_len = sizeof (ps); - BOOL status; - - if (from_process != GetCurrentProcess ()) - { - if (!DuplicateHandle (from_process, from_handle, - GetCurrentProcess (), &local_handle, - 0, bInheritHandle, - DUPLICATE_SAME_ACCESS)) - { - log (LOG_ERR, "error getting handle(%p) to server (err %u)", - from_handle, GetLastError ()); - goto out; - } - } else - local_handle = from_handle; - - if (!GetKernelObjectSecurity (local_handle, - (OWNER_SECURITY_INFORMATION - | GROUP_SECURITY_INFORMATION - | DACL_SECURITY_INFORMATION), - sd, sizeof (sd_buf), &bytes_needed)) - { - log (LOG_ERR, "error getting handle SD (err %u)", GetLastError ()); - goto out; - } - - MapGenericMask (&access, &access_mapping); - - if (!AccessCheck (sd, from_process_token, access, &access_mapping, - &ps, &ps_len, &access, &status)) - { - log (LOG_ERR, "error checking access rights (err %u)", GetLastError ()); - goto out; - } - - if (!status) - { - log (LOG_ERR, "access to object denied"); - goto out; - } - - if (!DuplicateHandle (from_process, from_handle, - to_process, to_handle_ptr, - access, bInheritHandle, 0)) - { - log (LOG_ERR, "error getting handle to client (err %u)", GetLastError ()); - goto out; - } - - debug ("Duplicated %p to %p", from_handle, *to_handle_ptr); - - ret_val = 0; - - out: - if (local_handle && from_process != GetCurrentProcess ()) - CloseHandle (local_handle); - - return (ret_val); -} - -/* - * client_request_attach_tty::serve () - */ - -void -client_request_attach_tty::serve (transport_layer_base *const conn, - process_cache *) -{ - assert (conn); - - assert (!error_code ()); - - if (msglen () != sizeof (req)) - { - log (LOG_ERR, "bad request body length: expecting %lu bytes, got %lu", - sizeof (req), msglen ()); - error_code (EINVAL); - msglen (0); - return; - } - - msglen (0); // Until we fill in some fields. - - debug ("pid %ld:(%p,%p) -> pid %ld", req.master_pid, req.from_master, - req.to_master, req.pid); - - debug ("opening process %ld", req.master_pid); - - const HANDLE from_process_handle = - OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.master_pid); - - if (!from_process_handle) - { - log (LOG_ERR, "error opening `from' process (err %u)", GetLastError ()); - error_code (EACCES); - return; - } - - debug ("opening process %ld", req.pid); - - const HANDLE to_process_handle = - OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.pid); - - if (!to_process_handle) - { - log (LOG_ERR, "error opening `to' process (err %u)", GetLastError ()); - CloseHandle (from_process_handle); - error_code (EACCES); - return; - } - - debug ("Impersonating client"); - if (!conn->impersonate_client ()) - { - CloseHandle (from_process_handle); - CloseHandle (to_process_handle); - error_code (EACCES); - return; - } - - HANDLE token_handle = NULL; - - debug ("about to open thread token"); - const DWORD rc = OpenThreadToken (GetCurrentThread (), - TOKEN_QUERY, - TRUE, - &token_handle); - - debug ("opened thread token, rc=%u", rc); - if (!conn->revert_to_self ()) - { - CloseHandle (from_process_handle); - CloseHandle (to_process_handle); - error_code (EACCES); - return; - } - - if (!rc) - { - log (LOG_ERR, "error opening thread token (err %u)", GetLastError ()); - CloseHandle (from_process_handle); - CloseHandle (to_process_handle); - error_code (EACCES); - return; - } - - // From this point on, a reply body is returned to the client. - - const HANDLE from_master = req.from_master; - const HANDLE to_master = req.to_master; - - req.from_master = NULL; - req.to_master = NULL; - - msglen (sizeof (req)); - - if (from_master) - if (check_and_dup_handle (from_process_handle, to_process_handle, - token_handle, - GENERIC_READ, - from_master, - &req.from_master, TRUE) != 0) - { - log (LOG_ERR, "error duplicating from_master handle (err %u)", - GetLastError ()); - error_code (EACCES); - } - - if (to_master) - if (check_and_dup_handle (from_process_handle, to_process_handle, - token_handle, - GENERIC_WRITE, - to_master, - &req.to_master, TRUE) != 0) - { - log (LOG_ERR, "error duplicating to_master handle (err %u)", - GetLastError ()); - error_code (EACCES); - } - - CloseHandle (from_process_handle); - CloseHandle (to_process_handle); - CloseHandle (token_handle); - - debug ("%u(%p, %p) -> %u(%p,%p)", req.master_pid, from_master, to_master, - req.pid, req.from_master, req.to_master); - - return; -} - -void -client_request_get_version::serve (transport_layer_base *, process_cache *) -{ - assert (!error_code ()); - - if (msglen ()) - log (LOG_ERR, "unexpected request body ignored: %lu bytes", msglen ()); - - msglen (sizeof (version)); - - version.major = CYGWIN_SERVER_VERSION_MAJOR; - version.api = CYGWIN_SERVER_VERSION_API; - version.minor = CYGWIN_SERVER_VERSION_MINOR; - version.patch = CYGWIN_SERVER_VERSION_PATCH; -} - -class server_request : public queue_request -{ -public: - server_request (transport_layer_base *const conn, process_cache *const cache) - : _conn (conn), _cache (cache) - {} - - virtual ~server_request () - { - delete _conn; - } - - virtual void process () - { - client_request::handle_request (_conn, _cache); - } - -private: - transport_layer_base *const _conn; - process_cache *const _cache; -}; - -class server_submission_loop : public queue_submission_loop -{ -public: - server_submission_loop (threaded_queue *const queue, - transport_layer_base *const transport, - process_cache *const cache) - : queue_submission_loop (queue, false), - _transport (transport), - _cache (cache) - { - assert (_transport); - assert (_cache); - } - -private: - transport_layer_base *const _transport; - process_cache *const _cache; - - virtual void request_loop (); -}; - -/* FIXME: this is a little ugly. What we really want is to wait on - * two objects: one for the pipe/socket, and one for being told to - * shutdown. Otherwise this will stay a problem (we won't actually - * shutdown until the request _AFTER_ the shutdown request. And - * sending ourselves a request is ugly - */ -void -server_submission_loop::request_loop () -{ - /* I'd like the accepting thread's priority to be above any "normal" - * thread in the system to avoid overflowing the listen queue (for - * sockets; similar issues exist for named pipes); but, for example, - * a normal priority thread in a foregrounded process is boosted to - * THREAD_PRIORITY_HIGHEST (AFAICT). Thus try to set the current - * thread's priority to a level one above that. This fails on - * win9x/ME so assume any failure in that call is due to that and - * simply call again at one priority level lower. - * FIXME: This looks weird and is an issue on NT, too. Per MSDN, - * THREAD_PRIORITY_HIGHEST + 1 is only a valid priority level if - * the priority class is set to REALTIME_PRIORITY_CLASS. - */ - if (!SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_HIGHEST + 1)) - if (!SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_HIGHEST)) - debug ("failed to raise accept thread priority (err %u)", - GetLastError ()); - - while (_running) - { - bool recoverable = false; - transport_layer_base *const conn = _transport->accept (&recoverable); - if (!conn && !recoverable) - { - log (LOG_ERR, "fatal error on IPC transport: closing down"); - return; - } - // EINTR probably implies a shutdown request; so back off for a - // moment to let the main thread take control, otherwise the - // server spins here receiving EINTR repeatedly since the signal - // handler in the main thread doesn't get a chance to be called. - if (!conn && errno == EINTR) - { - if (!SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_NORMAL)) - debug ("failed to reset thread priority (err %u)", - GetLastError ()); - - Sleep (0); - if (!SetThreadPriority (GetCurrentThread (), - THREAD_PRIORITY_HIGHEST + 1)) - if (!SetThreadPriority (GetCurrentThread (), - THREAD_PRIORITY_HIGHEST)) - debug ("failed to raise thread priority (err %u)", - GetLastError ()); - } - if (conn) - _queue->add (new server_request (conn, _cache)); - } -} - -client_request_shutdown::client_request_shutdown () - : client_request (CYGSERVER_REQUEST_SHUTDOWN) -{ -} - -void -client_request_shutdown::serve (transport_layer_base *, process_cache *) -{ - assert (!error_code ()); - - if (msglen ()) - log (LOG_ERR, "unexpected request body ignored: %lu bytes", msglen ()); - - /* FIXME: link upwards, and then this becomes a trivial method call to - * only shutdown _this queue_ - */ - - kill (getpid (), SIGINT); - - msglen (0); -} - -static sig_atomic_t shutdown_server = false; - -static void -handle_signal (const int signum) -{ - /* any signal makes us die :} */ - - shutdown_server = true; -} - -/* - * print_usage () - */ - -static void -print_usage (const char *const pgm) -{ - log (LOG_NOTICE, "Usage: %s [OPTIONS]\n" -"\n" -"Cygwin background service daemon\n" -"\n" -"Configuration option:\n" -"\n" -" -f, --config-file Use as config file. Default is\n" -" " DEF_CONFIG_FILE "\n" -"\n" -"Performance options:\n" -"\n" -" -c, --cleanup-threads Number of cleanup threads to use.\n" -" -p, --process-cache Size of process cache.\n" -" -r, --request-threads Number of request threads to use.\n" -"\n" -"Logging options:\n" -"\n" -" -d, --debug Log debug messages to stderr.\n" -" -e, --stderr Log to stderr (default if stderr is a tty).\n" -" -E, --no-stderr Don't log to stderr (see -y, -Y options).\n" -" -l, --log-level Verbosity of logging (1..7). Default: 6\n" -" -y, --syslog Log to syslog (default if stderr is no tty).\n" -" -Y, --no-syslog Don't log to syslog (See -e, -E options).\n" -"\n" -"Support options:\n" -"\n" -" -m, --no-sharedmem Don't start XSI Shared Memory support.\n" -" -q, --no-msgqueues Don't start XSI Message Queue support.\n" -" -s, --no-semaphores Don't start XSI Semaphore support.\n" -"\n" -"Miscellaneous:\n" -"\n" -" -S, --shutdown Shutdown the daemon.\n" -" -h, --help Output usage information and exit.\n" -" -V, --version Output version information and exit.\n" -, pgm); -} - -/* - * print_version () - */ - -static void -print_version () -{ - log (LOG_INFO, - "cygserver (cygwin) %d.%d.%d\n" - "Cygwin background service daemon\n" - "Copyright (C) 2001 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -/* - * main () - */ - -int -main (const int argc, char *argv[]) -{ - const struct option longopts[] = { - {"cleanup-threads", required_argument, NULL, 'c'}, - {"debug", no_argument, NULL, 'd'}, - {"stderr", no_argument, NULL, 'e'}, - {"no-stderr", no_argument, NULL, 'E'}, - {"config-file", required_argument, NULL, 'f'}, - {"help", no_argument, NULL, 'h'}, - {"log-level", required_argument, NULL, 'l'}, - {"no-sharedmem", no_argument, NULL, 'm'}, - {"process-cache", required_argument, NULL, 'p'}, - {"no-msgqueues", no_argument, NULL, 'q'}, - {"request-threads", required_argument, NULL, 'r'}, - {"no-semaphores", no_argument, NULL, 's'}, - {"shutdown", no_argument, NULL, 'S'}, - {"version", no_argument, NULL, 'V'}, - {"syslog", no_argument, NULL, 'y'}, - {"no-syslog", no_argument, NULL, 'Y'}, - {0, no_argument, NULL, 0} - }; - - const char opts[] = "c:deEf:hl:mp:qr:sSVyY"; - - int32_t cleanup_threads = 0; - int32_t request_threads = 0; - int32_t process_cache_size = 0; - bool shutdown = false; - const char *config_file = DEF_CONFIG_FILE; - bool force_config_file = false; - tun_bool_t option_log_stderr = TUN_UNDEF; - tun_bool_t option_log_syslog = TUN_UNDEF; - - char *c = NULL; - - /* Check if we have a terminal. If so, default to stderr logging, - otherwise default to syslog logging. This must be done early - to allow default logging already in option processing state. */ - openlog ("cygserver", LOG_PID, LOG_KERN); - if (isatty (2)) - log_stderr = TUN_TRUE; - else - log_syslog = TUN_TRUE; - - int opt; - - securityinit (); - - opterr = 0; - while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (opt) - { - case 'c': - c = NULL; - cleanup_threads = strtol (optarg, &c, 10); - if (cleanup_threads <= 0 || cleanup_threads > 32 || (c && *c)) - panic ("Number of cleanup threads must be between 1 and 32"); - break; - - case 'd': - log_debug = TUN_TRUE; - break; - - case 'e': - option_log_stderr = TUN_TRUE; - break; - - case 'E': - option_log_stderr = TUN_FALSE; - break; - - case 'f': - config_file = optarg; - force_config_file = true; - break; - - case 'h': - print_usage (getprogname ()); - return 0; - - case 'l': - c = NULL; - log_level = strtoul (optarg, &c, 10); - if (!log_level || log_level > 7 || (c && *c)) - panic ("Log level must be between 1 and 7"); - break; - - case 'm': - support_sharedmem = TUN_FALSE; - break; - - case 'p': - c = NULL; - process_cache_size = strtol (optarg, &c, 10); - if (process_cache_size <= 0 || process_cache_size > 310 || (c && *c)) - panic ("Size of process cache must be between 1 and 310"); - break; - - case 'q': - support_msgqueues = TUN_FALSE; - break; - - case 'r': - c = NULL; - request_threads = strtol (optarg, &c, 10); - if (request_threads <= 0 || request_threads > 310 || (c && *c)) - panic ("Number of request threads must be between 1 and 310"); - break; - - case 's': - support_semaphores = TUN_FALSE; - break; - - case 'S': - shutdown = true; - break; - - case 'V': - print_version (); - return 0; - - case 'y': - option_log_syslog = TUN_TRUE; - break; - - case 'Y': - option_log_syslog = TUN_FALSE; - break; - - case '?': - panic ("unknown option -- %c\n" - "Try `%s --help' for more information.", optopt, getprogname ()); - } - - if (optind != argc) - panic ("Too many arguments"); - - if (shutdown) - { - /* Setting `cygserver_running' stops the request code making a - * version request, which is not much to the point. - */ - cygserver_running = CYGSERVER_OK; - - client_request_shutdown req; - - if (req.make_request () == -1 || req.error_code ()) - panic("Shutdown request failed: %s", strerror (req.error_code ())); - - // FIXME: It would be nice to wait here for the daemon to exit. - - return 0; - } - - SIGHANDLE (SIGHUP); - SIGHANDLE (SIGINT); - SIGHANDLE (SIGTERM); - - tunable_param_init (config_file, force_config_file); - - loginit (option_log_stderr, option_log_syslog); - - log (LOG_INFO, "daemon starting up"); - - if (!cleanup_threads) - TUNABLE_INT_FETCH ("kern.srv.cleanup_threads", &cleanup_threads); - if (!cleanup_threads) - cleanup_threads = 2; - - if (!request_threads) - TUNABLE_INT_FETCH ("kern.srv.request_threads", &request_threads); - if (!request_threads) - request_threads = 10; - - if (!process_cache_size) - TUNABLE_INT_FETCH ("kern.srv.process_cache_size", &process_cache_size); - if (!process_cache_size) - process_cache_size = 62; - - if (support_sharedmem == TUN_UNDEF) - TUNABLE_BOOL_FETCH ("kern.srv.sharedmem", &support_sharedmem); - if (support_sharedmem == TUN_UNDEF) - support_sharedmem = TUN_TRUE; - - if (support_msgqueues == TUN_UNDEF) - TUNABLE_BOOL_FETCH ("kern.srv.msgqueues", &support_msgqueues); - if (support_msgqueues == TUN_UNDEF) - support_msgqueues = TUN_TRUE; - - if (support_semaphores == TUN_UNDEF) - TUNABLE_BOOL_FETCH ("kern.srv.semaphores", &support_semaphores); - if (support_semaphores == TUN_UNDEF) - support_semaphores = TUN_TRUE; - - if (!setup_privileges ()) - panic ("Setting process privileges failed."); - - ipcinit (); - - /*XXXXX*/ - threaded_queue request_queue (request_threads); - - transport_layer_base *const transport = create_server_transport (); - assert (transport); - - if (transport->listen () == -1) - return 1; - - process_cache cache (process_cache_size, cleanup_threads); - - server_submission_loop submission_loop (&request_queue, transport, &cache); - - request_queue.add_submission_loop (&submission_loop); - - cache.start (); - - request_queue.start (); - - log (LOG_NOTICE, "Initialization complete. Waiting for requests."); - - /* TODO: wait on multiple objects - the thread handle for each - * request loop + all the process handles. This should be done by - * querying the request_queue and the process cache for all their - * handles, and then waiting for (say) 30 seconds. after that we - * recreate the list of handles to wait on, and wait again. the - * point of all this abstraction is that we can trivially server - * both sockets and pipes simply by making a new transport, and then - * calling request_queue.process_requests (transport2); - */ - /* WaitForMultipleObjects abort && request_queue && process_queue && signal - -- if signal event then retrigger it - */ - while (!shutdown_server && request_queue.running () && cache.running ()) - { - pause (); - if (ipcunload ()) - { - shutdown_server = false; - log (LOG_WARNING, "Shutdown request received but ignored. " - "Dependent processes still running."); - } - } - - log (LOG_INFO, "Shutdown request received - new requests will be denied"); - request_queue.stop (); - log (LOG_INFO, "All pending requests processed"); - delete transport; - log (LOG_INFO, "No longer accepting requests - cygwin will operate in daemonless mode"); - cache.stop (); - log (LOG_INFO, "All outstanding process-cache activities completed"); - log (LOG_NOTICE, "Shutdown finished."); - - return 0; -} -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/cygserver.conf b/winsup/cygserver/cygserver.conf deleted file mode 100644 index 589931b11..000000000 --- a/winsup/cygserver/cygserver.conf +++ /dev/null @@ -1,147 +0,0 @@ -# cygserver.conf, Copyright(C) 2003, 2005 Red Hat Inc. -# -# Contains configurable parameters for the cygserver. -# -# The format of this file is easy. Lines beginning with a hash `#' are -# comments and ignored. Lines consisting of only whitespaces are ignored. -# Any other line is a setting for cygserver. -# A setting consists of a name/value pair, separated by whitespace. -# Each line must only consist of one name/value pair. -# Lines must not be longer than 1023 characters. -# -# Some settings can be overridden by a command line switch. If so, it's -# mentioned below. -# -# Settings which are commented out will use the default values. These are -# mentioned below, too. - -# kern.srv.cleanup_threads: No. of cygserver threads used for cleanup tasks. -# Default: 2, Min: 1, Max: 16, command line option -c, --cleanup-threads -#kern.srv.cleanup_threads 2 - -# kern.srv.request_threads: No. of cygserver threads used to serve -# application requests. -# Default: 10, Min: 1, Max: 310, command line option -r, --request-threads -#kern.srv.request_threads 10 - -# kern.srv.process_cache_size: No. of concurrent processes which can be handled -# by Cygserver concurrently. -# Default: 62, Min: 1, Max: 310, command line option -p, --process-cache -#kern.srv.process_cache_size 62 - -# kern.srv.msgqueues: Determines whether XSI Message Queue support should be -# started, "yes" (or "true", "y", "t", "1") or "no" (or "false", "n", "f", "0"). -# These values are valid for all binary type options. -# Default is "yes". Command line option -q, --no-msgqueues -#kern.srv.msgqueues yes - -# kern.srv.semaphores: Determines whether XSI Semaphore support should be -# started. Default is "yes". Command line option -s, --no-semaphores -#kern.srv.semaphores yes - -# kern.srv.sharedmem: Determines whether XSI Shared Memory support should be -# started. Default is "yes". Command line option -m, --no-sharedmem -#kern.srv.sharedmem yes - -# LOGGING - -# kern.log.syslog: Determines whether logging should go to the syslog, -# Default is "yes", if stderr is no tty, "no" otherwise. -# Command line option -y, --syslog or -Y, --no-syslog. -#kern.log.syslog no - -# kern.log.stderr: Determines whether logging should go to stderr, -# Default is "yes", if stderr is a tty, "no" otherwise. -# Command line option -e, --stderr or -E, --no-stderr. -#kern.log.stderr no - -# kern.log.level: Logging level. Valid values are 1 to 7 with a bigger -# value emitting more logging output. Default level is 6. -# Command line option -l, --log-level. -#kern.log.level 6 - -# kern.log.debug: Determines whether debug output should be printed to stderr. -# Default is "no". Command line option -d, --debug -#kern.log.debug no - -# XSI message queue parameters. -# -# Each message is broken up and stored in segments that are msgssz bytes -# long. For efficiency reasons, this should be a power of two. Also, -# it doesn't make sense if it is less than 8 or greater than about 256. - -# kern.ipc.msgseg: Maximum no. of message queue segments hold concurrently. -# Default: 2048, Min: 256, Max: 65535 -#kern.ipc.msgseg 2048 - -# kern.ipc.msgssz: Size of segment in bytes. Must be a power of 2 value. -# Default: 8, Min: 8, Max: 1024 -#kern.ipc.msgssz 8 - -# kern.ipc.msgmnb: Maximum no. of bytes in a single message queue. -# Default: 2048, Min: 1, Max: 65535 -#kern.ipc.msgmnb 2048 - -# kern.ipc.msgmni: Maximum no. of message queue identifiers hold concurrently. -# Default: 40, Min: 1, Max: 1024 -#kern.ipc.msgmni 40 - -# kern.ipc.msgtql: Maximum no. of messages hold concurrently. -# Default: 40, Min: 1, Max: 1024 -#kern.ipc.msgtql 40 - -# XSI semaphore parameters - -# kern.ipc.semmni: Maximum no. of semaphore identifiers hold concurrently. -# Default: 10, Min: 1, Max: 1024 -#kern.ipc.semmni 10 - -# kern.ipc.semmns: Maximum no. of semaphores hold concurrently. -# Default: 60, Min: 1, Max: 1024 -#kern.ipc.semmns 60 - -# kern.ipc.semmnu: Total no. of undo structures hold by server. -# Default: 30, Min: 1, Max: 1024 -#kern.ipc.semmnu 30 - -# kern.ipc.semmsl: Maximum no. of semaphores per semaphore id. -# Default: 60, Min: 1, Max: 1024 -#kern.ipc.semmsl 60 - -# kern.ipc.semopm: Maximum no. of operations per semop call. -# Default: 100, Min: 1, Max: 1024 -#kern.ipc.semopm 100 - -# kern.ipc.semume: Maximum no. of undo entries per process. -# Default: 10, Min: 1, Max: 1024 -#kern.ipc.semume 10 - -# kern.ipc.semvmx: Maximum value of a semaphore. -# Default: 32767, Min: 1, Max: 32767 -#kern.ipc.semvmx 32767 - -# kern.ipc.semaem: Maximum value to adjust on process exit. -# Default: 16384, Min: 1, Max: 32767 -#kern.ipc.semaem 16384 - -# XSI shared memory parameters - -# kern.ipc.shmmaxpgs: Maximum pages available for XSI shared memory. -# Changing shmmaxpgs immediately affects setting SHMMAX. The relation -# between shmmaxpgs and SHMMAX is: SHMMAX = shmmaxpgs * getpagesize(). -# Default: 8192, Min: 1, Max: 32767 -#kern.ipc.shmmaxpgs 8192 - -# kern.ipc.shmmni: Maximum number of shared memory segments, system wide. -# Default: 192, Min: 1, Max: 32767 -#kern.ipc.shmmni 192 - -# kern.ipc.shmseg: Maximum number of shared memory segments per process. -# Default: 128, Min: 1, Max: 32767 -#kern.ipc.shmseg 128 - -# kern.ipc.shm_allow_removed: Determines whether a process is allowed to -# attach to a shared memory segment (using the shmat call) after a successful -# call to shmctl(IPC_RMID). This is a Linux-specific, and therefore -# non-portable feature. Use with care. Default is "no". -#kern.ipc.shm_allow_removed no diff --git a/winsup/cygserver/msg.cc b/winsup/cygserver/msg.cc deleted file mode 100644 index c92e698b0..000000000 --- a/winsup/cygserver/msg.cc +++ /dev/null @@ -1,117 +0,0 @@ -/* msg.cc: Single unix specification IPC interface for Cygwin. - - Copyright 2003, 2004, 2012 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" - -#include -#include -#include -#include -#include -#include - -#include "cygserver.h" -#include "process.h" -#include "transport.h" - -#include "cygserver_ipc.h" -#include "cygserver_msg.h" - -client_request_msg::client_request_msg () - : client_request (CYGSERVER_REQUEST_MSG, - &_parameters, sizeof (_parameters)) -{ -} - -void -client_request_msg::serve (transport_layer_base *const conn, - process_cache *const cache) -{ - if (msglen () != sizeof (_parameters.in)) - { - syscall_printf ("bad request body length: expecting %lu bytes, got %lu", - sizeof (_parameters), msglen ()); - error_code (EINVAL); - msglen (0); - return; - } - if (support_msgqueues == TUN_FALSE) - { - syscall_printf ("Message queue support not started"); - error_code (ENOSYS); - if (_parameters.in.msgop == MSGOP_msgrcv) - _parameters.out.rcv = -1; - else - _parameters.out.ret = -1; - msglen (sizeof (_parameters.out)); - return; - } - process *const client = cache->process (_parameters.in.ipcblk.cygpid, - _parameters.in.ipcblk.winpid, - _parameters.in.ipcblk.signal_arrived); - if (!client) - { - error_code (EAGAIN); - msglen (0); - return; - } - if (!conn->impersonate_client ()) - { - client->release (); - error_code (EACCES); - msglen (0); - return; - } - if (!adjust_identity_info (&_parameters.in.ipcblk)) - { - client->release (); - conn->revert_to_self (); - error_code (EACCES); - msglen (0); - return; - } - /* Early revert_to_self since IPC code runs in kernel mode. */ - conn->revert_to_self (); - /* sysv_msg.cc takes care of itself. */ - client->release (); - thread td = { client, &_parameters.in.ipcblk, {-1, -1} }; - int res; - msgop_t msgop = _parameters.in.msgop; /* Get's overwritten otherwise. */ - switch (msgop) - { - case MSGOP_msgctl: - res = msgctl (&td, &_parameters.in.ctlargs); - break; - case MSGOP_msgget: - res = msgget (&td, &_parameters.in.getargs); - break; - case MSGOP_msgrcv: - res = msgrcv (&td, &_parameters.in.rcvargs); - break; - case MSGOP_msgsnd: - res = msgsnd (&td, &_parameters.in.sndargs); - break; - default: - res = ENOSYS; - td.td_retval[0] = -1; - break; - } - /* Allocated by the call to adjust_identity_info(). */ - if (_parameters.in.ipcblk.gidlist) - free (_parameters.in.ipcblk.gidlist); - error_code (res); - if (msgop == MSGOP_msgrcv) - _parameters.out.rcv = td.td_retval[0]; - else - _parameters.out.ret = td.td_retval[0]; - msglen (sizeof (_parameters.out)); -} -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/process.cc b/winsup/cygserver/process.cc deleted file mode 100644 index cc665d88e..000000000 --- a/winsup/cygserver/process.cc +++ /dev/null @@ -1,500 +0,0 @@ -/* process.cc - - Copyright 2001, 2002, 2003, 2004, 2005 Red Hat Inc. - - Written by Robert Collins - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" - -#include - -#include -#include - -#include "process.h" - -/*****************************************************************************/ - -#define elements(ARRAY) (sizeof (ARRAY) / sizeof (*ARRAY)) - -/*****************************************************************************/ - -process_cleanup::~process_cleanup () -{ - delete _process; -} - -void -process_cleanup::process () -{ - _process->cleanup (); -} - -/*****************************************************************************/ - -process::process (const pid_t cygpid, const DWORD winpid, HANDLE signal_arrived) - : _cygpid (cygpid), - _winpid (winpid), - _hProcess (NULL), - _signal_arrived (INVALID_HANDLE_VALUE), - _cleaning_up (false), - _exit_status (STILL_ACTIVE), - _routines_head (NULL), - _next (NULL) -{ - _hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, winpid); - if (!_hProcess) - { - system_printf ("unable to obtain handle for new cache process %d(%lu)", - _cygpid, _winpid); - _hProcess = INVALID_HANDLE_VALUE; - _exit_status = 0; - } - else - debug_printf ("got handle %p for new cache process %d(%lu)", - _hProcess, _cygpid, _winpid); - if (!signal_arrived) - system_printf ("signal_arrived NULL for process %d(%lu)", - _cygpid, _winpid); - else if (signal_arrived != INVALID_HANDLE_VALUE) - { - if (!DuplicateHandle (_hProcess, signal_arrived, - GetCurrentProcess (), &_signal_arrived, - 0, FALSE, DUPLICATE_SAME_ACCESS)) - { - system_printf ("error getting signal_arrived to server (%lu)", - GetLastError ()); - _signal_arrived = INVALID_HANDLE_VALUE; - } - } - InitializeCriticalSection (&_access); - debug ("initialized (%lu)", _cygpid); -} - -process::~process () -{ - debug ("deleting (%lu)", _cygpid); - DeleteCriticalSection (&_access); - if (_signal_arrived && _signal_arrived != INVALID_HANDLE_VALUE) - CloseHandle (_signal_arrived); - CloseHandle (_hProcess); -} - -/* No need to be thread-safe as this is only ever called by - * process_cache::check_and_remove_process (). If it has to be made - * thread-safe later on, it should not use the `access' critical section as - * that is held by the client request handlers for an arbitrary length of time, - * i.e. while they do whatever processing is required for a client request. - */ -DWORD -process::check_exit_code () -{ - if (_hProcess && _hProcess != INVALID_HANDLE_VALUE - && _exit_status == STILL_ACTIVE - && !GetExitCodeProcess (_hProcess, &_exit_status)) - { - system_printf ("failed to retrieve exit code for %d(%lu), error = %lu", - _cygpid, _winpid, GetLastError ()); - _hProcess = INVALID_HANDLE_VALUE; - } - return _exit_status; -} - -bool -process::add (cleanup_routine *const entry) -{ - assert (entry); - - bool res = false; - hold (); - - if (!_cleaning_up) - { - entry->_next = _routines_head; - _routines_head = entry; - res = true; - } - - release (); - return res; -} - -bool -process::remove (const cleanup_routine *const entry) -{ - assert (entry); - - bool res = false; - hold (); - - if (!_cleaning_up) - { - cleanup_routine *previous = NULL; - - for (cleanup_routine *ptr = _routines_head; - ptr; - previous = ptr, ptr = ptr->_next) - { - if (*ptr == *entry) - { - if (previous) - previous->_next = ptr->_next; - else - _routines_head = ptr->_next; - - delete ptr; - res = true; - break; - } - } - } - - release (); - return res; -} - -/* This is single threaded. It's called after the process is removed - * from the cache, but inserts may be attemped by worker threads that - * have a pointer to it. - */ -void -process::cleanup () -{ - hold (); - assert (!is_active ()); - assert (!_cleaning_up); - InterlockedExchange (&_cleaning_up, true); - cleanup_routine *entry = _routines_head; - _routines_head = NULL; - release (); - - while (entry) - { - cleanup_routine *const ptr = entry; - entry = entry->_next; - ptr->cleanup (this); - delete ptr; - } -} - -/*****************************************************************************/ - -void -process_cache::submission_loop::request_loop () -{ - assert (this); - assert (_cache); - assert (_interrupt_event); - - while (_running) - _cache->wait_for_processes (_interrupt_event); -} - -/*****************************************************************************/ - -process_cache::process_cache (const size_t max_procs, - const unsigned int initial_workers) - : _queue (initial_workers), - _submitter (this, &_queue), // true == interruptible - _processes_count (0), - _max_process_count (max_procs), - _processes_head (NULL), - _cache_add_trigger (NULL) -{ - /* there can only be one */ - InitializeCriticalSection (&_cache_write_access); - - _cache_add_trigger = CreateEvent (NULL, // SECURITY_ATTRIBUTES - TRUE, // Manual-reset - FALSE, // Initially non-signalled - NULL); // Anonymous - - if (!_cache_add_trigger) - { - system_printf ("failed to create cache add trigger, error = %lu", - GetLastError ()); - abort (); - } - - _queue.add_submission_loop (&_submitter); -} - -process_cache::~process_cache () -{ - (void) CloseHandle (_cache_add_trigger); - DeleteCriticalSection (&_cache_write_access); -} - -/* This returns the process object to the caller already locked, that - * is, with the object's `access' critical region entered. Thus the - * caller must unlock the object when it's finished with it (via - * process::release ()). It must then not try to access the object - * afterwards, except by going through this routine again, as it may - * have been deleted once it has been unlocked. - */ -class process * -process_cache::process (const pid_t cygpid, const DWORD winpid, - HANDLE signal_arrived) -{ - /* TODO: make this more granular, so a search doesn't involve the - * write lock. - */ - EnterCriticalSection (&_cache_write_access); - class process *previous = NULL; - class process *entry = find (winpid, &previous); - - if (!entry) - { - if (_processes_count >= _max_process_count) - { - LeaveCriticalSection (&_cache_write_access); - system_printf (("process limit (%d processes) reached; " - "new connection refused for %d(%lu)"), - _max_process_count, cygpid, winpid); - return NULL; - } - - entry = new class process (cygpid, winpid, signal_arrived); - if (!entry->is_active ()) - { - LeaveCriticalSection (&_cache_write_access); - delete entry; - return NULL; - } - - if (previous) - { - entry->_next = previous->_next; - previous->_next = entry; - } - else - { - entry->_next = _processes_head; - _processes_head = entry; - } - - _processes_count += 1; - SetEvent (_cache_add_trigger); - } - - entry->hold (); // To be released by the caller. - LeaveCriticalSection (&_cache_write_access); - assert (entry); - assert (entry->_winpid == winpid); - return entry; -} - -struct pcache_wait_t -{ - size_t index; - size_t count; - HANDLE *hdls; -}; - -static DWORD WINAPI -pcache_wait_thread (const LPVOID param) -{ - pcache_wait_t *p = (pcache_wait_t *) param; - - DWORD rc = WaitForMultipleObjects (p->count, p->hdls, FALSE, INFINITE); - ExitThread (rc == WAIT_FAILED ? rc : rc + p->index); -} - -void -process_cache::wait_for_processes (const HANDLE interrupt_event) -{ - // Update `_wait_array' with handles of all current processes. - size_t idx; - const size_t count = sync_wait_array (interrupt_event); - - debug_printf ("waiting on %u objects in total (%u processes)", - count, _processes_count); - - DWORD rc = WAIT_FAILED; - - if (count <= 64) - { - /* If count <= 64, a single WaitForMultipleObjects is sufficient and - we can simply wait in the main thread. */ - rc = WaitForMultipleObjects (count, _wait_array, FALSE, INFINITE); - if (rc == WAIT_FAILED) - { - system_printf ("could not wait on the process handles, error = %lu", - GetLastError ()); - abort (); - } - } - else - { - /* If count > 64 we have to create sub-threads which wait for the - actual wait objects and the main thread waits for the termination - of one of the threads. */ - HANDLE main_wait_array[5] = { NULL }; - DWORD mcount = 0; - - for (idx = 0; idx < count; idx += 64) - { - pcache_wait_t p = { idx, min (count - idx, 64), _wait_array + idx }; - main_wait_array[mcount++] = CreateThread (NULL, 0, pcache_wait_thread, - &p, 0, NULL); - } - - rc = WaitForMultipleObjects (mcount, main_wait_array, FALSE, INFINITE); - if (rc == WAIT_FAILED) - { - system_printf ("could not wait on the process handles, error = %lu", - GetLastError ()); - abort (); - } - - /* Check for error condition on signalled sub-thread. */ - GetExitCodeThread (main_wait_array[rc], &rc); - if (rc == WAIT_FAILED) - { - system_printf ("could not wait on the process handles, error = %lu", - GetLastError ()); - abort (); - } - - /* Wake up all waiting threads. _cache_add_trigger gets reset - in sync_wait_array again. */ - SetEvent (_cache_add_trigger); - WaitForMultipleObjects (mcount, main_wait_array, TRUE, INFINITE); - for (idx = 0; idx < mcount; idx++) - CloseHandle (main_wait_array[idx]); - } - - /* Tell all processes the bad news. This one formerly only checked - processes beginning with the index of the signalled process, but - this can result in processes which are signalled but never removed - under heavy load conditions. */ - for (idx = 0; idx < count; idx++) - if (_process_array[idx]) - check_and_remove_process (idx); -} - -/* - * process_cache::sync_wait_array () - * - * Fill-in the wait array with the handles that the cache needs to wait on. - * These handles are: - * - the process_process_param's interrupt event - * - the process_cache's cache_add_trigger event - * - the handle for each live process in the cache. - * - * Return value: the number of live handles in the array. - */ - -size_t -process_cache::sync_wait_array (const HANDLE interrupt_event) -{ - assert (this); - assert (interrupt_event && interrupt_event != INVALID_HANDLE_VALUE); - - /* Always reset _cache_add_trigger before filling up the array again. */ - ResetEvent (_cache_add_trigger); - - EnterCriticalSection (&_cache_write_access); - - size_t index = 0; - - for (class process *ptr = _processes_head; ptr; ptr = ptr->_next) - { - assert (ptr->_hProcess && ptr->_hProcess != INVALID_HANDLE_VALUE); - assert (ptr->is_active ()); - - _wait_array[index] = ptr->handle (); - _process_array[index++] = ptr; - - if (!ptr->_next || index % 64 == 62) - { - /* Added at the end of each thread's array part for efficiency. */ - _wait_array[index] = interrupt_event; - _process_array[index++] = NULL; - _wait_array[index] = _cache_add_trigger; - _process_array[index++] = NULL; - } - } - - if (!index) - { - /* To get at least *something* to wait for. */ - _wait_array[index] = interrupt_event; - _process_array[index++] = NULL; - _wait_array[index] = _cache_add_trigger; - _process_array[index++] = NULL; - } - - assert (index <= elements (_wait_array)); - - LeaveCriticalSection (&_cache_write_access); - - return index; -} - -void -process_cache::check_and_remove_process (const size_t index) -{ - assert (this); - assert (index < elements (_wait_array) - SPECIALS_COUNT); - - class process *const process = _process_array[index]; - - assert (process); - assert (process->handle () == _wait_array[index]); - - if (process->check_exit_code () == STILL_ACTIVE) - return; - - debug_printf ("process %d(%lu) has left the building ($? = %lu)", - process->_cygpid, process->_winpid, process->_exit_status); - - /* Unlink the process object from the process list. */ - - EnterCriticalSection (&_cache_write_access); - - class process *previous = NULL; - - const class process *const tmp = find (process->_winpid, &previous); - - assert (tmp == process); - assert (previous ? previous->_next == process : _processes_head == process); - - if (previous) - previous->_next = process->_next; - else - _processes_head = process->_next; - - _processes_count -= 1; - LeaveCriticalSection (&_cache_write_access); - - /* Schedule any cleanup tasks for this process. */ - _queue.add (new process_cleanup (process)); -} - -class process * -process_cache::find (const DWORD winpid, class process **previous) -{ - if (previous) - *previous = NULL; - - for (class process *ptr = _processes_head; ptr; ptr = ptr->_next) - if (ptr->_winpid == winpid) - return ptr; - else if (ptr->_winpid > winpid) // The list is sorted by winpid. - return NULL; - else if (previous) - *previous = ptr; - - return NULL; -} - -/*****************************************************************************/ -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/process.h b/winsup/cygserver/process.h deleted file mode 100644 index 3de11b6f8..000000000 --- a/winsup/cygserver/process.h +++ /dev/null @@ -1,179 +0,0 @@ -/* process.h - - Copyright 2001, 2002, 2003, 2004, 2005, 2012 Red Hat Inc. - - Written by Robert Collins - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifndef _PROCESS_H -#define _PROCESS_H - -#include - -#include "threaded_queue.h" - -class process_cleanup : public queue_request -{ -public: - process_cleanup (class process *const theprocess) - : _process (theprocess) - { - assert (_process); - } - - virtual ~process_cleanup (); - - virtual void process (); - -private: - class process *const _process; -}; - -class process; - -class cleanup_routine -{ - friend class process; - -public: - cleanup_routine (void *const key) - : _key (key), - _next (NULL) - {} - - virtual ~cleanup_routine () = 0; - - bool operator== (const cleanup_routine &rhs) const - { - return _key == rhs._key; - } - - void *key () const { return _key; } - - /* MUST BE SYNCHRONOUS */ - virtual void cleanup (class process *) = 0; - -private: - void *const _key; - cleanup_routine *_next; -}; - -class process_cache; - -#define hold() _hold(__FILE__,__LINE__) -#define release() _release(__FILE__,__LINE__) - -class process -{ - friend class process_cache; - friend class process_cleanup; - -public: - process (pid_t cygpid, DWORD winpid, - HANDLE signal_arrived = INVALID_HANDLE_VALUE); - ~process (); - - pid_t cygpid () const { return _cygpid; } - DWORD winpid () const { return _winpid; } - HANDLE handle () const { return _hProcess; } - HANDLE signal_arrived () const { return _signal_arrived; } - - bool is_active () const { return _exit_status == STILL_ACTIVE; } - - void _hold (const char *file, int line) { - _log (file, line, LOG_DEBUG, "Try hold(%lu)", _cygpid); - EnterCriticalSection (&_access); - _log (file, line, LOG_DEBUG, "holding (%lu)", _cygpid); - } - void _release (const char *file, int line) { - _log (file, line, LOG_DEBUG, "leaving (%lu)", _cygpid); - LeaveCriticalSection (&_access); - } - - bool add (cleanup_routine *); - bool remove (const cleanup_routine *); - -private: - const pid_t _cygpid; - const DWORD _winpid; - HANDLE _hProcess; - HANDLE _signal_arrived; - LONG _cleaning_up; - DWORD _exit_status; // Set in the constructor and in exit_code (). - cleanup_routine *_routines_head; - /* used to prevent races-on-delete */ - CRITICAL_SECTION _access; - class process *_next; - - DWORD check_exit_code (); - void cleanup (); -}; - -class process_cache -{ - // Number of special (i.e., non-process) handles in _wait_array. - // See wait_for_processes () and sync_wait_array () for details. - enum { - SPECIALS_COUNT = 2 - }; - - class submission_loop : public queue_submission_loop - { - public: - submission_loop (process_cache *const cache, threaded_queue *const queue) - : queue_submission_loop (queue, true), - _cache (cache) - { - assert (_cache); - } - - private: - process_cache *const _cache; - - virtual void request_loop (); - }; - - friend class submission_loop; - -public: - process_cache (const size_t max_procs, const unsigned int initial_workers); - ~process_cache (); - - class process *process (pid_t cygpid, DWORD winpid, - HANDLE signal_arrived = INVALID_HANDLE_VALUE); - - bool running () const { return _queue.running (); } - - bool start () { return _queue.start (); } - bool stop () { return _queue.stop (); } - -private: - threaded_queue _queue; - submission_loop _submitter; - - size_t _processes_count; - size_t _max_process_count; - class process *_processes_head; // A list sorted by winpid. - - // Access to the _wait_array and related fields is not thread-safe, - // since they are used solely by wait_for_processes () and its callees. - - HANDLE _wait_array[5 * MAXIMUM_WAIT_OBJECTS]; - class process *_process_array[5 * MAXIMUM_WAIT_OBJECTS]; - - HANDLE _cache_add_trigger; // Actually both add and remove. - CRITICAL_SECTION _cache_write_access; // Actually both read and write access. - - void wait_for_processes (HANDLE interrupt); - size_t sync_wait_array (HANDLE interrupt); - void check_and_remove_process (const size_t index); - - class process *find (DWORD winpid, class process **previous = NULL); -}; - -#endif /* _PROCESS_H */ diff --git a/winsup/cygserver/sem.cc b/winsup/cygserver/sem.cc deleted file mode 100644 index 55cd6e51e..000000000 --- a/winsup/cygserver/sem.cc +++ /dev/null @@ -1,107 +0,0 @@ -/* sem.cc: Single unix specification IPC interface for Cygwin. - - Copyright 2003, 2004, 2012 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" - -#include -#include -#include -#include -#include -#include - -#include "cygserver.h" -#include "process.h" -#include "transport.h" - -#include "cygserver_ipc.h" -#include "cygserver_sem.h" - -client_request_sem::client_request_sem () - : client_request (CYGSERVER_REQUEST_SEM, - &_parameters, sizeof (_parameters)) -{ -} - -void -client_request_sem::serve (transport_layer_base *const conn, - process_cache *const cache) -{ - if (msglen () != sizeof (_parameters.in)) - { - syscall_printf ("bad request body length: expecting %lu bytes, got %lu", - sizeof (_parameters), msglen ()); - error_code (EINVAL); - msglen (0); - return; - } - if (support_semaphores == TUN_FALSE) - { - syscall_printf ("Semaphore support not started"); - error_code (ENOSYS); - _parameters.out.ret = -1; - msglen (sizeof (_parameters.out)); - return; - } - process *const client = cache->process (_parameters.in.ipcblk.cygpid, - _parameters.in.ipcblk.winpid, - _parameters.in.ipcblk.signal_arrived); - if (!client) - { - error_code (EAGAIN); - msglen (0); - return; - } - if (!conn->impersonate_client ()) - { - client->release (); - error_code (EACCES); - msglen (0); - return; - } - if (!adjust_identity_info (&_parameters.in.ipcblk)) - { - client->release (); - conn->revert_to_self (); - error_code (EACCES); - msglen (0); - return; - } - /* Early revert_to_self since IPC code runs in kernel mode. */ - conn->revert_to_self (); - /* sysv_sem.cc takes care of itself. */ - client->release (); - thread td = { client, &_parameters.in.ipcblk, {-1, -1} }; - int res; - switch (_parameters.in.semop) - { - case SEMOP_semctl: - res = semctl (&td, &_parameters.in.ctlargs); - break; - case SEMOP_semget: - res = semget (&td, &_parameters.in.getargs); - break; - case SEMOP_semop: - res = semop (&td, &_parameters.in.opargs); - break; - default: - res = ENOSYS; - td.td_retval[0] = -1; - break; - } - /* Allocated by the call to adjust_identity_info(). */ - if (_parameters.in.ipcblk.gidlist) - free (_parameters.in.ipcblk.gidlist); - error_code (res); - _parameters.out.ret = td.td_retval[0]; - msglen (sizeof (_parameters.out)); -} -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/setpwd.cc b/winsup/cygserver/setpwd.cc deleted file mode 100644 index 8125fd25a..000000000 --- a/winsup/cygserver/setpwd.cc +++ /dev/null @@ -1,104 +0,0 @@ -/* setpwd.cc: Set LSA private data password for current user. - - Copyright 2008 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "ntdll.h" - -#include "cygserver.h" -#include "process.h" -#include "transport.h" - -#include "cygserver_setpwd.h" - -client_request_setpwd::client_request_setpwd () - : client_request (CYGSERVER_REQUEST_SETPWD, - &_parameters, sizeof (_parameters)) -{ -} - -void -client_request_setpwd::serve (transport_layer_base *const conn, - process_cache *const cache) -{ - HANDLE tok; - PTOKEN_USER user; - WCHAR sidbuf[128], key_name [128 + wcslen (CYGWIN_LSA_KEY_PREFIX)]; - UNICODE_STRING sid, key, data; - - syscall_printf ("Request to set private data"); - if (msglen () != sizeof (_parameters.in)) - { - syscall_printf ("bad request body length: expecting %lu bytes, got %lu", - sizeof (_parameters), msglen ()); - error_code (EINVAL); - msglen (0); - return; - } - msglen (0); - if (!conn->impersonate_client ()) - { - error_code (EACCES); - return; - } - if (!OpenThreadToken (GetCurrentThread (), TOKEN_READ, TRUE, &tok)) - { - conn->revert_to_self (); - error_code (EACCES); - return; - } - /* Get uid from user SID in token. */ - user = (PTOKEN_USER) get_token_info (tok, TokenUser); - CloseHandle (tok); - conn->revert_to_self (); - if (!user) - { - error_code (EACCES); - return; - } - LSA_OBJECT_ATTRIBUTES oa = { 0, 0, 0, 0, 0, 0 }; - HANDLE lsa; - NTSTATUS status = LsaOpenPolicy (NULL, &oa, POLICY_CREATE_SECRET, &lsa); - if (!NT_SUCCESS (status)) - { - error_code (LsaNtStatusToWinError (status)); - return; - } - RtlInitEmptyUnicodeString (&sid, sidbuf, sizeof sidbuf); - RtlConvertSidToUnicodeString (&sid, user->User.Sid, FALSE); - free (user); - RtlInitEmptyUnicodeString (&key, key_name, sizeof key_name); - RtlAppendUnicodeToString (&key, CYGWIN_LSA_KEY_PREFIX); - RtlAppendUnicodeStringToString (&key, &sid); - RtlInitUnicodeString (&data, _parameters.in.passwd); - status = LsaStorePrivateData (lsa, &key, data.Length ? &data : NULL); - if (data.Length) - memset (data.Buffer, 0, data.Length); - /* Success or we're trying to remove a password entry which doesn't exist. */ - if (NT_SUCCESS (status) - || (data.Length == 0 && status == STATUS_OBJECT_NAME_NOT_FOUND)) - error_code (0); - else - error_code (LsaNtStatusToWinError (status)); - syscall_printf ("Request to set private data returns error %d", error_code ()); - LsaClose (lsa); -} -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/shm.cc b/winsup/cygserver/shm.cc deleted file mode 100644 index 3be0d15f4..000000000 --- a/winsup/cygserver/shm.cc +++ /dev/null @@ -1,124 +0,0 @@ -/* shm.cc: Single unix specification IPC interface for Cygwin. - - Copyright 2003, 2004, 2012 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" - -#include -#include -#include -#include -#include -#include - -#include "cygserver.h" -#include "process.h" -#include "transport.h" - -#include "cygserver_ipc.h" -#include "cygserver_shm.h" - -client_request_shm::client_request_shm () - : client_request (CYGSERVER_REQUEST_SHM, - &_parameters, sizeof (_parameters)) -{ -} - -void -client_request_shm::serve (transport_layer_base *const conn, - process_cache *const cache) -{ - if (msglen () != sizeof (_parameters.in)) - { - syscall_printf ("bad request body length: expecting %lu bytes, got %lu", - sizeof (_parameters), msglen ()); - error_code (EINVAL); - msglen (0); - return; - } - if (support_sharedmem == TUN_FALSE) - { - syscall_printf ("Shared memory support not started"); - error_code (ENOSYS); - if (_parameters.in.shmop == SHMOP_shmat) - _parameters.out.ptr = (vm_offset_t)0; - else - _parameters.out.ret = -1; - msglen (sizeof (_parameters.out)); - return; - } - process *const client = cache->process (_parameters.in.ipcblk.cygpid, - _parameters.in.ipcblk.winpid, - _parameters.in.ipcblk.signal_arrived); - if (!client) - { - error_code (EAGAIN); - msglen (0); - return; - } - if (!conn->impersonate_client ()) - { - client->release (); - error_code (EACCES); - msglen (0); - return; - } - if (!adjust_identity_info (&_parameters.in.ipcblk)) - { - client->release (); - conn->revert_to_self (); - error_code (EACCES); - msglen (0); - return; - } - /* Early revert_to_self since IPC code runs in kernel mode. */ - conn->revert_to_self (); - /* sysv_shm.cc takes care of itself. */ - client->release (); - thread td = { client, &_parameters.in.ipcblk, {0, 0} }; - int res; - shmop_t shmop = _parameters.in.shmop; /* Get's overwritten otherwise. */ - switch (shmop) - { - case SHMOP_shmat: - ipc_p_vmspace (td.ipcblk); - res = shmat (&td, &_parameters.in.atargs); - break; - case SHMOP_shmctl: - res = shmctl (&td, &_parameters.in.ctlargs); - break; - case SHMOP_shmdt: - ipc_p_vmspace (td.ipcblk); - res = shmdt (&td, &_parameters.in.dtargs); - break; - case SHMOP_shmget: - res = shmget (&td, &_parameters.in.getargs); - break; - case SHMOP_shmfork: - res = cygwin_shmfork_myhook (&td, &_parameters.in.forkargs); - break; - default: - res = ENOSYS; - td.td_retval[0] = -1; - break; - } - /* Allocated by the call to adjust_identity_info(). */ - if (_parameters.in.ipcblk.gidlist) - free (_parameters.in.ipcblk.gidlist); - error_code (res); - if (shmop == SHMOP_shmat) - _parameters.out.ptr = td.td_retval[0]; - else - _parameters.out.ret = td.td_retval[0]; - if (shmop == SHMOP_shmget) - _parameters.out.obj = td.td_retval[1]; - msglen (sizeof (_parameters.out)); -} -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/sysv_msg.cc b/winsup/cygserver/sysv_msg.cc deleted file mode 100644 index 217cc1d97..000000000 --- a/winsup/cygserver/sysv_msg.cc +++ /dev/null @@ -1,1215 +0,0 @@ -/* - * Implementation of SVID messages - * - * Author: Daniel Boulet - * - * Copyright 1993 Daniel Boulet and RTMX Inc. - * - * This system call was implemented by Daniel Boulet under contract from RTMX. - * - * Redistribution and use in source forms, with and without modification, - * are permitted provided that this entire comment appears intact. - * - * Redistribution in binary form may occur without any restrictions. - * Obviously, it would be nice if you gave credit where credit is due - * but requiring it would be too onerous. - * - * This software is provided ``AS IS'' without any warranties of any kind. - */ - -/* - * This file is heavily changed to become part of Cygwin's cygserver. - */ - -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" -#include -#ifndef __FBSDID -#define __FBSDID(s) const char version[] = (s) -#endif -__FBSDID("$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/kern/sysv_msg.c,v 1.52 2003/11/07 04:47:14 rwatson Exp $"); -/* CV, 2006-01-09: Inspected upstream up to version 1.60. */ - -#define _KERNEL 1 -#define __BSD_VISIBLE 1 -#include -#include -#include -#include -#include -#include -#include -#include -#include "cygserver.h" -#include "process.h" -#include "cygserver_ipc.h" - -#ifdef __CYGWIN__ -#define MSG_DEBUG -#endif /* __CYGWIN__ */ - -#ifdef MSG_DEBUG -#define DPRINTF(a) debug_printf a -#else -#define DPRINTF(a) -#endif - -static void msg_freehdr(struct msg *msghdr); - -#ifndef __CYGWIN__ -int msgctl(struct thread *, struct msgctl_args *); -int msgget(struct thread *, struct msgget_args *); -int msgsnd(struct thread *, struct msgsnd_args *); -int msgrcv(struct thread *, struct msgrcv_args *); - -static sy_call_t *msgcalls[] = { - (sy_call_t *)msgctl, (sy_call_t *)msgget, - (sy_call_t *)msgsnd, (sy_call_t *)msgrcv -}; -#endif /* __CYGWIN__ */ - - -struct msg { - struct msg *msg_next; /* next msg in the chain */ - long msg_type; /* type of this message */ - /* >0 -> type of this message */ - /* 0 -> free header */ - u_short msg_ts; /* size of this message */ - short msg_spot; /* location of start of msg in buffer */ -}; - - -#ifndef MSGSSZ -#define MSGSSZ 8 /* Each segment must be 2^N long */ -#endif -#ifndef MSGSEG -#define MSGSEG 2048 /* must be less than 32767 */ -#endif -#define MSGMAX (MSGSSZ*MSGSEG) -#ifndef MSGMNB -#define MSGMNB 2048 /* max # of bytes in a queue */ -#endif -#ifndef MSGMNI -#define MSGMNI 40 -#endif -#ifndef MSGTQL -#define MSGTQL 40 -#endif - -/* - * Based on the configuration parameters described in an SVR2 (yes, two) - * config(1m) man page. - * - * Each message is broken up and stored in segments that are msgssz bytes - * long. For efficiency reasons, this should be a power of two. Also, - * it doesn't make sense if it is less than 8 or greater than about 256. - * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of - * two between 8 and 1024 inclusive (and panic's if it isn't). - */ -struct msginfo msginfo = { - MSGMAX, /* max chars in a message */ - MSGMNB, /* max chars in a queue */ - MSGMNI, /* # of message queue identifiers */ - MSGTQL, /* max messages in system */ - MSGSSZ, /* size of a message segment */ - /* (must be small power of 2 greater than 4) */ - MSGSEG /* number of message segments */ -}; - -/* - * macros to convert between msqid_ds's and msqid's. - * (specific to this implementation) - */ -#define MSQID(ix,ds) ((ix) & 0xffff | (((ds).msg_perm.seq << 16) & 0xffff0000)) -#define MSQID_IX(id) ((id) & 0xffff) -#define MSQID_SEQ(id) (((id) >> 16) & 0xffff) - -/* - * The rest of this file is specific to this particular implementation. - */ - -struct msgmap { - short next; /* next segment in buffer */ - /* -1 -> available */ - /* 0..(MSGSEG-1) -> index of next segment */ -}; - -#define MSG_LOCKED 01000 /* Is this msqid_ds locked? */ - -static int nfree_msgmaps; /* # of free map entries */ -static short free_msgmaps; /* head of linked list of free map entries */ -static struct msg *free_msghdrs;/* list of free msg headers */ -static char *msgpool; /* MSGMAX byte long msg buffer pool */ -static struct msgmap *msgmaps; /* MSGSEG msgmap structures */ -static struct msg *msghdrs; /* MSGTQL msg headers */ -static struct msqid_ds *msqids; /* MSGMNI msqid_ds struct's */ -static struct mtx msq_mtx; /* global mutex for message queues. */ - -#ifdef __CYGWIN__ -static struct msg_info msg_info; -#endif /* __CYGWIN__ */ - -void -msginit() -{ - int i; - - TUNABLE_INT_FETCH("kern.ipc.msgseg", &msginfo.msgseg); - TUNABLE_INT_FETCH("kern.ipc.msgssz", &msginfo.msgssz); - msginfo.msgmax = msginfo.msgseg * msginfo.msgssz; - TUNABLE_INT_FETCH("kern.ipc.msgmnb", &msginfo.msgmnb); - TUNABLE_INT_FETCH("kern.ipc.msgmni", &msginfo.msgmni); - TUNABLE_INT_FETCH("kern.ipc.msgtql", &msginfo.msgtql); - - msgpool = (char *) sys_malloc(msginfo.msgmax, M_MSG, M_WAITOK); - if (msgpool == NULL) - panic("msgpool is NULL"); - msgmaps = (msgmap *) sys_malloc(sizeof(struct msgmap) * msginfo.msgseg, M_MSG, M_WAITOK); - if (msgmaps == NULL) - panic("msgmaps is NULL"); - msghdrs = (msg *) sys_malloc(sizeof(struct msg) * msginfo.msgtql, M_MSG, M_WAITOK); - if (msghdrs == NULL) - panic("msghdrs is NULL"); - msqids = (msqid_ds *) sys_malloc(sizeof(struct msqid_ds) * msginfo.msgmni, M_MSG, M_WAITOK); - if (msqids == NULL) - panic("msqids is NULL"); - - /* - * msginfo.msgssz should be a power of two for efficiency reasons. - * It is also pretty silly if msginfo.msgssz is less than 8 - * or greater than about 256 so ... - */ - - i = 8; - while (i < 1024 && i != msginfo.msgssz) - i <<= 1; - if (i != msginfo.msgssz) { - DPRINTF(("msginfo.msgssz=%d (0x%x)\n", msginfo.msgssz, - msginfo.msgssz)); - panic("msginfo.msgssz not a small power of 2"); - } - - if (msginfo.msgseg > 32767) { - DPRINTF(("msginfo.msgseg=%d\n", msginfo.msgseg)); - panic("msginfo.msgseg > 32767"); - } - - if (msgmaps == NULL) - panic("msgmaps is NULL"); - - for (i = 0; i < msginfo.msgseg; i++) { - if (i > 0) - msgmaps[i-1].next = i; - msgmaps[i].next = -1; /* implies entry is available */ - } - free_msgmaps = 0; - nfree_msgmaps = msginfo.msgseg; - - if (msghdrs == NULL) - panic("msghdrs is NULL"); - - for (i = 0; i < msginfo.msgtql; i++) { - msghdrs[i].msg_type = 0; - if (i > 0) - msghdrs[i-1].msg_next = &msghdrs[i]; - msghdrs[i].msg_next = NULL; - } - free_msghdrs = &msghdrs[0]; - - if (msqids == NULL) - panic("msqids is NULL"); - - for (i = 0; i < msginfo.msgmni; i++) { - msqids[i].msg_qbytes = 0; /* implies entry is available */ - msqids[i].msg_perm.seq = 0; /* reset to a known value */ - msqids[i].msg_perm.mode = 0; - } - mtx_init(&msq_mtx, "msq", NULL, MTX_DEF); -} - -int -msgunload() -{ - struct msqid_ds *msqptr; - int msqid; - - for (msqid = 0; msqid < msginfo.msgmni; msqid++) { - /* - * Look for an unallocated and unlocked msqid_ds. - * msqid_ds's can be locked by msgsnd or msgrcv while - * they are copying the message in/out. We can't - * re-use the entry until they release it. - */ - msqptr = &msqids[msqid]; - if (msqptr->msg_qbytes != 0 || - (msqptr->msg_perm.mode & MSG_LOCKED) != 0) - break; - } -#ifndef __CYGWIN__ - if (msqid != msginfo.msgmni) - return (EBUSY); -#endif /* __CYGWIN__ */ - - sys_free(msgpool, M_MSG); - sys_free(msgmaps, M_MSG); - sys_free(msghdrs, M_MSG); - sys_free(msqids, M_MSG); - mtx_destroy(&msq_mtx); - return (0); -} - - -#ifndef __CYGWIN__ -static int -sysvmsg_modload(struct module *module, int cmd, void *arg) -{ - int error = 0; - - switch (cmd) { - case MOD_LOAD: - msginit(); - break; - case MOD_UNLOAD: - error = msgunload(); - break; - case MOD_SHUTDOWN: - break; - default: - error = EINVAL; - break; - } - return (error); -} - -static moduledata_t sysvmsg_mod = { - "sysvmsg", - &sysvmsg_modload, - NULL -}; - -SYSCALL_MODULE_HELPER(msgsys); -SYSCALL_MODULE_HELPER(msgctl); -SYSCALL_MODULE_HELPER(msgget); -SYSCALL_MODULE_HELPER(msgsnd); -SYSCALL_MODULE_HELPER(msgrcv); - -DECLARE_MODULE(sysvmsg, sysvmsg_mod, - SI_SUB_SYSV_MSG, SI_ORDER_FIRST); -MODULE_VERSION(sysvmsg, 1); - -/* - * Entry point for all MSG calls - * - * MPSAFE - */ -int -msgsys(thread *td, struct msgsys_args *uap) -{ - int error; - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - if (uap->which < 0 || - (unsigned) uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0])) - return (EINVAL); - error = (*msgcalls[uap->which])(td, &uap->a2); - return (error); -} -#endif - -static void -msg_freehdr(struct msg *msghdr) -{ - while (msghdr->msg_ts > 0) { - short next; - if (msghdr->msg_spot < 0 || msghdr->msg_spot >= msginfo.msgseg) - panic("msghdr->msg_spot out of range"); - next = msgmaps[msghdr->msg_spot].next; - msgmaps[msghdr->msg_spot].next = free_msgmaps; - free_msgmaps = msghdr->msg_spot; - nfree_msgmaps++; - msghdr->msg_spot = next; - if (msghdr->msg_ts >= msginfo.msgssz) - msghdr->msg_ts -= msginfo.msgssz; - else - msghdr->msg_ts = 0; - } - if (msghdr->msg_spot != -1) - panic("msghdr->msg_spot != -1"); - msghdr->msg_next = free_msghdrs; - free_msghdrs = msghdr; -} - -#ifndef _SYS_SYSPROTO_H_ -struct msgctl_args { - int msqid; - int cmd; - struct msqid_ds *buf; -}; -#endif - -/* - * MPSAFE - */ -int -msgctl(struct thread *td, struct msgctl_args *uap) -{ - int msqid = uap->msqid; - int cmd = uap->cmd; - struct msqid_ds *user_msqptr = uap->buf; - int rval, error; - struct msqid_ds msqbuf; - register struct msqid_ds *msqptr; - - DPRINTF(("call to msgctl(%d, %d, 0x%x)\n", msqid, cmd, user_msqptr)); - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - -#ifdef __CYGWIN__ - if (cmd == IPC_INFO) { - if (!msqid) { - error = copyout(&msginfo, user_msqptr, - sizeof(struct msginfo)); - td->td_retval[0] = error ? -1 : 0; - return (error); - } - if (msqid > msginfo.msgmni) - msqid = msginfo.msgmni; - error = copyout(msqids, user_msqptr, - msqid * sizeof(struct msqid_ds)); - td->td_retval[0] = error ? -1 : 0; - return (error); - } else if (cmd == MSG_INFO) { - mtx_lock(&msq_mtx); - error = copyout(&msg_info, user_msqptr, - sizeof(struct msg_info)); - td->td_retval[0] = error ? -1 : 0; - mtx_unlock(&msq_mtx); - return (error); - } -#endif /* __CYGWIN__ */ - msqid = IPCID_TO_IX(msqid); - - if (msqid < 0 || msqid >= msginfo.msgmni) { - DPRINTF(("msqid (%d) out of range (0<=msqid<%d)\n", msqid, - msginfo.msgmni)); - return (EINVAL); - } - if (cmd == IPC_SET && - (error = copyin(user_msqptr, &msqbuf, sizeof(msqbuf))) != 0) - return (error); - - msqptr = &msqids[msqid]; - - mtx_lock(&msq_mtx); - if (msqptr->msg_qbytes == 0) { - DPRINTF(("no such msqid\n")); - error = EINVAL; - goto done2; - } - if (msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) { - DPRINTF(("wrong sequence number\n")); - error = EINVAL; - goto done2; - } - - error = 0; - rval = 0; - - switch (cmd) { - - case IPC_RMID: - { - struct msg *msghdr; - if ((error = ipcperm(td, &msqptr->msg_perm, IPC_M))) - goto done2; - /* Free the message headers */ - msghdr = msqptr->msg_first; - while (msghdr != NULL) { - struct msg *msghdr_tmp; - - /* Free the segments of each message */ - msqptr->msg_cbytes -= msghdr->msg_ts; - msqptr->msg_qnum--; - msghdr_tmp = msghdr; - msghdr = msghdr->msg_next; - msg_freehdr(msghdr_tmp); - } - - if (msqptr->msg_cbytes != 0) - panic("msg_cbytes is screwed up"); - if (msqptr->msg_qnum != 0) - panic("msg_qnum is screwed up"); - - msqptr->msg_qbytes = 0; /* Mark it as free */ -#ifdef __CYGWIN__ - msg_info.msg_ids--; -#endif /* __CYGWIN__ */ - - wakeup(msqptr); - } - - break; - - case IPC_SET: - if ((error = ipcperm(td, &msqptr->msg_perm, IPC_M))) - goto done2; - if (msqbuf.msg_qbytes > msqptr->msg_qbytes) { - error = suser(td); - if (error) - goto done2; - } - if (msqbuf.msg_qbytes > (unsigned long) msginfo.msgmnb) { - DPRINTF(("can't increase msg_qbytes beyond %d" - "(truncating)\n", msginfo.msgmnb)); - msqbuf.msg_qbytes = msginfo.msgmnb; /* silently restrict qbytes to system limit */ - } - if (msqbuf.msg_qbytes == 0) { - DPRINTF(("can't reduce msg_qbytes to 0\n")); - error = EINVAL; /* non-standard errno! */ - goto done2; - } - msqptr->msg_perm.uid = msqbuf.msg_perm.uid; /* change the owner */ - msqptr->msg_perm.gid = msqbuf.msg_perm.gid; /* change the owner */ - msqptr->msg_perm.mode = (msqptr->msg_perm.mode & ~0777) | - (msqbuf.msg_perm.mode & 0777); - msqptr->msg_qbytes = msqbuf.msg_qbytes; - msqptr->msg_ctime = time (NULL); - break; - - case IPC_STAT: - if ((error = ipcperm(td, &msqptr->msg_perm, IPC_R))) { - DPRINTF(("requester doesn't have read access\n")); - goto done2; - } - break; - - default: - DPRINTF(("invalid command %d\n", cmd)); - error = EINVAL; - goto done2; - } - - if (error == 0) - td->td_retval[0] = rval; -done2: - mtx_unlock(&msq_mtx); - if (cmd == IPC_STAT && error == 0) - error = copyout(msqptr, user_msqptr, sizeof(struct msqid_ds)); - return(error); -} - -#ifndef _SYS_SYSPROTO_H_ -struct msgget_args { - key_t key; - int msgflg; -}; -#endif - -/* - * MPSAFE - */ -int -msgget(struct thread *td, struct msgget_args *uap) -{ - int msqid, error = 0; - key_t key = uap->key; - unsigned msgflg = uap->msgflg; - register struct msqid_ds *msqptr = NULL; - - DPRINTF(("msgget(0x%x, 0%o)\n", key, msgflg)); - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - - mtx_lock(&msq_mtx); - if (key != IPC_PRIVATE) { - for (msqid = 0; msqid < msginfo.msgmni; msqid++) { - msqptr = &msqids[msqid]; - if (msqptr->msg_qbytes != 0 && - msqptr->msg_perm.key == key) - break; - } - if (msqid < msginfo.msgmni) { - DPRINTF(("found public key\n")); - if ((msgflg & IPC_CREAT) && (msgflg & IPC_EXCL)) { - DPRINTF(("not exclusive\n")); - error = EEXIST; - goto done2; - } - if ((error = ipcperm(td, &msqptr->msg_perm, msgflg & 0700))) { - DPRINTF(("requester doesn't have 0%o access\n", - msgflg & 0700)); - goto done2; - } - goto found; - } - } - - DPRINTF(("need to allocate the msqid_ds\n")); - if (key == IPC_PRIVATE || (msgflg & IPC_CREAT)) { - for (msqid = 0; msqid < msginfo.msgmni; msqid++) { - /* - * Look for an unallocated and unlocked msqid_ds. - * msqid_ds's can be locked by msgsnd or msgrcv while - * they are copying the message in/out. We can't - * re-use the entry until they release it. - */ - msqptr = &msqids[msqid]; - if (msqptr->msg_qbytes == 0 && - (msqptr->msg_perm.mode & MSG_LOCKED) == 0) - break; - } - if (msqid == msginfo.msgmni) { - DPRINTF(("no more msqid_ds's available\n")); - error = ENOSPC; - goto done2; - } - DPRINTF(("msqid %d is available\n", msqid)); - msqptr->msg_perm.key = key; -#ifdef __CYGWIN__ - msqptr->msg_perm.cuid = td->ipcblk->uid; - msqptr->msg_perm.uid = td->ipcblk->uid; - msqptr->msg_perm.cgid = td->ipcblk->gid; - msqptr->msg_perm.gid = td->ipcblk->gid; -#else - msqptr->msg_perm.cuid = cred->cr_uid; - msqptr->msg_perm.uid = cred->cr_uid; - msqptr->msg_perm.cgid = cred->cr_gid; - msqptr->msg_perm.gid = cred->cr_gid; -#endif /* __CYGWIN__ */ - msqptr->msg_perm.mode = (msgflg & 0777); - /* Make sure that the returned msqid is unique */ - msqptr->msg_perm.seq = (msqptr->msg_perm.seq + 1) & 0x7fff; - msqptr->msg_first = NULL; - msqptr->msg_last = NULL; - msqptr->msg_cbytes = 0; - msqptr->msg_qnum = 0; - msqptr->msg_qbytes = msginfo.msgmnb; - msqptr->msg_lspid = 0; - msqptr->msg_lrpid = 0; - msqptr->msg_stime = 0; - msqptr->msg_rtime = 0; - msqptr->msg_ctime = time (NULL); -#ifdef __CYGWIN__ - msg_info.msg_ids++; -#endif /* __CYGWIN__ */ - } else { - DPRINTF(("didn't find it and wasn't asked to create it\n")); - error = ENOENT; - goto done2; - } - -found: - /* Construct the unique msqid */ - td->td_retval[0] = IXSEQ_TO_IPCID(msqid, msqptr->msg_perm); -done2: - mtx_unlock(&msq_mtx); - return (error); -} - -#ifndef _SYS_SYSPROTO_H_ -struct msgsnd_args { - int msqid; - const void *msgp; - size_t msgsz; - int msgflg; -}; -#endif - -/* - * MPSAFE - */ -int -msgsnd(struct thread *td, struct msgsnd_args *uap) -{ - int msqid = uap->msqid; - const void *user_msgp = uap->msgp; - size_t msgsz = uap->msgsz; - int msgflg = uap->msgflg; - int segs_needed, error = 0; - register struct msqid_ds *msqptr; - register struct msg *msghdr; - short next; - - DPRINTF(("call to msgsnd(%d, 0x%x, %d, %d)\n", msqid, user_msgp, msgsz, - msgflg)); - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - - mtx_lock(&msq_mtx); - msqid = IPCID_TO_IX(msqid); - - if (msqid < 0 || msqid >= msginfo.msgmni) { - DPRINTF(("msqid (%d) out of range (0<=msqid<%d)\n", msqid, - msginfo.msgmni)); - error = EINVAL; - goto done2; - } - - msqptr = &msqids[msqid]; - if (msqptr->msg_qbytes == 0) { - DPRINTF(("no such message queue id\n")); - error = EINVAL; - goto done2; - } - if (msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) { - DPRINTF(("wrong sequence number\n")); - error = EINVAL; - goto done2; - } - - if ((error = ipcperm(td, &msqptr->msg_perm, IPC_W))) { - DPRINTF(("requester doesn't have write access\n")); - goto done2; - } - - segs_needed = (msgsz + msginfo.msgssz - 1) / msginfo.msgssz; - DPRINTF(("msgsz=%d, msgssz=%d, segs_needed=%d\n", msgsz, msginfo.msgssz, - segs_needed)); - for (;;) { - int need_more_resources = 0; - - /* - * check msgsz - * (inside this loop in case msg_qbytes changes while we sleep) - */ - - if (msgsz > msqptr->msg_qbytes) { - DPRINTF(("msgsz > msqptr->msg_qbytes\n")); - error = EINVAL; - goto done2; - } - - if (msqptr->msg_perm.mode & MSG_LOCKED) { - DPRINTF(("msqid is locked\n")); - need_more_resources = 1; - } - if (msgsz + msqptr->msg_cbytes > msqptr->msg_qbytes) { - DPRINTF(("msgsz + msg_cbytes > msg_qbytes\n")); - need_more_resources = 1; - } - if (segs_needed > nfree_msgmaps) { - DPRINTF(("segs_needed > nfree_msgmaps\n")); - need_more_resources = 1; - } - if (free_msghdrs == NULL) { - DPRINTF(("no more msghdrs\n")); - need_more_resources = 1; - } - - if (need_more_resources) { - int we_own_it; - - if ((msgflg & IPC_NOWAIT) != 0) { - DPRINTF(("need more resources but caller " - "doesn't want to wait\n")); - error = EAGAIN; - goto done2; - } - - if ((msqptr->msg_perm.mode & MSG_LOCKED) != 0) { - DPRINTF(("we don't own the msqid_ds\n")); - we_own_it = 0; - } else { - /* Force later arrivals to wait for our - request */ - DPRINTF(("we own the msqid_ds\n")); - msqptr->msg_perm.mode |= MSG_LOCKED; - we_own_it = 1; - } - DPRINTF(("goodnight\n")); - error = msleep(msqptr, &msq_mtx, (PZERO - 4) | PCATCH, - "msgsnd", 50); - DPRINTF(("good morning, error=%d\n", error)); - if (we_own_it) - msqptr->msg_perm.mode &= ~MSG_LOCKED; - if (error == EWOULDBLOCK) { - DPRINTF(("timed out\n")); - continue; - } - if (error != 0) { - DPRINTF(("msgsnd: interrupted system call\n")); -#ifdef __CYGWIN__ - if (error != EIDRM) -#endif /* __CYGWIN__ */ - error = EINTR; - goto done2; - } - - /* - * Make sure that the msq queue still exists - */ - - if (msqptr->msg_qbytes == 0) { - DPRINTF(("msqid deleted\n")); - error = EIDRM; - goto done2; - } - - } else { - DPRINTF(("got all the resources that we need\n")); - break; - } - } - - /* - * We have the resources that we need. - * Make sure! - */ - - if (msqptr->msg_perm.mode & MSG_LOCKED) - panic("msg_perm.mode & MSG_LOCKED"); - if (segs_needed > nfree_msgmaps) - panic("segs_needed > nfree_msgmaps"); - if (msgsz + msqptr->msg_cbytes > msqptr->msg_qbytes) - panic("msgsz + msg_cbytes > msg_qbytes"); - if (free_msghdrs == NULL) - panic("no more msghdrs"); - - /* - * Re-lock the msqid_ds in case we page-fault when copying in the - * message - */ - - if ((msqptr->msg_perm.mode & MSG_LOCKED) != 0) - panic("msqid_ds is already locked"); - msqptr->msg_perm.mode |= MSG_LOCKED; - - /* - * Allocate a message header - */ - - msghdr = free_msghdrs; - free_msghdrs = msghdr->msg_next; - msghdr->msg_spot = -1; - msghdr->msg_ts = msgsz; - - /* - * Allocate space for the message - */ - - while (segs_needed > 0) { - if (nfree_msgmaps <= 0) - panic("not enough msgmaps"); - if (free_msgmaps == -1) - panic("nil free_msgmaps"); - next = free_msgmaps; - if (next <= -1) - panic("next too low #1"); - if (next >= msginfo.msgseg) - panic("next out of range #1"); - DPRINTF(("allocating segment %d to message\n", next)); - free_msgmaps = msgmaps[next].next; - nfree_msgmaps--; - msgmaps[next].next = msghdr->msg_spot; - msghdr->msg_spot = next; - segs_needed--; - } - - /* - * Copy in the message type - */ - - mtx_unlock(&msq_mtx); - if ((error = copyin(user_msgp, &msghdr->msg_type, - sizeof(msghdr->msg_type))) != 0) { - mtx_lock(&msq_mtx); - DPRINTF(("error %d copying the message type\n", error)); - msg_freehdr(msghdr); - msqptr->msg_perm.mode &= ~MSG_LOCKED; - wakeup(msqptr); - goto done2; - } - mtx_lock(&msq_mtx); - user_msgp = (const char *)user_msgp + sizeof(msghdr->msg_type); - - /* - * Validate the message type - */ - - if (msghdr->msg_type < 1) { - msg_freehdr(msghdr); - msqptr->msg_perm.mode &= ~MSG_LOCKED; - wakeup(msqptr); - DPRINTF(("mtype (%d) < 1\n", msghdr->msg_type)); - error = EINVAL; - goto done2; - } - - /* - * Copy in the message body - */ - - next = msghdr->msg_spot; - while (msgsz > 0) { - size_t tlen; - if (msgsz > (unsigned long) msginfo.msgssz) - tlen = msginfo.msgssz; - else - tlen = msgsz; - if (next <= -1) - panic("next too low #2"); - if (next >= msginfo.msgseg) - panic("next out of range #2"); - mtx_unlock(&msq_mtx); - if ((error = copyin(user_msgp, &msgpool[next * msginfo.msgssz], - tlen)) != 0) { - mtx_lock(&msq_mtx); - DPRINTF(("error %d copying in message segment\n", - error)); - msg_freehdr(msghdr); - msqptr->msg_perm.mode &= ~MSG_LOCKED; - wakeup(msqptr); - goto done2; - } - mtx_lock(&msq_mtx); - msgsz -= tlen; - user_msgp = (const char *)user_msgp + tlen; - next = msgmaps[next].next; - } - if (next != -1) - panic("didn't use all the msg segments"); - - /* - * We've got the message. Unlock the msqid_ds. - */ - - msqptr->msg_perm.mode &= ~MSG_LOCKED; - - /* - * Make sure that the msqid_ds is still allocated. - */ - - if (msqptr->msg_qbytes == 0) { - msg_freehdr(msghdr); - wakeup(msqptr); - error = EIDRM; - goto done2; - } - - /* - * Put the message into the queue - */ - - if (msqptr->msg_first == NULL) { - msqptr->msg_first = msghdr; - msqptr->msg_last = msghdr; - } else { - msqptr->msg_last->msg_next = msghdr; - msqptr->msg_last = msghdr; - } - msqptr->msg_last->msg_next = NULL; - - msqptr->msg_cbytes += msghdr->msg_ts; - msqptr->msg_qnum++; - msqptr->msg_lspid = td->td_proc->p_pid; - msqptr->msg_stime = time (NULL); - -#ifdef __CYGWIN__ - msg_info.msg_num++; - msg_info.msg_tot += uap->msgsz; -#endif /* __CYGWIN__ */ - - wakeup(msqptr); - td->td_retval[0] = 0; -done2: - mtx_unlock(&msq_mtx); - return (error); -} - -#ifndef _SYS_SYSPROTO_H_ -struct msgrcv_args { - int msqid; - void *msgp; - size_t msgsz; - long msgtyp; - int msgflg; -}; -#endif - -/* - * MPSAFE - */ -int -msgrcv(struct thread *td, struct msgrcv_args *uap) -{ - int msqid = uap->msqid; - void *user_msgp = uap->msgp; - size_t msgsz = uap->msgsz; - long msgtyp = uap->msgtyp; - int msgflg = uap->msgflg; - size_t len; - register struct msqid_ds *msqptr; - register struct msg *msghdr; - int error = 0; - short next; - - DPRINTF(("call to msgrcv(%d, 0x%x, %d, %ld, %d)\n", msqid, user_msgp, - msgsz, msgtyp, msgflg)); - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - - msqid = IPCID_TO_IX(msqid); - - if (msqid < 0 || msqid >= msginfo.msgmni) { - DPRINTF(("msqid (%d) out of range (0<=msqid<%d)\n", msqid, - msginfo.msgmni)); - return (EINVAL); - } - - msqptr = &msqids[msqid]; - mtx_lock(&msq_mtx); - if (msqptr->msg_qbytes == 0) { - DPRINTF(("no such message queue id\n")); - error = EINVAL; - goto done2; - } - if (msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) { - DPRINTF(("wrong sequence number\n")); - error = EINVAL; - goto done2; - } - - if ((error = ipcperm(td, &msqptr->msg_perm, IPC_R))) { - DPRINTF(("requester doesn't have read access\n")); - goto done2; - } - - msghdr = NULL; - while (msghdr == NULL) { - if (msgtyp == 0) { - msghdr = msqptr->msg_first; - if (msghdr != NULL) { - if (msgsz < msghdr->msg_ts && - (msgflg & MSG_NOERROR) == 0) { - DPRINTF(("first message on the queue " - "is too big (want %d, got %d)\n", - msgsz, msghdr->msg_ts)); - error = E2BIG; - goto done2; - } - if (msqptr->msg_first == msqptr->msg_last) { - msqptr->msg_first = NULL; - msqptr->msg_last = NULL; - } else { - msqptr->msg_first = msghdr->msg_next; - if (msqptr->msg_first == NULL) - panic("msg_first/last screwed up #1"); - } - } - } else { - struct msg *previous; - struct msg **prev; - - previous = NULL; - prev = &(msqptr->msg_first); - while ((msghdr = *prev) != NULL) { - /* - * Is this message's type an exact match or is - * this message's type less than or equal to - * the absolute value of a negative msgtyp? - * Note that the second half of this test can - * NEVER be true if msgtyp is positive since - * msg_type is always positive! - */ - - if (msgtyp == msghdr->msg_type || - msghdr->msg_type <= -msgtyp) { - DPRINTF(("found message type %d, " - "requested %d\n", - msghdr->msg_type, msgtyp)); - if (msgsz < msghdr->msg_ts && - (msgflg & MSG_NOERROR) == 0) { - DPRINTF(("requested message " - "on the queue is too big " - "(want %d, got %d)\n", - msgsz, msghdr->msg_ts)); - error = E2BIG; - goto done2; - } - *prev = msghdr->msg_next; - if (msghdr == msqptr->msg_last) { - if (previous == NULL) { - if (prev != - &msqptr->msg_first) - panic("msg_first/last screwed up #2"); - msqptr->msg_first = - NULL; - msqptr->msg_last = - NULL; - } else { - if (prev == - &msqptr->msg_first) - panic("msg_first/last screwed up #3"); - msqptr->msg_last = - previous; - } - } - break; - } - previous = msghdr; - prev = &(msghdr->msg_next); - } - } - - /* - * We've either extracted the msghdr for the appropriate - * message or there isn't one. - * If there is one then bail out of this loop. - */ - - if (msghdr != NULL) - break; - - /* - * Hmph! No message found. Does the user want to wait? - */ - - if ((msgflg & IPC_NOWAIT) != 0) { - DPRINTF(("no appropriate message found (msgtyp=%d)\n", - msgtyp)); - /* The SVID says to return ENOMSG. */ - error = ENOMSG; - goto done2; - } - - /* - * Wait for something to happen - */ - - DPRINTF(("msgrcv: goodnight\n")); - error = msleep(msqptr, &msq_mtx, (PZERO - 4) | PCATCH, - "msgrcv", 0); - DPRINTF(("msgrcv: good morning (error=%d)\n", error)); - - if (error != 0) { - DPRINTF(("msgrcv: interrupted system call\n")); -#ifdef __CYGWIN__ - if (error != EIDRM) -#endif /* __CYGWIN__ */ - error = EINTR; - goto done2; - } - - /* - * Make sure that the msq queue still exists - */ - - if (msqptr->msg_qbytes == 0 || - msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) { - DPRINTF(("msqid deleted\n")); - error = EIDRM; - goto done2; - } - } - - /* - * Return the message to the user. - * - * First, do the bookkeeping (before we risk being interrupted). - */ - - msqptr->msg_cbytes -= msghdr->msg_ts; - msqptr->msg_qnum--; - msqptr->msg_lrpid = td->td_proc->p_pid; - msqptr->msg_rtime = time (NULL); - - /* - * Make msgsz the actual amount that we'll be returning. - * Note that this effectively truncates the message if it is too long - * (since msgsz is never increased). - */ - - DPRINTF(("found a message, msgsz=%d, msg_ts=%d\n", msgsz, - msghdr->msg_ts)); - if (msgsz > msghdr->msg_ts) - msgsz = msghdr->msg_ts; - - /* - * Return the type to the user. - */ - - mtx_unlock(&msq_mtx); - error = copyout(&(msghdr->msg_type), user_msgp, - sizeof(msghdr->msg_type)); - mtx_lock(&msq_mtx); - if (error != 0) { - DPRINTF(("error (%d) copying out message type\n", error)); - msg_freehdr(msghdr); - wakeup(msqptr); - goto done2; - } - user_msgp = (char *)user_msgp + sizeof(msghdr->msg_type); - - /* - * Return the segments to the user - */ - - next = msghdr->msg_spot; - for (len = 0; len < msgsz; len += msginfo.msgssz) { - size_t tlen; - - if (msgsz - len > (unsigned long) msginfo.msgssz) - tlen = msginfo.msgssz; - else - tlen = msgsz - len; - if (next <= -1) - panic("next too low #3"); - if (next >= msginfo.msgseg) - panic("next out of range #3"); - mtx_unlock(&msq_mtx); - error = copyout(&msgpool[next * msginfo.msgssz], - user_msgp, tlen); - mtx_lock(&msq_mtx); - if (error != 0) { - DPRINTF(("error (%d) copying out message segment\n", - error)); - msg_freehdr(msghdr); - wakeup(msqptr); - goto done2; - } - user_msgp = (char *)user_msgp + tlen; - next = msgmaps[next].next; - } - - /* - * Done, return the actual number of bytes copied out. - */ - -#ifdef __CYGWIN__ - msg_info.msg_num--; - msg_info.msg_tot -= msgsz; -#endif /* __CYGWIN__ */ - - msg_freehdr(msghdr); - wakeup(msqptr); - td->td_retval[0] = msgsz; -done2: - mtx_unlock(&msq_mtx); - return (error); -} - -#ifndef __CYGWIN__ -static int -sysctl_msqids(SYSCTL_HANDLER_ARGS) -{ - - return (SYSCTL_OUT(req, msqids, - sizeof(struct msqid_ds) * msginfo.msgmni)); -} - -SYSCTL_DECL(_kern_ipc); -SYSCTL_INT(_kern_ipc, OID_AUTO, msgmax, CTLFLAG_RD, &msginfo.msgmax, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, msgmni, CTLFLAG_RDTUN, &msginfo.msgmni, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, msgmnb, CTLFLAG_RD, &msginfo.msgmnb, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, msgtql, CTLFLAG_RD, &msginfo.msgtql, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, msgssz, CTLFLAG_RDTUN, &msginfo.msgssz, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, msgseg, CTLFLAG_RDTUN, &msginfo.msgseg, 0, ""); -SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLFLAG_RD, - NULL, 0, sysctl_msqids, "", "Message queue IDs"); -#endif /* __CYGWIN__ */ -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/sysv_sem.cc b/winsup/cygserver/sysv_sem.cc deleted file mode 100644 index e7ba48b61..000000000 --- a/winsup/cygserver/sysv_sem.cc +++ /dev/null @@ -1,1389 +0,0 @@ -/* - * Implementation of SVID semaphores - * - * Author: Daniel Boulet - * - * This software is provided ``AS IS'' without any warranties of any kind. - */ - -/* - * This file is heavily changed to become part of Cygwin's cygserver. - */ - -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" -#include -#include -#include -#ifndef __FBSDID -#define __FBSDID(s) const char version[] = (s) -#endif -__FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/kern/sysv_sem.c,v 1.70 2004/05/30 20:34:58 phk Exp $"); -/* CV, 2006-01-09: Inspected upstream up to version 1.78. */ - -#define _KERNEL 1 -#define __BSD_VISIBLE 1 -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include "cygserver.h" -#include "process.h" -#include "cygserver_ipc.h" -#include - -#ifdef __CYGWIN__ -#define __semctl semctl -#define __semctl_args semctl_args -#define SEM_DEBUG -#endif /* __CYGWIN__ */ - -#ifdef SEM_DEBUG -#define DPRINTF(a) debug_printf a -#else -#define DPRINTF(a) -#endif - -static int semvalid(int semid, struct semid_ds *semaptr); - -static struct sem_undo *semu_alloc(struct thread *td); -static int semundo_adjust(struct thread *td, struct sem_undo **supptr, - int semid, int semnum, int adjval); -static void semundo_clear(int semid, int semnum, struct thread *td); - -#ifndef _SYS_SYSPROTO_H_ -struct __semctl_args; -int __semctl(struct thread *td, struct __semctl_args *uap); -struct semget_args; -int semget(struct thread *td, struct semget_args *uap); -struct semop_args; -int semop(struct thread *td, struct semop_args *uap); -#endif - -#ifndef __CYGWIN__ -/* XXX casting to (sy_call_t *) is bogus, as usual. */ -static sy_call_t *semcalls[] = { - (sy_call_t *)__semctl, (sy_call_t *)semget, - (sy_call_t *)semop -}; -#endif - -static struct mtx sem_mtx; /* semaphore global lock */ -static int semtots = 0; -static int semtot = 0; -static struct semid_ds *sema; /* semaphore id pool */ -static struct mtx *sema_mtx; /* semaphore id pool mutexes*/ -static struct sem *sem; /* semaphore pool */ -static SLIST_HEAD(, sem_undo) semu_list; /* list of active undo structures */ -static int *semu; /* undo structure pool */ -#ifndef __CYGWIN__ -static eventhandler_tag semexit_tag; -#endif /* __CYGWIN__ */ - -#define SEMUNDO_MTX sem_mtx -#define SEMUNDO_LOCK() mtx_lock(&SEMUNDO_MTX); -#define SEMUNDO_HOOKLOCK() _mtx_lock(&SEMUNDO_MTX, p->winpid, __FILE__, __LINE__); -#define SEMUNDO_UNLOCK() mtx_unlock(&SEMUNDO_MTX); -#define SEMUNDO_LOCKASSERT(how,pid) mtx_assert(&SEMUNDO_MTX, (how), (pid)); - -struct sem { - u_short semval; /* semaphore value */ - pid_t sempid; /* pid of last operation */ - u_short semncnt; /* # awaiting semval > cval */ - u_short semzcnt; /* # awaiting semval = 0 */ -}; - -/* - * Undo structure (one per process) - */ -struct undo { - short un_adjval; /* adjust on exit values */ - short un_num; /* semaphore # */ - int un_id; /* semid */ -} un_ent[1]; /* undo entries */ - -struct sem_undo { - SLIST_ENTRY(sem_undo) un_next; /* ptr to next active undo structure */ -#ifdef __CYGWIN__ - DWORD un_proc; /* owner of this structure */ -#else - struct proc *un_proc; /* owner of this structure */ -#endif - short un_cnt; /* # of active entries */ - struct undo un_ent[1]; /* undo entries */ -}; - -/* - * Configuration parameters - */ -#ifndef SEMMNI -#define SEMMNI 10 /* # of semaphore identifiers */ -#endif -#ifndef SEMMNS -#define SEMMNS 60 /* # of semaphores in system */ -#endif -#ifndef SEMUME -#define SEMUME 10 /* max # of undo entries per process */ -#endif -#ifndef SEMMNU -#define SEMMNU 30 /* # of undo structures in system */ -#endif - -/* shouldn't need tuning */ -#ifndef SEMMAP -#define SEMMAP 30 /* # of entries in semaphore map */ -#endif -#ifndef SEMMSL -#define SEMMSL SEMMNS /* max # of semaphores per id */ -#endif -#ifndef SEMOPM -#define SEMOPM 100 /* max # of operations per semop call */ -#endif - -#ifndef SEMVMX -#define SEMVMX 32767 /* semaphore maximum value */ -#endif -#ifndef SEMAEM -#define SEMAEM 16384 /* adjust on exit max value */ -#endif - -#ifdef __CYGWIN__ -/* gcc 3.4 defines a new offsetof which is different for C++. Since this - file is just a derived plain-C file, we need to revert to the plain-C - definition of offsetof. */ -#ifdef offsetof -#undef offsetof -#endif -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif /* __CYGWIN__ */ -/* - * Due to the way semaphore memory is allocated, we have to ensure that - * SEMUSZ is properly aligned. - */ - -#define SEM_ALIGN(bytes) (((bytes) + (sizeof(long) - 1)) & ~(sizeof(long) - 1)) - -/* actual size of an undo structure */ -#define SEMUSZ SEM_ALIGN(offsetof(struct sem_undo, un_ent[SEMUME])) - -/* - * Macro to find a particular sem_undo vector - */ -#define SEMU(ix) \ - ((struct sem_undo *)(((intptr_t)semu)+ix * seminfo.semusz)) - -/* - * semaphore info struct - */ -struct seminfo seminfo = { - SEMMNI, /* # of semaphore identifiers */ - SEMMNS, /* # of semaphores in system */ - SEMMSL, /* max # of semaphores per id */ - SEMOPM, /* max # of operations per semop call */ - SEMMNU, /* # of undo structures in system */ - SEMUME, /* max # of undo entries per process */ - SEMVMX, /* semaphore maximum value */ - SEMAEM, /* adjust on exit max value */ - SEMMAP, /* # of entries in semaphore map */ - SEMUSZ /* size in bytes of undo structure */ -}; - -#ifndef __CYGWIN__ -SYSCTL_DECL(_kern_ipc); -SYSCTL_INT(_kern_ipc, OID_AUTO, semmap, CTLFLAG_RW, &seminfo.semmap, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, semmni, CTLFLAG_RDTUN, &seminfo.semmni, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, semmns, CTLFLAG_RDTUN, &seminfo.semmns, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, semmnu, CTLFLAG_RDTUN, &seminfo.semmnu, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, semmsl, CTLFLAG_RW, &seminfo.semmsl, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, semopm, CTLFLAG_RDTUN, &seminfo.semopm, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, semume, CTLFLAG_RDTUN, &seminfo.semume, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, semusz, CTLFLAG_RDTUN, &seminfo.semusz, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, semvmx, CTLFLAG_RW, &seminfo.semvmx, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, semaem, CTLFLAG_RW, &seminfo.semaem, 0, ""); -SYSCTL_PROC(_kern_ipc, OID_AUTO, sema, CTLFLAG_RD, - NULL, 0, sysctl_sema, "", ""); -#endif /* __CYGWIN__ */ - -void -seminit(void) -{ - int i; - - TUNABLE_INT_FETCH("kern.ipc.semmap", &seminfo.semmap); - TUNABLE_INT_FETCH("kern.ipc.semmni", &seminfo.semmni); - TUNABLE_INT_FETCH("kern.ipc.semmns", &seminfo.semmns); - TUNABLE_INT_FETCH("kern.ipc.semmnu", &seminfo.semmnu); - TUNABLE_INT_FETCH("kern.ipc.semmsl", &seminfo.semmsl); - TUNABLE_INT_FETCH("kern.ipc.semopm", &seminfo.semopm); - TUNABLE_INT_FETCH("kern.ipc.semume", &seminfo.semume); - TUNABLE_INT_FETCH("kern.ipc.semusz", &seminfo.semusz); - TUNABLE_INT_FETCH("kern.ipc.semvmx", &seminfo.semvmx); - TUNABLE_INT_FETCH("kern.ipc.semaem", &seminfo.semaem); - -#ifdef __CYGWIN__ - /* It's too dangerous a setting to leave it alone. - Keep that clean here. */ - seminfo.semusz = SEM_ALIGN(offsetof(struct sem_undo, - un_ent[seminfo.semume])); -#endif /* __CYGWIN__ */ - - sem = (struct sem *) sys_malloc(sizeof(struct sem) * seminfo.semmns, M_SEM, M_WAITOK); - sema = (struct semid_ds *) sys_malloc(sizeof(struct semid_ds) * seminfo.semmni, M_SEM, - M_WAITOK); - sema_mtx = (struct mtx *) sys_malloc(sizeof(struct mtx) * seminfo.semmni, M_SEM, - M_WAITOK | M_ZERO); - semu = (int *) sys_malloc(seminfo.semmnu * seminfo.semusz, M_SEM, M_WAITOK); - - for (i = 0; i < seminfo.semmni; i++) { - sema[i].sem_base = 0; - sema[i].sem_perm.mode = 0; - sema[i].sem_perm.seq = 0; - } - for (i = 0; i < seminfo.semmni; i++) - { - char *buf = (char *) sys_malloc(16, M_SEM, M_WAITOK); - snprintf(buf, 16, "semid[%d]", i); - mtx_init(&sema_mtx[i], buf, NULL, MTX_DEF); - } - for (i = 0; i < seminfo.semmnu; i++) { - struct sem_undo *suptr = SEMU(i); -#ifdef __CYGWIN__ - suptr->un_proc = 0; -#else - suptr->un_proc = NULL; -#endif - } - SLIST_INIT(&semu_list); - mtx_init(&sem_mtx, "sem", NULL, MTX_DEF); -#ifndef __CYGWIN__ - semexit_tag = EVENTHANDLER_REGISTER(process_exit, semexit_myhook, NULL, - EVENTHANDLER_PRI_ANY); -#endif /* __CYGWIN__ */ -} - -int -semunload(void) -{ -#ifndef __CYGWIN__ /* Would result in being unable to shutdown the - server gracefully. */ - if (semtot != 0) - return (EBUSY); - - EVENTHANDLER_DEREGISTER(process_exit, semexit_tag); -#endif /* __CYGWIN__ */ - sys_free(sem, M_SEM); - sys_free(sema, M_SEM); - sys_free(semu, M_SEM); - for (int i = 0; i < seminfo.semmni; i++) { - sys_free((void *) sema_mtx[i].name, M_SEM); - mtx_destroy(&sema_mtx[i]); - } - mtx_destroy(&sem_mtx); - return (0); -} - -#ifndef __CYGWIN__ -static int -sysvsem_modload(struct module *module, int cmd, void *arg) -{ - int error = 0; - - switch (cmd) { - case MOD_LOAD: - seminit(); - break; - case MOD_UNLOAD: - error = semunload(); - break; - case MOD_SHUTDOWN: - break; - default: - error = EINVAL; - break; - } - return (error); -} - -static moduledata_t sysvsem_mod = { - "sysvsem", - &sysvsem_modload, - NULL -}; - -SYSCALL_MODULE_HELPER(semsys); -SYSCALL_MODULE_HELPER(__semctl); -SYSCALL_MODULE_HELPER(semget); -SYSCALL_MODULE_HELPER(semop); - -DECLARE_MODULE(sysvsem, sysvsem_mod, - SI_SUB_SYSV_SEM, SI_ORDER_FIRST); -MODULE_VERSION(sysvsem, 1); - -/* - * Entry point for all SEM calls - * - * MPSAFE - */ -int -semsys(td, uap) - struct thread *td; - /* XXX actually varargs. */ - struct semsys_args /* { - int which; - int a2; - int a3; - int a4; - int a5; - } */ *uap; -{ - int error; - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - if (uap->which < 0 || - uap->which >= sizeof(semcalls)/sizeof(semcalls[0])) - return (EINVAL); - error = (*semcalls[uap->which])(td, &uap->a2); - return (error); -} -#endif /* __CYGWIN__ */ - -/* - * Allocate a new sem_undo structure for a process - * (returns ptr to structure or NULL if no more room) - */ - -static struct sem_undo * -semu_alloc(struct thread *td) -{ - int i; - struct sem_undo *suptr; - struct sem_undo **supptr; - int attempt; - - SEMUNDO_LOCKASSERT(MA_OWNED, td->td_proc->winpid); - /* - * Try twice to allocate something. - * (we'll purge an empty structure after the first pass so - * two passes are always enough) - */ - - for (attempt = 0; attempt < 2; attempt++) { - /* - * Look for a free structure. - * Fill it in and return it if we find one. - */ - - for (i = 0; i < seminfo.semmnu; i++) { - suptr = SEMU(i); -#ifdef __CYGWIN__ - if (suptr->un_proc == 0) { -#else - if (suptr->un_proc == NULL) { -#endif - SLIST_INSERT_HEAD(&semu_list, suptr, un_next); - suptr->un_cnt = 0; - suptr->un_proc = td->td_proc->winpid; - return(suptr); - } - } - - /* - * We didn't find a free one, if this is the first attempt - * then try to free a structure. - */ - - if (attempt == 0) { - /* All the structures are in use - try to free one */ - int did_something = 0; - - SLIST_FOREACH_PREVPTR(suptr, supptr, &semu_list, - un_next) { - if (suptr->un_cnt == 0) { -#ifdef __CYGWIN__ - suptr->un_proc = 0; -#else - suptr->un_proc = NULL; -#endif - did_something = 1; - *supptr = SLIST_NEXT(suptr, un_next); - break; - } - } - - /* If we didn't free anything then just give-up */ - if (!did_something) - return(NULL); - } else { - /* - * The second pass failed even though we freed - * something after the first pass! - * This is IMPOSSIBLE! - */ - panic("semu_alloc - second attempt failed"); - } - } - return (NULL); -} - -/* - * Adjust a particular entry for a particular proc - */ - -static int -semundo_adjust(struct thread *td, struct sem_undo **supptr, int semid, - int semnum, int adjval) -{ - struct proc *p = td->td_proc; - struct sem_undo *suptr; - struct undo *sunptr; - int i; - - SEMUNDO_LOCKASSERT(MA_OWNED, td->td_proc->winpid); - /* Look for and remember the sem_undo if the caller doesn't provide - it */ - - suptr = *supptr; - if (suptr == NULL) { - SLIST_FOREACH(suptr, &semu_list, un_next) { -#ifdef __CYGWIN__ - if (suptr->un_proc == p->winpid) { -#else - if (suptr->un_proc == p) { -#endif - *supptr = suptr; - break; - } - } - if (suptr == NULL) { - if (adjval == 0) - return(0); - suptr = semu_alloc(td); - if (suptr == NULL) - return(ENOSPC); - *supptr = suptr; - } - } - - /* - * Look for the requested entry and adjust it (delete if adjval becomes - * 0). - */ - sunptr = &suptr->un_ent[0]; - for (i = 0; i < suptr->un_cnt; i++, sunptr++) { - if (sunptr->un_id != semid || sunptr->un_num != semnum) - continue; - if (adjval != 0) { - adjval += sunptr->un_adjval; - if (adjval > seminfo.semaem || adjval < -seminfo.semaem) - return (ERANGE); - } - sunptr->un_adjval = adjval; - if (sunptr->un_adjval == 0) { - suptr->un_cnt--; - if (i < suptr->un_cnt) - suptr->un_ent[i] = - suptr->un_ent[suptr->un_cnt]; - } - return(0); - } - - /* Didn't find the right entry - create it */ - if (adjval == 0) - return(0); - if (adjval > seminfo.semaem || adjval < -seminfo.semaem) - return (ERANGE); - if (suptr->un_cnt != seminfo.semume) { - sunptr = &suptr->un_ent[suptr->un_cnt]; - suptr->un_cnt++; - sunptr->un_adjval = adjval; - sunptr->un_id = semid; sunptr->un_num = semnum; - } else - return(EINVAL); - return(0); -} - -static void -semundo_clear(int semid, int semnum, struct thread *td) -{ - struct sem_undo *suptr; - - SEMUNDO_LOCKASSERT(MA_OWNED, td->td_proc->winpid); - SLIST_FOREACH(suptr, &semu_list, un_next) { - struct undo *sunptr = &suptr->un_ent[0]; - int i = 0; - - while (i < suptr->un_cnt) { - if (sunptr->un_id == semid) { - if (semnum == -1 || sunptr->un_num == semnum) { - suptr->un_cnt--; - if (i < suptr->un_cnt) { - suptr->un_ent[i] = - suptr->un_ent[suptr->un_cnt]; - continue; - } - if (semnum != -1) - break; - } - } - i++, sunptr++; - } - } -} - -static int -semvalid(int semid, struct semid_ds *semaptr) -{ - - return ((semaptr->sem_perm.mode & SEM_ALLOC) == 0 || - semaptr->sem_perm.seq != IPCID_TO_SEQ(semid) ? EINVAL : 0); -} - -/* - * Note that the user-mode half of this passes a union, not a pointer - */ -#ifndef _SYS_SYSPROTO_H_ -struct __semctl_args { - int semid; - int semnum; - int cmd; - union semun *arg; -}; -#endif - -/* - * MPSAFE - */ -int -__semctl(struct thread *td, struct __semctl_args *uap) -{ - int semid = uap->semid; - int semnum = uap->semnum; - int cmd = uap->cmd; - u_short *array; - union semun *arg = uap->arg; - union semun real_arg; -#ifndef __CYGWIN__ - struct ucred *cred = td->td_ucred; -#endif - int i, rval, error; - struct semid_ds sbuf; - struct semid_ds *semaptr; - struct mtx *sema_mtxp; - u_short usval, count; - - DPRINTF(("call to semctl(%d, %d, %d, 0x%x)\n", - semid, semnum, cmd, arg)); - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - - array = NULL; - - switch(cmd) { -#ifdef __CYGWIN__ - case IPC_INFO: - if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0) - return (error); - if (!semid) { - error = copyout(&seminfo, real_arg.buf, - sizeof(struct seminfo)); - td->td_retval[0] = error ? -1 : 0; - return (error); - } - if (semid > seminfo.semmni) - semid = seminfo.semmni; - error = copyout(sema, real_arg.buf, - semid * sizeof(struct semid_ds)); - td->td_retval[0] = error ? -1 : 0; - return (error); - case SEM_INFO: - if (!(error = copyin(arg, &real_arg, sizeof(real_arg)))) { - struct sem_info sem_info; - sem_info.sem_ids = semtots; - sem_info.sem_num = semtot; - error = copyout(&sem_info, real_arg.buf, - sizeof(struct sem_info)); - } - td->td_retval[0] = error ? -1 : 0; - return (error); - -#endif /* __CYGWIN__ */ - case SEM_STAT: - if (semid < 0 || semid >= seminfo.semmni) - return (EINVAL); - if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0) - return (error); - semaptr = &sema[semid]; - sema_mtxp = &sema_mtx[semid]; - mtx_lock(sema_mtxp); - if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0) { - error = EINVAL; - goto done2; - } - if ((error = ipcperm(td, &semaptr->sem_perm, IPC_R))) - goto done2; - mtx_unlock(sema_mtxp); - error = copyout(semaptr, real_arg.buf, sizeof(struct semid_ds)); - rval = IXSEQ_TO_IPCID(semid,semaptr->sem_perm); - if (error == 0) - td->td_retval[0] = rval; - return (error); - } - - semid = IPCID_TO_IX(semid); - if (semid < 0 || semid >= seminfo.semmni) - return (EINVAL); - - semaptr = &sema[semid]; - sema_mtxp = &sema_mtx[semid]; - - error = 0; - rval = 0; - - switch (cmd) { - case IPC_RMID: - mtx_lock(sema_mtxp); - if ((error = semvalid(uap->semid, semaptr)) != 0) - goto done2; - if ((error = ipcperm(td, &semaptr->sem_perm, IPC_M))) - goto done2; -#ifdef __CYGWIN__ - semaptr->sem_perm.cuid = td->ipcblk->uid; - semaptr->sem_perm.uid = td->ipcblk->uid; -#else - semaptr->sem_perm.cuid = cred->cr_uid; - semaptr->sem_perm.uid = cred->cr_uid; -#endif - semtot -= semaptr->sem_nsems; - semtots--; - for (i = semaptr->sem_base - sem; i < semtot; i++) - sem[i] = sem[i + semaptr->sem_nsems]; - for (i = 0; i < seminfo.semmni; i++) { - if ((sema[i].sem_perm.mode & SEM_ALLOC) && - sema[i].sem_base > semaptr->sem_base) - sema[i].sem_base -= semaptr->sem_nsems; - } - semaptr->sem_perm.mode = 0; - SEMUNDO_LOCK(); - semundo_clear(semid, -1, td); - SEMUNDO_UNLOCK(); - wakeup(semaptr); - break; - - case IPC_SET: - if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0) - goto done2; - if ((error = copyin(real_arg.buf, &sbuf, sizeof(sbuf))) != 0) - goto done2; - mtx_lock(sema_mtxp); - if ((error = semvalid(uap->semid, semaptr)) != 0) - goto done2; - if ((error = ipcperm(td, &semaptr->sem_perm, IPC_M))) - goto done2; - semaptr->sem_perm.uid = sbuf.sem_perm.uid; - semaptr->sem_perm.gid = sbuf.sem_perm.gid; - semaptr->sem_perm.mode = (semaptr->sem_perm.mode & ~0777) | - (sbuf.sem_perm.mode & 0777); - semaptr->sem_ctime = time (NULL); - break; - - case IPC_STAT: - if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0) - goto done2; - mtx_lock(sema_mtxp); - if ((error = semvalid(uap->semid, semaptr)) != 0) - goto done2; - if ((error = ipcperm(td, &semaptr->sem_perm, IPC_R))) - goto done2; - sbuf = *semaptr; - mtx_unlock(sema_mtxp); - error = copyout(semaptr, real_arg.buf, - sizeof(struct semid_ds)); - break; - - case GETNCNT: - mtx_lock(sema_mtxp); - if ((error = semvalid(uap->semid, semaptr)) != 0) - goto done2; - if ((error = ipcperm(td, &semaptr->sem_perm, IPC_R))) - goto done2; - if (semnum < 0 || semnum >= semaptr->sem_nsems) { - error = EINVAL; - goto done2; - } - rval = semaptr->sem_base[semnum].semncnt; - break; - - case GETPID: - mtx_lock(sema_mtxp); - if ((error = semvalid(uap->semid, semaptr)) != 0) - goto done2; - if ((error = ipcperm(td, &semaptr->sem_perm, IPC_R))) - goto done2; - if (semnum < 0 || semnum >= semaptr->sem_nsems) { - error = EINVAL; - goto done2; - } - rval = semaptr->sem_base[semnum].sempid; - break; - - case GETVAL: - mtx_lock(sema_mtxp); - if ((error = semvalid(uap->semid, semaptr)) != 0) - goto done2; - if ((error = ipcperm(td, &semaptr->sem_perm, IPC_R))) - goto done2; - if (semnum < 0 || semnum >= semaptr->sem_nsems) { - error = EINVAL; - goto done2; - } - rval = semaptr->sem_base[semnum].semval; - break; - - case GETALL: - if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0) - goto done2; - array = (u_short *) sys_malloc(sizeof(*array) * semaptr->sem_nsems, M_TEMP, - M_WAITOK); - mtx_lock(sema_mtxp); - if ((error = semvalid(uap->semid, semaptr)) != 0) - goto done2; - if ((error = ipcperm(td, &semaptr->sem_perm, IPC_R))) - goto done2; - for (i = 0; i < semaptr->sem_nsems; i++) - array[i] = semaptr->sem_base[i].semval; - mtx_unlock(sema_mtxp); - error = copyout(array, real_arg.array, - i * sizeof(real_arg.array[0])); - break; - - case GETZCNT: - mtx_lock(sema_mtxp); - if ((error = semvalid(uap->semid, semaptr)) != 0) - goto done2; - if ((error = ipcperm(td, &semaptr->sem_perm, IPC_R))) - goto done2; - if (semnum < 0 || semnum >= semaptr->sem_nsems) { - error = EINVAL; - goto done2; - } - rval = semaptr->sem_base[semnum].semzcnt; - break; - - case SETVAL: - if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0) - goto done2; - mtx_lock(sema_mtxp); - if ((error = semvalid(uap->semid, semaptr)) != 0) - goto done2; - if ((error = ipcperm(td, &semaptr->sem_perm, IPC_W))) - goto done2; - if (semnum < 0 || semnum >= semaptr->sem_nsems) { - error = EINVAL; - goto done2; - } - if (real_arg.val < 0 || real_arg.val > seminfo.semvmx) { - error = ERANGE; - goto done2; - } - semaptr->sem_base[semnum].semval = real_arg.val; - SEMUNDO_LOCK(); - semundo_clear(semid, semnum, td); - SEMUNDO_UNLOCK(); - wakeup(semaptr); - break; - - case SETALL: - mtx_lock(sema_mtxp); -raced: - if ((error = semvalid(uap->semid, semaptr)) != 0) - goto done2; - count = semaptr->sem_nsems; - mtx_unlock(sema_mtxp); - if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0) - goto done2; - array = (u_short *) sys_malloc(sizeof(*array) * count, M_TEMP, M_WAITOK); - error = copyin(real_arg.array, array, count * sizeof(*array)); - if (error) - break; - mtx_lock(sema_mtxp); - if ((error = semvalid(uap->semid, semaptr)) != 0) - goto done2; - /* we could have raced? */ - if (count != semaptr->sem_nsems) { - sys_free(array, M_TEMP); - array = NULL; - goto raced; - } - if ((error = ipcperm(td, &semaptr->sem_perm, IPC_W))) - goto done2; - for (i = 0; i < semaptr->sem_nsems; i++) { - usval = array[i]; - if (usval > seminfo.semvmx) { - error = ERANGE; - break; - } - semaptr->sem_base[i].semval = usval; - } - SEMUNDO_LOCK(); - semundo_clear(semid, -1, td); - SEMUNDO_UNLOCK(); - wakeup(semaptr); - break; - - default: - error = EINVAL; - break; - } - - if (error == 0) - td->td_retval[0] = rval; -done2: - if (mtx_owned(sema_mtxp, td->td_proc->winpid)) - mtx_unlock(sema_mtxp); - if (array != NULL) - sys_free(array, M_TEMP); - return(error); -} - -#ifndef _SYS_SYSPROTO_H_ -struct semget_args { - key_t key; - int nsems; - int semflg; -}; -#endif - -/* - * MPSAFE - */ -int -semget(struct thread *td, struct semget_args *uap) -{ - int semid, error = 0; - key_t key = uap->key; - int nsems = uap->nsems; - int semflg = uap->semflg; -#ifndef __CYGWIN__ - struct ucred *cred = td->td_ucred; -#endif - - DPRINTF(("semget(0x%llx, %d, 0%o)\n", key, nsems, semflg)); - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - - mtx_lock(&Giant); - if (key != IPC_PRIVATE) { - for (semid = 0; semid < seminfo.semmni; semid++) { - if ((sema[semid].sem_perm.mode & SEM_ALLOC) && - sema[semid].sem_perm.key == key) - break; - } - if (semid < seminfo.semmni) { - DPRINTF(("found public key\n")); - if ((error = ipcperm(td, &sema[semid].sem_perm, - semflg & 0700))) { - goto done2; - } - if (nsems > 0 && sema[semid].sem_nsems < nsems) { - DPRINTF(("too small\n")); - error = EINVAL; - goto done2; - } - if ((semflg & IPC_CREAT) && (semflg & IPC_EXCL)) { - DPRINTF(("not exclusive\n")); - error = EEXIST; - goto done2; - } - goto found; - } - } - - DPRINTF(("need to allocate the semid_ds\n")); - if (key == IPC_PRIVATE || (semflg & IPC_CREAT)) { - if (nsems <= 0 || nsems > seminfo.semmsl) { - DPRINTF(("nsems out of range (0<%d<=%d)\n", nsems, - seminfo.semmsl)); - error = EINVAL; - goto done2; - } - if (nsems > seminfo.semmns - semtot) { - DPRINTF(( - "not enough semaphores left (need %d, got %d)\n", - nsems, seminfo.semmns - semtot)); - error = ENOSPC; - goto done2; - } - for (semid = 0; semid < seminfo.semmni; semid++) { - if ((sema[semid].sem_perm.mode & SEM_ALLOC) == 0) - break; - } - if (semid == seminfo.semmni) { - DPRINTF(("no more semid_ds's available\n")); - error = ENOSPC; - goto done2; - } - DPRINTF(("semid %d is available\n", semid)); - sema[semid].sem_perm.key = key; -#ifdef __CYGWIN__ - sema[semid].sem_perm.cuid = td->ipcblk->uid; - sema[semid].sem_perm.uid = td->ipcblk->uid; - sema[semid].sem_perm.cgid = td->ipcblk->gid; - sema[semid].sem_perm.gid = td->ipcblk->gid; -#else - sema[semid].sem_perm.cuid = cred->cr_uid; - sema[semid].sem_perm.uid = cred->cr_uid; - sema[semid].sem_perm.cgid = cred->cr_gid; - sema[semid].sem_perm.gid = cred->cr_gid; -#endif - sema[semid].sem_perm.mode = (semflg & 0777) | SEM_ALLOC; - sema[semid].sem_perm.seq = - (sema[semid].sem_perm.seq + 1) & 0x7fff; - sema[semid].sem_nsems = nsems; - sema[semid].sem_otime = 0; - sema[semid].sem_ctime = time (NULL); - sema[semid].sem_base = &sem[semtot]; - semtot += nsems; - semtots++; - bzero(sema[semid].sem_base, - sizeof(sema[semid].sem_base[0])*nsems); - DPRINTF(("sembase = 0x%x, next = 0x%x\n", sema[semid].sem_base, - &sem[semtot])); - } else { - DPRINTF(("didn't find it and wasn't asked to create it\n")); - error = ENOENT; - goto done2; - } - -found: - td->td_retval[0] = IXSEQ_TO_IPCID(semid, sema[semid].sem_perm); -done2: -#ifdef __CYGWIN__ - if (!error) - ipcexit_creat_hookthread (td); -#endif - mtx_unlock(&Giant); - return (error); -} - -#ifndef _SYS_SYSPROTO_H_ -struct semop_args { - int semid; - struct sembuf *sops; - size_t nsops; -}; -#endif - -/* - * MPSAFE - */ -int -semop(struct thread *td, struct semop_args *uap) -{ -#define SMALL_SOPS 8 - struct sembuf small_sops[SMALL_SOPS]; - int semid = uap->semid; - size_t nsops = uap->nsops; - struct sembuf *sops; - struct semid_ds *semaptr; - struct sembuf *sopptr = 0; - struct sem *semptr = 0; - struct sem_undo *suptr; - struct mtx *sema_mtxp; - size_t i, j, k; - int error; - int do_wakeup, do_undos; - - DPRINTF(("call to semop(%d, 0x%x, %u)\n", semid, uap->sops, nsops)); - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - - semid = IPCID_TO_IX(semid); /* Convert back to zero origin */ - - if (semid < 0 || semid >= seminfo.semmni) - return (EINVAL); - - /* Allocate memory for sem_ops */ - if (nsops <= SMALL_SOPS) - sops = small_sops; - else if (nsops <= (unsigned long) seminfo.semopm) - sops = (struct sembuf *) sys_malloc(nsops * sizeof(*sops), M_SEM, M_WAITOK); - else { - DPRINTF(("too many sops (max=%d, nsops=%d)\n", seminfo.semopm, - nsops)); - return (E2BIG); - } - if ((error = copyin(uap->sops, sops, nsops * sizeof(sops[0]))) != 0) { - DPRINTF(("error = %d from copyin(%08x, %08x, %d)\n", error, - uap->sops, sops, nsops * sizeof(sops[0]))); - if (sops != small_sops) - sys_free(sops, M_SEM); - return (error); - } - - semaptr = &sema[semid]; - sema_mtxp = &sema_mtx[semid]; - mtx_lock(sema_mtxp); - if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0) { - error = EINVAL; - goto done2; - } - if (semaptr->sem_perm.seq != IPCID_TO_SEQ(uap->semid)) { - error = EINVAL; - goto done2; - } - /* - * Initial pass thru sops to see what permissions are needed. - * Also perform any checks that don't need repeating on each - * attempt to satisfy the request vector. - */ - j = 0; /* permission needed */ - do_undos = 0; - for (i = 0; i < nsops; i++) { - sopptr = &sops[i]; - if (sopptr->sem_num >= semaptr->sem_nsems) { - error = EFBIG; - goto done2; - } - if (sopptr->sem_flg & SEM_UNDO && sopptr->sem_op != 0) - do_undos = 1; - j |= (sopptr->sem_op == 0) ? SEM_R : SEM_A; - } - - if ((error = ipcperm(td, &semaptr->sem_perm, j))) { - DPRINTF(("error = %d from ipaccess\n", error)); - goto done2; - } - - /* - * Loop trying to satisfy the vector of requests. - * If we reach a point where we must wait, any requests already - * performed are rolled back and we go to sleep until some other - * process wakes us up. At this point, we start all over again. - * - * This ensures that from the perspective of other tasks, a set - * of requests is atomic (never partially satisfied). - */ - for (;;) { - do_wakeup = 0; - error = 0; /* error return if necessary */ - - for (i = 0; i < nsops; i++) { - sopptr = &sops[i]; - semptr = &semaptr->sem_base[sopptr->sem_num]; - - DPRINTF(( - "semop: semaptr=%x, sem_base=%x, " - "semptr=%x, sem[%d]=%d : op=%d, flag=%s\n", - semaptr, semaptr->sem_base, semptr, - sopptr->sem_num, semptr->semval, sopptr->sem_op, - (sopptr->sem_flg & IPC_NOWAIT) ? - "nowait" : "wait")); - - if (sopptr->sem_op < 0) { - if (semptr->semval + sopptr->sem_op < 0) { - DPRINTF(("semop: can't do it now\n")); - break; - } else { - semptr->semval += sopptr->sem_op; - if (semptr->semval == 0 && - semptr->semzcnt > 0) - do_wakeup = 1; - } - } else if (sopptr->sem_op == 0) { - if (semptr->semval != 0) { - DPRINTF(("semop: not zero now\n")); - break; - } - } else if (semptr->semval + sopptr->sem_op > - seminfo.semvmx) { - error = ERANGE; - break; - } else { - if (semptr->semncnt > 0) - do_wakeup = 1; - semptr->semval += sopptr->sem_op; - } - } - - /* - * Did we get through the entire vector? - */ - if (i >= nsops) - goto done; - - /* - * No ... rollback anything that we've already done - */ - DPRINTF(("semop: rollback 0 through %d\n", i-1)); - for (j = 0; j < i; j++) - semaptr->sem_base[sops[j].sem_num].semval -= - sops[j].sem_op; - - /* If we detected an error, return it */ - if (error != 0) - goto done2; - - /* - * If the request that we couldn't satisfy has the - * NOWAIT flag set then return with EAGAIN. - */ - if (sopptr->sem_flg & IPC_NOWAIT) { - error = EAGAIN; - goto done2; - } - - if (sopptr->sem_op == 0) - semptr->semzcnt++; - else - semptr->semncnt++; - - DPRINTF(("semop: good night!\n")); - error = msleep(semaptr, sema_mtxp, (PZERO - 4) | PCATCH, - "semwait", 0); - DPRINTF(("semop: good morning (error=%d)!\n", error)); - /* return code is checked below, after sem[nz]cnt-- */ - - /* - * Make sure that the semaphore still exists - */ - if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0 || - semaptr->sem_perm.seq != IPCID_TO_SEQ(uap->semid)) { - error = EIDRM; - goto done2; - } - - /* - * The semaphore is still alive. Readjust the count of - * waiting processes. - */ - if (sopptr->sem_op == 0) - semptr->semzcnt--; - else - semptr->semncnt--; - - /* - * Is it really morning, or was our sleep interrupted? - * (Delayed check of msleep() return code because we - * need to decrement sem[nz]cnt either way.) - */ - if (error != 0) { -#ifdef __CYGWIN__ - if (error != EIDRM) -#endif /* __CYGWIN__ */ - error = EINTR; - goto done2; - } - DPRINTF(("semop: good morning!\n")); - } - -done: - /* - * Process any SEM_UNDO requests. - */ - if (do_undos) { - SEMUNDO_LOCK(); - suptr = NULL; - for (i = 0; i < nsops; i++) { - /* - * We only need to deal with SEM_UNDO's for non-zero - * op's. - */ - int adjval; - - if ((sops[i].sem_flg & SEM_UNDO) == 0) - continue; - adjval = sops[i].sem_op; - if (adjval == 0) - continue; - error = semundo_adjust(td, &suptr, semid, - sops[i].sem_num, -adjval); - if (error == 0) - continue; - - /* - * Oh-Oh! We ran out of either sem_undo's or undo's. - * Rollback the adjustments to this point and then - * rollback the semaphore ups and down so we can return - * with an error with all structures restored. We - * rollback the undo's in the exact reverse order that - * we applied them. This guarantees that we won't run - * out of space as we roll things back out. - */ - for (j = 0; j < i; j++) { - k = i - j - 1; - if ((sops[k].sem_flg & SEM_UNDO) == 0) - continue; - adjval = sops[k].sem_op; - if (adjval == 0) - continue; - if (semundo_adjust(td, &suptr, semid, - sops[k].sem_num, adjval) != 0) - panic("semop - can't undo undos"); - } - - for (j = 0; j < nsops; j++) - semaptr->sem_base[sops[j].sem_num].semval -= - sops[j].sem_op; - - DPRINTF(("error = %d from semundo_adjust\n", error)); - SEMUNDO_UNLOCK(); - goto done2; - } /* loop through the sops */ - SEMUNDO_UNLOCK(); - } /* if (do_undos) */ - - /* We're definitely done - set the sempid's and time */ - for (i = 0; i < nsops; i++) { - sopptr = &sops[i]; - semptr = &semaptr->sem_base[sopptr->sem_num]; - semptr->sempid = td->td_proc->p_pid; - } - semaptr->sem_otime = time (NULL); - - /* - * Do a wakeup if any semaphore was up'd whilst something was - * sleeping on it. - */ - if (do_wakeup) { - DPRINTF(("semop: doing wakeup\n")); - wakeup(semaptr); - DPRINTF(("semop: back from wakeup\n")); - } - DPRINTF(("semop: done\n")); - td->td_retval[0] = 0; -done2: - mtx_unlock(sema_mtxp); - if (sops != small_sops) - sys_free(sops, M_SEM); - return (error); -} - -/* - * Go through the undo structures for this process and apply the adjustments to - * semaphores. - */ -void -semexit_myhook(void *arg, struct proc *p) -{ - struct sem_undo *suptr; - struct sem_undo **supptr; - - /* - * Go through the chain of undo vectors looking for one - * associated with this process. - */ - SEMUNDO_HOOKLOCK(); - SLIST_FOREACH_PREVPTR(suptr, supptr, &semu_list, un_next) { -#ifdef __CYGWIN__ - if (suptr->un_proc == p->winpid) -#else - if (suptr->un_proc == p) -#endif - break; - } -#ifndef __CYGWIN__ - SEMUNDO_UNLOCK(); -#endif - - if (suptr == NULL) { - SEMUNDO_UNLOCK(); - return; - } - -#ifdef __CYGWIN__ - DPRINTF(("proc @%u(%u) has undo structure with %d entries\n", - p->cygpid, p->winpid, suptr->un_cnt)); -#else - DPRINTF(("proc @%08x has undo structure with %d entries\n", p, - suptr->un_cnt)); -#endif - - /* - * If there are any active undo elements then process them. - */ - if (suptr->un_cnt > 0) { - int ix; - - for (ix = 0; ix < suptr->un_cnt; ix++) { - int semid = suptr->un_ent[ix].un_id; - int semnum = suptr->un_ent[ix].un_num; - int adjval = suptr->un_ent[ix].un_adjval; - struct semid_ds *semaptr; - struct mtx *sema_mtxp; - - semaptr = &sema[semid]; - sema_mtxp = &sema_mtx[semid]; -#ifdef __CYGWIN__ - _mtx_lock(sema_mtxp, p->winpid, __FILE__, __LINE__); -#else - mtx_lock(sema_mtxp); - SEMUNDO_HOOKLOCK(); -#endif - if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0) - panic("semexit - semid not allocated"); - if (semnum >= semaptr->sem_nsems) - panic("semexit - semnum out of range"); - - DPRINTF(( -#ifdef __CYGWIN__ - "semexit: %u id=%d num=%d(adj=%d) ; sem=%d\n", -#else - "semexit: %08x id=%d num=%d(adj=%d) ; sem=%d\n", -#endif - suptr->un_proc, suptr->un_ent[ix].un_id, - suptr->un_ent[ix].un_num, - suptr->un_ent[ix].un_adjval, - semaptr->sem_base[semnum].semval)); - - if (adjval < 0) { - if (semaptr->sem_base[semnum].semval < -adjval) - semaptr->sem_base[semnum].semval = 0; - else - semaptr->sem_base[semnum].semval += - adjval; - } else - semaptr->sem_base[semnum].semval += adjval; - - wakeup(semaptr); - DPRINTF(("semexit: back from wakeup\n")); - _mtx_unlock(sema_mtxp, __FILE__, __LINE__); -#ifndef __CYGWIN__ - SEMUNDO_UNLOCK(); -#endif - } - } - - /* - * Deallocate the undo vector. - */ - DPRINTF(("removing vector (%u)\n", suptr->un_proc)); -#ifdef __CYGWIN__ - suptr->un_proc = 0; -#else - suptr->un_proc = NULL; -#endif - *supptr = SLIST_NEXT(suptr, un_next); -#ifdef __CYGWIN__ - SEMUNDO_UNLOCK(); -#endif -} - -#ifndef __CYGWIN__ -static int -sysctl_sema(SYSCTL_HANDLER_ARGS) -{ - - return (SYSCTL_OUT(req, sema, - sizeof(struct semid_ds) * seminfo.semmni)); -} -#endif /* __CYGWIN__ */ -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/sysv_shm.cc b/winsup/cygserver/sysv_shm.cc deleted file mode 100644 index 4578c53a2..000000000 --- a/winsup/cygserver/sysv_shm.cc +++ /dev/null @@ -1,1045 +0,0 @@ -/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */ -/* - * Copyright (c) 1994 Adam Glass and Charles Hannum. 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 Adam Glass and Charles - * Hannum. - * 4. The names of the authors may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. - */ - -/* - * This file is heavily changed to become part of Cygwin's cygserver. - */ - -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" -#include -#ifndef __FBSDID -#define __FBSDID(s) const char version[] = (s) -#endif -__FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/kern/sysv_shm.c,v 1.89 2003/11/07 04:47:14 rwatson Exp $"); -/* CV, 2006-01-09: Inspected upstream up to version 1.104. */ - -#define _KERNEL 1 -#define __BSD_VISIBLE 1 -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "cygserver.h" -#include "process.h" -#include "cygserver_ipc.h" - -#ifdef __CYGWIN__ -#ifndef PAGE_SIZE -#define PAGE_SIZE (getpagesize ()) -#endif -#ifndef PAGE_MASK -#define PAGE_MASK (PAGE_SIZE - 1) -#endif -#define btoc(b) (((b) + PAGE_MASK) / PAGE_SIZE) -#define round_page(p) ((((unsigned long)(p)) + PAGE_MASK) & ~(PAGE_MASK)) -#ifdef __CYGWIN__ -#define GIANT_REQUIRED -#else -#define GIANT_REQUIRED mtx_assert(&Giant, MA_OWNED) -#endif -#define KERN_SUCCESS 0 -#define VM_PROT_READ PROT_READ -#define VM_PROT_WRITE PROT_WRITE -#define VM_INHERIT_SHARE 0 -#define OBJT_PHYS 0 -#define OBJT_SWAP 0 -#define VM_PROT_DEFAULT 0 -#define VM_OBJECT_LOCK(a) -#define vm_object_clear_flag(a,b) -#define vm_object_set_flag(a,b) -#define VM_OBJECT_UNLOCK(a) -#define vm_map_remove(a,b,c) KERN_SUCCESS -typedef int vm_prot_t; -#endif /* __CYGWIN__ */ - -#ifndef __CYGWIN__ -static MALLOC_DEFINE(M_SHM, "shm", "SVID compatible shared memory segments"); - -struct oshmctl_args; -static int oshmctl(struct thread *td, struct oshmctl_args *uap); -#endif /* __CYGWIN__ */ - -static int shmget_allocate_segment(struct thread *td, - struct shmget_args *uap, int mode); -static int shmget_existing(struct thread *td, struct shmget_args *uap, - int mode, int segnum); - -#ifndef __CYGWIN__ -/* XXX casting to (sy_call_t *) is bogus, as usual. */ -static sy_call_t *shmcalls[] = { - (sy_call_t *)shmat, (sy_call_t *)oshmctl, - (sy_call_t *)shmdt, (sy_call_t *)shmget, - (sy_call_t *)shmctl -}; -#endif /* __CYGWIN__ */ - -#define SHMSEG_FREE 0x0200 -#define SHMSEG_REMOVED 0x0400 -#define SHMSEG_ALLOCATED 0x0800 -#define SHMSEG_WANTED 0x1000 - -static int shm_last_free, shm_nused, shm_committed, shmalloced, shm_nattch; -static struct shmid_ds *shmsegs; - -struct shm_handle { - /* vm_offset_t kva; */ - vm_object_t shm_object; -}; - -struct shmmap_state { - vm_offset_t va; - int shmid; -}; - -static void shm_deallocate_segment(struct shmid_ds *); -static int shm_find_segment_by_key(key_t); -static struct shmid_ds *shm_find_segment_by_shmid(int); -static struct shmid_ds *shm_find_segment_by_shmidx(int); -static int shm_delete_mapping(struct vmspace *vm, struct shmmap_state *); -static void shmrealloc(void); - -/* - * Tuneable values. - */ -#ifndef SHMMAXPGS -#define SHMMAXPGS 8192 /* Note: sysv shared memory is swap backed. */ -#endif -#ifndef SHMMAX -#define SHMMAX (SHMMAXPGS*PAGE_SIZE) -#endif -#ifndef SHMMIN -#define SHMMIN 1 -#endif -#ifndef SHMMNI -#define SHMMNI 192 -#endif -#ifndef SHMSEG -#define SHMSEG 128 -#endif -#ifndef SHMALL -#define SHMALL (SHMMAXPGS) -#endif - -struct shminfo shminfo = { - SHMMAX, - SHMMIN, - SHMMNI, - SHMSEG, - SHMALL -}; - -#ifndef __CYGWIN__ -static int shm_use_phys; -#else -static long shm_use_phys; -static long shm_allow_removed; -#endif /* __CYGWIN__ */ - -#ifndef __CYGWIN__ -struct shm_info shm_info; -#endif /* __CYGWIN__ */ - -#ifndef __CYGWIN__ -SYSCTL_DECL(_kern_ipc); -SYSCTL_INT(_kern_ipc, OID_AUTO, shmmax, CTLFLAG_RW, &shminfo.shmmax, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, shmmin, CTLFLAG_RW, &shminfo.shmmin, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, shmmni, CTLFLAG_RDTUN, &shminfo.shmmni, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, shmseg, CTLFLAG_RDTUN, &shminfo.shmseg, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, shmall, CTLFLAG_RW, &shminfo.shmall, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, shm_use_phys, CTLFLAG_RW, - &shm_use_phys, 0, ""); -SYSCTL_INT(_kern_ipc, OID_AUTO, shm_allow_removed, CTLFLAG_RW, - &shm_allow_removed, 0, ""); -SYSCTL_PROC(_kern_ipc, OID_AUTO, shmsegs, CTLFLAG_RD, - NULL, 0, sysctl_shmsegs, "", ""); -#endif /* __CYGWIN__ */ - -static int -shm_find_segment_by_key(key_t key) -{ - int i; - - for (i = 0; i < shmalloced; i++) - if ((shmsegs[i].shm_perm.mode & SHMSEG_ALLOCATED) && - shmsegs[i].shm_perm.key == key) - return (i); - return (-1); -} - -static struct shmid_ds * -shm_find_segment_by_shmid(int shmid) -{ - int segnum; - struct shmid_ds *shmseg; - - segnum = IPCID_TO_IX(shmid); - if (segnum < 0 || segnum >= shmalloced) - return (NULL); - shmseg = &shmsegs[segnum]; - if ((shmseg->shm_perm.mode & SHMSEG_ALLOCATED) == 0 || - (!shm_allow_removed && - (shmseg->shm_perm.mode & SHMSEG_REMOVED) != 0) || - shmseg->shm_perm.seq != IPCID_TO_SEQ(shmid)) - return (NULL); - return (shmseg); -} - -static struct shmid_ds * -shm_find_segment_by_shmidx(int segnum) -{ - struct shmid_ds *shmseg; - - if (segnum < 0 || segnum >= shmalloced) - return (NULL); - shmseg = &shmsegs[segnum]; - if ((shmseg->shm_perm.mode & SHMSEG_ALLOCATED) == 0 || - (!shm_allow_removed && - (shmseg->shm_perm.mode & SHMSEG_REMOVED) != 0)) - return (NULL); - return (shmseg); -} - -static void -shm_deallocate_segment(struct shmid_ds *shmseg) -{ - struct shm_handle *shm_handle; - size_t size; - - GIANT_REQUIRED; - - shm_handle = shmseg->shm_internal; - vm_object_deallocate(shm_handle->shm_object); - sys_free(shm_handle, M_SHM); - shmseg->shm_internal = NULL; - size = round_page(shmseg->shm_segsz); - shm_committed -= btoc(size); - shm_nused--; - shmseg->shm_perm.mode = SHMSEG_FREE; -} - -static int -shm_delete_mapping(struct vmspace *vm, struct shmmap_state *shmmap_s) -{ - struct shmid_ds *shmseg; - int segnum, result; - size_t size __attribute__ ((unused)); - - GIANT_REQUIRED; - - segnum = IPCID_TO_IX(shmmap_s->shmid); - shmseg = &shmsegs[segnum]; - size = round_page(shmseg->shm_segsz); - result = vm_map_remove(&vm->vm_map, shmmap_s->va, shmmap_s->va + size); - if (result != KERN_SUCCESS) - return (EINVAL); - shmmap_s->shmid = -1; - shmseg->shm_dtime = time (NULL); - --shm_nattch; - if ((--shmseg->shm_nattch <= 0) && - (shmseg->shm_perm.mode & SHMSEG_REMOVED)) { - shm_deallocate_segment(shmseg); - shm_last_free = segnum; - } - return (0); -} - -#ifndef _SYS_SYSPROTO_H_ -struct shmdt_args { - const void *shmaddr; -}; -#endif - -/* - * MPSAFE - */ -int -shmdt(struct thread *td, struct shmdt_args *uap) -{ - struct proc *p = td->td_proc; - struct shmmap_state *shmmap_s; - int i; - int error = 0; - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - mtx_lock(&Giant); - shmmap_s = p->p_vmspace->vm_shm; - if (shmmap_s == NULL) { - error = EINVAL; - goto done2; - } - for (i = 0; i < shminfo.shmseg; i++, shmmap_s++) { - if (shmmap_s->shmid != -1 && - shmmap_s->va == (vm_offset_t)uap->shmaddr) { - break; - } - } - if (i == shminfo.shmseg) { - error = EINVAL; - goto done2; - } - error = shm_delete_mapping(p->p_vmspace, shmmap_s); -done2: - mtx_unlock(&Giant); - return (error); -} - -#ifndef _SYS_SYSPROTO_H_ -struct shmat_args { - int shmid; - const void *shmaddr; - int shmflg; -}; -#endif - -/* - * MPSAFE - */ -int -kern_shmat(struct thread *td, int shmid, const void *shmaddr, int shmflg) -{ - struct proc *p = td->td_proc; - int i, flags __attribute__ ((unused)); - struct shmid_ds *shmseg; - struct shmmap_state *shmmap_s = NULL; -#ifndef __CYGWIN__ - struct shm_handle *shm_handle; -#endif - vm_offset_t attach_va; - vm_prot_t prot; - vm_size_t size; -#ifndef __CYGWIN__ - int rv; -#endif - int error = 0; - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - mtx_lock(&Giant); - shmmap_s = p->p_vmspace->vm_shm; - if (shmmap_s == NULL) { - size = shminfo.shmseg * sizeof(struct shmmap_state); - shmmap_s = (struct shmmap_state *) sys_malloc(size, M_SHM, M_WAITOK); - for (i = 0; i < shminfo.shmseg; i++) - shmmap_s[i].shmid = -1; - p->p_vmspace->vm_shm = shmmap_s; - } - shmseg = shm_find_segment_by_shmid(shmid); - if (shmseg == NULL) { - error = EINVAL; - goto done2; - } - error = ipcperm(td, &shmseg->shm_perm, - (shmflg & SHM_RDONLY) ? IPC_R : IPC_R|IPC_W); - if (error) - goto done2; - for (i = 0; i < shminfo.shmseg; i++) { - if (shmmap_s->shmid == -1) - break; - shmmap_s++; - } - if (i >= shminfo.shmseg) { - error = EMFILE; - goto done2; - } - size = round_page(shmseg->shm_segsz); -#ifdef VM_PROT_READ_IS_EXEC - prot = VM_PROT_READ | VM_PROT_EXECUTE; -#else - prot = VM_PROT_READ; -#endif - if ((shmflg & SHM_RDONLY) == 0) - prot |= VM_PROT_WRITE; - flags = MAP_ANON | MAP_SHARED; - debug_printf ("shmaddr: %x, shmflg: %x", shmaddr, shmflg); -#ifdef __CYGWIN__ - /* The alignment checks have already been made in the Cygwin DLL - and shmat's only job is to keep record of the attached mem. - These checks break shm on 9x since MapViewOfFileEx apparently - returns memory which isn't aligned to SHMLBA. Go figure! */ - attach_va = (vm_offset_t)shmaddr; -#else - if (shmaddr) { - flags |= MAP_FIXED; - if (shmflg & SHM_RND) { - attach_va = (vm_offset_t)shmaddr & ~(SHMLBA-1); - } else if (((vm_offset_t)shmaddr & (SHMLBA-1)) == 0) { - attach_va = (vm_offset_t)shmaddr; - } else { - error = EINVAL; - goto done2; - } - } else { - /* - * This is just a hint to vm_map_find() about where to - * put it. - */ - attach_va = round_page((vm_offset_t)p->p_vmspace->vm_taddr - + maxtsiz + maxdsiz); - } - - shm_handle = shmseg->shm_internal; - vm_object_reference(shm_handle->shm_object); - rv = vm_map_find(&p->p_vmspace->vm_map, shm_handle->shm_object, - 0, &attach_va, size, (flags & MAP_FIXED)?0:1, prot, prot, 0); - if (rv != KERN_SUCCESS) { - error = ENOMEM; - goto done2; - } - vm_map_inherit(&p->p_vmspace->vm_map, - attach_va, attach_va + size, VM_INHERIT_SHARE); -#endif - - shmmap_s->va = attach_va; - shmmap_s->shmid = shmid; - shmseg->shm_lpid = p->p_pid; - shmseg->shm_atime = time (NULL); - shmseg->shm_nattch++; - shm_nattch++; - td->td_retval[0] = attach_va; -done2: - mtx_unlock(&Giant); - return (error); -} - -int -shmat(struct thread *td, struct shmat_args *uap) -{ - return kern_shmat(td, uap->shmid, uap->shmaddr, uap->shmflg); -} - -#ifndef __CYGWIN__ -struct oshmid_ds { - struct ipc_perm shm_perm; /* operation perms */ - int shm_segsz; /* size of segment (bytes) */ - u_short shm_cpid; /* pid, creator */ - u_short shm_lpid; /* pid, last operation */ - short shm_nattch; /* no. of current attaches */ - time_t shm_atime; /* last attach time */ - time_t shm_dtime; /* last detach time */ - time_t shm_ctime; /* last change time */ - void *shm_handle; /* internal handle for shm segment */ -}; - -struct oshmctl_args { - int shmid; - int cmd; - struct oshmid_ds *ubuf; -}; - -/* - * MPSAFE - */ -static int -oshmctl(struct thread *td, struct oshmctl_args *uap) -{ -#ifdef COMPAT_43 - int error = 0; - struct shmid_ds *shmseg; - struct oshmid_ds outbuf; - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - mtx_lock(&Giant); - shmseg = shm_find_segment_by_shmid(uap->shmid); - if (shmseg == NULL) { - error = EINVAL; - goto done2; - } - switch (uap->cmd) { - case IPC_STAT: - error = ipcperm(td, &shmseg->shm_perm, IPC_R); - if (error) - goto done2; - outbuf.shm_perm = shmseg->shm_perm; - outbuf.shm_segsz = shmseg->shm_segsz; - outbuf.shm_cpid = shmseg->shm_cpid; - outbuf.shm_lpid = shmseg->shm_lpid; - outbuf.shm_nattch = shmseg->shm_nattch; - outbuf.shm_atime = shmseg->shm_atime; - outbuf.shm_dtime = shmseg->shm_dtime; - outbuf.shm_ctime = shmseg->shm_ctime; - outbuf.shm_handle = shmseg->shm_internal; - error = copyout(&outbuf, uap->ubuf, sizeof(outbuf)); - if (error) - goto done2; - break; - default: - /* XXX casting to (sy_call_t *) is bogus, as usual. */ - error = ((sy_call_t *)shmctl)(td, uap); - break; - } -done2: - mtx_unlock(&Giant); - return (error); -#else - return (EINVAL); -#endif -} -#endif /* !__CYGWIN__ */ - -#ifndef _SYS_SYSPROTO_H_ -struct shmctl_args { - int shmid; - int cmd; - struct shmid_ds *buf; -}; -#endif - -/* - * MPSAFE - */ -int -kern_shmctl(struct thread *td, int shmid, int cmd, void *buf, size_t *bufsz) -{ - int error = 0; - struct shmid_ds *shmseg; - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - - mtx_lock(&Giant); - switch (cmd) { - case IPC_INFO: - memcpy(buf, &shminfo, sizeof(shminfo)); - if (bufsz) - *bufsz = sizeof(shminfo); - td->td_retval[0] = shmalloced; - goto done2; - case SHM_INFO: { - struct shm_info shm_info; - shm_info.used_ids = shm_nused; - shm_info.shm_tot = shm_committed * PAGE_SIZE; -#ifdef __CYGWIN__ - shm_info.shm_atts = shm_nattch; -#else - shm_info.shm_rss = 0; /*XXX where to get from ? */ - shm_info.shm_swp = 0; /*XXX where to get from ? */ - shm_info.swap_attempts = 0; /*XXX where to get from ? */ - shm_info.swap_successes = 0; /*XXX where to get from ? */ -#endif /* __CYGWIN__ */ - memcpy(buf, &shm_info, sizeof(shm_info)); - if (bufsz) - *bufsz = sizeof(shm_info); - td->td_retval[0] = shmalloced; - goto done2; - } - } - if (cmd == SHM_STAT) - shmseg = shm_find_segment_by_shmidx(shmid); - else - shmseg = shm_find_segment_by_shmid(shmid); - if (shmseg == NULL) { - error = EINVAL; - goto done2; - } - switch (cmd) { - case SHM_STAT: - case IPC_STAT: - error = ipcperm(td, &shmseg->shm_perm, IPC_R); - if (error) - goto done2; - memcpy(buf, shmseg, sizeof(struct shmid_ds)); - if (bufsz) - *bufsz = sizeof(struct shmid_ds); - if (cmd == SHM_STAT) - td->td_retval[0] = IXSEQ_TO_IPCID(shmid, shmseg->shm_perm); - break; - case IPC_SET: { - struct shmid_ds *shmid; - - shmid = (struct shmid_ds *)buf; - error = ipcperm(td, &shmseg->shm_perm, IPC_M); - if (error) - goto done2; - shmseg->shm_perm.uid = shmid->shm_perm.uid; - shmseg->shm_perm.gid = shmid->shm_perm.gid; - shmseg->shm_perm.mode = - (shmseg->shm_perm.mode & ~ACCESSPERMS) | - (shmid->shm_perm.mode & ACCESSPERMS); - shmseg->shm_ctime = time (NULL); - break; - } - case IPC_RMID: - error = ipcperm(td, &shmseg->shm_perm, IPC_M); - if (error) - goto done2; - shmseg->shm_perm.key = IPC_PRIVATE; - shmseg->shm_perm.mode |= SHMSEG_REMOVED; - if (shmseg->shm_nattch <= 0) { - shm_deallocate_segment(shmseg); - shm_last_free = IPCID_TO_IX(shmid); - } - break; -#if 0 - case SHM_LOCK: - case SHM_UNLOCK: -#endif - default: - error = EINVAL; - break; - } -done2: - mtx_unlock(&Giant); - return (error); -} - -int -shmctl(struct thread *td, struct shmctl_args *uap) -{ - int error = 0; - struct shmid_ds buf; - size_t bufsz; - - /* IPC_SET needs to copyin the buffer before calling kern_shmctl */ - if (uap->cmd == IPC_SET) { - if ((error = copyin(uap->buf, &buf, sizeof(struct shmid_ds)))) - goto done; - } -#ifdef __CYGWIN__ - if (uap->cmd == IPC_INFO && uap->shmid > 0) { - /* Can't use the default kern_shmctl interface. */ - int shmid = uap->shmid; - if (shmid > shminfo.shmmni) - shmid = shminfo.shmmni; - error = copyout(shmsegs, uap->buf, - shmid * sizeof(struct shmid_ds)); - td->td_retval[0] = error ? -1 : 0; - return (error); - } -#endif /* __CYGWIN__ */ - - error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&buf, &bufsz); - if (error) - goto done; - - /* Cases in which we need to copyout */ - switch (uap->cmd) { - case IPC_INFO: - case SHM_INFO: - case SHM_STAT: - case IPC_STAT: - error = copyout(&buf, uap->buf, bufsz); - break; - } - -done: - if (error) { - /* Invalidate the return value */ - td->td_retval[0] = -1; - } - return (error); -} - - -#ifndef _SYS_SYSPROTO_H_ -struct shmget_args { - key_t key; - size_t size; - int shmflg; -}; -#endif - -static int -shmget_existing(struct thread *td, struct shmget_args *uap, int mode, int segnum) -{ - struct shmid_ds *shmseg; - int error; - - shmseg = &shmsegs[segnum]; - if (shmseg->shm_perm.mode & SHMSEG_REMOVED) { - /* - * This segment is in the process of being allocated. Wait - * until it's done, and look the key up again (in case the - * allocation failed or it was freed). - */ - shmseg->shm_perm.mode |= SHMSEG_WANTED; - error = tsleep(shmseg, PLOCK | PCATCH, "shmget", 0); - if (error) - return (error); - return (EAGAIN); - } - if ((uap->shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL)) - return (EEXIST); - error = ipcperm(td, &shmseg->shm_perm, mode); - if (error) - return (error); - if (uap->size && uap->size > shmseg->shm_segsz) - return (EINVAL); - td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->shm_perm); -#ifdef __CYGWIN__ - td->td_retval[1] = - vm_object_duplicate(td, shmseg->shm_internal->shm_object); -#endif /* __CYGWIN__ */ - return (0); -} - -static int -shmget_allocate_segment(struct thread *td, struct shmget_args *uap, int mode) -{ - int i, segnum, shmid, size; -#ifndef __CYGWIN__ - struct ucred *cred = td->td_ucred; -#endif /* __CYGWIN__ */ - struct shmid_ds *shmseg; - struct shm_handle *shm_handle; - - GIANT_REQUIRED; - - if (uap->size < (unsigned long) shminfo.shmmin || - uap->size > (unsigned long) shminfo.shmmax) - return (EINVAL); - if (shm_nused >= shminfo.shmmni) /* Any shmids left? */ - return (ENOSPC); - size = round_page(uap->size); - if (shm_committed + btoc(size) > shminfo.shmall) - return (ENOMEM); - if (shm_last_free < 0) { - shmrealloc(); /* Maybe expand the shmsegs[] array. */ - for (i = 0; i < shmalloced; i++) - if (shmsegs[i].shm_perm.mode & SHMSEG_FREE) - break; - if (i == shmalloced) - return (ENOSPC); - segnum = i; - } else { - segnum = shm_last_free; - shm_last_free = -1; - } - shmseg = &shmsegs[segnum]; - /* - * In case we sleep in malloc(), mark the segment present but deleted - * so that noone else tries to create the same key. - */ - shmseg->shm_perm.mode = SHMSEG_ALLOCATED | SHMSEG_REMOVED; - shmseg->shm_perm.key = uap->key; - shmseg->shm_perm.seq = (shmseg->shm_perm.seq + 1) & 0x7fff; - shm_handle = (struct shm_handle *) - sys_malloc(sizeof(struct shm_handle), M_SHM, M_WAITOK); - shmid = IXSEQ_TO_IPCID(segnum, shmseg->shm_perm); - - /* - * We make sure that we have allocated a pager before we need - * to. - */ - if (shm_use_phys) { - shm_handle->shm_object = - vm_pager_allocate(OBJT_PHYS, 0, size, VM_PROT_DEFAULT, 0); - } else { - shm_handle->shm_object = - vm_pager_allocate(OBJT_SWAP, 0, size, VM_PROT_DEFAULT, 0); - } - VM_OBJECT_LOCK(shm_handle->shm_object); - vm_object_clear_flag(shm_handle->shm_object, OBJ_ONEMAPPING); - vm_object_set_flag(shm_handle->shm_object, OBJ_NOSPLIT); - VM_OBJECT_UNLOCK(shm_handle->shm_object); - - shmseg->shm_internal = shm_handle; -#ifdef __CYGWIN__ - shmseg->shm_perm.cuid = shmseg->shm_perm.uid = td->ipcblk->uid; - shmseg->shm_perm.cgid = shmseg->shm_perm.gid = td->ipcblk->gid; -#else - shmseg->shm_perm.cuid = shmseg->shm_perm.uid = cred->cr_uid; - shmseg->shm_perm.cgid = shmseg->shm_perm.gid = cred->cr_gid; -#endif /* __CYGWIN__ */ - shmseg->shm_perm.mode = (shmseg->shm_perm.mode & SHMSEG_WANTED) | - (mode & ACCESSPERMS) | SHMSEG_ALLOCATED; - shmseg->shm_segsz = uap->size; - shmseg->shm_cpid = td->td_proc->p_pid; - shmseg->shm_lpid = shmseg->shm_nattch = 0; - shmseg->shm_atime = shmseg->shm_dtime = 0; - shmseg->shm_ctime = time (NULL); - shm_committed += btoc(size); - shm_nused++; - if (shmseg->shm_perm.mode & SHMSEG_WANTED) { - /* - * Somebody else wanted this key while we were asleep. Wake - * them up now. - */ - shmseg->shm_perm.mode &= ~SHMSEG_WANTED; - wakeup(shmseg); - } - td->td_retval[0] = shmid; -#ifdef __CYGWIN__ - td->td_retval[1] = - vm_object_duplicate(td, shmseg->shm_internal->shm_object); -#endif /* __CYGWIN__ */ - return (0); -} - -/* - * MPSAFE - */ -int -shmget(struct thread *td, struct shmget_args *uap) -{ - int segnum, mode; - int error; - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - mtx_lock(&Giant); - mode = uap->shmflg & ACCESSPERMS; - if (uap->key != IPC_PRIVATE) { - again: -#ifdef __CYGWIN__ - if (uap->shmflg & IPC_KEY_IS_SHMID) - segnum = shm_find_segment_by_shmid ((int) uap->key) ? - IPCID_TO_IX((int) uap->key) : -1; - else -#endif - segnum = shm_find_segment_by_key(uap->key); - if (segnum >= 0) { - error = shmget_existing(td, uap, mode, segnum); - if (error == EAGAIN) - goto again; - goto done2; - } - if ((uap->shmflg & IPC_CREAT) == 0) { - error = ENOENT; - goto done2; - } - } - error = shmget_allocate_segment(td, uap, mode); -done2: -#ifdef __CYGWIN__ - if (!error) - ipcexit_creat_hookthread (td); - else - td->td_retval[0] = -1; -#endif - mtx_unlock(&Giant); - return (error); -} - -#ifndef __CYGWIN__ -/* - * MPSAFE - */ -int -shmsys(td, uap) - struct thread *td; - /* XXX actually varargs. */ - struct shmsys_args /* { - int which; - int a2; - int a3; - int a4; - } */ *uap; -{ - int error; - - if (!jail_sysvipc_allowed && jailed(td->td_ucred)) - return (ENOSYS); - if (uap->which < 0 || - uap->which >= sizeof(shmcalls)/sizeof(shmcalls[0])) - return (EINVAL); - mtx_lock(&Giant); - error = (*shmcalls[uap->which])(td, &uap->a2); - mtx_unlock(&Giant); - return (error); -} -#endif /* __CYGWIN__ */ - -static void -shmfork_myhook(struct proc *p1, struct proc *p2) -{ - struct shmmap_state *shmmap_s; - size_t size; - int i; - - size = shminfo.shmseg * sizeof(struct shmmap_state); - shmmap_s = (struct shmmap_state *) sys_malloc(size, M_SHM, M_WAITOK); - bcopy(p1->p_vmspace->vm_shm, shmmap_s, size); - p2->p_vmspace->vm_shm = shmmap_s; - for (i = 0; i < shminfo.shmseg; i++, shmmap_s++) - if (shmmap_s->shmid != -1) { - shm_nattch++; - shmsegs[IPCID_TO_IX(shmmap_s->shmid)].shm_nattch++; - } -} - -#ifdef __CYGWIN__ -int cygwin_shmfork_myhook (struct thread *td, struct proc *parent) -{ - ipcexit_creat_hookthread (td); - ipc_p_vmspace (td->ipcblk); - ipc_p_vmspace (parent); - shmfork_myhook (parent, td->ipcblk); - return 0; -} -#endif - -void -shmexit_myhook(struct vmspace *vm) -{ - struct shmmap_state *base, *shm; - int i; - - GIANT_REQUIRED; - - if ((base = vm->vm_shm) != NULL) { - vm->vm_shm = NULL; - for (i = 0, shm = base; i < shminfo.shmseg; i++, shm++) { - if (shm->shmid != -1) - shm_delete_mapping(vm, shm); - } - sys_free(base, M_SHM); - } -} - -static void -shmrealloc(void) -{ - int i; - struct shmid_ds *newsegs; - - if (shmalloced >= shminfo.shmmni) - return; - - newsegs = (struct shmid_ds *) sys_malloc(shminfo.shmmni * sizeof(*newsegs), M_SHM, M_WAITOK); - if (newsegs == NULL) - return; - for (i = 0; i < shmalloced; i++) - bcopy(&shmsegs[i], &newsegs[i], sizeof(newsegs[0])); - for (; i < shminfo.shmmni; i++) { - shmsegs[i].shm_perm.mode = SHMSEG_FREE; - shmsegs[i].shm_perm.seq = 0; - } - sys_free(shmsegs, M_SHM); - shmsegs = newsegs; - shmalloced = shminfo.shmmni; -} - -void -shminit(void) -{ - int i; - tun_bool_t shm_ar; - - TUNABLE_INT_FETCH("kern.ipc.shmmaxpgs", &shminfo.shmall); - for (i = PAGE_SIZE; i > 0; i--) { - shminfo.shmmax = shminfo.shmall * i; - if (shminfo.shmmax >= shminfo.shmall) - break; - } - TUNABLE_INT_FETCH("kern.ipc.shmmin", &shminfo.shmmin); - TUNABLE_INT_FETCH("kern.ipc.shmmni", &shminfo.shmmni); - TUNABLE_INT_FETCH("kern.ipc.shmseg", &shminfo.shmseg); - TUNABLE_BOOL_FETCH("kern.ipc.shm_allow_removed", &shm_ar); - if (shm_ar == TUN_TRUE) - shm_allow_removed = 1; - shmalloced = shminfo.shmmni; - shmsegs = (struct shmid_ds *) sys_malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, M_WAITOK); - if (shmsegs == NULL) - panic("cannot allocate initial memory for sysvshm"); - for (i = 0; i < shmalloced; i++) { - shmsegs[i].shm_perm.mode = SHMSEG_FREE; - shmsegs[i].shm_perm.seq = 0; - } - shm_last_free = 0; - shm_nused = 0; - shm_committed = 0; -#ifndef __CYGWIN__ - shmexit_hook = &shmexit_myhook; - shmfork_hook = &shmfork_myhook; -#endif /* __CYGWIN__ */ -} - -int -shmunload(void) -{ - - if (shm_nused > 0) - return (EBUSY); - - sys_free(shmsegs, M_SHM); -#ifndef __CYGWIN__ - shmexit_hook = NULL; - shmfork_hook = NULL; -#endif /* __CYGWIN__ */ - return (0); -} - -#ifndef __CYGWIN__ -static int -sysctl_shmsegs(SYSCTL_HANDLER_ARGS) -{ - - return (SYSCTL_OUT(req, shmsegs, shmalloced * sizeof(shmsegs[0]))); -} - -static int -sysvshm_modload(struct module *module, int cmd, void *arg) -{ - int error = 0; - - switch (cmd) { - case MOD_LOAD: - shminit(); - break; - case MOD_UNLOAD: - error = shmunload(); - break; - case MOD_SHUTDOWN: - break; - default: - error = EINVAL; - break; - } - return (error); -} - -static moduledata_t sysvshm_mod = { - "sysvshm", - &sysvshm_modload, - NULL -}; - -SYSCALL_MODULE_HELPER(shmsys); -SYSCALL_MODULE_HELPER(shmat); -SYSCALL_MODULE_HELPER(shmctl); -SYSCALL_MODULE_HELPER(shmdt); -SYSCALL_MODULE_HELPER(shmget); - -DECLARE_MODULE(sysvshm, sysvshm_mod, - SI_SUB_SYSV_SHM, SI_ORDER_FIRST); -MODULE_VERSION(sysvshm, 1); -#endif /* __CYGWIN__ */ -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/threaded_queue.cc b/winsup/cygserver/threaded_queue.cc deleted file mode 100644 index 53dd6fa11..000000000 --- a/winsup/cygserver/threaded_queue.cc +++ /dev/null @@ -1,410 +0,0 @@ -/* threaded_queue.cc - - Copyright 2001, 2002, 2003 Red Hat Inc. - - Written by Robert Collins - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" - -#include -#include -#include -#include -#include -#include -#include "threaded_queue.h" - -/*****************************************************************************/ - -/* queue_request */ - -queue_request::~queue_request () -{} - -/*****************************************************************************/ - -/* threaded_queue */ - -threaded_queue::threaded_queue (const size_t initial_workers) - : _workers_count (0), - _running (false), - _submitters_head (NULL), - _requests_count (0), - _requests_head (NULL), - _requests_sem (NULL) -{ - InitializeCriticalSection (&_queue_lock); - - // This semaphore's count is the number of requests on the queue. - // The maximum count (129792) is calculated as MAXIMUM_WAIT_OBJECTS - // multiplied by max. threads per process (2028?), which is (a few) - // more requests than could ever be pending with the current design. - - _requests_sem = CreateSemaphore (NULL, // SECURITY_ATTRIBUTES - 0, // Initial count - 129792, // Maximum count - NULL); // Anonymous - - if (!_requests_sem) - { - system_printf (("failed to create the request queue semaphore, " - "error = %lu"), - GetLastError ()); - abort (); - } - - create_workers (initial_workers); -} - -threaded_queue::~threaded_queue () -{ - if (_running) - stop (); - - debug_printf ("deleting all pending queue requests"); - queue_request *reqptr = _requests_head; - while (reqptr) - { - queue_request *const ptr = reqptr; - reqptr = reqptr->_next; - delete ptr; - } - - DeleteCriticalSection (&_queue_lock); - if (_requests_sem) - (void) CloseHandle (_requests_sem); -} - -/* FIXME: return success or failure rather than quitting */ -void -threaded_queue::add_submission_loop (queue_submission_loop *const submitter) -{ - assert (this); - assert (submitter); - assert (submitter->_queue == this); - assert (!submitter->_next); - - submitter->_next = - TInterlockedExchangePointer (&_submitters_head, submitter); - - if (_running) - submitter->start (); -} - -bool -threaded_queue::start () -{ - EnterCriticalSection (&_queue_lock); - const bool was_running = _running; - _running = true; - queue_submission_loop *loopptr = _submitters_head; - LeaveCriticalSection (&_queue_lock); - - if (!was_running) - { - debug_printf ("starting all queue submission loops"); - - while (loopptr) - { - queue_submission_loop *const ptr = loopptr; - loopptr = loopptr->_next; - ptr->start (); - } - } - - return was_running; -} - -bool -threaded_queue::stop () -{ - EnterCriticalSection (&_queue_lock); - const bool was_running = _running; - _running = false; - queue_submission_loop *loopptr = _submitters_head; - LeaveCriticalSection (&_queue_lock); - - if (was_running) - { - debug_printf ("stopping all queue submission loops"); - while (loopptr) - { - queue_submission_loop *const ptr = loopptr; - loopptr = loopptr->_next; - ptr->stop (); - } - - ReleaseSemaphore (_requests_sem, _workers_count, NULL); - while (_workers_count) - { - debug_printf (("waiting for worker threads to terminate: " - "%lu still running"), - _workers_count); - Sleep (1000); - } - debug_printf ("all worker threads have terminated"); - } - - return was_running; -} - -/* FIXME: return success or failure */ -void -threaded_queue::add (queue_request *const therequest) -{ - assert (this); - assert (therequest); - assert (!therequest->_next); - - if (!_workers_count) - { - system_printf ("warning: no worker threads to handle request!"); - // FIXME: And then what? - } - - EnterCriticalSection (&_queue_lock); - if (!_requests_head) - _requests_head = therequest; - else - { - /* Add to the queue end. */ - queue_request *reqptr = _requests_head; - for (; reqptr->_next; reqptr = reqptr->_next) - {} - assert (reqptr); - assert (!reqptr->_next); - reqptr->_next = therequest; - } - - _requests_count += 1; - assert (_requests_count > 0); - LeaveCriticalSection (&_queue_lock); - - (void) ReleaseSemaphore (_requests_sem, 1, NULL); -} - -/*static*/ DWORD WINAPI -threaded_queue::start_routine (const LPVOID lpParam) -{ - class threaded_queue *const queue = (class threaded_queue *) lpParam; - assert (queue); - - queue->worker_loop (); - - const long count = InterlockedDecrement (&queue->_workers_count); - assert (count >= 0); - - if (queue->_running) - debug_printf ("worker loop has exited; thread about to terminate"); - - return 0; -} - -/* Called from the constructor: so no need to be thread-safe until the - * worker threads start to be created; thus the interlocked increment - * of the `_workers_count' field. - */ - -void -threaded_queue::create_workers (const size_t initial_workers) -{ - assert (initial_workers > 0); - - for (unsigned int i = 0; i != initial_workers; i++) - { - const long count = InterlockedIncrement (&_workers_count); - assert (count > 0); - - DWORD tid; - const HANDLE hThread = - CreateThread (NULL, 0, start_routine, this, 0, &tid); - - if (!hThread) - { - system_printf ("failed to create thread, error = %lu", - GetLastError ()); - abort (); - } - - (void) CloseHandle (hThread); - } -} - -void -threaded_queue::worker_loop () -{ - while (true) - { - const DWORD rc = WaitForSingleObject (_requests_sem, INFINITE); - if (rc == WAIT_FAILED) - { - system_printf ("wait for request semaphore failed, error = %lu", - GetLastError ()); - return; - } - assert (rc == WAIT_OBJECT_0); - - EnterCriticalSection (&_queue_lock); - if (!_running) - { - LeaveCriticalSection (&_queue_lock); - return; - } - - assert (_requests_head); - queue_request *const reqptr = _requests_head; - _requests_head = reqptr->_next; - - _requests_count -= 1; - assert (_requests_count >= 0); - LeaveCriticalSection (&_queue_lock); - - assert (reqptr); - reqptr->process (); - delete reqptr; - } -} - -/*****************************************************************************/ - -/* queue_submission_loop */ - -queue_submission_loop::queue_submission_loop (threaded_queue *const queue, - const bool ninterruptible) - : _running (false), - _interrupt_event (NULL), - _queue (queue), - _interruptible (ninterruptible), - _hThread (NULL), - _tid (0), - _next (NULL) -{ - if (_interruptible) - { - // verbose: debug_printf ("creating an interruptible processing thread"); - - _interrupt_event = CreateEvent (NULL, // SECURITY_ATTRIBUTES - FALSE, // Auto-reset - FALSE, // Initially non-signalled - NULL); // Anonymous - - if (!_interrupt_event) - { - system_printf ("failed to create interrupt event, error = %lu", - GetLastError ()); - abort (); - } - } -} - -queue_submission_loop::~queue_submission_loop () -{ - if (_running) - stop (); - if (_interrupt_event) - (void) CloseHandle (_interrupt_event); - if (_hThread) - (void) CloseHandle (_hThread); -} - -bool -queue_submission_loop::start () -{ - assert (this); - assert (!_hThread); - - const bool was_running = _running; - - if (!was_running) - { - _running = true; - - _hThread = CreateThread (NULL, 0, start_routine, this, 0, &_tid); - if (!_hThread) - { - system_printf ("failed to create thread, error = %lu", - GetLastError ()); - abort (); - } - } - - return was_running; -} - -bool -queue_submission_loop::stop () -{ - assert (this); - assert (_hThread && _hThread != INVALID_HANDLE_VALUE); - - const bool was_running = _running; - - if (_running) - { - _running = false; - - if (_interruptible) - { - assert (_interrupt_event - && _interrupt_event != INVALID_HANDLE_VALUE); - - SetEvent (_interrupt_event); - - if (WaitForSingleObject (_hThread, 1000) == WAIT_TIMEOUT) - { - system_printf (("request loop thread %lu failed to shutdown " - "when asked politely: about to get heavy"), - _tid); - - if (!TerminateThread (_hThread, 0)) - { - system_printf (("failed to kill request loop thread %lu" - ", error = %lu"), - _tid, GetLastError ()); - abort (); - } - } - } - else - { - // FIXME: could wait to see if the request loop notices that - // the submission loop is no longer running and shuts down - // voluntarily. - - debug_printf ("killing request loop thread %lu", _tid); - - if (!TerminateThread (_hThread, 0)) - system_printf (("failed to kill request loop thread %lu" - ", error = %lu"), - _tid, GetLastError ()); - } - } - - return was_running; -} - -/*static*/ DWORD WINAPI -queue_submission_loop::start_routine (const LPVOID lpParam) -{ - class queue_submission_loop *const submission_loop = - (class queue_submission_loop *) lpParam; - assert (submission_loop); - - submission_loop->request_loop (); - - debug_printf ("submission loop has exited; thread about to terminate"); - - submission_loop->stop (); - - return 0; -} - -/*****************************************************************************/ -#endif /* __OUTSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/threaded_queue.h b/winsup/cygserver/threaded_queue.h deleted file mode 100644 index e17f90434..000000000 --- a/winsup/cygserver/threaded_queue.h +++ /dev/null @@ -1,127 +0,0 @@ -/* threaded_queue.h - - Copyright 2001, 2002, 2003, 2012 Red Hat Inc. - - Written by Robert Collins - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifndef _THREADED_QUEUE_ -#define _THREADED_QUEUE_ - -/*****************************************************************************/ - -/* a specific request */ - -class queue_request -{ -public: - queue_request *_next; - - queue_request () : _next (NULL) {} - virtual ~queue_request (); - - virtual void process () = 0; -}; - -/*****************************************************************************/ - -/* a queue to allocate requests from n submission loops to x worker threads */ - -class queue_submission_loop; - -class threaded_queue -{ -public: - threaded_queue (size_t initial_workers = 1); - ~threaded_queue (); - - void add_submission_loop (queue_submission_loop *); - - bool running () const { return _running; } - - bool start (); - bool stop (); - - void add (queue_request *); - -private: - LONG _workers_count; - bool _running; - - queue_submission_loop *_submitters_head; - - long _requests_count; // Informational only. - queue_request *_requests_head; - - CRITICAL_SECTION _queue_lock; - HANDLE _requests_sem; // == _requests_count - - static DWORD WINAPI start_routine (LPVOID /* this */); - - void create_workers (size_t initial_workers); - void worker_loop (); -}; - -/*****************************************************************************/ - -/* parameters for a request finding and submitting loop */ - -class queue_submission_loop -{ - friend class threaded_queue; - -public: - queue_submission_loop (threaded_queue *, bool ninterruptible); - virtual ~queue_submission_loop (); - - bool start (); - bool stop (); - - threaded_queue *queue () { return _queue; }; - -protected: - bool _running; - HANDLE _interrupt_event; - threaded_queue *const _queue; - -private: - bool _interruptible; - HANDLE _hThread; - DWORD _tid; - queue_submission_loop *_next; - - static DWORD WINAPI start_routine (LPVOID /* this */); - virtual void request_loop () = 0; -}; - -#ifdef __cplusplus - -/*---------------------------------------------------------------------------* - * Some type-safe versions of the various interlocked functions. - *---------------------------------------------------------------------------*/ - -template T * -TInterlockedExchangePointer (T **lvalue, T *rvalue) -{ - return reinterpret_cast - (InterlockedExchangePointer (reinterpret_cast (lvalue), - reinterpret_cast (rvalue))); -} - -template T * -TInterlockedCompareExchangePointer (T **lvalue, T *rvalue1, T *rvalue2) -{ - return reinterpret_cast - (InterlockedCompareExchangePointer (reinterpret_cast (lvalue), - reinterpret_cast (rvalue1), - reinterpret_cast (rvalue2))); -} - -#endif /* __cplusplus */ - -#endif /* _THREADED_QUEUE_ */ diff --git a/winsup/cygserver/transport.cc b/winsup/cygserver/transport.cc deleted file mode 100644 index ff9ce8d80..000000000 --- a/winsup/cygserver/transport.cc +++ /dev/null @@ -1,49 +0,0 @@ -/* transport.cc - - Copyright 2001, 2002, 2003, 2004, 2007 Red Hat Inc. - - Written by Robert Collins - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -/* to allow this to link into cygwin and the .dll, a little magic is needed. */ -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" -#else -#include "winsup.h" -#endif - -#include - -#include "transport.h" -#include "transport_pipes.h" - -/* The factory */ -transport_layer_base * -create_server_transport () -{ - return new transport_layer_pipes; -} - -#ifndef __INSIDE_CYGWIN__ - -bool -transport_layer_base::impersonate_client () -{ - return true; -} - -bool -transport_layer_base::revert_to_self () -{ - return true; -} - -#endif /* !__INSIDE_CYGWIN__ */ - -transport_layer_base::~transport_layer_base () -{} diff --git a/winsup/cygserver/transport.h b/winsup/cygserver/transport.h deleted file mode 100644 index 80f50fd06..000000000 --- a/winsup/cygserver/transport.h +++ /dev/null @@ -1,39 +0,0 @@ -/* transport.h - - Copyright 2001, 2002, 2003, 2004 Red Hat Inc. - - Written by Robert Collins - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifndef _TRANSPORT_H -#define _TRANSPORT_H - -class transport_layer_base *create_server_transport (); - -class transport_layer_base -{ -public: -#ifndef __INSIDE_CYGWIN__ - virtual int listen () = 0; - virtual class transport_layer_base *accept (bool *recoverable) = 0; -#endif - - virtual void close () = 0; - virtual ssize_t read (void *buf, size_t len) = 0; - virtual ssize_t write (void *buf, size_t len) = 0; - virtual int connect () = 0; - -#ifndef __INSIDE_CYGWIN__ - virtual bool impersonate_client (); - virtual bool revert_to_self (); -#endif - - virtual ~transport_layer_base (); -}; - -#endif /* _TRANSPORT_H */ diff --git a/winsup/cygserver/transport_pipes.cc b/winsup/cygserver/transport_pipes.cc deleted file mode 100644 index dda15d3d4..000000000 --- a/winsup/cygserver/transport_pipes.cc +++ /dev/null @@ -1,336 +0,0 @@ -/* transport_pipes.cc - - Copyright 2001, 2002, 2003, 2004, 2009, 2012 Red Hat Inc. - - Written by Robert Collins - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -/* to allow this to link into cygwin and the .dll, a little magic is needed. */ -#ifdef __OUTSIDE_CYGWIN__ -#include "woutsup.h" -#include -#else -#include "winsup.h" -#endif - -#include - -#include -#include -#include -#include -#include -#include - -#include "cygerrno.h" -#include "transport.h" -#include "transport_pipes.h" - -#ifndef __INSIDE_CYGWIN__ -#include "cygserver.h" -#include "cygserver_ipc.h" -#else -#include "security.h" -#endif - -#ifdef __INSIDE_CYGWIN__ -#define SET_ERRNO(err) set_errno (err) -#else -#define SET_ERRNO(err) errno = (err) -#endif - -enum - { - MAX_WAIT_NAMED_PIPE_RETRY = 64, - WAIT_NAMED_PIPE_TIMEOUT = 10 // milliseconds - }; - -#ifndef __INSIDE_CYGWIN__ - -transport_layer_pipes::transport_layer_pipes (const HANDLE hPipe) - : _hPipe (hPipe), - _is_accepted_endpoint (true), - _is_listening_endpoint (false) -{ - assert (_hPipe); - assert (_hPipe != INVALID_HANDLE_VALUE); - _pipe_name[0] = L'\0'; -} - -#endif /* !__INSIDE_CYGWIN__ */ - -transport_layer_pipes::transport_layer_pipes () - : _hPipe (NULL), - _is_accepted_endpoint (false), - _is_listening_endpoint (false) -{ - wchar_t cyg_instkey[18]; - - wchar_t *p = wcpcpy (_pipe_name, PIPE_NAME_PREFIX); - if (!cygwin_internal (CW_GET_INSTKEY, cyg_instkey)) - wcpcpy (wcpcpy (p, cyg_instkey), PIPE_NAME_SUFFIX); -} - -transport_layer_pipes::~transport_layer_pipes () -{ - close (); -} - -#ifndef __INSIDE_CYGWIN__ - -int -transport_layer_pipes::listen () -{ - assert (!_hPipe); - assert (!_is_accepted_endpoint); - assert (!_is_listening_endpoint); - - _is_listening_endpoint = true; - - debug ("Try to create named pipe: %ls", _pipe_name); - - HANDLE listen_pipe = - CreateNamedPipeW (_pipe_name, - PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE, - PIPE_TYPE_BYTE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, - 0, 0, 1000, &sec_all_nih); - if (listen_pipe != INVALID_HANDLE_VALUE) - { - HANDLE connect_pipe = - CreateFileW (_pipe_name, GENERIC_READ | GENERIC_WRITE, 0, &sec_all_nih, - OPEN_EXISTING, 0, NULL); - if (connect_pipe == INVALID_HANDLE_VALUE) - { - CloseHandle (listen_pipe); - listen_pipe = INVALID_HANDLE_VALUE; - } - } - - if (listen_pipe == INVALID_HANDLE_VALUE) - { - system_printf ("failed to create named pipe: " - "is the daemon already running?"); - return -1; - } - - return 0; -} - -class transport_layer_pipes * -transport_layer_pipes::accept (bool *const recoverable) -{ - assert (!_hPipe); - assert (!_is_accepted_endpoint); - assert (_is_listening_endpoint); - - debug ("Try to create named pipe instance: %ls", _pipe_name); - - const HANDLE accept_pipe = - CreateNamedPipeW (_pipe_name, PIPE_ACCESS_DUPLEX, - PIPE_TYPE_BYTE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, - 0, 0, 1000, &sec_all_nih); - - if (accept_pipe == INVALID_HANDLE_VALUE) - { - debug_printf ("error creating pipe (%lu).", GetLastError ()); - *recoverable = true; // FIXME: case analysis? - return NULL; - } - - if (!ConnectNamedPipe (accept_pipe, NULL) - && GetLastError () != ERROR_PIPE_CONNECTED) - { - debug_printf ("error connecting to pipe (%lu)", GetLastError ()); - (void) CloseHandle (accept_pipe); - *recoverable = true; // FIXME: case analysis? - return NULL; - } - - return new transport_layer_pipes (accept_pipe); -} - -#endif /* !__INSIDE_CYGWIN__ */ - -void -transport_layer_pipes::close () -{ - // verbose: debug_printf ("closing pipe %p", _hPipe); - - if (_hPipe) - { - assert (_hPipe != INVALID_HANDLE_VALUE); - -#ifndef __INSIDE_CYGWIN__ - - if (_is_accepted_endpoint) - { - (void) FlushFileBuffers (_hPipe); // Blocks until client reads. - (void) DisconnectNamedPipe (_hPipe); - (void) CloseHandle (_hPipe); - } - else - (void) CloseHandle (_hPipe); - -#else /* __INSIDE_CYGWIN__ */ - - assert (!_is_accepted_endpoint); - (void) ForceCloseHandle (_hPipe); - -#endif /* __INSIDE_CYGWIN__ */ - - _hPipe = NULL; - } -} - -ssize_t -transport_layer_pipes::read (void *const buf, const size_t len) -{ - // verbose: debug_printf ("reading from pipe %p", _hPipe); - - assert (_hPipe); - assert (_hPipe != INVALID_HANDLE_VALUE); - assert (!_is_listening_endpoint); - - DWORD count; - if (!ReadFile (_hPipe, buf, len, &count, NULL)) - { - debug_printf ("error reading from pipe (%lu)", GetLastError ()); - SET_ERRNO (EINVAL); // FIXME? - return -1; - } - - return count; -} - -ssize_t -transport_layer_pipes::write (void *const buf, const size_t len) -{ - // verbose: debug_printf ("writing to pipe %p", _hPipe); - - assert (_hPipe); - assert (_hPipe != INVALID_HANDLE_VALUE); - assert (!_is_listening_endpoint); - - DWORD count; - if (!WriteFile (_hPipe, buf, len, &count, NULL)) - { - debug_printf ("error writing to pipe, error = %lu", GetLastError ()); - SET_ERRNO (EINVAL); // FIXME? - return -1; - } - - return count; -} - -/* - * This routine holds a static variable, assume_cygserver, that is set - * if the transport has good reason to think that cygserver is - * running, i.e. if if successfully connected to it with the previous - * attempt. If this is set, the code tries a lot harder to get a - * connection, making the assumption that any failures are just - * congestion and overloading problems. - */ - -int -transport_layer_pipes::connect () -{ - assert (!_hPipe); - assert (!_is_accepted_endpoint); - assert (!_is_listening_endpoint); - - static bool assume_cygserver = false; - - BOOL rc = TRUE; - int retries = 0; - - debug_printf ("Try to connect to named pipe: %W", _pipe_name); - while (rc) - { - _hPipe = CreateFileW (_pipe_name, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - &sec_all_nih, - OPEN_EXISTING, - SECURITY_IMPERSONATION, - NULL); - - if (_hPipe != INVALID_HANDLE_VALUE) - { - assert (_hPipe); -#ifdef __INSIDE_CYGWIN__ - ProtectHandle (_hPipe); -#endif - assume_cygserver = true; - return 0; - } - - _hPipe = NULL; - - if (!assume_cygserver && GetLastError () != ERROR_PIPE_BUSY) - { - debug_printf ("Error opening the pipe (%lu)", GetLastError ()); - return -1; - } - - /* Note: `If no instances of the specified named pipe exist, the - * WaitNamedPipe function returns immediately, regardless of the - * time-out value.' Thus the explicit Sleep if the call fails - * with ERROR_FILE_NOT_FOUND. - */ - while (retries != MAX_WAIT_NAMED_PIPE_RETRY - && !(rc = WaitNamedPipeW (_pipe_name, WAIT_NAMED_PIPE_TIMEOUT))) - { - if (GetLastError () == ERROR_FILE_NOT_FOUND) - Sleep (0); // Give the server a chance. - - retries += 1; - } - } - - assert (retries == MAX_WAIT_NAMED_PIPE_RETRY); - - system_printf ("lost connection to cygserver, error = %lu", - GetLastError ()); - - assume_cygserver = false; - - return -1; -} - -#ifndef __INSIDE_CYGWIN__ - -bool -transport_layer_pipes::impersonate_client () -{ - assert (_hPipe); - assert (_hPipe != INVALID_HANDLE_VALUE); - assert (_is_accepted_endpoint); - - if (_hPipe && !ImpersonateNamedPipeClient (_hPipe)) - { - debug_printf ("Failed to Impersonate client, (%lu)", GetLastError ()); - return false; - } - - return true; -} - -bool -transport_layer_pipes::revert_to_self () -{ - assert (_is_accepted_endpoint); - - if (!RevertToSelf ()) - { - debug_printf ("Failed to RevertToSelf, (%lu)", GetLastError ()); - return false; - } - return true; -} - -#endif /* !__INSIDE_CYGWIN__ */ diff --git a/winsup/cygserver/transport_pipes.h b/winsup/cygserver/transport_pipes.h deleted file mode 100644 index 136812106..000000000 --- a/winsup/cygserver/transport_pipes.h +++ /dev/null @@ -1,50 +0,0 @@ -/* transport_pipes.h - - Copyright 2001, 2002, 2003 Red Hat Inc. - - Written by Robert Collins - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifndef _TRANSPORT_PIPES_H -#define _TRANSPORT_PIPES_H - -#define PIPE_NAME_PREFIX L"\\\\.\\pipe\\cygwin-" -#define PIPE_NAME_SUFFIX L"-lpc" - -/* Named pipes based transport, for security on NT */ -class transport_layer_pipes : public transport_layer_base -{ -public: -#ifndef __INSIDE_CYGWIN__ - virtual int listen (); - virtual class transport_layer_pipes *accept (bool *recoverable); -#endif - - virtual void close (); - virtual ssize_t read (void *buf, size_t len); - virtual ssize_t write (void *buf, size_t len); - virtual int connect (); - -#ifndef __INSIDE_CYGWIN__ - virtual bool impersonate_client (); - virtual bool revert_to_self (); -#endif - - transport_layer_pipes (); - virtual ~transport_layer_pipes (); - -private: - wchar_t _pipe_name[40]; - HANDLE _hPipe; - const bool _is_accepted_endpoint; - bool _is_listening_endpoint; - - transport_layer_pipes (HANDLE hPipe); -}; - -#endif /* _TRANSPORT_PIPES_H */ diff --git a/winsup/cygserver/woutsup.h b/winsup/cygserver/woutsup.h deleted file mode 100644 index 5598c11c2..000000000 --- a/winsup/cygserver/woutsup.h +++ /dev/null @@ -1,56 +0,0 @@ -/* woutsup.h: for Cygwin code compiled outside the DLL (i.e. cygserver). - - Copyright 2002, 2003, 2007 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#define _MT_SAFE 1 - -#ifdef __INSIDE_CYGWIN__ -#error "woutsup.h is not for code being compiled inside the dll" -#endif - -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0500 -#endif - -#if _WIN32_WINNT < 0x0500 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0500 -#endif - -#include "winlean.h" - -#include "bsd_helper.h" -#include "bsd_log.h" -#include "bsd_mutex.h" - -/* The one function we use from winuser.h most of the time */ -extern "C" DWORD WINAPI GetLastError (void); - -extern int cygserver_running; - -#define SIGHANDLE(SIG) \ - do \ - { \ - struct sigaction act; \ - \ - act.sa_handler = &handle_signal; \ - act.sa_mask = 0; \ - act.sa_flags = 0; \ - \ - if (sigaction (SIG, &act, NULL) == -1) \ - { \ - panic ("failed to install handler for " #SIG ": %s", \ - strerror (errno)); \ - exit (1); \ - } \ - } while (false) - -#define debug_printf(f,...) debug((f),##__VA_ARGS__) -#define syscall_printf(f,...) log(LOG_ERR,(f),##__VA_ARGS__) -#define system_printf(f,...) log(LOG_ERR,(f),##__VA_ARGS__) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d2e188499..be0a3f7fa 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2014-02-08 Corinna Vinschen + + * miscfuncs.h (class NT_readline): New class to implement line-wise + reading from file using native NT functions. + * miscfuncs.cc (NT_readline::init): New method. + (NT_readline::fgets): New method. + * mount.cc (mount_info::from_fstab): Utilize NT_readline to read + fstab files. + 2014-02-06 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::fchown): Fix typo in diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index b2da91846..241819460 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -1,7 +1,7 @@ /* miscfuncs.cc: misc funcs that don't belong anywhere else Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc. This file is part of Cygwin. @@ -384,6 +384,82 @@ WritePipeOverlapped (HANDLE h, LPCVOID buf, DWORD len, LPDWORD ret_len, return ret; } +bool +NT_readline::init (POBJECT_ATTRIBUTES attr, PCHAR in_buf, ULONG in_buflen) +{ + NTSTATUS status; + IO_STATUS_BLOCK io; + + status = NtOpenFile (&fh, SYNCHRONIZE | FILE_READ_DATA, attr, &io, + FILE_SHARE_VALID_FLAGS, + FILE_SYNCHRONOUS_IO_NONALERT + | FILE_OPEN_FOR_BACKUP_INTENT); + if (!NT_SUCCESS (status)) + { + paranoid_printf ("NtOpenFile(%S) failed, status %y", + &attr->ObjectName, status); + return false; + } + buf = in_buf; + buflen = in_buflen; + got = end = buf; + len = 0; + line = 1; + return true; +} + +PCHAR +NT_readline::gets () +{ + IO_STATUS_BLOCK io; + + while (true) + { + /* len == 0 indicates we have to read from the file. */ + if (!len) + { + if (!NT_SUCCESS (NtReadFile (fh, NULL, NULL, NULL, &io, got, + (buflen - 2) - (got - buf), NULL, NULL))) + return NULL; + len = io.Information; + /* Set end marker. */ + got[len] = got[len + 1] = '\0'; + /* Set len to the absolute len of bytes in buf. */ + len += got - buf; + /* Reset got to start reading at the start of the buffer again. */ + got = end = buf; + } + else + { + got = end + 1; + ++line; + } + /* Still some valid full line? */ + if (got < buf + len) + { + if ((end = strchr (got, '\n'))) + { + end[end[-1] == '\r' ? -1 : 0] = '\0'; + return got; + } + /* Last line missing a \n at EOF? */ + if (len < buflen - 2) + { + len = 0; + return got; + } + } + /* We have to read once more. Move remaining bytes to the start of + the buffer and reposition got so that it points to the end of + the remaining bytes. */ + len = buf + len - got; + memmove (buf, got, len); + got = buf + len; + buf[len] = buf[len + 1] = '\0'; + len = 0; + } +} + /* backslashify: Convert all forward slashes in src path to back slashes in dst path. Add a trailing slash to dst when trailing_slash_p arg is set to 1. */ diff --git a/winsup/cygwin/miscfuncs.h b/winsup/cygwin/miscfuncs.h index bc36a1987..66dfc900a 100644 --- a/winsup/cygwin/miscfuncs.h +++ b/winsup/cygwin/miscfuncs.h @@ -1,7 +1,7 @@ /* miscfuncs.h: main Cygwin header file. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc. This file is part of Cygwin. @@ -23,6 +23,24 @@ BOOL WINAPI ReadPipeOverlapped (HANDLE h, PVOID buf, DWORD len, BOOL WINAPI WritePipeOverlapped (HANDLE h, LPCVOID buf, DWORD len, LPDWORD ret_len, DWORD timeout); +/* class for per-line reading using native functions. The caller provides + the file as an POBJECT_ATTRIBUTES, and the buffer space. */ +class NT_readline +{ + HANDLE fh; + PCHAR buf; + PCHAR got; + PCHAR end; + ULONG buflen; + ULONG len; + ULONG line; +public: + NT_readline () : fh (NULL) {} + bool init (POBJECT_ATTRIBUTES attr, char *buf, ULONG buflen); + PCHAR gets (); + ~NT_readline () { if (fh) NtClose (fh); } +}; + extern "C" void yield (); #define import_address(x) __import_address ((void *)(x)) diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index 4abc77e68..60ccdd505 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -1177,10 +1177,9 @@ mount_info::from_fstab (bool user, WCHAR fstab[], PWCHAR fstab_end) { UNICODE_STRING upath; OBJECT_ATTRIBUTES attr; - IO_STATUS_BLOCK io; - NTSTATUS status; - HANDLE fh; + NT_readline rl; tmp_pathbuf tp; + char *buf = tp.c_get (); if (user) { @@ -1195,81 +1194,10 @@ mount_info::from_fstab (bool user, WCHAR fstab[], PWCHAR fstab_end) RtlInitUnicodeString (&upath, fstab); InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE, NULL, NULL); debug_printf ("Try to read mounts from %W", fstab); - status = NtOpenFile (&fh, SYNCHRONIZE | FILE_READ_DATA, &attr, &io, - FILE_SHARE_VALID_FLAGS, - FILE_SYNCHRONOUS_IO_NONALERT - | FILE_OPEN_FOR_BACKUP_INTENT); - if (!NT_SUCCESS (status)) - { - debug_printf ("NtOpenFile(%S) failed, %y", &upath, status); - return false; - } - - char *buf = tp.c_get (); - char *got = buf; - DWORD len = 0; - unsigned line = 1; - /* Using buffer size - 2 leaves space to append two \0. */ - while (NT_SUCCESS (NtReadFile (fh, NULL, NULL, NULL, &io, got, - (NT_MAX_PATH - 2) - (got - buf), NULL, NULL))) - { - char *end; - - len = io.Information; - /* Set end marker. */ - got[len] = got[len + 1] = '\0'; - /* Set len to the absolute len of bytes in buf. */ - len += got - buf; - /* Reset got to start reading at the start of the buffer again. */ - got = buf; -retry: - bool got_nl = false; - while (got < buf + len && (end = strchr (got, '\n'))) - { - got_nl = true; - end[end[-1] == '\r' ? -1 : 0] = '\0'; - if (!from_fstab_line (got, user)) - goto done; - got = end + 1; - ++line; - } - if (len < (NT_MAX_PATH - 2)) + if (rl.init (&attr, buf, NT_MAX_PATH)) + while ((buf = rl.gets ())) + if (!from_fstab_line (buf, user)) break; - /* Check if the buffer contained at least one \n. If not, the - line length is > 32K. We don't take such long lines. Print - a debug message and skip this line entirely. */ - if (!got_nl) - { - system_printf ("%W: Line %d too long, skipping...", fstab, line); - while (NT_SUCCESS (NtReadFile (fh, NULL, NULL, NULL, &io, buf, - (NT_MAX_PATH - 2), NULL, NULL))) - { - len = io.Information; - buf[len] = buf[len + 1] = '\0'; - got = strchr (buf, '\n'); - if (got) - { - ++got; - ++line; - goto retry; - } - } - got = buf; - break; - } - /* We have to read once more. Move remaining bytes to the start of - the buffer and reposition got so that it points to the end of - the remaining bytes. */ - len = buf + len - got; - memmove (buf, got, len); - got = buf + len; - buf[len] = buf[len + 1] = '\0'; - } - /* Catch a last line without trailing \n. */ - if (got > buf) - from_fstab_line (got, user); -done: - NtClose (fh); return true; } diff --git a/winsup/cygwin/release/1.7.29 b/winsup/cygwin/release/1.7.29 deleted file mode 100644 index c06fe60fe..000000000 --- a/winsup/cygwin/release/1.7.29 +++ /dev/null @@ -1,29 +0,0 @@ -What's new: ------------ - -- Introduce reading passwd/group entries directly from SAM/AD, thus allowing - to do without /etc/passwd and /etc/group files. Introduce /etc/nsswitch.conf - file to configure passwd/group handling. - -- Allow quoting of arguments to the CYGWIN environment variable, i.e., - set CYGWIN=error_start="c:\bin\someprogram -T" - - -What changed: -------------- - - -Bug Fixes ---------- - -- Try harder to do the right thing in the presence of console screen buffers, - i.e., never clear the screen buffer unless the user asked for it. Also - fix screen escape sequences which attempted to scroll the screen. - Addresses: http://cygwin.com/ml/cygwin/2014-02/threads.html#00274 - -- Make "ps -W" report different WINPIDs for processes that have been execed - from, e.g., cmd. - Addresses: http://cygwin.com/ml/cygwin/2014-02/threads.html#00382 - -- Avoid error messages from the signal handler if we're exiting. - Addresses: A random irc #cygwin complaint. diff --git a/winsup/doc/.cvsignore b/winsup/doc/.cvsignore deleted file mode 100644 index 288848833..000000000 --- a/winsup/doc/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -Makefile -Makefile.dep - -autom4te.cache -config.log -config.status - -cygwin-api -cygwin-api.xml - -cygwin-ug-net -cygwin-ug-net.html - -faq diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog deleted file mode 100644 index 41cd32ba4..000000000 --- a/winsup/doc/ChangeLog +++ /dev/null @@ -1,2458 +0,0 @@ -2014-01-29 Christopher Faylor - - * faq-setup.xml: Minor snapshot instruction rewording. Update - discussion about setup*.exe. - * faq-using.xml: Update information about setup*.exe. - * faq-what.xml: Ditto. - -2014-01-27 Corinna Vinschen - - * new-features.xml (ov-new1.7.28): Add new section. - -2014-01-07 Mark Geisert - - * faq-programming.xml: Update packages needed to build Cygwin. - -2013-12-07 Corinna Vinschen - - * new-features.xml (ov-new1.7.27): Add new section. - -2013-11-29 Corinna Vinschen - - * new-features.xml (ov-new1.7.26): Fix section ID and title. Add - posix_spawn item. - -2013-11-23 Corinna Vinschen - - * new-features.xml (ov-new1.7.26): Add new section. - -2013-11-12 Tom Schutter - - * faq-setup.xml (faq.setup.uninstall-service): Describe how to unhook - cyglsa DLL from OS before uninstalling. - -2013-11-11 Corinna Vinschen - - * faq-setup.xml: Throughout remove setup.exe, use setup or setup-x86... - instead. - (faq.setup.cli): Reproduce latest --help output. - (faq.setup.noroot): New section. - (faq.setup.setup-fails-on-ts): Remove section. - * setup-net.xml (internet-setup): Mention setup-x86{_64} in first - paragraph. Add note to allow using setup.exe in subsequent paragraphs. - Add paragraph to introduce --no-admin option. - -2013-11-06 Christopher Faylor - - * Makefile.in: Fix problems accessing xidepend when configured with a - (discouraged) relative path to source directory. - -2013-08-23 Christopher Faylor - - * new-features.xml (ov-new1.7.25): Change wording. - -2013-08-23 Corinna Vinschen - - * new-features.xml (ov-new1.7.25): Add new section. - -2013-08-14 Corinna Vinschen - - * new-features.xml (ov-new1.7.24): Add new section. Mention - posix_memalign override. - -2013-07-26 Christopher Faylor - - * new-features.xml (ov-new1.7.23): Add new section. Mention wincmdln. - * cygwinenv.xml: Mention wincmdln. - -2013-07-25 Corinna Vinschen - - * gcc.xml (gcc-64): Fix example. - -2013-07-25 Corinna Vinschen - - * gcc.xml (gcc-default: Rename from gcc-cons. Change title. - (gcc-64): New section explaininig differences in programming for - 64 bit Cygwin. - (gcc-gui): Simplify description and aim at UNIX/Linux developers only. - Note that X programming is preferred. Drop example. - -2013-07-21 Corinna Vinschen - - * new-features.sgml (ov-new1.7.22): Add GetCommandLine and regcomp - changes. - -2013-07-21 Corinna Vinschen - - * Makefile.in (cygwin-ug-net/cygwin-ug-net.html): Add dependency to - cygwin.xsl. - (cygwin-api/cygwin-api.html): Ditto. - (cygwin-ug-net/cygwin-ug-net.pdf): Add dependency to fo.xsl. - (cygwin-api/cygwin-api.pdf): Ditto. - (cygwin-api.xml): Drop "." path component from doctool dependency. - Change Makefile to Makefile.in dep. - (doctool): Drop "." path component from target. - -2013-07-20 Warren Young - Corinna Vinschen - - * Makefile.in (cygwin-ug-net/cygwin-ug-net.pdf): Process input via - xsltproc and fop. - (cygwin-api/cygwin-api.pdf): Ditto. - * fo.xsl: New file. - -2013-07-15 Corinna Vinschen - - * new-features.sgml (ov-new1.7.22): New section. Document dropped - support for /dev/mem, /dev/kmem, /dev/port. - * specialnames.xml (pathnames-posixdevices): Drop description of - /dev/mem, /dev/kmem, /dev/port. - -2013-06-24 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.21): New section. Document rawmemchr. - -2013-06-19 Corinna Vinschen - - * faq-using.xml (faq.using.private-cygwin): Drop. - -2013-06-19 Corinna Vinschen - - * faq-using.xml (faq.using.multiple-copies): Modernize to reflect - installation separation since Cygwin 1.7. - (faq.using.third-party.multiple-copies): Ditto. - -2013-06-17 Corinna Vinschen - - * cygwinenv.xml: Fix link to FAQ. - -2013-06-05 Corinna Vinschen - - * faq-copyright.xml: Fix link to license. - * faq-using.xml: Ditto. - * faq-what.xml: Ditto. - -2013-06-05 Corinna Vinschen - - * faq-programming.xml: Convert url to refer to new flat faq.html file. - * faq-setup.xml: Ditto. - * faq-using.xml: Ditto. - * highlights.xml: Ditto. - -2013-06-05 Corinna Vinschen - - * new-features.xml (ov-new1.7.19): Revert mandatory locking support to - "preliminary". - -2013-06-04 Corinna Vinschen - - * Makefile.in: Add rule to rebuild Makefile if Makefile.in changes. - Include Makefile.dep last. - (Makefile.dep): Run xidepend within source dir. Temporarily drop - faq.xml from dependencies. - * xidepend: Fix creating base filename to accommodate VPATH. - -2013-06-04 Corinna Vinschen - - * new-features.xml (ov-new1.7.19): Align mandatory locking text to - today's changes. - -2013-06-03 Corinna Vinschen - - * new-features.xml (ov-new1.7.19): Add mandatory locking. - -2013-05-23 Warren Young - - * xidepend: New script, generates Makefile.dep from top-level XML - * .cvsignore: Ignoring Makefile.dep output - * Makefile: Creating Makefile.dep if it doesn't exist, including it - if it does, and removing it on 'make clean' - * Wishlist: Knocked autodependency generation off the list - -2013-05-23 Corinna Vinschen - - * cygwinenv.xml (cygwinenv-implemented-options): Explain new - winsymliks:nativestrict option. Strip out description of symlink types - and refer to new pathnames-symlinks section. - * highlights.xml (ov-hi-files): Rip out most of symlink description and - refer to new pathnames-symlinks section instead. - * new-features.xml (ov-new1.7.19): Add CYGWIN=winsymlinks:nativestrict. - * pathnames.xml (pathnames-symlinks): New section describing symbolic - link handling. - -2013-05-21 Corinna Vinschen - - * new-features.xml (ov-new1.7.19): Add arc4random, - arc4random_addrandom, arc4random_buf, arc4random_stir and - arc4random_uniform. - -2013-05-21 Corinna Vinschen - - * new-features.xml (ov-new1.7.19): Add __b64_ntop and __b64_pton. - -2013-05-13 Warren Young - - * cygwin-ug.xml setup.xml: Removed; unused. - * Wishlist: Created, with initial content based on a -patches - mailing list post. - -2013-05-06 Warren Young - - * cygwin-api.in.xml (bookinfo): Reverted XInclude for legal.xml - fragment to a DOCTOOL include. - -2013-05-03 Christopher Faylor - - * Makefile (FAQ_SOURCES): Use wildcard function to find sources in - srcdir. - -2013-05-01 Warren Young - - * bodysnatcher.pl: Created - * Makefile.in (faq/faq.body): Added target to create this file from - faq/faq.html using new bodysnatcher.pl script. - -2013-05-01 Warren Young - - * cygwin-ug.xml: Renamed from cygwin-ug.in.sgml - (bookinfo) Extracted section into new ug-info.xml file - * ug-info.xml: Created - * cygwin-ug-net.xml: Renamed from cygwin-ug-net.in.sgml - (bookinfo) Replaced content with XInclude referencing ug-info.xml - * configure.ac: Replaced a *.sgml file reference with *.xml - * cygserver.xml cygwinenv.xml dll.xml effectively.xml filemodes.xml - gcc.xml gdb.xml legal.xml new-features.xml ntsec.xml overview.xml - pathnames.xml programming.xml setup.xml setup-net.xml textbinary.xml - using.xml windres.xml: Renamed from *.sgml. - Added and tags to the top. - * cygserver.sgml cygwinenv.sgml dll.sgml effectively.sgml filemodes.sgml - gcc.sgml gdb.sgml legal.sgml new-features.sgml ntsec.sgml overview.sgml - pathnames.sgml programming.sgml setup.sgml setup-net.sgml textbinary.sgml - using.sgml windres.sgml: Renamed to *.xml - * faq.xml: Renamed from faq-sections.sgml. (Not faq.sgml!) - Replaced FAQ section ENTITY declarations with XIncludes. - Removed all other ENTITY declarations as they just name entities - already defined in the current DocBook stylesheets. - * faq.sgml: Removed without translating to DocBook XML. Obsolete. - * faq-*.xml: Added and tags to the top. - Moved tags from faq.xml and faq-sections.xml into - individual section files so they individually pass XML validation. - * pathnames.xml: Contained two top-level elements, which is - malformed XML. Moved second to new specialnames.xml file. - * specialnames.xml: Created; extracted from pathnames.sgml - * overview2.xml: Broke it up into following three files, and - removed the original. - * ov-ex-win.xml (ov-ex-win): Created; contents extracted from - overview2.sgml - * ov-ex-unix.xml (ov-ex-unix): Ditto - * highlights.xml (highlights): Ditto - * setup2.xml: Broke it up into setup-*.xml. - * setup-env.xml setup-files.xml setup-locale.xml setup-maxmem.xml: - Created; contents extracted from setup2.sgml - -2013-04-24 Corinna Vinschen - - * faq-programming.xml (faq.programming.64bitporting): Fix typo. - -2013-04-24 Corinna Vinschen - - * faq-programming.xml (faq.programming.64bitporting): Extend entry. - (faq.programming.64bitporting-fail): New entry. - (faq.programming.64bitporting-cygwin64): New entry. - -2013-04-24 Corinna Vinschen - Christian Franke - - * faq-programming.xml (faq.programming.64bitporting): Mention the - -Wformat and -Wall gcc options. - -2013-04-24 Corinna Vinschen - - * faq-programming.xml (faq.programming.64bitporting): New FAQ entry. - (faq.programming.objective-c): Include gcc4. - (faq.programming.make-execvp): Drop text discouraging usage of -j. - (faq.programming.undeclared-functions): Drop entry. - (faq.programming.x86-assembly): Ditto. - (faq.programming.djgpp): Ditto. - -2013-04-24 Corinna Vinschen - - * cygwinenv.sgml (cygwinenv-implemented-options): Change description - for winsymlink option to explain new implementation. - * new-features.sgml (ov-new1.7.19): Add support for native symlinks and - AFS. - -2013-04-23 Corinna Vinschen - - * Throughout, eliminate Windows 2000 from the documentation. - * overview.sgml (brief-history): Mention native AMD64 support. - -2013-04-23 Corinna Vinschen - - * Makefile.in (SGMLDIRS): Accommodate dropping utils_source and - cygwin_source from ../Makefile.common. - * new-features.sgml (ov-new1.7.19): New section. Document dropped - support for pre-XP SP3 and added support for 64 bit Cygwin. - -2013-04-23 Corinna Vinschen - - * faq-what.xml (faq.what.supported): Change to accommodate existence - of 64 bit version. - -2013-03-27 Corinna Vinschen - - * faq-what.xml (faq.what.supported): Mention Windows 8 and Server 2012. - Change sentence on native 64 bit version. - -2013-03-06 Anthony Geoghegan - - * faq-using.xml: Fix expression and uppercase Samba. - -2013-02-13 Christopher Faylor - - * pathnames.sgml: Remove stray '@'. - -2013-02-13 Christopher Faylor - - * pathnames.sgml: Clarify '@' processing. - -2013-01-23 Christopher Faylor - - * faq-programming.xml: Remove reference to "make check". - -2013-01-12 Thomas Wolff - - * new-features.sgml (ov-new1.7.18): Add console enhancements. - -2012-12-20 Corinna Vinschen - - * pathnames.sgml (pathnames-at): Drop confusing description on - "embedded double quotes". - -2012-12-14 Corinna Vinschen - - * new-features.sgml (ov-new1.7.18): Add sparse change. - * pathnames.sgml (mount-table): Document sparse mount option. - -2012-12-06 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.18): New section. Document cfsetspeed. - -2012-11-26 Christopher Faylor - - * configure.ac: Rename from configure.in. - * configure.in: Delete. - * configure: Regenerate. - -2012-10-24 Corinna Vinschen - - * configure.in: Add AC_NO_EXECUTABLES. - * configure: Regenerate. - -2012-10-20 Corinna Vinschen - - * new-features.sgml (ov-new1.7.17): Add section. - -2012-09-03 Christopher Faylor - - * faq-what.xml: Fix typos, clarify responsibility slightly. - -2012-08-03 Adam Dinwoodie - - * faq-using.xml (faq.using.man): Make relevance to whatis explicit. - -2012-07-20 Corinna Vinschen - - * pathnames.sgml (pathnames-intro): Remove paragraph on UNC paths. - Try to be clearer on POSIX vs. Win32 paths. - (unc-paths): New section. - (cygdrive): Fix a few SGML qualifiers. - * setup-net.sgml: Move ntsec section from here... - * using.sgml: ..to here. - -2012-07-18 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.16): Document getmntent_r. - -2012-07-17 Yaakov Selkowitz - - * faq-programming.xml (faq.programming.unix-gui): Update to - reflect the availability of X11 toolkits on Cygwin. - -2012-06-03 Corinna Vinschen - - * new-features.sgml (ov-new1.7.16): Document ReFS support. - -2012-05-10 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.16): Document memrchr. - -2012-05-09 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.15): Fix XML syntax. - -2012-05-07 Christopher Faylor - - * new-features.sgml (ov-new1.7.15): Fix tag. - -2012-05-06 Christopher Faylor - - * cygwinenv.sgml: Add pipe_byte description. - * new-features.sgml (ov-new1.7.15): Add new pipe_byte description for - 1.7.15. - -2012-04-25 Corinna Vinschen - - * new-features.sgml (ov-new1.7.14): Add mouse reporting mode 1005. - -2012-04-24 Corinna Vinschen - - * new-features.sgml (ov-new1.7.14): New section. Add new console mouse - reporting modes. - -2012-04-24 Yaakov Selkowitz - - * configure: Regenerate. - -2012-04-23 Yaakov Selkowitz - - * faq-using.xml (faq.using.emacs, faq.using.xemacs): Change links - from http://cygwin.com/xfree to http://x.cygwin.com. - -2012-04-23 Yaakov Selkowitz - - * faq-programming.xml (faq.programming.objective-c): Update for gcc4. - (faq.programming.win32-api): -mwindows does include -lcomdlg32. - (faq.programming.win32-no-cygwin): Update for removal of -mno-cygwin. - * overview2.sgml (ov-ex-win): Ditto. - -2012-04-05 Corinna Vinschen - - * new-features.sgml (ov-new1.7.13): Add typeahead description. - -2012-04-05 Corinna Vinschen - - * new-features.sgml (ov-new1.7.13): New section. Add entry for - mkpasswd/mkgroup change to print TrustedInstaller account. - -2012-04-03 Corinna Vinschen - - * new-features.sgml (ov-new1.7.12): Fix layout of flock example. - -2012-03-30 Corinna Vinschen - - * new-features.sgml (ov-new1.7.12): Fix typo. - -2012-03-30 Corinna Vinschen - - * cygwinenv.sgml (cygwinenv-implemented-options): Add detect_bloda. - * new-features.sgml (ov-new1.7.12): Add list items for the change to - flock and the detect_bloda CYGWIN option. - * overview2.sgml (ov-hi-process-problems): Add a reference to the - detect_bloda CYGWIN option. - -2012-03-27 Corinna Vinschen - - * new-features.sgml (ov-new1.7.12): Create. Move mountinfo here. - Add /dev notice. - * pathnames.sgml (pathnames-posixdevices): Rephrase to account for - /dev change in 1.7.12. - -2012-03-27 Corinna Vinschen - - * new-features.sgml (ov-new1.7.11): Add mountinfo. - -2012-03-01 Yaakov Selkowitz - - * faq-programming.xml (faq.programming.make-execvp): Remove obsolete - information about Tcl/Tk. - (faq.programming.dll-relocatable): Ditto. - * faq-using.xml (faq.using.tcl-tk): Rewrite to reflect switch to - X11 Tcl/Tk. - -2012-02-27 Yaakov Selkowitz - - * faq-using.xml (faq.using.bloda): Fix missing closing parenthesis. - -2012-02-25 Corinna Vinschen - - * new-features.sgml (ov-new1.7.11): Add two more changes to the list. - -2012-02-24 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.11): Document pldd. - -2012-02-21 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.11): New section. Document scandirat. - -2012-02-21 Corinna Vinschen - - * faq-using.xml (faq.using.bloda): Add AVAST and Citrix Metaframe - Presentation Server. - -2012-02-08 Corinna Vinschen - - * faq-using.xml (faq.using.sshd-in-domain): Document autoload error - 1114 when loading user32.dll as potential problem when not using - a domain service account. - -2012-02-05 Corinna Vinschen - - * new-features.sgml (ov-new1.7.10): Fix typo. - -2012-02-05 Corinna Vinschen - - * legal.sgml: Fix copyright. - -2012-02-04 Corinna Vinschen - - * setup2.sgml: Fix more typos. - * setup-net.sgml: Ditto. - -2012-02-04 Corinna Vinschen - - * faq-using.xml: Fix typos. - * ntsec.sgml: Ditto. - * pathnames.sgml: Ditto. - * setup2.sgml: Ditto. - * setup-net.sgml: Ditto. - (setup-dir): Drop paragraph on Unix/DOS file mode. - -2012-01-29 Corinna Vinschen - - * new-features.sgml (ov-new1.7.10): Add tzset. - -2012-01-24 Corinna Vinschen - - * pathnames.sgml (mount-table): Rephrase a few expressions for - clearness. - -2012-01-13 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document support for the %m - conversion flag in printf functions. - -2012-01-12 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document tgmath.h. - -2012-01-06 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document pthread_sigqueue. - -2012-01-01 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document get_current_dir_name. - -2011-12-30 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document getpt. - -2011-12-12 Ken Brown - - * faq-using.xml: Remove obsolete entry about the standard console - window. - * new-features.sgml: Remove obsolete entry which references cygwin.bat. - * setup-net.sgml: Clarify new shortcut behavior for the "Cygwin - Terminal". - -2011-11-21 Andy Koppe - - * faq-using.xml (faq.using.weirdchars): Rewrite. - -2011-11-17 Corinna Vinschen - - * faq-using.xml (faq.using.converting-paths): Remove reference to - cygwin.bat. - (faq.using.emacs): Drop "CYGWIN=tty" setting. - * pathnames.sgml (pathnames-posixdevices): Align list of device names - with changes in 1.7.10. - * setup2.sgml (setup-env-ov): Drop text which assumes that Cygwin - processes are started in console window. Align wording to lessened - relevance of $CYGWIN. Don't use dropped CYGWIN setting in example. - (setup-locale-how): Put using console and Cygwin.bat file into - perspective. - (setup-locale-problems): Ditto. - -2011-11-08 Corinna Vinschen - - * new-features.sgml (ov-new1.7.10): Document ptsname_r. - -2011-11-05 Jon TURNEY - - * faq-using.xml (faq.using.fixing-fork-failures): Add new FAQ. - * overview2.sgml (ov-hi-process-problems): Describe some difficulties - in implementing fork() - -2011-10-28 Corinna Vinschen - - * new-features.sgml (ov-new1.7.10): Document getgrouplist. - -2011-10-10 Corinna Vinschen - - * cygserver.sgml: Change -v to -V, same as in sources. - -2011-08-19 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document /proc/devices - and /proc/misc. - -2011-08-16 Corinna Vinschen - - * new-features.sgml (ov-new1.7.10): Document new RTLD flags. - -2011-08-12 Corinna Vinschen - - * new-features.sgml (ov-new1.7.10): Document large address awareness - of heap and new way to set the default heap size per executable. - * setup2.sgml (setup-maxmem): Revamp to explain new method of - allocating more heap on a per-executable basis. Drop outdated stuff. - Keep shortened description of heap_chunk_in_mb as note. - -2011-08-04 Corinna Vinschen - - * faq-using.xml (faq.using.bloda): Add NVIDIA. Change wording slightly. - -2011-08-03 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document new POSIX Clock Selection - option APIs. - -2011-07-20 Andy Koppe - - * setup-net.sgml (setup-packages): Reflect removal of Prev button. - Also document Keep button and improve description of Exp button. - -2011-07-19 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document getconf(1). - -2011-07-15 Christopher Faylor - - * cygwinenv.sgml (using-cygwinenv): Clarify how "glob" works. - -2011-06-15 Corinna Vinschen - - * cygwinenv.sgml (using-cygwinenv): Move envcache, strip_title, title, - tty, and upcaseenv options to list of obsolete options. - * effectively.sgml (using-console): Remove section. - * new-features.sgml (ov-new1.7.10): Document removed CYGWIN options. - Document removed tty mode. - -2011-05-25 Eric Blake - - * new-features.sgml (ov-new1.7.10): Document strerror changes. - -2011-05-25 Corinna Vinschen - - * legal.sgml: Drop an old paragraph. Reactivate copyright note for - documentation. - -2011-05-19 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document __fpurge. - -2011-05-17 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document error.h functions. - -2011-05-17 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document CPU-time clock support. - Move pthread stack management APIs to separate listitem. - -2011-05-15 Corinna Vinschen - - * new-features.sgml (ov-new1.7.10): Document pthread_attr_getguardsize, - pthread_attr_setstack, pthread_attr_setstackaddr and - pthread_attr_setguardsize. - -2011-05-10 Corinna Vinschen - - * cygwinenv.sgml: Move "forkchunk:xxx" to the removed options section. - Change text accordingly. - -2011-05-10 Corinna Vinschen - - * setup2.sgml (setup-env-ov): Make sure everybody knows that the - CYGWIN settings are just an example. - -2011-05-08 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document clock_settime. - -2011-05-06 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document sysinfo. - -2011-05-04 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document psiginfo, psignal, - and sys_siglist. - -2011-05-02 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document new pthread APIs. - -2011-05-02 Corinna Vinschen - - Throughout remove NT4 from documentation. - - * new-features.sgml (ov-new1.7.10): Document change in passwd command. - -2011-04-18 Corinna Vinschen - - * new-features.sgml (ov-new1.7.10): Document ppoll. - -2011-04-10 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document /proc/swaps. - -2011-04-04 Corinna Vinschen - - * new-features.sgml (ov-new1.7.10): Document dropped NT4 support. - -2011-04-04 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document additional information - in /proc/version. - -2011-04-01 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): Document /proc/sysvipc/. - -2011-04-01 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.10): /proc/loadavg now shows - current running/total processes count. - -2011-03-29 Corinna Vinschen - - * new-features.sgml (ov-new1.7.10): Document pthread spinlocks. - -2011-03-28 Corinna Vinschen - - * new-features.sgml (ov-new1.7.9): Add "new API" paragraph. - -2011-02-15 Corinna Vinschen - - * new-features.sgml (ov-new1.7.8): Fix typo. - -2011-02-15 Corinna Vinschen - - * legal.sgml: Bump date. - * new-features.sgml (ov-new1.7.8): Move dropped NT4 pre-SP4 support - up to be the first paragraph. - -2011-02-15 Corinna Vinschen - - * new-features.sgml (ov-new1.7.8): Document /proc/sys. - -2011-02-10 Eric Blake - - * new-features.sgml (ov-new1.7.8): Document strerror_r fixes. - -2011-02-10 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.8): Document pthread_yield. - -2011-01-12 Corinna Vinschen - - * new-features.sgml (ov-new1.7.8): Add "new API" paragraph. - -2011-01-05 Jon TURNEY - - * faq-setup.xml (faq.setup.cli): Correct description of -pubkey option - -2010-10-18 Andy Koppe - - * setup2.sgml (setup-locale-ov): Document CJK ambiguous width change - for non-Unicode charsets. - * new-features.sgml (ov-new1.7.8): Mention CJK ambiguous width change. - Drop redundant NT4 pre-SP4 support entry. - -2010-10-09 Corinna Vinschen - - * new-features.sgml (ov-new1.7.8): Document reinstantiation of the - original 1.7 CWD handling. - -2010-10-08 Corinna Vinschen - - * new-features.sgml (ov-new1.7.8): Document new C99 complex API. - -2010-09-27 Corinna Vinschen - - * pathnames.sgml (mount-table): Fix pathnames-mount-ex example. Change - an expression. - -2010-09-27 Corinna Vinschen - - * new-features.sgml (ov-new1.7.8): Document dropped NT4 pre-SP4 support. - * faq-what.xml (faq.what.supported): Change accordingly. - * ntsec.sgml (ntsec-mapping): Add 2008 R2. - -2010-09-18 Christopher Faylor - - * overview2.sgml: Remove cheerful paragraph which implied that it was - ok to casually mix Windows and POSIX. Add more words about mixing - POSIX/Windows. - -2010-09-18 Corinna Vinschen - - * setup2.sgml (setup-locale-how): Fix typo. - -2010-09-11 Dave Korn - - * new-features.sgml: Mention fenv support. - -2010-09-06 Corinna Vinschen - - * new-features.sgml (ov-new1.7.8): Document /proc/sys. - -2010-08-30 Corinna Vinschen - - * new-features.sgml (ov-new1.7.7): Document change to binmode/textmode - link libs. - * textbinary.sgml (textbin-devel): Ditto. - -2010-08-28 Corinna Vinschen - - * new-features.sgml (ov-new1.7.7): Document change to avoid DLL - hijacking. - -2010-08-27 Corinna Vinschen - - * new-features.sgml (ov-new1.7.7): Change to describe partial - reversion to pre-1.7.6 behaviour. - (ov-new1.7.6): Deprecate description of CWD handling. - * pathnames.sgml (pathnames-win32-api): Rewrite to reflect new CWD - behaviour. - -2010-08-19 Corinna Vinschen - - * new-features.sgml (ov-new1.7.7): New section. - * pathnames.sgml: Throughout, align style of screen elements. - Throughout, make all emphasis elements bold. - (pathnames-win32-api): Rewrite section. - -2010-08-18 Corinna Vinschen - - * pathnames.sgml (pathnames-win32-api): Try to use a more clear wording. - -2010-08-13 Corinna Vinschen - - * faq-programming.xml (faq.programming.win32-api): Remove simplicity. - Add note and xrefs to User's Guide chapters explaining restrictions - using the Win32 API. - * new-features.sgml (ov-new1.7.6): Add note about Win CWD. - * overview2.sgml (ov-hi-intro): Add note and xrefs about Win32 API - restrictions. Tone down flexibility. - * pathnames.sgml (pathnames-intro): Add xref to pathnames-win32-api - section. - (pathnames-win32-api): New section describing Win32 CWD restriction. - * setup2.sgml (setup-env-ov): New sub-section. - (setup-env-win32): Ditto, describing Win32 environment restriction. - -2010-08-11 Corinna Vinschen - - * new-features.sgml (ov-new1.7.6): Document "bind" option. - * pathnames.sgml (mount-table): Add "bind" option with example. - -2010-08-09 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.6): Document POSIX monotonic clock. - -2010-08-09 Corinna Vinschen - - * new-features.sgml (ov-new1.7.6): Document /proc/filesystems. - -2010-07-26 Andy Koppe - - * setup-net.sgml, faq-setup.xml: Rename setup.exe's "Partial" - view to "Pending" - -2010-07-19 Eric Blake - - * textbinary.sgml (textbin-devel): Document temp file behavior. - (textbin-issue): Use sed rather than cat as an example of a - default-mode application. - * new-features.sgml (ov-new1.7.6): Document mkostemp[s]. - -2010-06-27 Yaakov Selkowitz - - * Makefile.in: Use "xmlto pdf" instead of docbook2pdf. - Force the dblatex backend, as the default passivetex does not work. - * README: Replace docbook-utils dependency with dblatex. - Update required docbook-xml version. - * faq-programming.xml (building-cygwin): Ditto. - -2010-06-26 Ken Brown - - * setup-net.sgml: Add a paragraph describing now to avoid unintentional - upgrades. - -2010-04-29 Corinna Vinschen - - * new-features.sgml (ov-new1.7.6): Add new "dos" and "inode" mount - options. - * pathnames.sgml (mount-table): Ditto. - (pathnames-specialchars): Change description order. Add paragraph - to explain new behaviour in terms of leading spaces and trailing dots - and spaces in pathnames. - -2010-04-28 Corinna Vinschen - - * new-features.sgml (ov-new1.7.6): Add locale wide-char changes. - -2010-04-22 Corinna Vinschen - - * cygserver.sgml: Note the fact that slave tty/pty handle dispersal is - unsed as of Cygwin 1.7.6. - * new-features.sgml (ov-new1.7.6): New section. Add tty/pty and - setrlimit changes. - -2010-04-11 Christopher Faylor - - * cygwin.dsl: Remove comments. - -2010-04-11 Corinna Vinschen - - * new-features.sgml (ov-new1.7.5): New section. - -2010-04-11 Christopher Faylor - - * cygwin-api.in.sgml: Update to DocBook SGML 4.5 DTD. - * cygwin-ug-net.in.sgml: Ditto. - * cygwin-ug.in.sgml: Ditto. - * faq-sections.xml: Ditto. - * faq.xml: Ditto. - -2010-04-01 Charles Wilson - - * setup-net.sgml: Remove more mentions of rxvt. - -2010-03-31 Christopher Faylor - - * cygwinenv.sgml: Remove/deprecate mention of rxvt. - * effectively.sgml: Ditto. - * faq-using.xml: Ditto. - * setup-net.sgml: Ditto. - -2010-03-29 Corinna Vinschen - - * new-features.sgml (ov-new1.7.3): New section. - -2010-03-27 Corinna Vinschen - - * setup2.sgml (setup-locale-charsetlist): Add EUC-CN and GB2312. - -2010-03-27 Corinna Vinschen - - * textbinary.sgml: Add missing . - -2010-03-27 Christopher Faylor - - * textbinary.sgml: Remove tr example and just mention u2d and d2u - instead. - -2010-03-25 Christopher Faylor - - * pathnames.sgml: Clarify wording of user-specific fstab files. Fix - typo. - -2010-03-24 Corinna Vinschen - - * legal.sgml: Bump copyright date. - -2010-03-17 Corinna Vinschen - - * faq-using.xml (faq.using.unicode): Remove old examples. - -2010-03-12 Corinna Vinschen - - * effectively.sgml (using-shortcuts): Match chapter with reality. - -2010-03-11 Corinna Vinschen - - * faq-using.xml (faq.using.bloda): Add "Credant Guardian Shield". - -2010-03-05 Corinna Vinschen - - * setup2.sgml (setup-env): Add cross reference to using-cygwinenv. - Change description for locale environment variables to comply with - changes in 1.7.2. - -2010-03-02 Charles Wilson - - * new-features.sgml (ov-new1.7.2): Describe XDR support. - -2010-02-26 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Add strptime changes. - -2010-02-26 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Add strftime/wcsftime changes. - -2010-02-25 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7.2): Add SIGPWR support. - -2010-02-25 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Move stty erase support into - correct category. Change "console window" to "Windows console". - -2010-02-17 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Accommodate name change of getlocale - to locale. - * setup2.sgml (setup-locale-how): Ditto. - -2010-02-15 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Add native DOS path and UNC path - change. - * pathnames.sgml (pathnames-intro): Make the Win32 path text a note - and xref to new pathnames-win32 section. - (cygdrive): Add description how the cygdrive mount flags apply to - UNC paths starting with slashes. - (pathnames-win32): New section describing native path handling. - -2010-02-11 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Rephrase getlocale entry. - -2010-02-10 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Add LC_MESSAGES support. - * setup2.sgml (setup-locale-ov): Change "@euro" modifier description. - (setup-locale-missing): Remove. - -2010-02-07 Yaakov Selkowitz - - * new-features.sgml (ov-new1.7-misc): Fix typo. - -2010-02-07 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Add support for locales from - /usr/share/locale/locale.alias. - * setup2.sgml (setup-locale-ov): Ditto. - -2010-02-06 Corinna Vinschen - - * setup2.sgml (setup-locale-ov): Align description of working modifiers - to latest changes. - -2010-02-06 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Add support for new charsets. - Change text for modifier support. - (setup-locale-charsetlist): Add new GEORGIAN-PS and PT154 charsets - to list of supported charsets. Reorder list for non-ISO, non-CP - charsets alphabetically. - -2010-02-05 Corinna Vinschen - - * setup2.sgml (setup-locale-ov): Add description for "uz_UZ@cyrillic" - and "tt_RU@iqtelif" modifiers. Slightly rephrase locale specifier - description in terms of the modifier string. - -2010-02-05 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Add grouping for printf/wprintf. - -2010-02-04 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Add multibyte-awareness of regcomp - and regexec. - -2010-02-01 Yaakov Selkowitz - - * README: Update for Cygwin docbook-utils package. - * faq-programming.xml: Ditto. - -2010-01-26 Yaakov Selkowitz - - * faq-api.xml: d2u/u2d are from cygutils, not util-linux. - -2010-01-26 Christopher Faylor - - * Makefile.in: Skip validation in xmlto step. - -2010-01-26 Christopher Faylor - - * overview.sgml: Clarify language in "A brief history of Cygwin". - -2010-01-26 Thomas Wolff - - * new-features.sgml (ov-new1.7.2): Add console enhancements. - -2010-01-25 Corinna Vinschen - - * faq-setup.xml: Drop references to non-NT systems. - * faq-using.xml: Ditto. - (faq.using.sshd-in-domain): New FAQ entry. - -2010-01-25 Andy Koppe - - * faq-using.xml: Fix typos and remove incorrect locale-specific - documentation. - * new-features.sgml: Ditto. - * pathnames.sgml: Ditto. - -2010-01-24 Corinna Vinschen - - * new-features.sgml: Rework layout to use itemizedlist. Fix typo. - Add two missing entries. - -2010-01-23 Corinna Vinschen - - * setup2.sgml (setup-locale-charsetlist): Add CP932. Change description - for SJIS. - -2010-01-23 Corinna Vinschen - - * setup2.sgml (setup-locale-charsetlist): Add ASCII and TIS-620. Add - various aliases and case differences. - -2010-01-22 Corinna Vinschen - - * new-features.sgml (ov-new1.7.2): Add chapter for news in 1.7.2. - * setup2.sgml (setup-locale-ov): Describe how valid locales are - determined by Windows locale support. Change description for modifiers - in locale environment variables. - (setup-locale-how): Describe new charset behaviour. Mention new - getlocale tool to fetch valid locale information from Windows. - (setup-locale-missing): Drop now implemented LC_foo options. - Explain missing LC_MESSAGES in more detail. - -2010-01-17 Corinna Vinschen - - * setup2.sgml (setup-locale): Mention three character codes per - ISO 639-3. - -2010-01-17 Corinna Vinschen - Andy Koppe - - * setup2.sgml (setup-locale): Adapt description to the C using ASCII - change in 1.7.2. - -2010-01-16 Christopher Faylor - - * setup-net.sgml: Remove obsolete assertion. - -2010-01-15 Corinna Vinschen - - Suggested by Frank Fesevur : - * faq-using.xml (faq.using.bloda): Clarify wxvault.dll. - -2010-01-15 Christopher Faylor - - * faq-setup.xml: Add missing setup options. Sort options. - -2010-01-12 Corinna Vinschen - - * cygwinenv.sgml (cygwinenv-implemented-options): Try to make - compatibility new symlinks vs. old Cygwin clearer. - -2010-01-10 Corinna Vinschen - - * pathnames.sgml (mount-table): Add info that posix=0 is default for - the cygdrive prefix. - -2010-01-07 Corinna Vinschen - - * overview.sgml: Fix Red Hat brand name. - -2010-01-04 Christopher Faylor - - * overview.sgml: Fix Red Hat URL. - -2009-12-23 Corinna Vinschen - - * pathnames.sgml (mount-table): Add missing slash in pathname. - -2009-12-14 Corinna Vinschen - - * faq-setup.xml (faq.setup.mirror): Fix URL to wget. - -2009-12-02 Ken Brown - - * setup2.sgml (setup-env): Clarify that Windows environment gets - copied over. Add paragraph about TMP, TEMP, and TMPDIR. - -2009-11-18 Corinna Vinschen - - * overview2.sgml (ov-hi-files): Remove reference to root directory when - explaining fstab content. Add paragraph about Extended Attributes. - Discourage chroot. - -2009-11-16 Corinna Vinschen - - * pathnames.sgml (pathnames-specialchars): Fix typos. - -2009-11-12 Corinna Vinschen - - * new-features.sgml (ov-new1.7-os): Mention Windows 7 and 2008 R2. - (ov-new1.7-device): Add API get_avphys_pages, get_nprocs, - get_nprocs_conf, and get_phys_pages. - -2009-10-31 Corinna Vinschen - - * new-features.sgml (ov-new1.7-misc): Add installation-specific - unique object names description. - -2009-10-28 Yaakov Selkowitz - - * pathnames.sgml: Add limitation of case sensitivity with CreateProcess. - -2009-10-28 Corinna Vinschen - - * new-features.sgml (ov-new1.7-posix): Mention UTF-8 as "C" default - and the default locale "C.UTF-8". - * setup2.sgml (setup-locale-ov): Ditto. - -2009-10-26 Christopher Faylor - - * faq-setup.xml: Fix clean_setup.pl reference. - -2009-10-26 Christopher Faylor - - * faq-setup.xml: Change clean_setup.pl reference. - -2009-10-15 Corinna Vinschen - - * faq-setup.xml (faq.setup.disk-space): Fix URL pointing to - clean_setup.pl script. - -2009-10-09 Corinna Vinschen - - * pathnames.sgml (pathnames-specialchars): Add control chars to the - list. Explain backslash exception. - -2009-10-03 Dave Korn - - * faq-using.xml (faq.using.bloda): Add Lenovo IPS Core Service. - -2009-10-02 Corinna Vinschen - - * setup2.sgml (setup-locale-ov): Fix typo in C+charset example. - Rephrase how the locale environment variables are evaluated. - -2009-09-30 Corinna Vinschen - - * new-features.sgml (ov-new1.7-file): Ctrl-X, not Ctrl-N. - * pathnames.sgml (pathnames-unusual): Ditto. - * setup2.sgml (setup-locale-ov): Change description according to - latest changes. - (setup-locale-how): Rewrite. - (setup-locale-console): Enable section again. Change to reflect - recent changes. - (setup-locale-problems): Change to reflect recent changes. - -2009-09-26 Eric Blake - - * new-features.sgml (ov-new1.7-file): Mention fexecve, execvpe. - -2009-09-25 Eric Blake - - * new-features.sgml (ov-new1.7-file): Mention eaccess, euidaccess, - canonicalize_file_name, and document change in access semantics. - -2009-09-24 Corinna Vinschen - - * setup2.sgml (setup-locale-problems): Fix charset names of codepages - 936 and 949. - -2009-09-24 Eric Blake - - * setup2.sgml (setup-locale-problems): Document how to install - non-default charsets. - -2009-09-21 Corinna Vinschen - - * new-features.sgml (ov-new1.7-file): Add new hardlink behaviour on - filesystems not supporting hardlinks. - * overview2.sgml (ov-hi-files): Change descripton accordingly. - -2009-08-26 Corinna Vinschen - - * new-features.sgml (ov-new1.7-posix): Add "KOI8-R" and "KOI8-U" - charsets. - -2009-08-22 Corinna Vinschen - - * setup2.sgml (setup-locale-charsetlist): Add KOI8-R and KOI8-U to list - of supported charsets. - -2009-08-22 Corinna Vinschen - - * setup2.sgml (setup-locale-charsetlist): Add description of - case-insensitivity of charsets. Fix a typo. Add "UTF8" to the list. - -2009-08-12 Dave Korn - - * faq-using.xml (faq.using.bloda): Typofix MacAfee -> McAfee. - -2009-07-23 Corinna Vinschen - - * faq-using.xml (faq.using.ipv6): Try to clarify OS specific support. - * faq-what.xml (faq.what.supported): Add Windows 7 and 2008 R2. - * new-features.sgml: Add "and later" to rcmd news. - -2009-07-20 Corinna Vinschen - - * Makefile.in (all): Fix wrong target names. - (cygwin-ug-net/cygwin-ug-net-nochunks.html.gz): Ditto. - (cygwin-ug-net/cygwin-ug-net.pdf): Convert to use docbook2pdf. - (cygwin-api/cygwin-api.pdf): Ditto. - -2009-07-20 Corinna Vinschen - - * faq: Throughout, revert references to User's Guide to default URL. - -2009-07-20 Corinna Vinschen - - * new-features.sgml (ov-new1.7-misc): Add stdc++ new/delete wrappers. - -2009-07-20 Corinna Vinschen - - * new-features.sgml (ov-new1.7-posix): Add WCONTINUED, WIFCONTINUED. - -2009-07-20 Corinna Vinschen - - * setup2.sgml (setup-locale-charsetlist): Fix ISO88-59-13 and -15 - codepage numbers. - -2009-07-08 Christopher Faylor - - * pathnames.sgml: Fix typo. - -2009-07-03 Corinna Vinschen - - * new-features.sgml (ov-new1.7-file): Add fpurge and mkstemps to new - API functions. - -2009-07-01 Christopher Faylor - - Clean up some sources.redhat.com references. - -2009-06-24 Corinna Vinschen - - * faq-setup.xml (faq.setup.setup-fails-on-ts): Fix another typo. - -2009-06-24 Corinna Vinschen - - * faq-setup.xml (faq.setup.setup-fails-on-ts): Fix typo. - -2009-06-23 Corinna Vinschen - - * faq-setup.xml (faq.setup.setup-failes-on-ts): Change rebaseall to - rebase. - -2009-06-23 Corinna Vinschen - - * faq-setup.xml (faq.setup.setup-failes-on-ts): New FAQ entry. - -2009-06-19 Corinna Vinschen - - * new-features.sgml (ov-new1.7-misc): Add new link libs. - * setup2.sgml (setup-locale-ov): Explain locale-specific wcwidth - feature. - -2009-06-12 Ken Brown - - * faq-using.xml (faq.using.emacs): Update. - -2009-06-04 Corinna Vinschen - - * new-features.sgml: Add changes to console BS and Space key. - -2009-05-26 Christopher Faylor - - Change explicitely to explicitly throughout. - -2009-05-15 Corinna Vinschen - - * setup2.sgml (setup-locale-console): Disable section for now. - -2009-05-14 Corinna Vinschen - - * faq-setup.xml (faq.setup.upgrade-mountpoints): New entry. - * faq-using.xml (faq.using.directory-structure): Align example to - latest mount output. - * pathnames.sgml (mount-table): Add note about upgrade helper scripts - to create /etc/fstab and /etc/fstab.f/${USER}. - -2009-05-14 Corinna Vinschen - - * new-features.sgml: Add automounting of /, /usr/bin, and /usr/lib. - * pathnames.sgml (pathnames-intro): Be more verbose about POSIX and - Win32 paths. - (mount-table): Add "auto" flag. Add a paragraph about /usr/bin and - /usr/lib. - (pathnames-mount-ex): Enhance flags output. - -2009-05-13 Corinna Vinschen - Christopher Faylor - - * pathnames.sgml (mount-table): Sort mount options and add override - option. Add description of root mount handling. - -2009-05-13 Corinna Vinschen - - * pathnames.sgml (pathnames-unusual): Talk about using UTF-8 in C - locale. - * setup2.sgml (setup-locale-problems): Ditto. - -2009-05-06 Corinna Vinschen - - * faq-setup.xml: Fix entry explaing how the homedir is evaluated - according to recent change. - -2009-04-07 Corinna Vinschen - - * setup2.sgml (setup-locale-console): New section to explain - console character set setting. - * faq: Throughout, change references to User's Guide to references - to 1.7 User's Guide temporarily. - * faq-setup.html (faq.using.unicode): Rephrase slightly. - (faq.using.weirdchars): New FAQ entry for console charset problems. - -2009-04-06 Corinna Vinschen - - * new-features.sgml (ov-new1.7-posix): Remove JIS from supported - charsets. - * setup2.sgml (setup-locale-charsetlist): Ditto. - -2009-04-06 Corinna Vinschen - - * setup2.sgml (setup-locale-problems): Change title to be more clear - when referencing this section. - -2009-04-03 Kevin Buettner - - * Various syntactical and semantical fixes throughout. - -2009-04-01 Corinna Vinschen - - * faq-using.xml (faq.using.symlinkstoppedworking): Rename. - (faq.using.ipv6): New IPv6 FAQ. - * gdb.sgml: Remove incorrect statement about Insight. - -2009-03-31 Corinna Vinschen - - * setup2.sgml (setup-locale-problems): Fix an incomplete sentence. - -2009-03-31 Corinna Vinschen - - * faq-using.xml (faq.using.unicode): Modernize. - (faq.api.symlinkstoppedworking): Move here from faq-api.xml. - -2009-03-30 Dave Korn - - * faq-using.xml (faq.using.bloda): Update with new entries. - -2009-03-26 Corinna Vinschen - - * cygwinenv.sgml: Add text to explain new UTF-16 symlinks. - * faq-api.xml: Add FAQ entry "Why do some of my old symlinks don't - work anymore?" - * new-features.sgml: Fix symlink text. Add new UTF-16 symlinks. - * overview2.sgml: Add text about new UTF-16 symlinks and potential - problems with old symlinks. - * pathnames.sgml: Fix typo. - * setup2.sgml: Extend text about problems with symlinks. - -2009-03-26 Corinna Vinschen - - * new-features.sgml: Replace GB2312 with GBK. - * setup2.sgml: Ditto. - -2009-03-25 Corinna Vinschen - - * pathnames.sgml: Add a note that ASCII SO handling isn't foolproof - under all circumstances. - -2009-03-25 Corinna Vinschen - - * new-features.sgml: Add missing GB2312 and eucKR character sets. - * pathnames.sgml: Change "DOS devices" title to "Invalid filenames" - and rephrase that section. - Add section "Filenames with unusual (foreign) characters". - Fix an emphasis. - * setup-net.sgml: Integrate setup-locale section. - * setup2.sgml: Add locale variables to section "Environment Variables". - Add section "Internationalization". - -2009-03-24 Corinna Vinschen - - * new-features.sgml: Add section about chaged (no)winsymlink default. - -2009-03-24 Corinna Vinschen - - * cygwinenv.sgml: Move "codepage:xxx" to the removed options section. - Change text accordingly. - * new-features.sgml: Try to explain new way to define character sets. - -2009-03-18 Corinna Vinschen - - * cygwin-ug-net.in.sgml: Update date. - * cygwinenv.sgml: Fix codepage:utf8 text in terms of setting - environment variables. - * new-features.sgml: New file describing new Cygwin 1.7 features. - Layout is preliminiary only. - * overview.sgml: Insert content of new-features.sgml. - -2009-03-18 Corinna Vinschen - - * overview2.sgml: Remove reference to CYGWIN=binmode. - * textbinary.sgml: Ditto. Rephrase certain paragraphs to match - Cygwin 1.7 behaviour. Add popen(3) and pipe(2) behaviour. Make - quite clear that binmode is preferred. Add *mode.o files to - description for developers. - -2009-03-09 Corinna Vinschen - - * pathnames.sgml: Try to be more clear explain raw devices. - -2009-03-03 Corinna Vinschen - - * faq-using.xml: Rework UTF FAQ to accommodate latest setlocale - change in newlib. - -2009-03-03 Corinna Vinschen - - * pathnames.sgml: Remove reference to managed mountpoints in mount - entry example. - -2009-02-23 Dr. Volker Zell - - * faq-using.xml: Rework XEmacs FAQ. - -2009-02-14 Corinna Vinschen - - * faq-using.xml: Fix usage of ampersand in NT emacs script. - -2009-02-14 Jari Aalto - - * faq-using.xml: Expand Emacs entries. - -2009-02-13 Nahor - - * overview.sgml: Fix 1.7 release date. - -2009-02-13 Corinna Vinschen - - * cygwin-api.in.sgml: Fix API section layout. - -2009-02-13 Corinna Vinschen - - * pathnames.sgml: Add a cygdrive section. - -2009-02-13 Corinna Vinschen - - * pathnames.sgml: Replace "binmode" with new "binary" output of mount. - -2009-02-12 Corinna Vinschen - - * faq-using.xml: First cut on Emacs. - -2009-02-12 Corinna Vinschen - - * faq-setup.xml: Revamp for Cygwin 1.7. - * faq-using.xml: Ditto. - -2009-02-11 Corinna Vinschen - - * faq-programming.xml: Revamp (mostely) for Cygwin 1.7. - * faq-what.xml: Ditto. - -2009-02-11 Corinna Vinschen - - * Makefile.in (FAQ_SOURCES): Define FAQ sources. - (faq/faq.html): Depend on FAQ sources. - (faq/faq-nochunks.html): Ditto. - * faq-api.xml: Revamp for Cygwin 1.7. - * faq-problems.xml: Remove. - * faq-sections.xml: Accommodate removal of faq-problems.xml. - * faq.xml: Ditto. - -2009-02-03 Corinna Vinschen - - * pathnames.sgml: Rephrase the "Case sensitive filenames" chapter - slightly. - -2009-01-24 Corinna Vinschen - - * pathnames.sgml: Add requirement for world-readability of special - /etc files. - -2009-01-24 Corinna Vinschen - - * pathnames.sgml: Add section about accessing /etc files. - -2009-01-21 Corinna Vinschen - - * cygserver.sgml: Remove the "How to use the Cygserver services" - section. - * cygwinenv.sgml: Move "(no)server" to the removed options section. - * faq-programming.xml: Remove CYGWIN=server requirement for running - the Cygwin testsuite. - * ntsec.sgml: Ditto for using `passwd -R'. - -2008-12-15 Corinna Vinschen - - * gcc.sgml: Use 'bash$' as Cygwin prompt throughout. - * gdb.sgml: Ditto. - * pathnames.sgml: Ditto. Fix the @ expansion example. - -2008-12-13 Christopher Faylor - - * pathnames.sgml: Convert some backslashes to slashes. - -2008-12-11 Christian Franke - - * pathnames.sgml: New section for /proc/registry. Document registry - name encoding. - -2008-12-04 Corinna Vinschen - - * ntsec.sgml: Fix typo. - -2008-12-03 Corinna Vinschen - - * ntsec.sgml: Revamp parts of the doc for clearness. - -2008-12-02 Corinna Vinschen - - * ntsec.sgml: Fix a few typos. - -2008-12-02 Corinna Vinschen - - * cygserver.sgml: Fix cross reference to the ntsec documentation. - -2008-12-02 Corinna Vinschen - - * cygserver.sgml: Document new feature to store hidden passwords - for seteuid. - -2008-12-02 Corinna Vinschen - - * ntsec.sgml: Finishing up changes for 1.7. - -2008-12-01 Corinna Vinschen - - * ntsec.sgml: Further changes for 1.7. Switch from "NT" to "Windows". - Add preliminary text. Try to be more clear in description. Remove - useless chapters. Finish the permission related chapters. - -2008-11-30 Christopher Faylor - - * faq-using.xml: Remove assertion that lpr doesn't exist. - * faq-what.xml: Remove ancient who's who data. - -2008-11-25 Christopher Faylor - - * overview2.sgml: Reorganize and make minor wording changes. - -2008-11-25 Christopher Faylor - - * overview2.sgml: Clarify unix-specific automatic updates section. - -2008-11-25 Corinna Vinschen - - Suggested by Valerio Bigiani : - * overview2.sgml: Add text that no automatic updates are provided. - -2008-11-11 Corinna Vinschen - - * cygwinenv.sgml: Add description for upcaseenv option. - -2008-09-22 Christopher Faylor - - * setup2.sgml: Clarify heap allocation. - -2008-08-13 Corinna Vinschen - - * pathnames.sgml: Move description for (cyg,not)exec mount options - from utils.sgml here. Clarify nouser mount points. - -2008-07-18 Corinna Vinschen - - * cygwinenv.sgml: Move binmode option to list of removed options. - -2008-07-17 Corinna Vinschen - - * Revamp documentation for Cygwin 1.7, part 1. - -2008-07-01 Christopher Faylor - - * Makefile.in: Temporarily add ability to generate pdfs. - -2008-06-26 Fred Korz - - * effectively.sgml: Correct subject-verb agreement, missing verb - (typo), preposition and (definite vs indefinite) article use. - -2008-06-19 Christopher Faylor - - * faq-using.xml: Add more words about multiple cygwins. - -2008-04-24 Corinna Vinschen - - * cygwin-api.in.sgml: Add std-susv4 section to Compatibility chapter. - -2008-04-13 Corinna Vinschen - - * cygwinenv.sgml: Drop description of "transparent_exe" option. - -2007-29-12 Dave Korn - - * faq-using.xml (faq.using.bloda): New entry. - (faq.using.firewall, faq.using.anti-virus): Link to faq.using.bloda. - * faq-setup.xml (faq.setup.hang): Likewise link to faq.using.bloda. - -2007-12-16 Christopher Faylor - - * pathnames.xml: Fix a typo. - -2007-09-25 Corinna Vinschen - - * faq-what.xml: Remove paragraph about and link to stoneage old - history.html file. - -2007-08-24 Christopher Faylor - - * dll.sgml: myprog.ca -> myprog.c - -2007-08-12 Christopher Faylor - - * faq-programming.xml: Clarify where to run "make check". - -2007-07-18 Brian Dessent - - * faq-using.xml (faq.using.console-window): Mention FHS location of - docs and remove outdated reference to ash. - -2007-06-29 Corinna Vinschen - - * cygwin-api.in.sgml: Remove authorgroup and revhistory. - * cygwin-ug.in.sgml: Add Joshua Daniel Franklin to authorgroup. - Remove revhistory. - * legal.sgml: Update dates. - -2007-06-05 Corinna Vinschen - - * cygwin-api.in.sgml: Accommodate new "Compatibility" section layout. - -2006-12-12 Corinna Vinschen - - * cygwinenv.sgml: Drop description of "traverse" option. - -2006-08-25 Joshua Daniel Franklin - - * faq-setup.xml (faq.setup.uninstall): Mention Safe Mode - requirement for accessing the Security tab in XP Home. - * faq-using.xml (faq.using.chmod): Mention FAT32. - -2006-08-09 Christopher Faylor - - * overview2.sgml: Remove inaccurate "full support for windows - pathnames" clause. - -2006-08-01 Christopher Faylor - - * cygwinenv.sgml: Document [no]dosfilewarning option. - -2006-07-18 Corinna Vinschen - - * pathnames.sgml: Change text for the order in which executables - are evaluated. - -2006-06-01 Joshua Daniel Franklin - - * faq-setup.xml (faq.setup.automated): New FAQ. - -2006-05-30 Dave Korn - - * faq-api.xml (faq.api.winsock): Replace references to depracated - Win32_Winsock macro with __USE_W32_WINSOCK, and enlarge on details. - -2006-05-24 Christopher Faylor - - * configure.in: Update to newer autoconf. - (thanks to Steve Ellcey) - * configure: Regenerate. - * aclocal.m4: New file. - -2006-04-04 Joshua Daniel Franklin - - * faq-programming.xml (faq.programming.adjusting-heap): - Clarify argument parameter sizes. - * faq-using.xml (faq.using.chmod): - Improve chmod FAQ. - -2006-03-18 Christopher Faylor - - * cygwinenv.sgml: Rename fork_retry to proc_retry since it has turned - out to be more general than just fork. - -2006-03-13 Christopher Faylor - - * cygwinenv.sgml: Explain about new fork_retry CYGWIN environment - variable setting. - -2006-03-07 Bas van Gompel bavag.tmfweb.nl> - - * cygwinenv.sgml: Add missing at transparent_exe. - -2006-02-05 Corinna Vinschen - - * cygwinenv.sgml: Explain transparent_exe option. - -2006-02-01 Joshua Daniel Franklin - - * faq-setup.xml (faq.setup.what-packages): - Mention new cygcheck -p option. - -2006-01-27 Joshua Daniel Franklin - - * faq-programming.xml (faq.programming.building-cygwin): - Move cocom to the build requirements. - -2006-01-26 Joshua Daniel Franklin - - * faq-programming.xml (faq.programming.building-cygwin): - Simplify instructions, and remove tar usage basics. - -2006-01-26 Joshua Daniel Franklin - - * faq-programming.xml (faq.programming.ipc): Add new FAQ about - cygserver and its relation to the "Bad system call" error. - * faq-setup.xml (faq.setup.uninstall-all): Mention postgresql. - * overview2.sgml: Update security info on shared memory. - -2006-01-25 Joshua Daniel Franklin - - * faq-programming.xml (faq.programming.building-cygwin): Add - list of packages required for building and exact check instructions. - * faq-setup.xml (faq.setup.uninstall-service): New instructions - on uninstalling a cygwin service. - (faq.setup.uninstall-all): Reference new service uninstall FAQ. - -2006-01-25 Igor Peshansky - - * faq-setup.xml (faq.setup.snapshots): Rename DLL using Windows tools. - -2006-01-18 Joshua Daniel Franklin - - * Makefile.in : Remove references to old texinfo FAQ. - * calls.texinfo : Remove. - * changes.texinfo : Remove. - * copy.texinfo : Remove. - * faq.texinfo : Remove. - * history.texinfo : Remove. - * how-api.texinfo : Remove. - * how-programming.texinfo : Remove. - * how-resources.texinfo : Remove. - * how-using.texinfo : Remove. - * how.texinfo : Remove. - * install.texinfo : Remove. - * readme.texinfo : Remove. - * relnotes.texinfo : Remove. - * what.texinfo : Remove. - * who.texinfo : Remove. - -2006-01-12 Igor Peshansky - - * doctool.c (scan_directory): Ignore "CVS" directories. - * faq-setup.xml (faq.setup.setup): Correct URL typo. - (faq.setup.snapshots): Clarify. - -2005-12-30 Christopher Faylor - - * relnotes.texinfo: Remove entry about hyperthreaded processor. - -2005-12-30 Christopher Faylor - - * faq-problems.html: Remove entry about hyperthreaded processor. - -2005-12-12 Joshua Daniel Franklin - - * faq-programming.xml: Add note about struct stat64. - -2005-12-03 Joshua Daniel Franklin - - * faq-setup.xml: Add note about clean_setup.pl. - * faq-using.xml: Remove unnecessary line of elisp. - -2005-10-02 Joshua Daniel Franklin - - * faq-what.xml: Add 2003 and WOW64 to "supported" FAQ. - * faq-programming.xml: Fix cygexec FAQ, building link. - -2005-09-25 Joshua Daniel Franklin - - * faq.xml: Remove copyright section, link to license.html - * faq-sections.xml: Remove copyright section, link to license.html - * faq-programming.xml: Remove confusing reference to Red Hat. - * faq-what.xml: Reword "supported" FAQ. - -2005-09-15 Corinna Vinschen - - * cygwinenv.sgml (ntea): Add some wording to scare people away - from using this option. - -2005-08-26 Brian Dessent - - * faq-using.xml: Add 'net use' hint to network shares FAQ. - -2005-08-26 Joshua Daniel Franklin - - * Makefile.in: Remove extra anchor to make NN4 happy. - * faq.xml: Link to cygwin.com/license.html - * faq-resources.xml: Link instead of duplicating info. - * faq-using.xml: Split out services and network shares FAQ. - * faq-what.xml: Link to cygwin.com/license.html - -2005-08-17 Christopher Faylor - - * textbinary.sgml: Correct incorrect information about ability to - specify text mode in fopen(). - -2005-08-05 Joshua Daniel Franklin - - * cygwin.dsl: Add default DOCTYPE and output filename. - * Makefile: Update to switch FAQ from texinfo to DocBook. - * faq.xml: New file. - * faq-api.xml: New file. - * faq-problems.xml: New file. - * faq-programming.xml: New file. - * faq-resources.xml: New file. - * faq-sections.xml: New file. - * faq-setup.xml: New file. - * faq-using.xml: New file. - * faq-what.xml: New file. - -2005-07-10 Joshua Daniel Franklin - - * cygwinenv.sgml: Update tty section to mention rxvt and xterm. - * how-programming.texinfo: Update GPL section of CVS FAQ. - * how-using.texinfo: Expand FAQ about out of date packages. - * setup-net.sgml: Add troubleshooting setup.exe section. - -2005-07-08 Corinna Vinschen - - * how-using.texinfo: Fix typos. - -2005-06-20 Joshua Daniel Franklin - - * how-resources.texinfo: Update section on cygwin-developers. - * how-using.texinfo: Add FAQ about firewall software. Update - section on mounting and specifically note using managed mounts. - -2005-06-03 Max Kaehn - - * how-programming.texinfo: Add "How do I load cygwin1.dll dynamically - from a Visual Studio or MinGW application?" - -2005-05-28 Joshua Daniel Franklin - - * how-using.texinfo : Update the mkdir -p section to reflect - changes in handling network drives. - -2005-05-18 Brian Dessent - - * install.texinfo ("How do I uninstall..."): Rewrite to cover - removing services, dealing with permissions, and other common - tasks for removing Cygwin completely. - -2005-05-08 Joshua Daniel Franklin - - * how-programming.texinfo: Replace MAKE_MODE entry with FAQ about - execvp errors and cygexec. - -2005-04-20 Brian Dessent - - * pathnames.sgml (mount-table): Indicate that user-specific - mounts override system-wide. - -2005-04-20 Gerd Spalink - - * fhandler-tut.txt: Update description to cygwin 1.5.13 - -2005-04-19 Corinna Vinschen - - * cygwinenv.sgml: Mention that check_case is deprecated. - -2005-04-16 Corinna Vinschen - - * cygwinenv.sgml: Add new words for (no)traverse option. - -2005-03-30 Christopher Faylor - - * how-using.texinfo: Add more words to the "multiple DLL" section. - -2005-03-25 Joshua Daniel Franklin - - * how-programming.texinfo: Mention generic-build-script in - packaging FAQ. - -2005-03-19 Joshua Daniel Franklin - - * how-programming.texinfo: Remove incorrect libm.a note. - -2005-03-05 Christopher Faylor - - * pathnames.sgml: Clarify binmode/textmode behavior slightly. - * textbinary.sgml: Ditto. - -2005-03-03 Joshua Daniel Franklin - - * how-api.texinfo: Add Pierre's security text. - -2005-02-23 Joshua Daniel Franklin - - * README: New file. - -2005-01-31 Corinna Vinschen - - * cygwinenv.sgml: Add words for (no)traverse option. - -2005-01-29 Joshua Daniel Franklin - - * install.texinfo: Update setup.exe snapshot URL. - * ntsec.sgml: Add Pierre's Windows 2003 text. - -2005-01-28 Corinna Vinschen - - * how-using.texinfo: Change text about using shortcuts. - -2005-01-22 Joshua Daniel Franklin - - * how-api.texinfo: Make snapshot URL an HTML link. - * how-programming.texinfo: Add details about building a - debugging version of the DLL. - * how-using.texinfo: Correct rxvt README location. - * install.texinfo: Add mount -m note to uninstall instructions. - -2005-01-21 Christopher Faylor - - * how-programming.texinfo: Remove obsolete w32api instructions and add - some words about unpacking net release .tar.bz2. - -2004-12-30 Joshua Daniel Franklin - - * path.sgml: Encode programming example with CDATA. - * overview.sgml: Add notes about SUS, newlib, and ash. - * overview2.sgml: Add notes about /usr/share/doc/Cygwin. - -2004-12-27 Joshua Daniel Franklin - - * Makefile.in: Update to use xmlto. - * cygwin.dsl: Change into DocBook XSL stylesheet for xmlto. - * pathnames.sgml: Correct documentation of mount behavior. - -2004-12-24 Joshua Daniel Franklin - - * cygserver.sgml: Cleanup markup for XML validity. - * cygwin-api.in.sgml: Cleanup markup for XML validity. - * cygwin-ug-net.in.sgml: Cleanup markup for XML validity. - * cygwin-ug.in.sgml: Cleanup markup for XML validity. - * cygwinenv.sgml: Cleanup markup for XML validity. - * dll.sgml: Cleanup markup for XML validity. - * effectively.sgml: Cleanup markup for XML validity. - * filemodes.sgml: Cleanup markup for XML validity. - * legal.sgml: Cleanup markup for XML validity. - * ntsec.sgml: Cleanup markup for XML validity. - * overview.sgml: Cleanup markup for XML validity. - * overview2.sgml: Cleanup markup for XML validity. - * pathnames.sgml: Cleanup markup for XML validity. - * setup-net.sgml: Cleanup markup for XML validity. - * setup2.sgml: Cleanup markup for XML validity. - * textbinary.sgml: Cleanup markup for XML validity. - * utils.sgml: Cleanup markup for XML validity. - -2004-12-02 Joshua Daniel Franklin - - * cygserver.sgml: Cleanup minor markup problem. - * how-resources.texinfo: Add man and info to documentation FAQ. - * how-using.texinfo: Add more detail to Unicode FAQ. - * install.texinfo: Finally apply Pierre's patch from 2003-03-03. - * relnotes.texinfo: Add note about hyperthreading reports. - -2004-09-30 Joshua Daniel Franklin - - * how-using.texinfo: Fix typo. Add note about "Install For All Users" - -2004-09-30 Joshua Daniel Franklin - - * how-programming.texinfo: Add gcj note to WinMain@16 FAQ. - * how-using.texinfo: Add FAQ about network shares and authentication. - * install.texinfo: Add "Where is make" to FAQ subtitle. - -2004-09-24 Corinna Vinschen - - * cygwinenv.sgml: smbntsec is not on by default. - -2004-09-14 Christopher Faylor - - * what.texinfo: Fix two typos reported on cygwin list. - -2004-09-02 Corinna Vinschen - - * textbinary.sgml: Change default mode for non-mounted paths to binary. - -2004-07-16 Joshua Daniel Franklin - - * how-resources.texinfo: Update documentation to /usr/share/doc. - * how-using.texinfo: Add paragraph about find -noleaf. - -2004-06-14 Joshua Daniel Franklin - - * how-programming.texinfo: Add section about Visual Studio linking. - -2004-06-13 Joshua Daniel Franklin - - * faq.texinfo: Move outdated calls.texinfo to readme.texinfo. - * how-api.texinfo: Fix typos. - * how-programming.texinfo: Fix typos. - * how-resources.texinfo: Fix typos. - * how-using.texinfo: Fix typos. - * install.texinfo: Fix typos. - * readme.texinfo: Move outdated calls.texinfo to readme.texinfo. - -2004-05-21 Brian Ford - - * pathnames.sgml: Remove /dev/kmem from the supported POSIX - device list. - - * cygwinenv.sgml: Fix typo in check_case description. - -2004-03-30 Joshua Daniel Franklin - - * ntsec.sgml: Replace chapter numbers with s, - replace release-numbers in s with descriptions. - -2004-03-30 Ronald Landheer-Cieslak <ronald@landheer.com> - - * ntsec.sgml: Fix typos, correct chapter numbers. - -2004-03-29 Corinna Vinschen <corinna@vinschen.de> - - * pathnames.sgml: Fix /dev/srX description. - -2004-03-28 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * how-programming.texinfo: Make list in .lib FAQ enumerative. - -2004-03-28 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * how-programming.texinfo: Add note about gcc .lib linking. - * pathnames.sgml: Mention create_devices.sh for /dev/ creation. - -2004-03-27 Corinna Vinschen <corinna@vinschen.de> - - * cygserver.sgml: New file. - * using.sgml: Include Cygserver docs. - -2004-03-26 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * cygwinenv.sgml: Add example for CYGWIN=error_start. - * pathnames.sgml: Update list of /dev/ devices. - -2004-02-22 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * Makefile.in: Fix problem links in faq0.html file. - * what.texinfo: Remove outdated 'recent' history. - -2004-02-19 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * cygwinenv.sgml: Remove incorrect ^Z information. Add - some tags to server option description. - * textbinary.sgml: Remove incorrect ^Z information. - -2004-02-16 Corinna Vinschen <corinna@vinschen.de> - - * cygwinenv.sgml: Add server option description. - -2004-02-04 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * Makefile.in: Generate monolithic faq0.html file. - -2004-01-24 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * cygwinenv.sgml: Cleanup minor markup problems. - * dll.sgml: Cleanup minor markup problems. - * effectively.sgml: Cleanup minor markup problems. - * gcc.sgml: Cleanup minor markup problems. - * ntsec.sgml: Cleanup minor markup problems. - * pathnames.sgml: Cleanup minor markup problems. - * setup-net.sgml: Cleanup minor markup problems. - * textbinary.sgml: Cleanup minor markup problems. - * windres.sgml: Cleanup minor markup problems. - -2004-01-20 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * Makefile.in: Remove unused cygwin-ug and cygwin-api-int - targets from default build. - * how-using.texinfo: Add information about 8-bit character - display to FAQ. - * setup2.sgml: Add information about 8-bit character display - to "Setting up Cygwin". - -2004-01-15 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * setup-net.sgml: Add "internet-setup" id anchor. - * overview.sgml: Update "What is it?" section. Add links to - "Is it free software?" section. Update "Brief History" section. - * overview2.sgml: Rewrite "Expectations for {Windows,Unix}" - as "Quick Start for those more experienced with {Windows,Unix}". - -2004-01-11 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * Makefile.in: Add new target for single-file User's Guide, use new - cygwin.dsl for output. - * cygwin.dsl: New file, DSSSL stylesheet for custom Cygwin output. - * cygwin-api.in.sgml: Update to DocBook SGML 4.2 DTD. - * cygwin-ug-net.in.sgml: Update to DocBook SGML 4.2 DTD. - * cygwin-ug.in.sgml: Update to DocBook SGML 4.2 DTD. - * cygwinenv.sgml: Correct some tags. Add description of default values - to ntsec, export, and error_start items. - * dll.sgml: Add explanation of cyg prefix for DLLs. - * effectively.sgml: Use systemitem tag for names of Cygwin packages. - * how-programming.texinfo: Add example to FAQ entry. - * pathnames.sgml: Add discussion of /proc filesystem. - * setup-net.sgml: Correct some typos and grammar. - -2003-09-01 Corinna Vinschen <corinna@vinschen.de> - - * pathnames.sgml: Remove description how to mount raw devices and - dicourage it. Desparately try to make usage of raw devices a bit - clearer. - -2003-07-31 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * effectively.sgml: New file, "Using Cygwin Effectively with Windows". - * legal.sgml: Update year in copyright notice. - * using.sgml: Include "Using Cygwin Effectively with Windows" section. - -2003-07-15 Christopher Faylor <cgf@redhat.com> - - * pathnames.sgml: Use correct registry key. Clarify '@' operation. - -2003-07-03 Christopher Faylor <cgf@redhat.com> - - * ntsec.sgml: Reword references to "ntsec patch". - -2003-05-08 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * cygwin-ug-net.in.sgml: Remove outdated revision information and - author's names. - -2003-04-26 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * gcc.sgml: Remove outdated "WinMainCRTStartup" references. Add a - hellogui.c example. - -2003-03-26 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * setup-net.sgml: Make suggested additions to setup.exe documentation - -2003-03-23 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * setup-net.sgml: Improve setup.exe documentation - -2003-03-22 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * setup-net.sgml: Document setup.exe - -2003-02-07 Christopher Faylor <cgf@redhat.com> - - * how.texinfo: Add more w32api words. - -2003-02-07 Igor Pechtchanski <pechtcha@cs.nyu.edu> - - * ntsec.sgml: Add note on special names for missing user/group. - -2002-12-18 Christopher Faylor <cgf@redhat.com> - - * overview2.sgml: Remove CTRL-Z discussion. - * cygwinenv.sgml: Expand on CYGWIN=binmode. - -2002-11-10 Christopher Faylor <cgf@redhat.com> - - * how-programming.texinfo: Document _WIN32 more fully. - -2002-10-22 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * ntsec.sgml: Correct some minor grammatical errors. - -2002-10-22 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * dll.sgml: Simplify dll build instructions. - -2002-09-11 Corinna Vinschen <corinna@vinschen.de> - - * ntsec.html: Add chapter for switching user context w/o password. - -2002-08-29 Christopher Faylor <cgf@redhat.com> - - * how-api.texinfo: Remove a line from the CRLF discussion about lseek - not working. Answer thread safe question more simply. - -2002-08-27 Nicholas Wourms <nwourms@netscape.net> - - * calls.texinfo: Add getc_unlocked, getchar_unlocked, putc_unlocked - and putchar_unlocked. - -2002-08-21 Christopher Faylor <cgf@redhat.com> - - * dll.sgml: Remove indirect reference to older gccs. - -2002-06-22 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> - - * dll.sgml: Refine dll build instructions. - -2002-08-21 Christopher Faylor <cgf@redhat.com> - - * ntsec.html: Correct some typos. - -2002-07-23 Nicholas Wourms <nwourms@netscape.net> - - * calls.texinfo: Add fcloseall and fcloseall_r. - -2002-06-24 Corinna Vinschen <corinna@vinschen.de> - - * ntsec.sgml: Clean up text for examples of /etc/passwd and /etc/group. - Add examples with SIDs. Warn about changing them crudely. - -2002-06-21 Christopher Faylor <cgf@redhat.com> - - * what.texinfo: Fix typo. - -2002-06-02 Christopher Faylor <cgf@redhat.com> - - * how-programming.texinfo: Add more words to the "how to build". - -2002-03-01 Christopher Faylor <cgf@redhat.com> - - * overview.sgml: Fix 'more more' typo. - -2002-01-12 Christopher Faylor <cgf@redhat.com> - - * overview.sgml: Fix Red Hat cygwin contract link. - * what.texinfo: Ditto. - -2002-01-01 Christopher Faylor <cgf@redhat.com> - - * Makefile.in: Duh. Actually use bzip2 to create the tarball. Don't - just change the name. - -2002-01-01 Christopher Faylor <cgf@redhat.com> - - * Makefile.in: Make .bz2 tarball. - -2001-12-11 Christopher Faylor <cgf@redhat.com> - - * what.texinfo: Clarify XP. - -2001-12-03 Christopher Faylor <cgf@redhat.com> - - Cleanup copyrights and Cygnus'isms throughout. - * setup.sgml: Nuke ancient instructions. - -Tue Oct 16 18:02:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * pathnames.sgml: Cleanup raw device text to be more coherent. - -Tue Oct 16 17:14:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * pathnames.sgml: Add description for new fixed device paths. - -Fri Sep 7 12:47:47 2001 Michael Schaap <cygwin@mscha.com> - - * how-resources.texinfo: Add some additional words about where to find - documentation. - -Wed Jun 13 13:54:35 2001 Christopher Faylor <cgf@cygnus.com> - - * who.texinfo: Oops. Add a couple of important folk. - -Wed Jun 13 13:45:44 2001 Christopher Faylor <cgf@cygnus.com> - - * who.texinfo: Remove email addresses. Modernize. - -Tue May 29 21:30:07 2001 Christopher Faylor <cgf@cygnus.com> - - * Makefile.in: Tweak to attempt to accomodate older texi2html. - -Tue May 29 16:24:46 2001 Christopher Faylor <cgf@cygnus.com> - - * Makefile.in: Accomodate newer versions of docbook and openjade. - -Thu Apr 12 23:52:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * cygwinenv.sgml: Add text for `check_case' option. - -Fri Mar 2 12:42:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * cygwinenv.sgml: Add text for `winsymlinks' option. - * how-api.texinfo: Add text to explain new symlinks==shortcuts - and the CYGWIN setting `(no)winsymlinks'. - * how-using.texinfo: Add text that Cygwin now treats shortcuts - as symlinks. - -2001-02-07 Eric M. Monsler <emonsler@beamreachnetworks.com> - - * setup2.sgml: Add docs about domain accounts. - -Thu Dec 21 15:03:29 2000 Edward M. Lee <tailbert@yahoo.com> - - * cygwinenv.sgml: Fix typo in <filename>. Add missing </para>. - -Tue Dec 19 21:06:00 2000 Corinna Vinschen <corinna@vinschen.de> - - * cygwinenv.sgml: Add text for `smbntsec' option. - -Sat Nov 18 23:50:12 2000 Christopher Faylor <cgf@cygnus.com> - - * cygwinenv.sgml: Remove CYGWIN=strace option. Update CYGWIN options. - * setup2.sgml: Remove CYGWIN=strace example. - * how-programming.texinfo: Remove stuff about CYGWIN=strace. - -Thu Oct 26 10:00:00 2000 Corinna Vinschen <corinna@vinschen.de> - - * ntsec.sgml: Slight changes. Fix some errors. - -Thu Oct 26 9:35:00 2000 Corinna Vinschen <corinna@vinschen.de> - - * ntsec.sgml: Changed the (now incorrect) hint that ntsec only - uses access allowed ACEs. - -Fri Sep 29 23:52:00 2000 Corinna Vinschen <corinna@vinschen.de> - - * pathnames.sgml: Add documentation about raw block special - devices and tape devices to the "POSIX devices" chapter. - -Fri Aug 18 15:51:06 2000 Christopher Faylor <cgf@cygnus.com> - - * fhandler-tut.txt: hinfo -> dtable. - -Thu Jul 20 13:01:00 2000 Corinna Vinschen <corinna@vinschen.de> - - * ntsec.sgml: Add description for the new setuid ability - of Cygwin since release 1.1.3. - * overview2.sgml: Add description for new chroot functionality. - * calls.texinfo: Add missing calls. Change comments for - setuid, setgid, seteuid, setegid, chroot. - -Tue May 3 0:25:00 2000 Corinna Vinschen <corinna@vinschen.de> - - * ntsec.sgml: Revisited description of `ntsec' according to - the changes in release 1.1. - * setup.sgml: Include ntsec. - * setup-net.sgml: Ditto. diff --git a/winsup/doc/Makefile.in b/winsup/doc/Makefile.in deleted file mode 100644 index 8bc583149..000000000 --- a/winsup/doc/Makefile.in +++ /dev/null @@ -1,93 +0,0 @@ -# -*- Makefile -*- for winsup/doc -# Copyright (c) 1998-2000, 2001, 2002, 2004, 2005, 2006, 2008, 2009, 2010, -# 2013 Red Hat, Inc. -# -# This file is part of Cygwin. -# -# This software is a copyrighted work licensed under the terms of the -# Cygwin license. Please consult the file "CYGWIN_LICENSE" for -# details. - -SHELL = @SHELL@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -DBXDIRS = -d $(srcdir) -d $(srcdir)/../utils -d $(srcdir)/../cygwin - -CC:=@CC@ -CC_FOR_TARGET:=@CC@ - -XMLTO:=xmlto --skip-validation --with-dblatex - -include $(srcdir)/../Makefile.common - -FAQ_SOURCES:= $(wildcard ${srcdir}/faq*.xml) - -.SUFFIXES: .html .body - -.html.body: - $(srcdir)/bodysnatcher.pl $< - -all: Makefile Makefile.dep \ - cygwin-ug-net/cygwin-ug-net.html \ - cygwin-ug-net/cygwin-ug-net-nochunks.html.gz \ - cygwin-api/cygwin-api.html \ - faq/faq.body faq/faq.html \ - cygwin-ug-net/cygwin-ug-net.pdf \ - cygwin-api/cygwin-api.pdf - -Makefile: ${srcdir}/Makefile.in - /bin/sh ./config.status - -clean: - rm -f Makefile.dep - rm -f doctool.exe doctool.o - rm -f cygwin-api.xml - rm -f *.html *.html.gz - rm -Rf cygwin-api cygwin-ug cygwin-ug-net faq - -install: all - -cygwin-ug-net/cygwin-ug-net-nochunks.html.gz : cygwin-ug-net.xml - -${XMLTO} html-nochunks -m $(srcdir)/cygwin.xsl $< - -cp cygwin-ug-net.html cygwin-ug-net/cygwin-ug-net-nochunks.html - -rm -f cygwin-ug-net/cygwin-ug-net-nochunks.html.gz - -gzip cygwin-ug-net/cygwin-ug-net-nochunks.html - -cygwin-ug-net/cygwin-ug-net.html : cygwin-ug-net.xml cygwin.xsl - -${XMLTO} html -o cygwin-ug-net/ -m $(srcdir)/cygwin.xsl $< - -cygwin-ug-net/cygwin-ug-net.pdf : cygwin-ug-net.xml fo.xsl - -xsltproc --xinclude $(srcdir)/fo.xsl $< | fop -q -fo - $@ - -cygwin-api/cygwin-api.html : cygwin-api.xml cygwin.xsl - -${XMLTO} html -o cygwin-api/ -m $(srcdir)/cygwin.xsl $< - -cygwin-api/cygwin-api.pdf : cygwin-api.xml fo.xsl - -xsltproc --xinclude $(srcdir)/fo.xsl $< | fop -q -fo - $@ - -cygwin-api.xml : cygwin-api.in.xml doctool Makefile.in - -./doctool -m $(DBXDIRS) -s $(srcdir) -o $@ $< - -faq/faq.html : $(FAQ_SOURCES) - -${XMLTO} html -o faq -m $(srcdir)/cygwin.xsl $(srcdir)/faq.xml - -sed -i 's;</a><a name="id[0-9]*"></a>;</a>;g' faq/faq.html - -doctool : doctool.c - gcc -g $< -o $@ - -TBFILES = cygwin-ug-net.dvi cygwin-ug-net.rtf cygwin-ug-net.ps \ - cygwin-ug-net.pdf cygwin-ug-net.xml \ - cygwin-api.dvi cygwin-api.rtf cygwin-api.ps \ - cygwin-api.pdf cygwin-api.xml -TBDIRS = cygwin-ug-net cygwin-api -TBDEPS = cygwin-ug-net/cygwin-ug-net.html cygwin-api/cygwin-api.html - -tarball : cygwin-docs.tar.bz2 -cygwin-docs.tar.bz2 : $(TBFILES) $(TBDEPS) - find $(TBFILES) $(TBDIRS) \! -type d | sort | tar -T - -cf - | bzip2 > cygwin-docs.tar.bz2 - -Makefile.dep: cygwin-ug-net.xml - cd $(srcdir) && ./xidepend $^ > "${CURDIR}/$@" - --include Makefile.dep diff --git a/winsup/doc/README b/winsup/doc/README deleted file mode 100644 index 58fd88721..000000000 --- a/winsup/doc/README +++ /dev/null @@ -1,29 +0,0 @@ -The cygwin-doc source files are kept in CVS. Please see -http://cygwin.com/cvs.html for more information. - -BUILD REQUIREMENTS: - -bash -bzip2 -coreutils -cygwin -dblatex -docbook-xml45 -docbook-xsl -gzip -make -texinfo -perl -xmlto - - -OTHER NOTES: - -You may use docbook2X to convert the DocBook files into info pages. -I have not been able to get a working docbook2X installation on Cygwin, -so currently I convert the files on a machine running GNU/Linux. - -A few handmade files (cygwin.texi, intro.3, etc.) are found in the -cygwin-doc-x.y-z-src.tar.bz2 package. It also contains the utilities for -building the cygwin-doc-x.y-z "binary" package--simply run each step in -the cygwin-doc-x.y-z.sh script. diff --git a/winsup/doc/Wishlist b/winsup/doc/Wishlist deleted file mode 100644 index 9e7aa4ca1..000000000 --- a/winsup/doc/Wishlist +++ /dev/null @@ -1,111 +0,0 @@ -- Change the '-' prefixes on Makefile.in commands to '@'. We only want - to avoid echoing the commands, not keep on trucking past build - errors. - -- Cygwin API docs update: - - - Either: - - - Convert existing SGML code embedded in Cygwin source code - to Doxygen format, then set up HTML and PDF reference manual - generation in doc/Makefile.in. Then, remove vestiges of doctool. - - The Cygwin User Manual reportedly references pieces of the - current SGML that makes up the API Manual, which if true means - we have a challenge to make the Doxygen process continue to feed - the user manual. - - - Or, move all SGML from winsup/cygwin into winsup/doc/api. - - - Current POSIX documentation is nonexistent. Either: - - - Fork the current POSIX/Linux manpages. Downside of this is that - it's in nroff format and the license demands that nroff sources - continue to be made available. This is a challenge for PDF - manual integration. - - - Switch to Doxygen, which lets us have skeletal POSIX docs almost - for free. Each can point to web docs for more complete info, such - that the Cygwin man pages only need to provide parameter lists and - document Cygwinisms in the implementation. - - - Write our own man pages in DocBook <refentry> form. Such files - should be XInclude-able in regular API/user manuals, and only have - to have the same mininal info as in the Doxygen case above. It - just requires a more verbose markup format. - -- Remove autotools outputs from repo. (configure, Makefile, etc.) - Create a bootstrap script to generate them. Make sure top-level - "make" process knows how to call the bootstrap script at need. - -- There are absolute HTTP <ulinks> which should be transformed to - relative links so that they do the right thing when you move the docs - around. Maybe they'll never live somewhere else on cygwin.com, but if - nothing else, they currently do the wrong thing when you open one of the - generated .html files from the local filesystem: hyperlinks take you off - to cygwin.com instead of to the relevant local file. - -- Convert remaining code snippets from HTML entity form (&, - <...) to raw C/C++ code in CDATA sections. Easier to read and - edit in XML form. - -- Pretty code snippets. Search for a DocBook aware automatic code - formatter that will take raw example code in and mark it up, as exists - for HTML. If one can't be found or created -- e.g. by lashing an HTML - code formatter to a sed script then whipping them until they sing -- do - the markup by hand. - -- Move to DocBook 5. - -- Files are often named with less detail than the ID of the top-level - XML element it contains. For example, specialnames.xml contains - <sect1 id="using-specialnames">. The ID scheme seems hierarchical, so - maybe the files should go into subdirectories; e.g. - using/specialnames.xml. This would help with the proliferation of files - this "patch" created. - -- "Tidy" the XML files. - -- Remove --skip-validation from XMLTO flags variable in Makefile.in, - then fix any errors and warnings that result. - -- Replace the hard-coded dates in <bookinfo><date> tags with DocBook - time stamps. (http://www.sagehill.net/docbookxsl/Datetime.html) - -- cygwin-ug-net/cygwin-ug-net-nochunks.html.gz build rules can probably - be reduced to a one-liner by moving from xmlto wrapper to a raw - xsltproc call. - -- Is xmlto pulling its own weight for the HTML case? It *might* have - some value for the PDF-via-dblatex case, but an xsltproc call for HTML - is also a one-liner. - -- Switch from xmlto/dblatex to xsltproc/FOP for PDF? Might be a - prerequisite to the font changes below if dblatex doesn't allow - one to specify fonts through the xmlto layer. - -- Typography improvements: curl all the quotation marks, replace "--" - with em dashes, check proper names for missing accents, etc. - -- Adapt top-level cygwin.com CSS to DocBook HTML output so the user - guide blends with the rest of the site. (Something like this has - been done to cygwin.com/faq.html already.) - -- Improve PDF styling: - - - Wider margins, section indenting, etc. (i.e. Fix the "wall of text" - problem.) - - - Current fonts are Business Blah at best. Most severe to least: - - - Courier for code is just plain ugly, and is apparently a bitmap - font in some people's PDF output besides. Switch to Deja Vu, - Inconsolata, or Adobe Source Code Pro. - - - Times. Sigh. There must be something better in the free world, - something more in the Palatino or Garamond mold. Bitstream Vera - Serif? Linux Libertine? - - - Arial/Helvetica/whatever. Not a serious issue, but we can do - better, even if it's just a minor shake-up, like switching to a - condensed face. diff --git a/winsup/doc/aclocal.m4 b/winsup/doc/aclocal.m4 deleted file mode 100644 index ecef4244c..000000000 --- a/winsup/doc/aclocal.m4 +++ /dev/null @@ -1,875 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p6 - -dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -# lib-prefix.m4 serial 4 (gettext-0.14.2) -dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) - -# lib-link.m4 serial 6 (gettext-0.14.3) -dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -AC_PREREQ(2.50) - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - undefine([Name]) - undefine([NAME]) -]) - -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. If found, it -dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and -dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIB[]NAME" - AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - undefine([Name]) - undefine([NAME]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, -dnl hardcode_direct, hardcode_minus_L. -AC_DEFUN([AC_LIB_RPATH], -[ - dnl Tell automake >= 1.10 to complain if config.rpath is missing. - m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE(rpath, - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib$1-prefix], -[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib - --without-lib$1-prefix don't search for lib$1 in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) - -# lib-ld.m4 serial 3 (gettext-0.13) -dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 </dev/null` in -*GNU* | *'with BFD'*) - acl_cv_prog_gnu_ld=yes ;; -*) - acl_cv_prog_gnu_ld=no ;; -esac]) -with_gnu_ld=$acl_cv_prog_gnu_ld -]) - -dnl From libtool-1.4. Sets the variable LD. -AC_DEFUN([AC_LIB_PROG_LD], -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi -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 GCC]) - 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. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path 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(acl_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; - *) - test "$with_gnu_ld" != yes && break ;; - esac - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) - -dnl This provides configure definitions used by all the winsup -dnl configure.in files. - -# FIXME: We temporarily define our own version of AC_PROG_CC. This is -# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We -# are probably using a cross compiler, which will not be able to fully -# link an executable. This should really be fixed in autoconf -# itself. - -AC_DEFUN([LIB_AC_PROG_CC_GNU], -[AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc, -[dnl The semicolon is to pacify NeXT's syntax-checking cpp. -cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi])]) - -AC_DEFUN([LIB_AC_PROG_CC], -[AC_BEFORE([$0], [AC_PROG_CPP])dnl -AC_CHECK_TOOL(CC, gcc, gcc) -: ${CC:=gcc} -AC_PROG_CC -test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) -]) - -AC_DEFUN([LIB_AC_PROG_CXX], -[AC_BEFORE([$0], [AC_PROG_CPP])dnl -AC_CHECK_TOOL(CXX, g++, g++) -if test -z "$CXX"; then - AC_CHECK_TOOL(CXX, g++, c++, , , ) - : ${CXX:=g++} - AC_PROG_CXX - test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) -fi - -CXXFLAGS='$(CFLAGS)' -]) - diff --git a/winsup/doc/bodysnatcher.pl b/winsup/doc/bodysnatcher.pl deleted file mode 100755 index 1db30aad4..000000000 --- a/winsup/doc/bodysnatcher.pl +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/perl -w -# Copyright © 2013 by Red Hat, Inc. -# -# This file is part of Cygwin. -# -# This software is a copyrighted work licensed under the terms of the -# Cygwin license. Please consult the file "CYGWIN_LICENSE" for -# details. - -use strict; - -if (@ARGV) { - my $infile = $ARGV[0]; - my $outfile = $infile; - $outfile =~ s/\.html$/.body/; - if ($infile ne $outfile) { - open my $input, '<', $infile or die "Failed to open $infile: $!\n"; - my $html = do { local $/; <$input> }; # slurp! - my ($body) = $html =~ m|<body[^>]*>(.*)</body>|is; - if ($body) { - open my $output, '>', $outfile - or die "Failed to write $outfile: $!\n"; - print $output $body; - } - else { - print STDERR "Could not find <body> element in $infile!\n\n"; - exit 3; - } - } - else { - print STDERR "Input file name must end in .html!\n\n"; - exit 2; - } -} -else { - print STDERR <<USAGE; -usage: $0 <input.html> - - Transforms input.html to input.body by extracting whatever is - between <body> and </body> in input.html. - -USAGE - exit 1; -} diff --git a/winsup/doc/configure b/winsup/doc/configure deleted file mode 100755 index 996722fc1..000000000 --- a/winsup/doc/configure +++ /dev/null @@ -1,4006 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69. -# -# -# Copyright (C) 1992-1996, 1998-2012 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 - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # 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 -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+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -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 -test -x / || 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" - 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 : - export CONFIG_SHELL - # 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 -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+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -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 about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a 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_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_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; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # 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 -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -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 - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# 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'" - - -test -n "$DJDIR" || exec 7<&0 </dev/null -exec 6>&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= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="cygwin-api.in.xml" -ac_no_link=no -ac_subst_vars='LTLIBOBJS -LIBOBJS -build_exeext -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -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 -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS' - - -# 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}' -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 - 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 this package 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/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a - nonstandard directory <lib dir> - LIBS libraries to pass to the linker, e.g. -l<library> - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if - you have headers in a nonstandard directory <include dir> - -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 the package provider. -_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 -configure -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 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 -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 $as_me, which was -generated by GNU Autoconf 2.69. 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 - -# 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 - - -ac_aux_dir= -for ac_dir in ../.. "$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\"/../.." "$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. - - - - -# 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 - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if ${ac_cv_target+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - -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 as_fn_executable_p "$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 as_fn_executable_p "$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="gcc" - 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 - -: ${CC:=gcc} -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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 -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 - ac_no_link=no - 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 <stdio.h> -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 - -else - rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.o conftest.obj conftest.dSYM - ac_no_link=yes - # Setting cross_compile will disable run tests; it will - # also disable AC_CHECK_FILE but that's generally - # correct if we can't link. - cross_compiling=yes - EXEEXT= - # 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; } - -fi -{ $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 <stdarg.h> -#include <stdio.h> -struct stat; -/* 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 - -test -z "$CC" && as_fn_error $? "no acceptable cc found in \$PATH" "$LINENO" 5 - - - - -ac_config_files="$ac_config_files 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}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.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 - - - -: "${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 -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -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 - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# 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 $as_me, which was -generated by GNU Autoconf 2.69. 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 - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_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 - -Configuration files: -$config_files - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 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' -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;; - --he | --h | --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 -_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 - "Makefile") CONFIG_FILES="$CONFIG_FILES 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 -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 2>/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 -' <conf$$subs.awk | sed ' -/^[^""]/{ - N - s/\n// -} -' >>$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" - - -eval set X " :F $CONFIG_FILES " -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 - # - -_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 -$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 - ;; - - - - 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 - diff --git a/winsup/doc/configure.ac b/winsup/doc/configure.ac deleted file mode 100644 index ea5d61074..000000000 --- a/winsup/doc/configure.ac +++ /dev/null @@ -1,23 +0,0 @@ -dnl Autoconf configure script for winsup/regexp -dnl Copyright 1997,1998,1999,2000,2001 Red Hat, Inc. -dnl -dnl This file is part of Cygwin. -dnl -dnl This software is a copyrighted work licensed under the terms of the -dnl Cygwin license. Please consult the file "CYGWIN_LICENSE" for -dnl details. - -dnl Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59) -AC_INIT(cygwin-api.in.xml) -AC_CONFIG_AUX_DIR(../..) - -AC_NO_EXECUTABLES -AC_CANONICAL_SYSTEM - -LIB_AC_PROG_CC - -AC_SUBST(build_exeext) - -AC_OUTPUT(Makefile) diff --git a/winsup/doc/cygserver.xml b/winsup/doc/cygserver.xml deleted file mode 100644 index 6a4ec4ec5..000000000 --- a/winsup/doc/cygserver.xml +++ /dev/null @@ -1,239 +0,0 @@ -<?xml version="1.0" encoding='UTF-8'?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> - -<sect1 id="using-cygserver"><title>Cygserver - -What is Cygserver? - - - Cygserver is a program which is designed to run as a background service. - It provides Cygwin applications with services which require security - arbitration or which need to persist while no other cygwin application - is running. - - - The implemented services so far are: - - - XSI IPC Message Queues. - XSI IPC Semaphores. - XSI IPC Shared Memory. - Allows non-privileged users to store obfuscated - passwords in the registry to be used by setuid and - seteuid calls to create user tokens with network - credentials. This service is used by passwd -R. Using the stored - passwords in set(e)uid does not require running - Cygserver. For details, see . - - This functionality is no longer used since Cygwin 1.7.6, - but the interface is still available: Control slave tty/pty handle dispersal - from tty owner to other processes without compromising the owner processes' - security. Starting with Cygwin 1.7.6 another safe mechanism to share tty/pty - handles is used. - - - - -Cygserver command line options - - - Options to Cygserver take the normal UNIX-style `-X' or `--longoption' form. - Nearly all options have a counterpart in the configuration file (see below) - so setting them on the command line isn't really necessary. Command line - options override settings from the Cygserver configuration file. - - - The one-character options are prepended by a single dash, the long variants - are prepended with two dashes. Arguments to options are marked in angle - brackets below. These are not part of the actual syntax but are used only to - denote the arguments. Note that all arguments are required. Cygserver - has no options with optional arguments. - - - The recognized options are: - - - - - -f, --config-file <file> - - Use <file> as configuration file instead of the default configuration - line. The default configuration file is /etc/cygserver.conf. - The --help and --version options will print the default configuration - pathname. - - - This option has no counterpart in the configuration file, for obvious - reasons. - - - - -c, --cleanup-threads <num> - - Number of threads started to perform cleanup tasks. Default is 2. - Configuration file option: kern.srv.cleanup_threads - - - - -r, --request-threads <num> - - Number of threads started to serve application requests. Default is 10. - The -c and -r options can be used to play with Cygserver's performance - under heavy load conditions or on slow machines. - Configuration file option: kern.srv.request_threads - - - - -d, --debug - - Log debug messages to stderr. These will clutter your stderr output with - a lot of information, typically only useful to developers. - - - - -e, --stderr - - Force logging to stderr. This is the default if stderr is connected to - a tty. Otherwise, the default is logging to the system log. By using - the -e, -E, -y, -Y options (or the appropriate settings in the - configuration file), you can explicitly set the logging output as you - like, even to both, stderr and syslog. - Configuration file option: kern.log.stderr - - - - -E, --no-stderr - - Don't log to stderr. Configuration file option: kern.log.stderr - - - - -y, --syslog - - Force logging to the system log. This is the default, if stderr is not - connected to a tty, e. g. redirected to a file. - Configuration file option: kern.log.syslog - - - - -Y, --no-syslog - - Don't log to syslog. Configuration file option: kern.log.syslog - - - - -l, --log-level <level> - - Set the verbosity level of the logging output. Valid values are between - 1 and 7. The default level is 6, which is relatively chatty. If you set - it to 1, you will get only messages which are printed under severe conditions, - which will result in stopping Cygserver itself. - Configuration file option: kern.log.level - - - - -m, --no-sharedmem - - Don't start XSI IPC Shared Memory support. If you don't need XSI IPC - Shared Memory support, you can switch it off here. - Configuration file option: kern.srv.sharedmem - - - - -q, --no-msgqueues - - Don't start XSI IPC Message Queues. - Configuration file option: kern.srv.msgqueues - - - - -s, --no-semaphores - - Don't start XSI IPC Semaphores. - Configuration file option: kern.srv.semaphores - - - - -S, --shutdown - - Shutdown a running daemon and exit. Other methods are sending a SIGHUP - to the Cygserver PID or, if running as service, calling `net stop - cygserver' or `cygrunsrv -E cygserver'. - - - - -h, --help - - Output usage information and exit. - - - - -V, --version - - Output version information and exit. - - - - - - -How to start Cygserver - - - Before you run Cygserver for the first time, you should run the - /usr/bin/cygserver-config script once. It creates the default - configuration file and, upon request, installs Cygserver as service. - The script only performs a default install, with no further options - given to Cygserver when running as service. Due to the wide - configurability by changing the configuration file, that's typically - not necessary. - - - You should always run Cygserver as a service under LocalSystem account. - This is the way it is installed for you by the /usr/bin/cygserver-config - script. - - - - -The Cygserver configuration file - - - Cygserver has many options, which allow you to customize the server - to your needs. Customization is accomplished by editing the configuration - file, which is by default /etc/cygserver.conf. This file is only read - once, at startup of Cygserver. There's no option to re-read the file at - runtime by, say, sending a signal to Cygserver. - - - The configuration file determines how Cygserver operates. There are - options which set the number of threads running in parallel, options - for setting how and what to log and options to set various maximum - values for the IPC services. - - - The default configuration file delivered with Cygserver is installed - to /etc/defaults/etc. The /usr/bin/cygserver-config script copies it to - /etc, giving you the option to overwrite an already existing file or to - leave it alone. Therefore, the /etc file is safe to be changed by you, - since it will not be overwritten by a later update installation. - - - The default configuration file contains many comments which describe - everything needed to understand the settings. A comment at the start of the - file describes the syntax rules for the file. The default options are shown - in the file but are commented out. - - - It is generally a good idea to uncomment only options which you intend to - change from the default values. Since reading the options file on Cygserver - startup doesn't take much time, it's also considered good practice to keep - all other comments in the file. This keeps you from searching for clues - in other sources. - - - - - diff --git a/winsup/doc/cygwin-api.in.xml b/winsup/doc/cygwin-api.in.xml deleted file mode 100644 index 3fee468dc..000000000 --- a/winsup/doc/cygwin-api.in.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - 1998-08-31 - Cygwin API Reference -DOCTOOL-INSERT-legal - - - - -Compatibility -DOCTOOL-INSERT-std-susv4 -DOCTOOL-INSERT-std-bsd -DOCTOOL-INSERT-std-gnu -DOCTOOL-INSERT-std-solaris -DOCTOOL-INSERT-std-deprec -DOCTOOL-INSERT-std-notimpl -DOCTOOL-INSERT-std-notes - - -Cygwin Functions - -These functions are specific to Cygwin itself, and probably -won't be found anywhere else. - -DOCTOOL-INSERT-func- - - - - diff --git a/winsup/doc/cygwin-ug-net.xml b/winsup/doc/cygwin-ug-net.xml deleted file mode 100644 index 89526d721..000000000 --- a/winsup/doc/cygwin-ug-net.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - 2009-03-18 - Cygwin User's Guide - - - - - - - - diff --git a/winsup/doc/cygwin.xsl b/winsup/doc/cygwin.xsl deleted file mode 100644 index 23512934a..000000000 --- a/winsup/doc/cygwin.xsl +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/winsup/doc/cygwinenv.xml b/winsup/doc/cygwinenv.xml deleted file mode 100644 index 5a3e999b2..000000000 --- a/winsup/doc/cygwinenv.xml +++ /dev/null @@ -1,264 +0,0 @@ - - - -The <envar>CYGWIN</envar> environment -variable - - -Implemented options - -The CYGWIN environment variable is used to configure -many global settings for the Cygwin runtime system. It contains the options -listed below, separated by blank characters. Many options can be turned off -by prefixing with no. - - - - -(no)detect_bloda - If set, Cygwin will try to detect -foreign applications which try to inject threads into a Cygwin process, -or which redirect system sockets by providing an enforced so-called -Layered Service Provider. This may or may not help to -detect -BLODAs. Don't use this option for day-to-day usage, it will slow -down every thread and socket creation! - - - -(no)dosfilewarning - If set, Cygwin will warn the -first time a user uses an "MS-DOS" style path name rather than a POSIX-style -path name. Defaults to set. - - - -(no)export - If set, the final values of these -settings are re-exported to the environment as CYGWIN again. -Defaults to off. - - - - -error_start:Win32filepath - if set, runs -Win32filepath when cygwin encounters a fatal error, -which is useful for debugging. Win32filepath is -usually set to the path to gdb or -dumper, for example -C:\cygwin\bin\gdb.exe. -There is no default set. - - - - -(no)glob[:ignorecase] - if set, command line arguments -containing UNIX-style file wildcard characters (brackets, braces, question mark, -asterisk, escaped with \) are expanded into lists of files that match -those wildcards. -This is applicable only to programs run from non-Cygwin programs such as a CMD prompt. -That means that this setting does not affect globbing operations for shells such as -bash, sh, tcsh, zsh, etc. -Default is set. -This option also accepts an optional [no]ignorecase modifer. -If supplied, wildcard matching is case insensitive. The default is noignorecase - - - -(no)pipe_byte - causes Cygwin to open pipes in byte mode rather than -message mode. - - - -proc_retry:n - causes fork() and -exec*() to retry n times when a child process fails -due to certain windows-specific errors. These errors usually occur when -processes are being started while a user is logging off. - - - - -(no)reset_com - if set, serial ports are reset -to 9600-8-N-1 with no flow control when used. This is done at open -time and when handles are inherited. Defaults to set. - - - -(no)wincmdln - if set, the windows complete command -line (truncated to ~32K) will be passed on any processes that it creates -in addition to the normal UNIX argv list. Defaults to not set. - - - -winsymlinks:{lnk,native,nativestrict} - if set to just -winsymlinks or winsymlinks:lnk, -Cygwin creates symlinks as Windows shortcuts with a special header and -the R/O attribute set. - -If set to winsymlinks:native or -winsymlinks:nativestrict, Cygwin creates symlinks as -native Windows symlinks on filesystems and OS versions supporting them. -If the OS is known not to support native symlinks (Windows XP, Windows -Server 2003), a warning message is produced once per session. - -The difference between winsymlinks:native and -winsymlinks:nativestrict is this: If the filesystem -supports native symlinks and Cygwin fails to create a native symlink for -some reason, it will fall back to creating Cygwin default symlinks -with winsymlinks:native, while with -winsymlinks:nativestrict the symlink(2) -system call will immediately fail. - -For more information on symbolic links, see -. - - - - - - - -Obsolete options - - -Certain CYGWIN options available in past releases have been removed in -Cygwin 1.7 for one reason or another. These obsolete options are listed -below. - - - - -(no)binmode - This option has been removed because -all file opens default to binary mode, unless the open mode has been specified -explicitly in the open(2) call. - - - - -check_case - This option has been removed in favor of -real case sensitivity and the per-mount option "posix=[0|1]". For more -information, read the documentation in and -. - - - -codepage:[ansi|oem] - This option controlled -which character set is used for file and console operations. Since Cygwin -is now doing all character conversion by itself, depending on the -application call to the setlocale() function, and in -turn by the setting of the environment variables $LANG, -$LC_ALL, or $LC_CTYPE, this setting -became superfluous. - - - -(no)envcache - Originally, envcache -controlled caching of environment variable conversion between Win32 and -POSIX. The default setting works fine, the option was just useless. - - - -forkchunk:[intval] - This option allowed to influence -the fork() function in the way the memory of the -parent process gets copied to the child process. This functionality was -only useful for Windows 95/98/Me. - - - - -(no)ntea - This option has been removed since it -only fakes security which is considered dangerous and useless. It also -created an uncontrollably large file on FAT and was entirely useless -on FAT32. - - - -(no)ntsec - This option has been removed in favor of -the per-mount option "acl"/"noacl". For more information, read the -documentation in . - - - -(no)server - Originally this option had to be -enabled on the client side to use features only available when running -cygserver. This option has been removed because Cygwin now -always tries to contact cygserver if a function is called which requires -cygserver being available. For more information, read the documentation -in . - - - -(no)smbntsec - This option has been removed in favor of -the per-mount option "acl"/"noacl". For more information, read the -documentation in . - - - -(no)strip_title - Removed because setting the Window title -can be controlled by the application via Escape sequences. - - - -(no)title - Removed because setting the Window title -can be controlled by the application via Escape sequences. - - - -(no)transparent_exe - This option has been removed -because the behaviour it switched on is now the standard behaviour in -Cygwin. - - - -(no)traverse - This option has been removed because -traverse checking is not quite correctly implemented by Microsoft and -it's behaviour has been getting worse with each new OS version. This -complicates its usage so the option has been removed for now. - - - -(no)tty - If set, Cygwin enabled extra support -(i.e., termios) for UNIX-like ttys in the Windows console. This option -has been removed because it can be easily replaced by using a terminal -like mintty, and it does not work well with some -Windows programs. - - - -(no)upcaseenv - This option could be used to convert -all environment variables to uppercase. This was the default behavior in -releases prior to Cygwin 1.7. Since keeping the case of environment -variables intact is POSIXly correct, Cygwin now does not change the case -of environment variables, except for a restricted set to maintain minimal -backward compatibility. The current list of always uppercased variables is: - - - ALLUSERSPROFILE - COMMONPROGRAMFILES - COMPUTERNAME - COMSPEC - HOME - HOMEDRIVE - HOMEPATH - NUMBER_OF_PROCESSORS - OS - PATH - PATHEXT - PROCESSOR_ARCHITECTURE - PROCESSOR_IDENTIFIER - PROCESSOR_LEVEL - PROCESSOR_REVISION - PROGRAMFILES - SYSTEMDRIVE - SYSTEMROOT - TEMP - TERM - TMP - TMPDIR - WINDIR - - - - - - - - diff --git a/winsup/doc/dll.xml b/winsup/doc/dll.xml deleted file mode 100644 index f0369760f..000000000 --- a/winsup/doc/dll.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - -Building and Using DLLs - -DLLs are Dynamic Link Libraries, which means that they're linked -into your program at run time instead of build time. There are three -parts to a DLL: - - - the exports - the code and data - the import library - - -The code and data are the parts you write - functions, -variables, etc. All these are merged together, like if you were -building one big object files, and put into the dll. They are not -put into your .exe at all. - -The exports contains a list of functions and variables that the -dll makes available to other programs. Think of this as the list of -"global" symbols, the rest being hidden. Normally, you'd create this -list by hand with a text editor, but it's possible to do it -automatically from the list of functions in your code. The -dlltool program creates the exports section of -the dll from your text file of exported symbols. - -The import library is a regular UNIX-like -.a library, but it only contains the tiny bit of -information needed to tell the OS how your program interacts with -("imports") the dll. This information is linked into your -.exe. This is also generated by -dlltool. - -Building DLLs - -This page gives only a few simple examples of gcc's DLL-building -capabilities. To begin an exploration of the many additional options, -see the gcc documentation and website, currently at -http://gcc.gnu.org/ - - -Let's go through a simple example of how to build a dll. -For this example, we'll use a single file -myprog.c for the program -(myprog.exe) and a single file -mydll.c for the contents of the dll -(mydll.dll). - -Fortunately, with the latest gcc and binutils the process for building a dll -is now pretty simple. Say you want to build this minimal function in mydll.c: - - -#include <stdio.h> - -int -hello() -{ - printf ("Hello World!\n"); -} - - -First compile mydll.c to object code: - -gcc -c mydll.c - -Then, tell gcc that it is building a shared library: - -gcc -shared -o mydll.dll mydll.o - - -That's it! To finish up the example, you can now link to the -dll with a simple program: - - - -int -main () -{ - hello (); -} - - - -Then link to your dll with a command like: - - -gcc -o myprog myprog.c -L./ -lmydll - -However, if you are building a dll as an export library, -you will probably want to use the complete syntax: - -gcc -shared -o cyg${module}.dll \ - -Wl,--out-implib=lib${module}.dll.a \ - -Wl,--export-all-symbols \ - -Wl,--enable-auto-import \ - -Wl,--whole-archive ${old_libs} \ - -Wl,--no-whole-archive ${dependency_libs} - - -The name of your library is ${module}, prefixed with -cyg for the DLL and lib for the -import library. Cygwin DLLs use the cyg prefix to -differentiate them from native-Windows MinGW DLLs, see -the MinGW website for more details. -${old_libs} are all -your object files, bundled together in static libs or single object -files and the ${dependency_libs} are import libs you -need to link against, e.g -'-lpng -lz -L/usr/local/special -lmyspeciallib'. - - - -Linking Against DLLs - -If you have an existing DLL already, you need to build a -Cygwin-compatible import library. If you have the source to compile -the DLL, see for details on having -gcc build one for you. If you do not have the -source or a supplied working import library, you can get most of -the way by creating a .def file with these commands (you might need to -do this in bash for the quoting to work -correctly): - - -echo EXPORTS > foo.def -nm foo.dll | grep ' T _' | sed 's/.* T _//' >> foo.def - - -Note that this will only work if the DLL is not stripped. -Otherwise you will get an error message: "No symbols in -foo.dll". - -Once you have the .def file, you can create -an import library from it like this: - - -dlltool --def foo.def --dllname foo.dll --output-lib foo.a - - - - - diff --git a/winsup/doc/doctool.c b/winsup/doc/doctool.c deleted file mode 100644 index 0a5060c76..000000000 --- a/winsup/doc/doctool.c +++ /dev/null @@ -1,622 +0,0 @@ -/* doctool.c - - Copyright 1998,1999,2000,2001,2006 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include - -/* Building native in a cross-built directory is tricky. Be careful, -and beware that you don't have the full portability stuff available to -you (like libiberty) */ - -/*****************************************************************************/ - -/* The list of extensions that may contain SGML snippets. We check - both cases in case the file system isn't case sensitive enough. */ - -struct { - char *upper; - char *lower; - int is_sgml; -} extensions[] = { - { ".C", ".c", 0 }, - { ".CC", ".cc", 0 }, - { ".H", ".h", 0 }, - { ".SGML", ".sgml", 1 }, - { 0, 0, 0 } -}; - -/*****************************************************************************/ - -void -show_help() -{ - printf("Usage: doctool [-m] [-i] [-d dir] [-o outfile] [-s prefix] \\\n"); - printf(" [-b book_id] infile\n"); - printf(" -m means to adjust Makefile to include new dependencies\n"); - printf(" -i means to include internal snippets\n"); - printf(" -d means to recursively scan directory for snippets\n"); - printf(" -o means to output to file (else stdout)\n"); - printf(" -s means to suppress source dir prefix\n"); - printf(" -b means to change the \n"); - printf("\n"); - printf("doctool looks for DOCTOOL-START and DOCTOOL-END lines in source,\n"); - printf("saves blocks, and looks for DOCTOOL-INSERT-bar\n"); - printf("commands to insert selected sections. IDs starting with int-\n"); - printf("are internal only, add- are added at the end of relevant sections\n"); - printf("or add-int- for both. Inserted sections are chosen by prefix,\n"); - printf("and sorted when inserted.\n"); - exit(1); -} - -/*****************************************************************************/ - -typedef struct Section { - struct Section *next; - struct OneFile *file; - char *name; - char internal; - char addend; - char used; - char **lines; - int num_lines; - int max_lines; -} Section; - -typedef struct OneFile { - struct OneFile *next; - char *filename; - int enable_scan; - int used; - Section *sections; -} OneFile; - -OneFile *file_list = 0; - -char *output_name = 0; -FILE *output_file = 0; - -char *source_dir_prefix = ""; -char *book_id = 0; - -int internal_flag = 0; - -/*****************************************************************************/ - -char * -has_string(char *line, char *string) -{ - int i; - while (*line) - { - for (i=0; line[i]; i++) - { - if (!string[i]) - return line; - if (line[i] != string[i]) - break; - } - line++; - } - return 0; -} - -int -starts_with(char *line, char *string) -{ - int i=0; - while (1) - { - if (!string[i]) - return 1; - if (!line[i] || line[i] != string[i]) - return 0; - i++; - } -} - -/*****************************************************************************/ - -#ifdef S_ISLNK -#define STAT lstat -#else -#define STAT stat -#endif - -void -scan_directory(dirname) - char *dirname; -{ - struct stat st; - char *name; - struct dirent *de; - DIR *dir = opendir(dirname); - if (!dir) - return; - while (de = readdir(dir)) - { - if (strcmp(de->d_name, ".") == 0 - || strcmp(de->d_name, "..") == 0) - continue; - - name = (char *)malloc(strlen(dirname)+strlen(de->d_name)+3); - strcpy(name, dirname); - strcat(name, "/"); - strcat(name, de->d_name); - - STAT(name, &st); - - if (S_ISDIR(st.st_mode) && strcmp(de->d_name, "CVS") != 0) - { - scan_directory(name); - } - - else if (S_ISREG(st.st_mode)) - { - char *dot = strrchr(de->d_name, '.'); - int i; - - if (dot) - { - for (i=0; extensions[i].upper; i++) - if (strcmp(dot, extensions[i].upper) == 0 - || strcmp(dot, extensions[i].lower) == 0) - { - OneFile *one = (OneFile *)malloc(sizeof(OneFile)); - one->next = file_list; - file_list = one; - one->filename = name; - one->enable_scan = ! extensions[i].is_sgml; - one->used = 0; - one->sections = 0; - } - } - } - } - closedir (dir); -} - -/*****************************************************************************/ - -void -scan_file(OneFile *one) -{ - FILE *f = fopen(one->filename, "r"); - int enabled = ! one->enable_scan; - char line[1000], *tag=0, *id=0, *tmp; - int taglen = 0; - Section *section = 0; - Section **prev_section_ptr = &(one->sections); - - if (!f) - { - perror(one->filename); - return; - } - - while (fgets(line, 1000, f)) - { - if (one->enable_scan) - { - /* source files have comment-embedded docs, check for them */ - if (has_string(line, "DOCTOOL-START")) - enabled = 1; - if (has_string(line, "DOCTOOL-END")) - enabled = 0; - } - if (!enabled) - continue; - - /* DOCTOOL-START - - -this is the doctool tags section. - - - DOCTOOL-END */ - - if (!tag && line[0] == '<') - { - tag = (char *)malloc(strlen(line)+1); - id = (char *)malloc(strlen(line)+1); - if (sscanf(line, "<%s id=\"%[^\"]\">", tag, id) == 2) - { - if (strcmp(tag, "book") == 0 || strcmp(tag, "BOOK") == 0) - { - /* Don't want to "scan" these */ - return; - } - taglen = strlen(tag); - section = (Section *)malloc(sizeof(Section)); - /* We want chunks within single files to appear in that order */ - section->next = 0; - section->file = one; - *prev_section_ptr = section; - prev_section_ptr = &(section->next); - section->internal = 0; - section->addend = 0; - section->used = 0; - section->name = id; - if (starts_with(section->name, "add-")) - { - section->addend = 1; - section->name += 4; - } - if (starts_with(section->name, "int-")) - { - section->internal = 1; - section->name += 4; - } - section->lines = (char **)malloc(10*sizeof(char *)); - section->num_lines = 0; - section->max_lines = 10; - } - else - { - free(tag); - free(id); - tag = id = 0; - } - } - - if (tag && section) - { - if (section->num_lines >= section->max_lines) - { - section->max_lines += 10; - section->lines = (char **)realloc(section->lines, - section->max_lines * sizeof (char *)); - } - section->lines[section->num_lines] = (char *)malloc(strlen(line)+1); - strcpy(section->lines[section->num_lines], line); - section->num_lines++; - - if (line[0] == '<' && line[1] == '/' - && memcmp(line+2, tag, taglen) == 0 - && (isspace(line[2+taglen]) || line[2+taglen] == '>')) - { - /* last line! */ - tag = 0; - } - } - } - fclose(f); -} - -/*****************************************************************************/ - -Section ** -enumerate_matching_sections(char *name_prefix, int internal, int addend, int *count_ret) -{ - Section **rv = (Section **)malloc(12*sizeof(Section *)); - int count = 0, max=10, prefix_len = strlen(name_prefix); - OneFile *one; - int wildcard = 0; - - if (name_prefix[strlen(name_prefix)-1] == '-') - wildcard = 1; - - for (one=file_list; one; one=one->next) - { - Section *s; - for (s=one->sections; s; s=s->next) - { - int matches = 0; - if (wildcard) - { - if (starts_with(s->name, name_prefix)) - matches = 1; - } - else - { - if (strcmp(s->name, name_prefix) == 0) - matches = 1; - } - if (s->internal <= internal - && s->addend == addend - && matches - && ! s->used) - { - s->used = 1; - if (count >= max) - { - max += 10; - rv = (Section **)realloc(rv, max*sizeof(Section *)); - } - rv[count++] = s; - rv[count] = 0; - } - } - } - if (count_ret) - *count_ret = count; - return rv; -} - -/*****************************************************************************/ - -#define ID_CHARS "~@$%&()_-+[]{}:." - -void include_section(char *name, int addend); - -char * -unprefix(char *fn) -{ - int l = strlen(source_dir_prefix); - if (memcmp(fn, source_dir_prefix, l) == 0) - { - fn += l; - while (*fn == '/' || *fn == '\\') - fn++; - return fn; - } - return fn; -} - -void -parse_line(char *line, char *filename) -{ - char *cmd = has_string(line, "DOCTOOL-INSERT-"); - char *sname, *send, *id, *save; - if (!cmd) - { - if (book_id - && (starts_with(line, "'); - if (cmd) - { - cmd++; - fprintf(output_file, "", book_id); - fputs(cmd, output_file); - return; - } - } - fputs(line, output_file); - return; - } - if (cmd != line) - fwrite(line, cmd-line, 1, output_file); - save = (char *)malloc(strlen(line)+1); - strcpy(save, line); - line = save; - - sname = cmd + 15; /* strlen("DOCTOOL-INSERT-") */ - for (send = sname; - *send && isalnum(*send) || strchr(ID_CHARS, *send); - send++); - id = (char *)malloc(send-sname+2); - memcpy(id, sname, send-sname); - id[send-sname] = 0; - include_section(id, 0); - - fprintf(output_file, "\n", unprefix(filename)); - - fputs(send, output_file); - free(save); -} - -int -section_sort(const void *va, const void *vb) -{ - Section *a = *(Section **)va; - Section *b = *(Section **)vb; - int rv = strcmp(a->name, b->name); - if (rv) - return rv; - return a->internal - b->internal; -} - -void -include_section(char *name, int addend) -{ - Section **sections, *s; - int count, i, l; - - sections = enumerate_matching_sections(name, internal_flag, addend, &count); - - qsort(sections, count, sizeof(sections[0]), section_sort); - for (i=0; ifile->used = 1; - fprintf(output_file, "\n", unprefix(s->file->filename)); - for (l=addend; lnum_lines-1; l++) - parse_line(s->lines[l], s->file->filename); - if (!addend) - { - include_section(s->name, 1); - parse_line(s->lines[l], s->file->filename); - } - } - - free(sections); -} - -void -parse_sgml(FILE *in, char *input_name) -{ - static char line[1000]; - while (fgets(line, 1000, in)) - { - parse_line(line, input_name); - } -} - -/*****************************************************************************/ - -void -fix_makefile(char *output_name) -{ - FILE *in, *out; - char line[1000]; - int oname_len = strlen(output_name); - OneFile *one; - int used_something = 0; - struct stat st; - struct utimbuf times; - - stat("Makefile", &st); - - in = fopen("Makefile", "r"); - if (!in) - { - perror("Makefile"); - return; - } - - out = fopen("Makefile.new", "w"); - if (!out) - { - perror("Makefile.new"); - return; - } - - while (fgets(line, 1000, in)) - { - if (starts_with(line, output_name) - && strcmp(line+oname_len, ": \\\n") == 0) - { - /* this is the old dependency */ - while (fgets(line, 1000, in)) - { - if (strcmp(line+strlen(line)-2, "\\\n")) - break; - } - } - else - fputs(line, out); - } - fclose(in); - - for (one=file_list; one; one=one->next) - if (one->used) - { - used_something = 1; - break; - } - - if (used_something) - { - fprintf(out, "%s:", output_name); - for (one=file_list; one; one=one->next) - if (one->used) - fprintf(out, " \\\n\t%s", one->filename); - fprintf(out, "\n"); - } - - fclose(out); - - times.actime = st.st_atime; - times.modtime = st.st_mtime; - utime("Makefile.new", ×); - - if (rename("Makefile", "Makefile.old")) - return; - if (rename("Makefile.new", "Makefile")) - rename("Makefile.old", "Makefile"); -} - -/*****************************************************************************/ - -int -main(argc, argv) - int argc; - char **argv; -{ - int i; - OneFile *one; - FILE *input_file; - int fix_makefile_flag = 0; - - while (argc > 1 && argv[1][0] == '-') - { - if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) - { - show_help(); - } - else if (strcmp(argv[1], "-i") == 0) - { - internal_flag = 1; - } - else if (strcmp(argv[1], "-m") == 0) - { - fix_makefile_flag = 1; - } - else if (strcmp(argv[1], "-d") == 0 && argc > 2) - { - scan_directory(argv[2]); - argc--; - argv++; - } - else if (strcmp(argv[1], "-o") == 0 && argc > 2) - { - output_name = argv[2]; - argc--; - argv++; - } - else if (strcmp(argv[1], "-s") == 0 && argc > 2) - { - source_dir_prefix = argv[2]; - argc--; - argv++; - } - else if (strcmp(argv[1], "-b") == 0 && argc > 2) - { - book_id = argv[2]; - argc--; - argv++; - } - - argc--; - argv++; - } - - for (one=file_list; one; one=one->next) - { - scan_file(one); - } - - input_file = fopen(argv[1], "r"); - if (!input_file) - { - perror(argv[1]); - return 1; - } - - if (output_name) - { - output_file = fopen(output_name, "w"); - if (!output_file) - { - perror(output_name); - return 1; - } - } - else - { - output_file = stdout; - output_name = ""; - } - - parse_sgml(input_file, argv[1]); - - if (output_file != stdout) - fclose(output_file); - - if (fix_makefile_flag) - fix_makefile(output_name); - - return 0; -} diff --git a/winsup/doc/doctool.txt b/winsup/doc/doctool.txt deleted file mode 100644 index c89e39243..000000000 --- a/winsup/doc/doctool.txt +++ /dev/null @@ -1,146 +0,0 @@ -Doctool - -DJ Delorie - -These are the instructions for using doctool. Yes, I should have -written them *in* DocBook, but hey, I was in a hurry. - -OK, doctool is a program that gathers snippets of a docbook document and -puts them all together in the right order. There are three -places that it gets snippets from: - -1. The document that you tell it you want "finished" - -2. blocks of SGML in *.sgml files - -3. comments in source code - -The first of these is the template file, which is to say, it's a -normal SGML file (sort of). This file is the first one read, and -includes such things as your tags etc. It contains commands to -doctool to tell it where to put the other parts. - -The second, the *.sgml files, contain one or more blocks of SGML. -To work with doctool, each of these snippets must begin and end -with matching tags, must have an id="" attribute, and the start/end -tags must begin at the beginning of the line. For example: - - - stuff goes here - - - stuff goes here - - -In this example, the file contains two snippets, one marked by "foo" -and one barked by "bar", with id's "from-45" and "from-48". Note that -I made up the foo and bar tags. You'd usually use a tag or -something useful like that. Stuff outside the blocks is ignored. - -The third is simply an encapsulation of the second in comments, like this: - -/* DOCTOOL-START - - stuff goes here - -DOCTOOL-END */ - -The DOCTOOL-START and DOCTOOL-END things are special. Doctool uses -those to know which parts of which comments are useful, and which -parts are the useless source code stuff ;-) - - -OK, so now we've got all these snippets of SGML floating around. What -do we do with them? Well, inside the template document (#1 in our -list up there) you'd put text snippets that said "ok, put them -here". Each text snippet looks like this: - -DOCTOOL-INSERT-frob- - -Note that the "frob-" part tells doctool to pull in all the snippets -with IDs that start with "frob-", in alphabetical (well, asciibetical -at the moment) order. So, by saying "DOCTOOL-INSERT-frob-" you'd get -all the "frob-*" snippets, like "frob-45" and "frob-48". - -If you just said DOCTOOL-INSERT-frob, it inserts the snippet named -"frob" and no others. - -Note that no snippet will ever be inserted more than once, no matter -how many DOCTOOL-INSERTs you have. - -There's two other tricks doctool has. If it finds a snippet with an ID -like "int-*" (i.e. int-frob-45) that means that snippet of documentation -is for the "internal" version only. The "int-" is discarded, and if -the -i option is given to doctool, this snippet is treated as if the -int- wasn't there. Without the -i, the int-* snippets are ignored -completely. - -If a snippet has "add-" on it, like "add-frob-45", that's an addendum. -Each time a snippet named without the add- is found, doctool looks for -an addendum with exactly that same name (i.e. frob-45 looks for -add-frob-45). If it finds any, it puts them just before the last line -of the non-add snippet (so that it's *inside* the main snippet's -block, not after it). Example: - - - some text - - - more text - - -This would yield: - - - some text - more text - - -You should use the same outermost tags as the main snippet, but only -because it sets the proper nesting rules for what's enclosed. - -You can use add- and int- at the same time, but always do add-int- and -not int-add- (i.e. "add-int-frob-45"). - - -OK, now for doctool command line options. - --m tells doctool to "fix" the Makefile (not makefile) to include the -extra dependencies needed by the file you're generating. You need to -manually include dependencies on the Makefile itself and the template -file; doctool only includes the snippet files (sources etc) that it -actually pulled content from. Note: this isn't perfect! Someone can -come along and add a new snippet to a source file, and doctool would -never know. Sometimes, it's best to just rebuild the docs all the -time. - --i means to include snippets with the "int-" prefix on their IDs. Use -with -b to make internal and public versions from the same sources. - -"-d dir" tells doctool to scan all the files in that directory (and -subdirectories, recursively) for files that might contain snippets of -SGML. These include *.c, *.cc, *.h, and *.sgml. The idea is that -most of the documentation would be in a *.sgml file named after the -source (i.e. foo.c -> foo.sgml) but some commentary within the source -might be useful in the docs as well. SGML files (*.sgml) do not need -the DOCTOOL-START/END tags but the others do. - --o sets the output file. Without -o, the file goes to stdout (ick). - --s tells doctool to supress a "source directory prefix". What this -means is that, in the generated output doctool puts comments that say -where each snippet comes from (for debugging), which includes the full -path sometimes, but if you use -s, you can tell doctool to cut off -that prefix. For example, -/usr/people/dj/src/cygnus/latest/devo/winsup/foo.c might get shortened -to winsup/foo.c if you gave "-s -/usr/people/dj/src/cygnus/latest/devo/". Cygnus makefiles could -just use -s $(srcdir) most of the time. - --b changes the ID for the tag. db2html uses the tag's -ID as the default subdirectory name and/or html file name to create -the book with. You'd need this to generate two books (internal vs -public) from the same source. - -The only other thing you'd add to the command line is the ONE template -file you want to pull in. diff --git a/winsup/doc/effectively.xml b/winsup/doc/effectively.xml deleted file mode 100644 index cb25628fd..000000000 --- a/winsup/doc/effectively.xml +++ /dev/null @@ -1,184 +0,0 @@ - - - - -Using Cygwin effectively with Windows - - -Cygwin is not a full operating system, and so must rely on Windows for -accomplishing some tasks. For example, Cygwin provides a POSIX view -of the Windows filesystem, but does not provide filesystem drivers of -its own. Therefore part of using Cygwin effectively is learning to use -Windows effectively. -Many Windows utilities provide a good way to interact with Cygwin's -predominately command-line environment. For example, -ipconfig.exe provides information about network -configuration, and net.exe views and configures -network file and printer resources. Most of these tools -support the /? switch to display usage information. - - - -Unfortunately, no standard set of tools included with all versions of -Windows exists. Generally, the younger the Windows version, the more -complete are the on-board tools. Microsoft also provides free downloads -for Windows XP (the Windows Support Tools). Additionally, many independent -sites such as -download.com, -simtel.net, -and Microsoft's own -Sysinternals -provide quite useful command-line utilities, as far as they are not -already provided by Cygwin. A few Windows tools, such as -find.exe, link.exe and -sort.exe, may conflict with the Cygwin versions -make sure that you use the full path (/usr/bin/find) -or that your Cygwin bin directory comes first in your -PATH. - - - Pathnames - - -Windows programs do not understand POSIX pathnames, so any arguments -that reference the filesystem must be in Windows (or DOS) format or -translated. Cygwin provides the cygpath utility for -converting between Windows and POSIX paths. A complete description of its -options and examples of its usage are in , -including a shell script for starting Windows Explorer in any directory. -The same format works for most Windows programs, for example - -notepad.exe "$(cygpath -aw "Desktop/Phone Numbers.txt")" - -A few programs require a Windows-style, semicolon-delimited path list, -which cygpath can translate from a POSIX path with the --p option. For example, a Java compilation from -bash might look like this: - -javac -cp "$(cygpath -pw "$CLASSPATH")" hello.java - -Since using quoting and subshells is somewhat awkward, it is often -preferable to use cygpath in shell scripts. - - - - - Cygwin and Windows Networking - -Many popular Cygwin packages, such as ncftp, -lynx, and wget, require a -network connection. Since Cygwin relies on Windows for connectivity, -if one of these tools is not working as expected you may need to -troubleshoot using Windows tools. The first test is to see if you -can reach the URL's host with ping.exe, one of the -few utilities included with every Windows version since Windows 95. -If you chose to install the inetutils package, -you may have both -Windows and Cygwin versions of utilities such as ftp -and telnet. If you are having problems using one -of these programs, see if the alternate one works as expected. - - - -There are a variety of other programs available for specific situations. -If your system does not have an always-on network connection, you -may be interested in rasdial.exe for automating dialup -connections. -Users who frequently change their network -configuration can script these changes with netsh.exe. -For proxy users, the open source - -NTLM Authorization Proxy Server or the no-charge - -Hummingbird SOCKS Proxy may allow you to use Cygwin network -programs in your environment. - - - - -The cygutils package - - -The optional cygutils package contains -miscellaneous tools that are small enough to not require their own package. -It is not included in a default Cygwin install; select it from the Utils -category in setup.exe. Several of the -cygutils tools are useful for interacting with -Windows. - - -One of the hassles of Unix-Windows interoperability is the different line -endings on text files. As mentioned in , -Unix tools such as tr can convert between CRLF and LF -endings, but cygutils provides several dedicated programs: -conv, d2u, dos2unix, -u2d, and unix2dos. Use the ---help switch for usage information. - - - -Creating shortcuts with cygutils - -Another problem area is between Unix-style links, which link one file -to another, and Microsoft .lnk files, which provide a shortcut to a -file. They seem similar at first glance but, in reality, are fairly -different. By default, Cygwin does not create symlinks as .lnk files, -but there's an option to do that, see . -These symlink .lnk files are compatible with Windows-created .lnk files, -but they are still different. They do not include much of the information -that is available in a standard Microsoft shortcut, such as the working -directory, an icon, etc. The cygutils -package includes a mkshortcut utility for creating -standard native Microsoft .lnk files. - - - -But here's the problem. If Cygwin handled these native shortcuts like any -other symlink, you could not archive Microsoft .lnk files into -tar archives and keep all the information in them. -After unpacking, these shortcuts would have lost all the extra information -and would be no different than standard Cygwin symlinks. Therefore these two -types of links are treated differently. Unfortunately, this means that the -usual Unix way of creating and using symlinks does not work with native -Windows shortcuts. - - - -Printing with cygutils - -There are several options for printing from Cygwin, including the -lpr found in cygutils (not to be confused with the -native Windows lpr.exe). The easiest way to use cygutils' -lpr is to specify a default device name in the -PRINTER environment variable. You may also specify a device -on the command line with the -d or -P -options, which will override the environment variable setting. - - - -A device name -may be a UNC path (\\server_name\printer_name), a reserved -DOS device name (prn, lpt1), or a -local port name that is mapped to a printer share. Note that forward slashes -may be used in a UNC path (//server_name/printer_name), -which is helpful when using lpr from a shell that uses -the backslash as an escape character. - - - -lpr sends raw data to the printer; no formatting is done. -Many, but not all, printers accept plain text as input. If your printer -supports PostScript, packages such as -a2ps and enscript can prepare -text files for printing. The ghostscript package also -provides some translation -from PostScript to various native printer languages. Additionally, a native -Windows application for printing PostScript, gsprint, is -available from the Ghostscript -website. - - - - - diff --git a/winsup/doc/faq-api.xml b/winsup/doc/faq-api.xml deleted file mode 100644 index de2d31cc6..000000000 --- a/winsup/doc/faq-api.xml +++ /dev/null @@ -1,329 +0,0 @@ - - - - -Cygwin API Questions - - - -How does everything work? - - -There's a C library which provides a POSIX-style API. The -applications are linked with it and voila - they run on Windows. - -The aim is to add all the goop necessary to make your apps run on -Windows into the C library. Then your apps should (ideally) run on POSIX -systems (Unix/Linux) and Windows with no changes at the source level. - -The C library is in a DLL, which makes basic applications quite small. -And it allows relatively easy upgrades to the Win32/POSIX translation -layer, providing that DLL changes stay backward-compatible. - -For a good overview of Cygwin, you may want to read the Cygwin -User's Guide. - - - - -Are development snapshots for the Cygwin library available? - - -Yes. They're made whenever anything interesting happens inside the -Cygwin library (usually roughly on a nightly basis, depending on how much -is going on). They are only intended for those people who wish to -contribute code to the project. If you aren't going to be happy -debugging problems in a buggy snapshot, avoid these and wait for a real -release. The snapshots are available from -http://cygwin.com/snapshots/. - - - - -How is the DOS/Unix CR/LF thing handled? - - -Let's start with some background. - -On POSIX systems, a file is a file and what the file contains is -whatever the program/programmer/user told it to put into it. In Windows, -a file is also a file and what the file contains depends not only on the -program/programmer/user but also the file processing mode. - -When processing in text mode, certain values of data are treated -specially. A \n (new line, NL) written to the file will prepend a \r -(carriage return, CR) so that if you `printf("Hello\n") you in fact get -"Hello\r\n". Upon reading this combination, the \r is removed and the -number of bytes returned by the read is 1 less than was actually read. -This tends to confuse programs dependent on ftell() and fseek(). A -Ctrl-Z encountered while reading a file sets the End Of File flags even -though it truly isn't the end of file. - -One of Cygwin's goals is to make it possible to mix Cygwin-ported -POSIX programs with generic Windows programs. As a result, Cygwin allows -to open files in text mode. In the accompanying tools, tools that deal -with binaries (e.g. objdump) operate in POSIX binary mode and many (but -not all) tools that deal with text files (e.g. bash) operate in text mode. -There are also some text tools which operate in a mixed mode. They read -files always in text mode, but write files in binary mode, or they write -in the mode (text or binary) which is specified by the underlying mount -point. For a description of mount points, see the Cygwin User's Guide. - -Actually there's no really good reason to do text mode processing -since it only slows down reading and writing files. Additionally many -Windows applications can deal with POSIX \n line endings just fine -(unfortunate exception: Notepad). So we suggest to use binary mode -as much as possible and only convert files from or to DOS text mode -using tools specifically created to do that job, for instance, d2u and -u2d from the cygutils package. - -It is rather easy for the porter of a Unix package to fix the source -code by supplying the appropriate file processing mode switches to the -open/fopen functions. Treat all text files as text and treat all binary -files as binary. To be specific, you can select binary mode by adding -O_BINARY to the second argument of an -open call, or "b" to second argument -of an fopen call. You can also call -setmode (fd, O_BINARY). To select text mode add -O_TEXT to the second argument of an open -call, or "t" to second argument of an -fopen call, or just call -setmode (fd, O_TEXT). - -You can also avoid to change the source code at all by linking -an additional object file to your executable. Cygwin provides various -object files in the /usr/lib directory which, -when linked to an executable, changes the default open modes of any -file opened within the executed process itself. The files are - - binmode.o - Open all files in binary mode. - textmode.o - Open all files in text mode. - textreadmode.o - Open all files opened for reading in text mode. - automode.o - Open all files opened for reading in text mode, - all files opened for writing in binary mode. - - - - - Linking against these object files does not change - the open mode of files propagated to a process by its parent process, - for instance, if the process is part of a shell pipe expression. - - -Note that of the above flags only the "b" fopen flags are defined by -ANSI. They exist under most flavors of Unix. However, using O_BINARY, -O_TEXT, or the "t" flag is non-portable. - - - - -Is the Cygwin library multi-thread-safe? - - -Yes. - -There is also extensive support for 'POSIX threads', see the file -cygwin.din for the list of POSIX thread functions provided. - - - - -How is fork() implemented? - - -Cygwin fork() essentially works like a non-copy on write version -of fork() (like old Unix versions used to do). Because of this it -can be a little slow. In most cases, you are better off using the -spawn family of calls if possible. - -Here's how it works: - -Parent initializes a space in the Cygwin process table for child. -Parent creates child suspended using Win32 CreateProcess call, giving -the same path it was invoked with itself. Parent calls setjmp to save -its own context and then sets a pointer to this in the Cygwin shared -memory area (shared among all Cygwin tasks). Parent fills in the child's -.data and .bss subsections by copying from its own address space into -the suspended child's address space. Parent then starts the child. -Parent waits on mutex for child to get to safe point. Child starts and -discovers if has been forked and then longjumps using the saved jump -buffer. Child sets mutex parent is waiting on and then blocks on -another mutex waiting for parent to fill in its stack and heap. Parent -notices child is in safe area, copies stack and heap from itself into -child, releases the mutex the child is waiting on and returns from the -fork call. Child wakes from blocking on mutex, recreates any mmapped -areas passed to it via shared area and then returns from fork itself. - - - - -How does wildcarding (globbing) work? - - -If the DLL thinks it was invoked from a DOS style prompt, it runs a -`globber' over the arguments provided on the command line. This means -that if you type LS *.EXE from DOS, it will do what you might -expect. - -Beware: globbing uses malloc. If your application defines -malloc, that will get used. This may do horrible things to you. - - - - -How do symbolic links work? - - -Cygwin knows of two ways to create symlinks. - -The default method generates link files with a magic header. When you -open a file or directory that is a link to somewhere else, it opens the file -or directory listed in the magic header. Because we don't want to have to -open every referenced file to check symlink status, Cygwin marks symlinks -with the system attribute. Files without the system attribute are not -checked. Because remote samba filesystems do not enable the system -attribute by default, symlinks do not work on network drives unless you -explicitly enable this attribute or use the second method to create symlinks. - - -The second method is enabled if `winsymlinks' is set in the environment -variable CYGWIN. -Using this method, Cygwin generates symlinks by creating Windows shortcuts. -Cygwin created shortcuts have a special header (which is in that way never -created by Explorer) and the R/O attribute set. A DOS path is stored in -the shortcut as usual and the description entry is used to store the POSIX -path. While the POSIX path is stored as is, the DOS path has perhaps to be -rearranged to result in a valid path. This may result in a divergence -between the DOS and the POSIX path when symlinks are moved crossing mount -points. When a user changes the shortcut, this will be detected by Cygwin -and it will only use the DOS path then. While Cygwin shortcuts are shown -without the ".lnk" suffix in `ls' output, non-Cygwin shortcuts are shown -with the suffix. However, both are treated as symlinks. - - -Both, types of symlinks can live peacefully together since Cygwin -treats both as symlinks regardless of the setting of `(no)winsymlinks' in -the environment variable CYGWIN. - - - - -Why do some files, which are not executables have the 'x' type. - - -When working out the POSIX-style attribute bits on a file stored on -certain filesystems (FAT, FAT32), the library has to fill out some information -not provided by these filesystems. - -It guesses that files ending in .exe and .bat are executable, as are -ones which have a "#!" as their first characters. This guessing doesn't -take place on filesystems providing real permission information (NTFS, NFS), -unless you switch the permission handling off using the mount flag "noacl" -on these filesystems. - - - - -How secure is Cygwin in a multi-user environment? - - -As of version 1.5.13, the Cygwin developers are not aware of any feature -in the cygwin dll that would allow users to gain privileges or to access -objects to which they have no rights under Windows. However there is no -guarantee that Cygwin is as secure as the Windows it runs on. Cygwin -processes share some variables and are thus easier targets of denial of -service type of attacks. - - - - -How do the net-related functions work? - - -The network support in Cygwin is supposed to provide the POSIX API, not -the Winsock API. - -There are differences between the semantics of functions with the same -name under the API. - -E.g., the POSIX select system call can wait on a standard file handles -and handles to sockets. The select call in Winsock can only wait on -sockets. Because of this, the Cygwin dll does a lot of nasty stuff behind -the scenes, trying to persuade various Winsock/Win32 functions to do what -a Unix select would do. - -If you are porting an application which already uses Winsock, then -porting the application to Cygwin means to port the application to using -the POSIX net functions. You should never mix Cygwin net functions with -direct calls to Winsock functions. If you use Cygwin, use the POSIX API. - - - - -I don't want Unix sockets, how do I use normal Win32 winsock? - - -You don't. Look for the MingW project to port applications using -native Win32/Winsock functions. - - - - -What version numbers are associated with Cygwin? - - -Cygwin versioning is relatively complicated because of its status as a -shared library. First of all, since October 1998 every Cygwin DLL has -been named cygwin1.dll and has a 1 in the release name. -Additionally, there are DLL major and minor numbers that correspond to -the name of the release, and a release number. In other words, -cygwin-1.7.1-2 is cygwin1.dll, major version 7, minor -version 1, release 2. - -The cygwin1.dll major version number gets incremented -only when a change is made that makes existing software incompatible. For -example, the first major version 5 release, cygwin-1.5.0-1, added 64-bit -file I/O operations, which required many libraries to be recompiled and -relinked. The minor version changes every time we make a new backward -compatible Cygwin release available. There is also a -cygwin1.dll release version number. The release number -is only incremented if we update an existing release in a way that does not -effect the DLL (like a missing header file). - -There are also Cygwin API major and minor numbers. The major number -tracks important non-backward-compatible interface changes to the API. -An executable linked with an earlier major number will not be compatible -with the latest DLL. The minor number tracks significant API additions -or changes that will not break older executables but may be required by -newly compiled ones. - -Then there is a shared memory region compatibility version number. It is -incremented when incompatible changes are made to the shared memory -region or to any named shared mutexes, semaphores, etc. For more exciting -Cygwin version number details, check out the -/usr/include/cygwin/version.h file. - - - - -Why isn't timezone set correctly? - - -(Please note: This section has not yet been updated for the latest net release.) - -Did you explicitly call tzset() before checking the value of timezone? -If not, you must do so. - - - - -Is there a mouse interface? - - -If you're using X then use the X API to handle mouse events. -In a Windows console window you can enable and capture mouse events -using the xterm escape sequences for mouse events. - - - diff --git a/winsup/doc/faq-copyright.xml b/winsup/doc/faq-copyright.xml deleted file mode 100644 index 95abaa2b4..000000000 --- a/winsup/doc/faq-copyright.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Copyright - - - What are the copyrights? - - - Please see - for more information about Cygwin copyright and licensing. - - - diff --git a/winsup/doc/faq-programming.xml b/winsup/doc/faq-programming.xml deleted file mode 100644 index 998364240..000000000 --- a/winsup/doc/faq-programming.xml +++ /dev/null @@ -1,1125 +0,0 @@ - - - - - -Programming Questions - - -How do I contribute a package? - - -If you are willing to be a package maintainer, great! We urgently need -volunteers to prepare and maintain packages, because the priority of the -Cygwin Team is Cygwin itself. - -The Cygwin Package Contributor's Guide at -http://cygwin.com/setup.html details everything you need to know -about being a package maintainer. The quickest way to get started is to -read the Initial packaging procedure, script-based section on -that page. The generic-build-script found there works well for -most packages. - -For questions about package maintenance, use the cygwin-apps mailing -list (start at http://cygwin.com/lists.html) after -searching and browsing the cygwin-apps list archives, of course. Be -sure to look at the Submitting a package checklist at -http://cygwin.com/setup.html before sending an ITP (Intent To -Package) email to cygwin-apps. - -You should also announce your intentions to the general cygwin list, in -case others were thinking the same thing. - - - - -How do I contribute to Cygwin? - - -If you want to contribute to Cygwin itself, see -http://cygwin.com/contrib.html. - - - - -Why are compiled executables so huge?!? - - -By default, gcc compiles in all symbols. You'll also find that gcc -creates large executables on UNIX. - -If that bothers you, just use the 'strip' program, part of the binutils -package. Or compile with the -s option to gcc. - - - - -What do I have to look out for when porting applications to 64 bit Cygwin? - - -The Cygwin x86_64 toolchain is using the -LP64 -data model. That means, in contrast to Windows, which uses an -LLP64 -data model, sizeof(long) != sizeof(int), just as on Linux. - -For comparison: - - - Cygwin Windows Cygwin - Linux x86_64 Linux - Windows x86_64 - i686 - -sizeof(int) 4 4 4 -sizeof(long) 4 4 8 -sizeof(size_t) 4 8 8 -sizeof(void*) 4 8 8 - - -This difference can result in interesting problems, especially when -using Win32 functions, especially when using pointers to Windows -datatypes like LONG, ULONG, DWORD. Given that Windows is LLP64, all of -the aforementioned types are 4 byte in size, on 32 as well as on 64 bit -Windows, while `long' on 64 bit Cygwin is 8 bytes. - -Take the example ReadFile: - - - ReadFile (HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED); - - -In the 32 bit Cygwin and Mingw environments, as well as in the 64 bit -Mingw environment, it is no problem to substitute DWORD with unsigned -long: - - - unsigned long number_of_bytes_read; - [...] - ReadFile (fhdl, buf, buflen, &number_of_bytes_read, NULL); - - -However, in 64 bit Cygwin, using LP64, number_of_bytes_read is 8 bytes -in size. But since ReadFile expects a pointer to a 4 byte type, the function -will only change the lower 4 bytes of number_of_bytes_read on return, while -the content of the upper 4 bytes stays undefined. - -Here are a few donts which should help porting -applications from the known ILP32 data model of 32 bit Cygwin, to the LP64 -data model of 64 bit Cygwin. Note that these are not Cygwin-only problems. -Many Linux applications suffered the same somewhat liberal handling of -datatypes when the AMD64 CPU was new. - - - - -Don't mix up int and long in printf/scanf. This: - - - int i; long l; - printf ("%d %ld\n", l, i); - - -may not print what you think it should. Enable the gcc options -Wformat or --Wall, which warn about type mismatches in printf/scanf functions. - -Using -Wall (optionally with -Werror to drive the point home) makes a -lot of sense in general, not only when porting code to a new platform. - - - -Don't mix int and long pointers. - - - long *long_ptr = (long *) &my_int; /* Uh oh! */ - *long_ptr = 42; - - -The assignment will write 8 bytes to the address of my_int. Since my_int -is only 4 bytes, something else gets randomly overwritten. -Finding this kind of bug is very hard, because you will often see a problem -which has no immediate connection to the actual bug. - - - -Don't mix int and pointers at all! This will -not work as expected anymore: - - - void *ptr; - printf ("Pointer value is %x\n", ptr); - - -%x denotes an int argument. The value printed by printf is a 4 byte value, -so on x86_64 the printed pointer value is missing its upper 4 bytes; the output -is very likely wrong. Use %p instead, which portable across architectures: - - - void *ptr; - printf ("Pointer value is %p\n", ptr); - - - - -Along the same lines don't use the type int in -pointer arithmetic. Don't cast pointers to int, don't cast pointer -differences to int, and don't store pointer differences in an int type. -Use the types intptr_t, uintptr_t -and ptrdiff_t instead, they are designed for performing -architecture-independent pointer arithmetic. - - - -Don't make blind assumptions about the size of a POSIX -type. For instance, time_t is 8 bytes on 64 bit Cygwin, -while it is (still, at the time of writing this) 4 bytes on 32 bit Cygwin, -since time_t is based on the type long. - - - -Don't use functions returning pointers without declaration. -For instance - - - printf ("Error message is: %s\n", strerror (errno)); - - -This code will crash, unless you included -string.h. The implicit rule in C is that an undeclared -function is of type int. But int is 4 byte and pointers are 8 byte, so the -string pointer given to printf is missing the upper 4 bytes. - - - -Don't use C base types together with Win32 functions. -Keep in mind that DWORD, LONG, ULONG are not the same -as long and unsigned long. Try to use only Win32 datatypes in conjunction -with Win32 API function calls to avoid type problems. See the above -ReadFile example. Windows functions in printf calls should be treated -carefully as well. This code is common for 32 bit code, but probably prints -the wrong value on 64 bit: - - - printf ("Error message is: %lu\n", GetLastError ()); - - -Using gcc's -Wformat option would warn about this. Casting to the requested -base type helps in this case: - - - printf ("Error message is: %lu\n", (unsigned long) GetLastError ()); - - - - -Don't mix Windows datatypes with POSIX type-specific -MIN/MAX values. - - - unsigned long l_max = ULONG_MAX; /* That's right. */ - ULONG w32_biggest = ULONG_MAX; /* Hey, wait! What? */ - ULONG w32_biggest = UINT_MAX; /* Ok, but borderline. */ - - -Again, keep in mind that ULONG (or DWORD) is not unsigned -long but rather unsigned int on 64 bit. - - - - - - - -My project doesn't build at all on 64 bit Cygwin. What's up? - - -Typically reasons for that are: - - - -__CYGWIN32__ is not defined in the -64 bit toolchain. This may hit a few projects which are around since before -Y2K. Check your project for occurences of __CYGWIN32__ -and change them to __CYGWIN__, which is defined in the -Cygwin toolchain since 1998, to get the same Cygwin-specific code changes done. - - -The project maintainers took it for granted that Cygwin is -running only on i686 CPUs and the code is making this assumption blindly. -You have to check the code for such assumptions and fix them. - - -The project is using autotools, the -config.sub and config.guess files -are hopelessly outdated and don't recognize -x86_64-{pc,unknown}-cygwin as valid target. Update the -project configury (cygport will do this by default) and try again. - - -The project uses Windows functions on Cygwin and it's suffering -from the problems described in the preceeding FAQ entry. - - - - -In all of this cases, please make sure to fix that upstream, or send -your patches to the upstream maintainers, so the problems get fixed for the -future. - - - - -Why is __CYGWIN64__ not defined for 64 bit? - - -There is no __CYGWIN64__ because we would like to -have a unified way to handle Cygwin code in portable projects. Using -__CYGWIN32__ and __CYGWIN64__ only -complicates the code for no good reason. Along the same lines you won't -find predefined macros __linux32__ and -__linux64__ on Linux. - -If you really have to differ between 32 and 64 bit in some way, you have -three choices. - - - -If your code depends on the CPU architecture, use the -predefined compiler definition for the architecture, like this: - - -#ifdef __CYGWIN__ -# ifdef __x86_64__ /* Alternatively __x86_64, __amd64__, __amd64 */ - /* Code specific for AMD64 CPU */ -# elif __X86__ - /* Code specific for ix86 CPUs */ -# else -# error Unsupported Architecture -# endif -#endif - - -If your code depends on differences in the data model, you -should consider to use the __LP64__ definition -instead: - - -#ifdef __CYGWIN__ -# ifdef __LP64__ /* Alternatively _LP64 */ - /* Code specific for 64 bit CPUs */ -# else - /* Code specific for 32 bit CPUs */ -# endif -#endif - - -If your code uses Windows functions, and some of the -functionality is 64 bit Windows-specific, use _WIN64, -which is defined on 64 bit Cygwin, as soon as you include -windows.h. This should only be used in the most -desperate of occasions, though, and only if it's -really about a difference in Windows API functionality! - - -#ifdef __CYGWIN__ -# ifdef _WIN64 - /* Code specific for 64 bit Windows */ -# else - /* Code specific for 32 bit Windows */ -# endif -#endif - - - - - - - -Where is glibc? - - -Cygwin does not provide glibc. It uses newlib instead, which provides -much (but not all) of the same functionality. Porting glibc to Cygwin -would be difficult. - - - - -Where is Objective C? - - -Support for compiling Objective C is available in the gcc{4}-objc -package; resulting binaries will depend on the libobjc2 -package at runtime. - - - - -Why does my make fail on Cygwin with an execvp error? - - -Beware of using non-portable shell features in your Makefiles (see tips -at ). - -Errors of make: execvp: /bin/sh: Illegal Argument or -make: execvp: /bin/sh: Argument list too long are often -caused by the command-line being to long for the Windows execution model. -To circumvent this, mount the path of the executable using the -X switch -to enable cygexec for all executables in that folder; you will also need -to exclude non-cygwin executables with the -x switch. Enabling cygexec -causes cygwin executables to talk directly to one another, which increases -the command-line limit. To enable cygexec for /bin and -/usr/bin, you can add or change these entries in /etc/fstab: - - -C:/cygwin/bin /bin ntfs binary,cygexec 0 0 -C:/cygwin/bin /usr/bin ntfs binary,cygexec 0 0 - - -If you have added other non-Cygwin programs to a path you want to mount -cygexec, you can find them with a script like this: - - -#!/bin/sh -cd /bin; for f in `find . -type f -name '*.exe'`; do - cygcheck $f | (fgrep -qi cygwin1.dll || echo $f) -done - - - -See -for more information on using mount. - - - - - -How can I use IPC, or why do I get a Bad system call -error? - - - -Try running cygserver. Read -. If you're -trying to use PostgreSQL, also read -/usr/share/doc/Cygwin/postgresql-*.README. - - - - - -Why the undefined reference to WinMain@16? - - -If you're using gcc, try adding an empty main() function to one -of your sources. Or, perhaps you have -lm too early in the -link command line. It should be at the end: - - - bash$ gcc hello.c -lm - bash$ ./a.exe - Hello World! - - -works, but - - - bash$ gcc -lm hello.c - /c/TEMP/ccjLEGlU.o(.text+0x10):hello.c: multiple definition of `main' - /usr/lib/libm.a(libcmain.o)(.text+0x0):libcmain.c: first defined here - /usr/lib/libm.a(libcmain.o)(.text+0x6a):libcmain.c: undefined reference to `WinMain@16' - collect2: ld returned 1 exit status - - -If you're using GCJ, you need to pass a "--main" flag: - - -gcj --main=Hello Hello.java - - - - - -How do I use Win32 API calls? - - -Cygwin tools require that you explicitly link the import libraries -for whatever Win32 API functions that you are going to use, with the exception -of kernel32, which is linked automatically (because the startup and/or -built-in code uses it). - -For example, to use graphics functions (GDI) you must link -with gdi32 like this: - -gcc -o foo.exe foo.o bar.o -lgdi32 - -or (compiling and linking in one step): - -gcc -o foo.exe foo.c bar.c -lgdi32 - -The regular setup allows you to use the option -mwindows on the -command line to include a set of the basic libraries (and also -make your program a GUI program instead of a console program), -including user32, gdi32 and comdlg32. - -It is a good idea to put import libraries last on your link line, -or at least after all the object files and static libraries that reference them. - - -There are a few restrictions for calls to the Win32 API. -For details, see the User's Guide section -Restricted Win32 environment, -as well as the User's Guide section -Using the Win32 file API in Cygwin applications. - - - -How do I compile a Win32 executable that doesn't use Cygwin? - - -The compilers provided by the mingw-gcc, -mingw64-i686-gcc, and mingw64-x86_64-gcc -packages link against standard Microsoft DLLs instead of Cygwin. This is -desirable for native Windows programs that don't need a UNIX emulation layer. - -This is not to be confused with 'MinGW' (Minimalist GNU for Windows), -which is a completely separate effort. That project's home page is -http://www.mingw.org/index.shtml. - - - - -Can I build a Cygwin program that does not require cygwin1.dll at runtime? - - -No. If your program uses the Cygwin API, then your executable cannot -run without cygwin1.dll. In particular, it is not possible to -statically link with a Cygwin library to obtain an independent, -self-contained executable. - -If this is an issue because you intend to distribute your Cygwin -application, then you had better read and understand -http://cygwin.com/licensing.html, which explains the licensing -options. Unless you purchase a special commercial license from Red -Hat, then your Cygwin application must be Open Source. - - - - -Can I link with both MSVCRT*.DLL and cygwin1.dll? - - -No, you must use one or the other, they are mutually exclusive. - - - - -How do I make the console window go away? - - -The default during compilation is to produce a console application. -It you are writing a GUI program, you should either compile with --mwindows as explained above, or add the string -"-Wl,--subsystem,windows" to the GCC command line. - - - - -Why does make complain about a "missing separator"? - - -This problem usually occurs as a result of someone editing a Makefile -with a text editor that replaces tab characters with spaces. Command -lines must start with tabs. This is not specific to Cygwin. - - - - -Why can't we redistribute Microsoft's Win32 headers? - - -Subsection 2.d.f of the `Microsoft Open Tools License agreement' looks -like it says that one may not "permit further redistribution of the -Redistributables to their end users". We take this to mean that we can -give them to you, but you can't give them to anyone else, which is -something that we can't agree to. Fortunately, we -have our own Win32 headers which are pretty complete. - - - - -How do I use cygwin1.dll with Visual Studio or MinGW? - - -Before you begin, note that Cygwin is licensed under the GNU GPL (as -indeed are many other Cygwin-based libraries). That means that if your -code links against the Cygwin dll (and if your program is calling -functions from Cygwin, it must, as a matter of fact, be linked against -it), you must apply the GPL to your source as well. Of course, this -only matters if you plan to distribute your program in binary form. For -more information, see http://gnu.org/licenses/gpl-faq.html. If -that is not a problem, read on. - -If you want to load the DLL dynamically, read -winsup/cygwin/how-cygtls-works.txt and the sample code in -winsup/testsuite/cygload to understand how this works. -The short version is: - -Make sure you have 4K of scratch space at the bottom of your stack. - -Invoke cygwin_dll_init(): - -HMODULE h = LoadLibrary("cygwin1.dll"); -void (*init)() = GetProcAddress(h, "cygwin_dll_init"); -init(); - - - - -If you want to link statically from Visual Studio, to my knowledge -none of the Cygwin developers have done this, but we have this report -from the mailing list that it can be done this way: - -Use the impdef program to generate a .def file for the cygwin1.dll -(if you build the cygwin dll from source, you will already have a def -file) - - -impdef cygwin1.dll > cygwin1.def - - - -Use the MS VS linker (lib) to generate an import library - - -lib /def=cygwin1.def /out=cygwin1.lib - - - -Create a file "my_crt0.c" with the following contents - - -#include <sys/cygwin.h> -#include <stdlib.h> - -typedef int (*MainFunc) (int argc, char *argv[], char **env); - -void - my_crt0 (MainFunc f) - { - cygwin_crt0(f); - } - - - -Use gcc in a Cygwin prompt to build my_crt0.c into a DLL - (e.g. my_crt0.dll). Follow steps 1 and 2 to generate .def and - .lib files for the DLL. - - -Download crt0.c from the cygwin website and include it in - your sources. Modify it to call my_crt0() instead of - cygwin_crt0(). - - -Build your object files using the MS VC compiler cl. - - -Link your object files, cygwin1.lib, and my_crt0.lib (or - whatever you called it) into the executable. - - - -Note that if you are using any other Cygwin based libraries -that you will probably need to build them as DLLs using gcc and -then generate import libraries for the MS VC linker. - -Thanks to Alastair Growcott (alastair dot growcott at bakbone dot co -dot uk) for this tip. - - - - -How do I link against a .lib file? - - -If your .lib file is a normal static or import library with -C-callable entry points, you can list foo.lib as an object file for -gcc/g++, just like any *.o file. Otherwise, here are some steps: - -Build a C file with a function table. Put all functions you intend -to use in that table. This forces the linker to include all the object -files from the .lib. Maybe there is an option to force LINK.EXE to -include an object file. - -Build a dummy 'LibMain'. - -Build a .def with all the exports you need. - -Link with your .lib using link.exe. - - - -or - -Extract all the object files from the .lib using LIB.EXE. - -Build a dummy C file referencing all the functions you need, either - with a direct call or through an initialized function pointer. - -Build a dummy LibMain. - -Link all the objects with this file+LibMain. - -Write a .def. - -Link. - - - -You can use these methods to use MSVC (and many other runtime libs) -with Cygwin development tools. - -Note that this is a lot of work (half a day or so), but much less than -rewriting the runtime library in question from specs... - -Thanks to Jacob Navia (root at jacob dot remcomp dot fr) for this explanation. - - - - -How do I build Cygwin on my own? - - -First, you need to make sure you have the necessary build tools -installed; you at least need gcc-g++, make, -perl, cocom, gettext, -and zlib-devel. -Building for 32-bit Cygwin also requires libiconv, -mingw64-i686-gcc-g++, mingw64-i686-zlib, -and mingw64-x86_64-gcc-core. -Building for 64-bit Cygwin also requires libiconv-devel, -mingw64-x86_64-gcc-g++, and -mingw64-x86_64-zlib. -If you want to run the tests, dejagnu is also required. -Normally, building ignores any errors in building the documentation, -which requires the dblatex, -docbook-xml45, docbook-xsl, and -xmlto packages. For more information on building the -documentation, see the README included in the cygwin-doc package. - - -Next, get the Cygwin source. Ideally, you should check out -what you need from CVS (). This is the -preferred method for acquiring the sources. Otherwise, if -you are trying to duplicate a cygwin release then you should -download the corresponding source package -(cygwin-x.y.z-n-src.tar.bz2). - -You must build cygwin in a separate directory from -the source, so create something like a build/ directory. -Assuming you checked out the source in /oss/src/, and you -also want to install to the temporary location install: - - -mkdir /oss/build -mkdir /oss/install -cd build -(/oss/src/configure --prefix=/oss/install -v; make) >& make.out -make install > install.log 2>&1 - - - -If the build works, install everything except the dll (if -you can). Then, close down all cygwin programs (including bash windows, -inetd, etc.), save your old dll, and copy the new dll to the correct -place. Then start up a bash window, or run a cygwin program from the -Windows command prompt, and see what happens. - -If you get the error "shared region is corrupted" it means that two -different versions of cygwin1.dll are running on your machine at the -same time. Remove all but one. - - - - -I may have found a bug in Cygwin, how can I debug it (the symbols in gdb look funny)? - - -Debugging symbols are stripped from distibuted Cygwin binaries, so any -symbols that you see in gdb are basically meaningless. It is also a good -idea to use the latest code in case the bug has been fixed, so we -recommend trying the latest snapshot from - or building the DLL from CVS. - -To build a debugging version of the Cygwin DLL, you will need to follow -the instructions at . -You can also contact the mailing list for pointers (a simple test case that -demonstrates the bug is always welcome). - - - - -How can I compile Cygwin for an unsupported platform (PowerPC, Alpha, ARM, Itanium)? - - -Unfortunately, this will be difficult. Exception handling and signals -support semantics and args have been designed for x86 so you would need -to write specific support for your platform. We don't know of any other -incompatibilities. Please send us patches if you do this work! - - - - -How can I adjust the heap/stack size of an application? - - -If you need to change the maximum amount of memory available to Cygwin, see -http://cygwin.com/cygwin-ug-net/setup-maxmem.html. Otherwise, -just pass heap/stack linker arguments to gcc. To create foo.exe with -a heap size of 200MB and a stack size of 8MB, you would invoke -gcc as: - -gcc -Wl,--heap,200000000,--stack,8000000 -o foo foo.c - - - - -How can I find out which DLLs are needed by an executable? - - -objdump -p provides this information, but is rather verbose. - -cygcheck will do this much more concisely, and operates -recursively, provided the command is in your path. - - - - - -How do I build a DLL? - - -There's documentation that explains the process in the Cygwin User's -Guide here: http://cygwin.com/cygwin-ug-net/dll.html - - - - -How can I set a breakpoint at MainCRTStartup? - - -(Please note: This section has not yet been updated for the latest net release.) - -Set a breakpoint at *0x401000 in gdb and then run the program in -question. - - - - -How can I build a relocatable dll? - - -(Please note: This section has not yet been updated for the latest net release. However, there was a discussion on the cygwin mailing list once that addresses this issue. Read http://cygwin.com/ml/cygwin/2000-06/msg00688.html and related messages.) - -You must execute the following sequence of five commands, in this -order: - - -$(LD) -s --base-file BASEFILE --dll -o DLLNAME OBJS LIBS -e ENTRY - -$(DLLTOOL) --as=$(AS) --dllname DLLNAME --def DEFFILE \ - --base-file BASEFILE --output-exp EXPFILE - -$(LD) -s --base-file BASEFILE EXPFILE -dll -o DLLNAME OBJS LIBS -e ENTRY - -$(DLLTOOL) --as=$(AS) --dllname DLLNAME --def DEFFILE \ - --base-file BASEFILE --output-exp EXPFILE - -$(LD) EXPFILE --dll -o DLLNAME OBJS LIBS -e ENTRY - - -In this example, $(LD) is the linker, ld. - -$(DLLTOOL) is dlltool. - -$(AS) is the assembler, as. - -DLLNAME is the name of the DLL you want to create, e.g., tcl80.dll. - -OBJS is the list of object files you want to put into the DLL. - -LIBS is the list of libraries you want to link the DLL against. For -example, you may or may not want -lcygwin. You may want -lkernel32. - -DEFFILE is the name of your definitions file. A simple DEFFILE would -consist of ``EXPORTS'' followed by a list of all symbols which should -be exported from the DLL. Each symbol should be on a line by itself. -Other programs will only be able to access the listed symbols. - -BASEFILE is a temporary file that is used during this five stage -process, e.g., tcl.base. - -EXPFILE is another temporary file, e.g., tcl.exp. - -ENTRY is the name of the function which you want to use as the entry -point. This function should be defined using the WINAPI attribute, -and should take three arguments: - int WINAPI startup (HINSTANCE, DWORD, LPVOID) - -This means that the actual symbol name will have an appended @12, so if -your entry point really is named startup, the string you should -use for ENTRY in the above examples would be startup@12. - -If your DLL calls any Cygwin API functions, the entry function will need -to initialize the Cygwin impure pointer. You can do that by declaring -a global variable _impure_ptr, and then initializing it in the -entry function. Be careful not to export the global variable -_impure_ptr from your DLL; that is, do not put it in DEFFILE. - - -/* This is a global variable. */ -struct _reent *_impure_ptr; -extern struct _reent *__imp_reent_data; - -int entry (HINSTANT hinst, DWORD reason, LPVOID reserved) -{ - _impure_ptr = __imp_reent_data; - /* Whatever else you want to do. */ -} - - -You may put an optional `--subsystem windows' on the $(LD) lines. -Note that if you specify a --subsytem <x> flag to ld, -the -e entry must come after the subsystem flag, since the subsystem flag -sets a different default entry point. - -You may put an optional `--image-base BASEADDR' on the $(LD) lines. -This will set the default image base. Programs using this DLL will -start up a bit faster if each DLL occupies a different portion of the -address space. Each DLL starts at the image base, and continues for -whatever size it occupies. - -Now that you've built your DLL, you may want to build a library so -that other programs can link against it. This is not required: you -could always use the DLL via LoadLibrary. However, if you want to be -able to link directly against the DLL, you need to create a library. -Do that like this: - -$(DLLTOOL) --as=$(AS) --dllname DLLNAME --def DEFFILE --output-lib LIBFILE - -$(DLLTOOL), $(AS), DLLNAME, and DEFFILE are the same as above. Make -sure you use the same DLLNAME and DEFFILE, or things won't work right. - -LIBFILE is the name of the library you want to create, e.g., -libtcl80.a. You can then link against that library using something -like -ltcl80 in your linker command. - - - - -How can I debug what's going on? - - -You can debug your application using gdb. Make sure you -compile it with the -g flag! If your application calls functions in -MS DLLs, gdb will complain about not being able to load debug information -for them when you run your program. This is normal since these DLLs -don't contain debugging information (and even if they did, that debug -info would not be compatible with gdb). - - - - -Can I use a system trace mechanism instead? - - -Yes. You can use the strace.exe utility to run other cygwin -programs with various debug and trace messages enabled. For information -on using strace, see the Cygwin User's Guide or the file -winsup/utils/utils.sgml in the Cygwin sources. - - - - -Why doesn't gdb handle signals? - - -Unfortunately, there is only minimal signal handling support in gdb -currently. Signal handling only works with Windows-type signals. -SIGINT may work, SIGFPE may work, SIGSEGV definitely does. You cannot -'stop', 'print' or 'nopass' signals like SIGUSR1 or SIGHUP to the -process being debugged. - - - - -The linker complains that it can't find something. - - -A common error is to put the library on the command line before -the thing that needs things from it. - -This is wrong gcc -lstdc++ hello.cc. -This is right gcc hello.cc -lstdc++. - - - - -Why do I get an error using struct stat64? - - -struct stat64 is not used in Cygwin, just -use struct stat. It's 64 bit aware. - - - -Can you make DLLs that are linked against libc ? - - -Yes. - - - - -Where is malloc.h? - - -It exists, but you should rather include stdlib.h instead of malloc.h. -stdlib.h is POSIX standard for defining malloc and friends, malloc.h is -definitely non-standard. - - - - -Can I use my own malloc? - - -If you define a function called malloc in your own code, and link -with the DLL, the DLL will call your malloc. Needless to -say, you will run into serious problems if your malloc is buggy. - -If you run any programs from the DOS command prompt, rather than from in -bash, the DLL will try and expand the wildcards on the command line. -This process uses malloc before your main line is started. -If you have written your own malloc to need some initialization -to occur after main is called, then this will surely break. - -Moreover, there is an outstanding issue with _malloc_r in -newlib. This re-entrant version of malloc will be called -directly from within newlib, by-passing your custom version, and -is probably incompatible with it. But it may not be possible to replace -_malloc_r too, because cygwin1.dll does not export it and -Cygwin does not expect your program to replace it. This is really a -newlib issue, but we are open to suggestions on how to deal with it. - - - - -Can I mix objects compiled with msvc++ and gcc? - - -Yes, but only if you are combining C object files. MSVC C++ uses a -different mangling scheme than GNU C++, so you will have difficulties -combining C++ objects. - - - - -Can I use the gdb debugger to debug programs built by VC++? - - -No, not for full (high level source language) debugging. -The Microsoft compilers generate a different type of debugging -symbol information, which gdb does not understand. - -However, the low-level (assembly-type) symbols generated by -Microsoft compilers are coff, which gdb DOES understand. -Therefore you should at least be able to see all of your -global symbols; you just won't have any information about -data types, line numbers, local variables etc. - - - - -Shell scripts aren't running properly from my makefiles? - - -If your scripts are in the current directory, you must have . -(dot) in your $PATH. (It is not normally there by default.) Better yet, -add /bin/sh in front of each and every shell script invoked in your Makefiles. - - - - -What preprocessor macros do I need to know about? - - -gcc for Cygwin defines __CYGWIN__ when building for a Cygwin -environment. - -Microsoft defines the preprocessor symbol _WIN32 in their Windows -development environment. - -In gcc for Cygwin, _WIN32 is only defined when you use the -mwin32 -gcc command line options. This is because Cygwin is supposed to be a -POSIX emulation environment in the first place and defining _WIN32 confuses -some programs which think that they have to make special concessions for -a Windows environment which Cygwin handles automatically. - -Check out the predefined symbols in detail by running, for example - - - $ gcc -dM -E -xc /dev/null >gcc.txt - $ gcc -mwin32 -dM -E -xc /dev/null >gcc-mwin32.txt - -Then use the diff and grep utilities to check what the difference is. - - - - -How should I port my Unix GUI to Windows? - - -Like other Unix-like platforms, the Cygwin distribtion includes many of -the common GUI toolkits, including X11, X Athena widgets, Motif, Tk, GTK+, -and Qt. Many programs which rely on these toolkits will work with little, if -any, porting work if they are otherwise portable. However, there are a few -things to look out for: - -Some packages written for both Windows and X11 incorrectly -treat Cygwin as a Windows platform rather than a Unix variant. Mixing Cygwin's -Unix APIs with Windows' GDI is best avoided; rather, remove these assumptions -so that Cygwin is treated like other X11 platforms. -GTK+ programs which use gtk_builder_connect_signals() -or glade_xml_signal_autoconnect() need to be able to -dlopen() themselves. In order for this to work, the program -must be linked with the -Wl,--export-all-symbols linker flag. -This can be added to LDFLAGS manually, or handled automatically with the --export-dynamic libtool flag (requires libtool 2.2.8) or -by adding gmodule-export-2.0 to the pkg-config modules used -to build the package. -Programs which include their own loadable modules (plugins) -often must have its modules linked against the symbols in the program. The -most portable solution is for such programs to provide all its symbols (except -for main()) in a shared library, against which the plugins -can be linked. Otherwise, the symbols from the executable itself must be -exported. -If the package uses the CMake build system, this can be done by adding -ENABLE_EXPORTS TRUE to the executable's set_target_properties -command, then adding the executable's target name to the target_link_libraries -command for the plugins. -For other build systems, the following steps are required: - -The executable must be built before its plugins. -Symbols must be exported from the executable with a --Wl,--export-all-symbols,--out-implib,libfoo.exe.a -linker flag, where foo represents the name of the -executable. -The plugins must be linked with a -Wl,/path/to/libfoo.exe.a -linker flag. - - - - diff --git a/winsup/doc/faq-resources.xml b/winsup/doc/faq-resources.xml deleted file mode 100644 index 128b713a3..000000000 --- a/winsup/doc/faq-resources.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - -Further Resources - - - -Where's the documentation? - - -If you have installed Cygwin, you can find lots of documentation in -/usr/share/doc/. Some packages have Cygwin specific -instructions in a file -/usr/share/doc/Cygwin/package_name.README. -In addition, many packages ship with standard documentation, which you can -find in -/usr/share/doc/package_name or -by using the man or info tools. (Hint: -use cygcheck -l package_name to -list what man pages the package includes.) Some older packages still keep -their documentation in /usr/doc/ -instead of /usr/share/doc/. - -There are links to quite a lot of documentation on the main Cygwin -project web page, http://cygwin.com/, -including this FAQ. Be sure to at least read any 'Release Notes' or 'Readme' -or 'read this' links on the main web page, if there are any. - -There is a comprehensive Cygwin User's Guide at http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html -and an API Reference at http://cygwin.com/cygwin-api/cygwin-api.html. - -You can find documentation for the individual GNU tools at http://www.fsf.org/manual/. (You -should read GNU manuals from a local mirror, check http://www.fsf.org/server/list-mirrors.html -for a list of them.) - - - - -What Cygwin mailing lists can I join? - -Comprehensive information about the Cygwin mailing lists can be found at -. - - - - -What if I have a problem? (Or: Why won't you/the mailing list answer my questions?) - -Comprehensive information about reporting problems with Cygwin can be found at . - - - diff --git a/winsup/doc/faq-setup.xml b/winsup/doc/faq-setup.xml deleted file mode 100644 index d2a0f1cc0..000000000 --- a/winsup/doc/faq-setup.xml +++ /dev/null @@ -1,621 +0,0 @@ - - - - -Setting up Cygwin - - - -What is the recommended installation procedure? - - -There is only one recommended way to install Cygwin, which is to use the GUI -installer setup-*.exe. It is flexible and easy to use. -You can pick and choose the packages you wish to install, and update -them individually. Full source code is available for all packages and -tools. More information on using Cygwin Setup may be found at -. - -If you do it any other way, you're on your own! -If something doesn't work right for you, and -it's not covered here or in the latest development snapshot at -http://cygwin.com/snapshots/, then by all means report it to the -mailing list. - -For a searchable list of packages that can be installed with Cygwin, -see http://cygwin.com/packages/. - - - - -What about an automated Cygwin installation? - - -The Cygwin Setup program is designed to be interactive, but there are -a few different ways to automate it. If you are deploying to multiple systems, -the best way is to run through a full installation once, saving the entire -downloaded package tree. Then, on target systems, run Cygwin Setup as a -"Local Install" pointed at your downloaded package tree. You could do this -non-interactively with the command line options --q -L -l x:\cygwin-local\, where your downloaded -package tree is in x:\cygwin-local\ (see the next FAQ for -an explanation of those options.) - - -For other options, search the mailing lists with terms such as -cygwin automated setup or -automated cygwin install. - - - - -Does Setup accept command-line arguments? - - -Yes, the full listing is written to the setup.log file -when you run setup-x86.exe --help or -setup-x86_64.exe --help. The current options are: - -Command Line Options: - -D --download Download from internet - -L --local-install Install from local directory - -s --site Download site - -O --only-site Ignore all sites except for -s - -R --root Root installation directory - -x --remove-packages Specify packages to uninstall - -c --remove-categories Specify categories to uninstall - -P --packages Specify packages to install - -C --categories Specify entire categories to install - -p --proxy HTTP/FTP proxy (host:port) - -a --arch architecture to install (x86_64 or x86) - -q --quiet-mode Unattended setup mode - -M --package-manager Semi-attended chooser-only mode - -B --no-admin Do not check for and enforce running as - Administrator - -h --help print help - -l --local-package-dir Local package directory - -r --no-replaceonreboot Disable replacing in-use files on next - reboot. - -X --no-verify Don't verify setup.ini signatures - -n --no-shortcuts Disable creation of desktop and start menu - shortcuts - -N --no-startmenu Disable creation of start menu shortcut - -d --no-desktop Disable creation of desktop shortcut - -K --pubkey URL of extra public key file (gpg format) - -S --sexpr-pubkey Extra public key in s-expr format - -u --untrusted-keys Use untrusted keys from last-extrakeys - -U --keep-untrusted-keys Use untrusted keys and retain all - -g --upgrade-also also upgrade installed packages - -o --delete-orphans remove orphaned packages - -A --disable-buggy-antivirus Disable known or suspected buggy anti virus - software packages during execution. - - - - - -Can I install Cygwin without administrator rights? - - -Yes. The default installation requests administrator rights because -this allows to set up the Cygwin environment so that all users can start -a Cygwin shell out of the box. However, if you don't have administrator -rights for your machine, and the admins don't want to install it for you, -you can install Cygwin just for yourself by downloading -setup-x86.exe (for a 32 bit install) or -setup-x86_64.exe (for a 64 bit install) and then start -it from the command line or via the "Run..." dialog from the start menu -using the --no-admin option, for instance: - - - - setup-x86.exe --no-admin - - - - - -Why not install in C:\? - - -The Cygwin Setup program will prompt you for a "root" directory. -The default is C:\cygwin, but you can change it. You are urged not to -choose something like C:\ (the root directory on the system drive) for -your Cygwin root. If you do, then critical Cygwin system directories -like etc, lib and bin could easily be corrupted by -other (non-Cygwin) applications or packages that use \etc, -\lib or \bin. Perhaps there is no conflict now, but who -knows what you might install in the future? It's also just good common -sense to segregate your Cygwin "filesystems" from the rest of your -Windows system disk. - -(In the past, there had been genuine bugs that would cause problems -for people who installed in C:\, but we believe those are gone -now.) - - - - -Can I use Cygwin Setup to get old versions of packages (like gcc-2.95)? - - -Cygwin Setup can be used to install any packages that are on a -Cygwin mirror, which usually includes one version previous to the -current one. The complete list may be searched at -http://cygwin.com/packages/. There is no complete archive of -older packages. If you have a problem with the current version of -a Cygwin package, please report it to the mailing list using the -guidelines at http://cygwin.com/problems.html. - -That said, if you really need an older package, you may be able to find -an outdated or archival mirror by searching the web for an old package -version (for example, gcc2-2.95.3-10-src.tar.bz2), but keep in -mind that this older version will not be supported by the mailing list -and that installing the older version will not help improve Cygwin. - - - - -After upgrading from Cygwin 1.5 to Cygwin 1.7 my user mount points disappeared! How can I get them back? - - - -When you upgrade an existing older Cygwin installation to Cygwin 1.7, your old -system mount points (stored in the HKEY_LOCAL_MACHINE branch of your registry) -are read by a script and the /etc/fstab file is generated from these entries. -No such automatism exists for the user mount points formerly stored in the -HKEY_CURRENT_USER branch of the registry. There's a bash script for your -convenience, which creates a user-specific /etc/fstab/${USER} file for you, -called /bin/copy-user-registry-fstab. For more information on the new fstab -files see the User's Guide at -http://cygwin.com/cygwin-ug-net/using.html#mount-table - - - - -Is Cygwin Setup, or one of the packages, infected with a virus? - - -Unlikely. Unless you can confirm it, please don't report it to the -mailing list. Anti-virus products have been known to detect false -positives when extracting compressed tar archives. If this causes -problems for you, consider disabling your anti-virus software when -running setup. Read the next entry for a fairly safe way to do -this. - - - - -My computer hangs when I run Cygwin Setup! - - -Both Network Associates (formerly McAfee) and Norton anti-virus -products have been reported to "hang" when extracting Cygwin tar -archives. If this happens to you, consider disabling your anti-virus -software when running Cygwin Setup. The following procedure should be -a fairly safe way to do that: - -Download setup-x86.exe or -setup-x86_64.exe and scan it explicitly. - - -Turn off the anti-virus software. - - -Run setup to download and extract all the tar files. - - -Re-activate your anti-virus software and scan everything -in C:\cygwin (or wherever you chose to install), or your entire hard -disk if you are paranoid. - - - - -This should be safe, but only if Cygwin Setup is not substituted by -something malicious, and no mirror has been compromised. - -See also -for a list of applications that have been known, at one time or another, to -interfere with the normal functioning of Cygwin. - - - - -What packages should I download? Where are 'make', 'gcc', 'vi', etc? - -When using Cygwin Setup for the first time, the default is to install -a minimal subset of all available packages. If you want anything beyond that, -you will have to select it explicitly. See - for a searchable list of available -packages, or use cygcheck -p as described in the Cygwin -User's Guide at -. - -If you want to build programs, of course you'll need gcc, -binutils, make and probably other packages from the -``Devel'' category. Text editors can be found under ``Editors''. - - - - -How do I just get everything? - - -Long ago, the default was to install everything, much to the -irritation of most users. Now the default is to install only a basic -core of packages. Cygwin Setup is designed to make it easy to browse -categories and select what you want to install or omit from those -categories. It's also easy to install everything: - - -At the ``Select Packages'' screen, in ``Categories'' view, at the line -marked ``All'', click on the word ``default'' so that it changes to -``install''. (Be patient, there is some computing to do at this step. -It may take a second or two to register the change.) This tells Setup -to install everything, not just what it thinks you should have -by default. - - -Now click on the ``View'' button (twice) until you get to the -``Pending'' view. This shows exactly which packages are about to be -downloaded and installed. - - - - -This procedure only works for packages that are currently available. -There is no way to tell Cygwin Setup to install all packages by -default from now on. As new packages become available that would not -be installed by default, you have to repeat the above procedure to get -them. - -In general, a better method (in my opinion), is to: - - -First download & install all packages that would normally be -installed by default. This includes fundamental packages and any -updates to what you have already installed. Then... - - -Run Cygwin Setup again, and apply the above technique to get all -new packages that would not be installed by default. You can check -the list in the ``Pending'' view before proceeding, in case there's -something you really don't want. - - -In the latest version of Cygwin Setup, if you click the ``View'' -button (twice) more, it shows packages not currently installed. You -ought to check whether you really want to install everything! - - - - - - - -How much disk space does Cygwin require? - - -That depends, obviously, on what you've chosen to download and -install. A full installation today is probably larger than 1 GB -installed, not including the package archives themselves nor the source -code. - -After installation, the package archives remain in your ``Local -Package Directory''. By default the location of -setup-x86{_64}.exe. You may conserve disk space by -deleting the subdirectories there. These directories will have very weird -looking names, being encoded with their URLs -(named ftp%3a%2f...). - -Of course, you can keep them around in case you want to reinstall a -package. If you want to clean out only the outdated packages, Michael Chase -has written a script called clean_setup.pl, available -at . - - - - -How do I know which version I upgraded from? - - -Detailed logs of the most recent Cygwin Setup session can be found in -/var/log/setup.log.full and less verbose information about -prior actions is in /var/log/setup.log. - - - - - -What if setup fails? - - -First, make sure that you are using the latest version of Cygwin Setup. -The latest version is always available from the Cygwin Home Page at http://cygwin.com/. -If you are downloading from the Internet, setup will fail if it cannot -download the list of mirrors at http://cygwin.com/mirrors.html. -It could be that the network is too busy. Something similar could be the -cause of a download site not working. Try another mirror, or try again -later. - -If setup refuses to download a package that you know needs to be -upgraded, try deleting that package's entry from /etc/setup. If you are -reacting quickly to an announcement on the mailing list, it could be -that the mirror you are using doesn't have the latest copy yet. Try -another mirror, or try again tomorrow. - -If setup has otherwise behaved strangely, check the files -setup.log and setup.log.full in -/var/log (C:\cygwin\var\log by -default). It may provide some clues as to what went wrong and why. - -If you're still baffled, search the Cygwin mailing list for clues. -Others may have the same problem, and a solution may be posted there. -If that search proves fruitless, send a query to the Cygwin mailing -list. You must provide complete details in your query: version of -setup, options you selected, contents of setup.log and setup.log.full, -what happened that wasn't supposed to happen, etc. - - - - -My Windows logon name has a space in it, will this cause problems? - - -Most definitely yes! UNIX shells (and thus Cygwin) use the space -character as a word delimiter. Under certain circumstances, it is -possible to get around this with various shell quoting mechanisms, but -you are much better off if you can avoid the problem entirely. - -You have two choices: - -You can rename the user in the Windows User Manager GUI and then -run mkpasswd. - - -You can simply edit the /etc/passwd file and change the Cygwin user name -(first field). It's also a good idea to avoid spaces in the home directory. - - - - - - - -My HOME environment variable is not what I want. - - -When starting Cygwin from Windows, HOME is determined as follows -in order of decreasing priority: - - -HOME from the Windows environment, translated to POSIX form. - - -The entry in /etc/passwd - - -/home/USERNAME - - - - -When using Cygwin from the network (telnet, ssh,...), HOME is set -from /etc/passwd. - -If your HOME is set to a value such as /cygdrive/c, it is likely -that it was set in Windows. Start a DOS Command Window and type -"set HOME" to verify if this is the case. - -Access to shared drives is often restricted when starting from the network, -thus Domain users may wish to have a different HOME in the -Windows environment (on shared drive) than in /etc/passwd (on local drive). -Note that ssh only considers /etc/passwd, disregarding HOME. - - - - -How do I uninstall individual packages? - - -Run Cygwin Setup as you would to install packages. In the list of -packages to install, browse the relevant category or click on the -``View'' button to get a full listing. Click on the cycle glyph until -the action reads ``Uninstall''. Proceed by clicking ``Next''. - - - - -How do I uninstall a Cygwin service? - - -List all services you have installed with -cygrunsrv -L. If you do not have -cygrunsrv installed, skip this FAQ. - -Before removing the service, you should stop it with -cygrunsrv --stop service_name. -If you have inetd configured to run as a standalone -service, it will not show up in the list, but -cygrunsrv --stop inetd will work to stop it as -well. - -Lastly, remove the service with -cygrunsrv --remove service_name. - - - - - -How do I uninstall all of Cygwin? - -Setup has no automatic uninstall facility. The recommended method to remove all -of Cygwin is as follows: - - -If you have any Cygwin services running, remove by repeating -the instructions in for -all services that you installed. Common services that might have been -installed are sshd, cron, -cygserver, inetd, apache, -postgresql, and so on. - - -Stop the X11 server if it is running, and terminate any Cygwin programs -that might be running in the background. Exit the command prompt and ensure -that no Cygwin processes remain. Note: If you want to save your mount points for a later -reinstall, first save the output of mount -m as described at -. - - -If you installed cyglsa.dll by running the -shell script /usr/bin/cyglsa-config as described in -, then you need to -configure Windows to stop using the LSA authentication package. You do so by -editing the registry and restoring -/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Lsa/Authentication Packages -back to it's original value of msv1_0, and then rebooting. - - -Delete the Cygwin root folder and all subfolders. If you get an error -that an object is in use, then ensure that you've stopped all services and -closed all Cygwin programs. If you get a 'Permission Denied' error then you -will need to modify the permissions and/or ownership of the files or folders -that are causing the error. For example, sometimes files used by system -services end up owned by the SYSTEM account and not writable by regular users. - -The quickest way to delete the entire tree if you run into this problem is to -change the ownership of all files and folders to your account. To do this in -Windows Explorer, right click on the root Cygwin folder, choose Properties, then -the Security tab. If you are using Windows XP Home or Simple File Sharing, -you will need to boot into Safe Mode to access the Security tab. Select -Advanced, then go to the Owner tab and make sure your account is listed as -the owner. Select the 'Replace owner on subcontainers and objects' checkbox -and press Ok. After Explorer applies the changes you should be able to -delete the entire tree in one operation. Note that you can also achieve -this in Cygwin by typing chown -R user / or by using other -tools such as CACLS.EXE. - - -Delete the Cygwin shortcuts on the Desktop and Start Menu, and -anything left by setup-x86{_64}.exe in the download directory. However, if you -plan to reinstall Cygwin it's a good idea to keep your setup-x86{_64}.exe -download directory since you can reinstall the packages left in its cache -without redownloading them. - - -If you added Cygwin to your system path, you should remove it unless you -plan to reinstall Cygwin to the same location. Similarly, if you set your -CYGWIN environment variable system-wide and don't plan to reinstall, you should -remove it. - - -Finally, if you want to be thorough you can delete the registry tree -Software\Cygwin under HKEY_LOCAL_MACHINE and/or -HKEY_CURRENT_USER. However, if you followed the directions above you -will have already removed everything important. Typically only the installation -directory has been stored in the registry at all. - - - - - - - -How do I install snapshots? - - -First, are you sure you want to do this? Snapshots are risky. They -have not been tested. Use them only if there is a feature or -bugfix that you need to try, and you are willing to deal with any -problems, or at the request of a Cygwin developer. - -You cannot use Cygwin Setup to install a snapshot. - -First, you will need to download the snapshot from the snapshots -page at http://cygwin.com/snapshots/. Note the directory where -you saved the snapshot tarball. - -Before installing a snapshot, you must first Close all Cygwin -applications, including shells and services (e.g., inetd, sshd). -You will not be able to replace cygwin1.dll if any Cygwin process is -running. You may have to restart Windows to clear the DLL from memory -(beware of automatic service startup). - -Most of the downloaded snapshot can be installed using tar. Cygwin -tar won't be able to update /usr/bin/cygwin1.dll (because it's -used by tar itself), but it should succeed with everything else. If -you are only installing the DLL snapshot, skip the first tar command. Open -a bash shell (it should be the only running Cygwin process) and issue -the following commands: - - /bin/tar -C / -xvf /posix/path/to/cygwin-inst-YYYYMMDD.tar.* --exclude=usr/bin/cygwin1.dll - /bin/tar -C /tmp -xvf /posix/path/to/cygwin-inst-YYYYMMDD.tar.* usr/bin/cygwin1.dll - - -Exit the bash shell, and use Explorer or the Windows command shell to -first rename C:\cygwin\bin\cygwin1.dll to -C:\cygwin\bin\cygwin1-prev.dll and then move -C:\cygwin\tmp\usr\bin\cygwin1.dll -to C:\cygwin\bin\cygwin1.dll (assuming you installed Cygwin in -C:\cygwin). - -The operative word in trying the snapshots is "trying". If you -notice a problem with the snapshot that was not present in the release -DLL (what we call a "regression"), please report it to the Cygwin -mailing list (see http://cygwin.com/problems.html for problem -reporting guidelines). If you wish to go back to the older version of the -DLL, again, close all Cygwin processes, delete -C:\cygwin\bin\cygwin1.dll, and -rename C:\cygwin\bin\cygwin1-prev.dll back to -C:\cygwin\bin\cygwin1.dll (again assuming that your "/" is -C:\cygwin). To restore the rest of the snapshot -files, reinstall the "cygwin" package using Setup. - - - - - -Can Cygwin Setup maintain a ``mirror''? - - -NO. Cygwin Setup cannot do this for you. Use a tool designed for -this purpose. See http://rsync.samba.org/, -http://www.gnu.org/software/wget/ for utilities that can do this for you. -For more information on setting up a custom Cygwin package server, see -the Cygwin Setup homepage at -http://sourceware.org/cygwin-apps/setup.html. - - - - -How can I make my own portable Cygwin on CD? - - -While some users have successfully done this, for example Indiana -University's XLiveCD http://xlivecd.indiana.edu/, there is no -easy way to do it. Full instructions for constructing a portable Cygwin -on CD by hand can be found on the mailing list at -http://www.cygwin.com/ml/cygwin/2003-07/msg01117.html -(Thanks to fergus at bonhard dot uklinux dot net for these instructions.) -Please note that these instructions are rather old and are referring to the -somewhat different setup of a Cygwin 1.5.x release. As soon as somebody set -this up for Cygwin 1.7, we might add this information here. - - - - -How do I save, restore, delete, or modify the Cygwin information stored in the registry? - - -Since Cygwin 1.7, there's nothing important in the registry anymore, -except for the installation directory information stored there for the sake -of setup-x86{_64}.exe. There's nothing left to manipulate anymore. - - - diff --git a/winsup/doc/faq-using.xml b/winsup/doc/faq-using.xml deleted file mode 100644 index 19e381624..000000000 --- a/winsup/doc/faq-using.xml +++ /dev/null @@ -1,1249 +0,0 @@ - - - - -Using Cygwin - - - -Why can't my application locate cygncurses-8.dll? or cygintl-3.dll? or cygreadline6.dll? or ...? - - -Well, something has gone wrong somehow... - -To repair the damage, you must run Cygwin Setup again, and re-install the -package which provides the missing DLL package. - -If you already installed the package at one point, Cygwin Setup won't -show the option to install the package by default. In the -``Select packages to install'' dialog, click on the Full/Part -button. This lists all packages, even those that are already -installed. Scroll down to locate the missing package, for instance -libncurses8. Click on the ``cycle'' glyph until it says -``Reinstall''. Continue with the installation. - -For a detailed explanation of the general problem, and how to extend -it to other missing DLLs and identify their containing packages, see -http://cygwin.com/ml/cygwin/2002-01/msg01619.html. - - - - -Why is Cygwin suddenly so slow? - - -If suddenly every command takes a -very long time, then something is probably attempting to -access a network share. You may have the obsolete //c -notation in your PATH or startup files. Using //c means -to contact the network server c, which -will slow things down tremendously if it does not exist. - - - - -Why can't my services access network shares? - - -If your service is one of those which switch the user context -(sshd, inetd, etc), then it depends on the method used to switch to -another user. This problem as well as its solution is described in -detail in the Cygwin User's Guide, see -. - -Workarounds include using public network share that does not require -authentication (for non-critical files), providing your password to a -net use command, or running the service as your own -user with cygrunsrv -u (see -/usr/share/doc/Cygwin/cygrunsrv.README for more -information). - - - - -How should I set my PATH? - - -This is done for you in the file /etc/profile, which is sourced by bash -when you start it from the Desktop or Start Menu shortcut, created by -setup.exe. The line is - - - PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - - -Effectively, this prepends /usr/local/bin and /usr/bin to your -Windows system path. If you choose to reset your PATH, say in -$HOME/.bashrc, or by editing etc/profile directly, then you should -follow this rule. You must have /usr/bin in your PATH -before any Windows system directories. (And you must not omit -the Windows system directories!) Otherwise you will likely encounter -all sorts of problems running Cygwin applications. - -If you're using another shell than bash (say, tcsh), the mechanism -is the same, just the names of the login scripts are different. - - - - -Bash (or another shell) says "command not found", but it's right there! - - -If you compile a program, you might find that you can't run it: - - - bash$ gcc -o hello hello.c - bash$ hello - bash: hello: command not found - - -Unlike the Windows default behaviour, Unix shells like bash do not look for programs in . (the current -directory) by default. You can add . to your PATH (see above), -but this is not recommended (at least on UNIX) for security reasons. -Just tell bash where to find it, when you type it on the command line: - - - bash$ gcc -o hello hello.c - bash$ ./hello - Hello World! - - - - - -How do I convert between Windows and UNIX paths? - - -Use the 'cygpath' utility. Type 'cygpath --help' for -information. For example (on my installation): - - bash$ cygpath --windows ~/.bashrc - D:\starksb\.bashrc - bash$ cygpath --unix C:/cygwin/bin/ls.exe - /usr/bin/ls.exe - bash$ cygpath --unix C:\\cygwin\\bin\\ls.exe - /usr/bin/ls.exe - -Note that bash interprets the backslash '\' as an escape character, so -you must type it twice in the bash shell if you want it to be recognized -as such. - - - - -Why doesn't bash read my .bashrc file on startup? - - -Your .bashrc is read from your home directory specified by the HOME -environment variable. It uses /.bashrc if HOME is not set. So you need -to set HOME (and the home dir in your /etc/passwd entry) correctly. - - - - -How can I get bash filename completion to be case insensitive? - - -Add the following to your ~/.bashrc file: - - - shopt -s nocaseglob - - -and add the following to your ~/.inputrc file: - - - set completion-ignore-case on - - - - - -Can I use paths/filenames containing spaces in them? - - -Cygwin does support spaces in filenames and paths. That said, some -utilities that use the library may not, since files don't typically -contain spaces in Unix. If you stumble into problems with this, you -will need to either fix the utilities or stop using spaces in filenames -used by Cygwin tools. - -In particular, bash interprets space as a word separator. You would have -to quote a filename containing spaces, or escape the space character. -For example: - - bash-2.03$ cd '/cygdrive/c/Program Files' - -or - - bash-2.03$ cd /cygdrive/c/Program\ Files - - - - - -Why can't I cd into a shortcut to a directory? - - -Cygwin does not follow MS Windows Explorer Shortcuts -(*.lnk files). It sees a shortcut as a regular file and this you -cannot "cd" into it. - -Cygwin is also capable to create POSIX symlinks as Windows shortcuts -(see the CYGWIN environment variable option "winsymlinks"), but these -shortcuts are different from shortcuts created by native Windows -applications. Windows applications can usually make use of Cygwin -shortcuts but not vice versa. This is by choice. The reason is that -Windows shortcuts may contain a bunch of extra information which would -get lost, if, for example, Cygwin tar archives and extracts them as -symlinks. - -Changing a Cygwin shortcut in Windows Explorer usually changes a Cygwin -shortcut into a Windows native shortcut. Afterwards, Cygwin will not -recognize it as symlink anymore. - - - - -I'm having basic problems with find. Why? - - -Make sure you are using the find that came with Cygwin and that you -aren't picking up the Win32 find command instead. You can verify that -you are getting the right one by doing a "type find" in bash. - -If the path argument to find, including current directory (default), is -itself a symbolic link, then find will not traverse it unless you -specify the -follow option. This behavior is different than most -other UNIX implementations, but is not likely to change. - -If find does not seem to be producing enough results, or seems to be -missing out some directories, you may be experiencing a problem with one -of find's optimisations. The absence of . and .. -directories on some filesystems, such as DVD-R UDF, can confuse find. -See the documentation for the option -noleaf in the man page. - - - - -Why doesn't su work? - - -The su command has been in and out of Cygwin distributions, but -it has not been ported to Cygwin and has never worked. It is -currently installed as part of the sh-utils, but again, it does not work. - -You should rather install sshd and use -ssh username@localhost as a su -replacement. - -For some technical background into why su doesn't work, read -http://www.cygwin.com/ml/cygwin/2003-06/msg00897.html and -related messages. - - - - -Why doesn't man -k, -apropos or whatis work? - - -Before you can use man -k, apropos -or whatis, you -must create the whatis database. Just run the command - - - /usr/sbin/makewhatis - - -(it may take a minute to complete). - - - - -Why doesn't chmod work? - - -The most common case is that your /etc/passwd -or /etc/group files are not properly set up. If -ls -l shows a group of mkpasswd -or mkgroup, you need to run one or both of those -commands. - -If you're using FAT32 instead of NTFS, chmod -will fail since FAT32 does not provide any permission information. -You should really consider converting the drive to NTFS with -CONVERT.EXE. FAT and FAT32 are barely good enough -for memory cards or USB sticks to exchange pictures... - -For other cases, understand that Cygwin attempts to show UNIX -permissions based on the security features of Windows, so the Windows -ACLs are likely the source of your problem. See the Cygwin User's -Guide at -for more information on how Cygwin maps Windows permissions. - - - - -Why doesn't my shell script work? - - -There are two basic problems you might run into. One is the fact that -/bin/sh is really bash. -It could be missing some features you might expect in -/bin/sh, if you are used to /bin/sh -actually being zsh (MacOS X "Panther") or -ksh (Tru64). - - -Or, it could be a permission problem, and Cygwin doesn't understand -that your script is executable. On NTFS or NFS just make the script -executable using chmod +x. However, -chmod may not work due to restrictions of the -filesystem (see FAQ entry above). In this case Cygwin must read the -contents of files to determine if they are executable. If your script -does not start with - - - #! /bin/sh - - -(or any path to a script interpreter, it does not have to be /bin/sh) -then Cygwin will not know it is an executable script. The Bourne shell -idiom - - - : - # This is the 2nd line, assume processing by /bin/sh - - -also works. - -Note that you can use the filesystem flag cygexec in -/etc/fstab to force Cygwin to treat all files -under the mount point as executable. This can be used for individual -files as well as directories. Then Cygwin will not bother to read files -to determine whether they are executable. - - - - -How do I print under Cygwin? - - -lpr is available in the cygutils package. Some usage hints are available courtesy of Rodrigo Medina. - -Jason Tishler has written a couple of messages that explain how to use -a2ps (for nicely formatted text in PostScript) and ghostscript (to print -PostScript files on non-PostScript Windows printers). Start at -http://cygwin.com/ml/cygwin/2001-04/msg00657.html. Note that the -file command is now available as part of Cygwin setup. - -Alternatively, you can use the Windows print -command. (It does not seem to be available on Win9x.) Type - - - bash$ print /\? - - -for usage instructions (note the ? must be escaped from the -shell). - -Finally, you can simply cat the file to the printer's share name: - - - bash$ cat myfile > //host/printer - - -You may need to press the formfeed button on your printer or append the -formfeed character to your file. - - - - -Why don't international (Unicode) characters work? - - -Internationalization is a complex issue. The short answer is that -Cygwin relies on the setting of the setting of LANG/LC_xxx environment -variables. The long answer can be found in the User's Guide in the -section Internationalization - - - Cygwin uses UTF-8 by default. To use a different character set, you -need to set the LC_ALL, LC_CTYPE or LANG environment variables. - - - -My application prints international characters but I only -see gray boxes - -In the case of Cygwin programs, this likely means that the -character set as determined by the LC_ALL, LC_CTYPE or LANG environment -variables does not match the one set on the Text page of the Cygwin Terminal's -options. Setting the locale in the terminal's options will set the LANG -variable accordingly. -Non-Cygwin programs in the Cygwin Terminal do not usually take -heed of the locale environment variables. Instead, they often use the -so-called console codepage, which can be determined with the command -cmd /c chcp followed by the appropriate Windows -codepage number. The codepage number for Cygwin's default UTF-8 character -set is 65001. - - - -Is it OK to have multiple copies of the DLL? - -Yes, as long as they are used in strictly separated installations. -The Cygwin DLL has to handle various sharing situations between -multiple processes. It has to keep a process table. It has to maintain -a mount table which is based on the installation path of the Cygwin DLL. -For that reason, the Cygwin DLL maintains shared resources based on -a hash value created from its own installation path. Each Cygwin DLL -on the machine constitutes a Cygwin installation, with the directory -the Cygwin DLL resides in treated as "/bin", the parent directory as "/". - -Therefore, you can install two or more separate Cygwin distros on -a single machine. Each of these installations use their own Cygwin DLL, -and they don't share the default POSIX paths, nor process tables, nor -any other shared resource used to maintain the installation. -However, a clean separation requires that you don't try to run -executables of one Cygwin installation from processes running in another -Cygwin installation. This may or may not work, but the chances that the -result is not what you expect are pretty high. -If you get the error "shared region is corrupted" or "shared region -version mismatch" it means you have multiple versions of cygwin1.dll -running at the same time which conflict with each other. Apart from -mixing executables of different Cygwin installations, this could also happen -if you have one a single Cygwin installation, for example, if you update the -Cygwin package without exiting all Cygwin apps (including -services like sshd) beforehand. -The only DLL that is sanctioned by the Cygwin project is the one that -you get by running setup.exe, -installed in a directory controlled by this program. If you have other -versions on your system and desire help from the cygwin project, you should -delete or rename all DLLs that are not installed by -setup.exe. - -If you're trying to find multiple versions of the DLL that are causing -this problem, reboot first, in case DLLs still loaded in memory are the -cause. Then use the Windows System find utility to search your whole -machine, not just components in your PATH (as 'type' would do) or -cygwin-mounted filesystems (as Cygwin 'find' would do). - - - - - -I read the above but I want to bundle Cygwin with a product, and ship it -to customer sites. How can I do this without conflicting with any Cygwin -installed by the user? - - -Usually, if you keep your installation separate, nothing bad should happen. -However, for the user's convenience, and to avoid potential problems which -still can occur, consider to integrate your product with an already existing -Cygwin installation on the user's machine, or, if there is none, consider -to install the official Cygwin distro on behalf of the user and integrate -your tools from there. (If you write a tool to make this easy, consider -contributing it for others to use) - - - - -Can I bundle Cygwin with my product for free? - - -Only if you comply with Cygwin's license very carefully. If you -choose to distribute cygwin1.dll, you must be willing to distribute the -exact source code used to build that copy of cygwin1.dll as per the -terms of the GPL. If you ship applications that link with cygwin1.dll, -you must either provide those applications' source code under a -GPL-compatible license, *or* purchase a cygwin license from Red Hat. - - - - -But doesn't that mean that if some application installs an older Cygwin -DLL on top of a newer DLL, my application will break? - - -It depends on what you mean by "break". If the application installs a -version of the Cygwin DLL in another location than Cygwin's /bin -directory then the rules in - apply. -If the application installs an older version of the DLL in /bin then you -should complain loudly to the application provider. - -Remember that the Cygwin DLL strives to be backwards compatible so a -newer version of the DLL should always work with older executables. So, -in general, it is always best to keep one version of the DLL on your -system and it should always be the latest version which matches your -installed distribution. - - - -Why isn't package XYZ available in Cygwin? - - -Probably because there is nobody willing or able to maintain it. It -takes time, and the priority for the Cygwin Team is the Cygwin package. -The rest is a volunteer effort. Want to contribute? See -http://cygwin.com/setup.html. - - - - -Why is the Cygwin package of XYZ so out of date? - - -(Also: Why is the version of package XYZ older than the version that I -can download from the XYZ web site? Why is the version of package XYZ -older than the version that I installed on my linux system? Is there -something special about Cygwin which requires that only an older version -of package XYZ will work on it?) - -Every package in the Cygwin distribution has a maintainer who is -responsible for sending out updates of the package. This person is a -volunteer who is rarely the same person as the official developer of the -package. If you notice that a version of a package seems to be out of -date, the reason is usually pretty simple -- the person who is -maintaining the package hasn't gotten around to updating it yet. Rarely, -the newer package actually requires complex changes that the maintainer -is working out. - -If you urgently need an update, sending a polite message to the cygwin -mailing list pinging the maintainer is perfectly acceptable. There are -no guarantees that the maintainer will have time to update the package -or that you'll receive a response to your request, however. - -Remember that the operative term here is "volunteer". - - - - -How can I access other drives? - - -You have some flexibility here. - -Cygwin has a builtin "cygdrive prefix" for drives that are not mounted. -You can access any drive, say Z:, as '/cygdrive/z/'. - -In some applications (notably bash), you can use the familiar windows -<drive>:/path/, using posix forward-slashes ('/') instead of Windows -backward-slashes ('\'). (But see the warning below!) This maps in the -obvious way to the Windows path, but will be converted internally to use -the Cygwin path, following mounts (default or explicit). For example: - - bash$ cd C:/Windows - bash$ pwd - /cygdrive/c/Windows - -and - - bash$ cd C:/cygwin - bash$ pwd - / - -for a default setup. You could also use backward-slashes in the -Windows path, but these would have to be escaped from the shell. - -Warning: There is some ambiguity in going from a Windows path -to the posix path, because different posix paths, through different -mount points, could map to the same Windows directory. This matters -because different mount points may be binmode or textmode, so the -behavior of Cygwin apps will vary depending on the posix path used to -get there. - -You can avoid the ambiguity of Windows paths, and avoid typing -"/cygdrive", by explicitly mounting drives to posix paths. For example: - - bash$ mkdir /c - bash$ mount c:/ /c - bash$ ls /c - -Then /cygdrive/c/Windows becomes /c/Windows which is a -little less typing. - -Note that you have to enter the mount point into the -/etc/fstab file to keep it indefinitely. -The mount command will only add the mount point for the lifetime -of your current Cygwin session. - -You can change the default cygdrive prefix and whether it is binmode or textmode using the /etc/fstab file -as well. See the Cygwin User's Guide at -http://cygwin.com/cygwin-ug-net/using.html#mount-table -for more details. - - - - -How can I copy and paste into Cygwin console windows? - - -First, consider using mintty instead of the standard console -window. In mintty, selecting with the left-mouse also copies, -and middle-mouse pastes. It couldn't be easier! - -In Windows's console window, open the properties dialog. -The options contain a toggle button, named "Quick edit mode". It must -be ON. Save the properties. - -You can also bind the insert key to paste from the clipboard by adding -the following line to your .inputrc file: - - "\e[2~": paste-from-clipboard - - - - - -What firewall should I use with Cygwin? - - -We have had good reports about Kerio Personal Firewall, ZoneLabs -Integrity Desktop, and the built-in firewall in Windows XP. Other -well-known products including ZoneAlarm and Norton Internet Security have -caused problems for some users but work fine for others. At last report, -Agnitum Outpost did not work with Cygwin. If you are having strange -connection-related problems, disabling the firewall is a good -troubleshooting step (as is closing or disabling all other running -applications, especially resource-intensive processes such as indexed -search). - -On the whole, Cygwin doesn't care which firewall is used. The few rare -exceptions have to do with socket code. -Cygwin uses sockets to implement many of its functions, such as IPC. -Some overzealous firewalls install themselves deeply into the winsock -stack (with the 'layered service provider' API) and install hooks -throughout. Sadly the mailing list archives are littered with examples -of poorly written firewall-type software that causes things to break. -Note that with many of these products, simply disabling the firewall -does not remove these changes; it must be completely uninstalled. - -See also -for a list of applications that have been known, at one time or another, to -interfere with the normal functioning of Cygwin. - - - - -How can I share files between Unix and Windows? - - -During development, we have Linux boxes running Samba and NFS as well -as Windows machines. We often build with cross-compilers under Linux and copy -binaries and source to the Windows system or just toy with them -directly off the Samba-mounted partition. Or, we use the Microsoft NFS -client and just use NFS shares on Linux from Windows. And then there are -tools like scp, ftp, -rsync, ... - - - - -Is Cygwin case-sensitive?? - - -Several Unix programs expect to be able to use to filenames -spelled the same way, but with different case. A prime example -of this is perl's configuration script, which wants -Makefile and makefile. Windows can't -tell the difference between files with just different case, so the -configuration fails. - -To help with this problem, Cygwin supports case sensitivity -starting with Cygwin 1.7.0. For a detailed description how to use that -feature see the Cygwin User's Guilde at -http://cygwin.com/cygwin-ug-net/using-specialnames.html. - - - - - -What about DOS special filenames? - - -In Windows, files cannot be named com1, lpt1, or aux (to name a few); -either as the root filename or as the extension part. If you do, you'll have -trouble. Unix programs don't avoid these names which can make things -interesting. E.g., the perl distribution has a file called -aux.sh. The perl configuration tries to make sure that -aux.sh is there, but an operation on a file with the magic -letters 'aux' in it will hang. - -At least that's what happens when using native Windows tools. Cygwin -1.7.0 and later can deal with these filenames just fine. Again, see the -User's Guide at -http://cygwin.com/cygwin-ug-net/using-specialnames.html -for a detailed description of what's possible with filenames and what is not. - - - - -When it hangs, how do I get it back? - - -If something goes wrong and the tools hang on you for some reason (easy -to do if you try and read a file called aux.sh), first try hitting ^C to -return to bash or the cmd prompt. - -If you start up another shell, and applications don't run, it's a good -bet that the hung process is still running somewhere. Use the Task -Manager, pview, or a similar utility to kill the process. - -And, if all else fails, there's always the reset button/power switch. -In theory this should never be necessary, though. - - - - -Why the weird directory structure? - - -Why do /lib and /usr/lib (and /bin, /usr/bin) point to the same thing? - -Why use mounts instead of symbolic links? - -Can I use a disk root (e.g., C:\) as Cygwin root? Why is this discouraged? - -After a new installation in the default location, your mount points will -look something like this: - - - bash$ mount - C:\cygwin\bin on /usr/bin type ntfs (binary,auto) - C:\cygwin\lib on /usr/lib type ntfs (binary,auto) - C:\cygwin on / type ntfs (binary,auto) - C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto) - - -Note that /bin and /usr/bin point to the same location, as do /lib and -/usr/lib. This is intentional, and you should not undo these mounts -unless you really know what you are doing. - -Various applications and packages may expect to be installed in /lib or -/usr/lib (similarly /bin or /usr/bin). Rather than distinguish between -them and try to keep track of them (possibly requiring the occasional -duplication or symbolic link), it was decided to maintain only one -actual directory, with equivalent ways to access it. - -Symbolic links had been considered for this purpose, but were dismissed -because they do not always work on Samba drives. Also, mounts are -faster to process because no disk access is required to resolve them. - -Note that non-cygwin applications will not observe Cygwin mounts (or -symlinks for that matter). For example, if you use WinZip to unpack the -tar distribution of a Cygwin package, it may not get installed to the -correct Cygwin path. So don't do this! - -It is strongly recommended not to make the Cygwin root directory the -same as your drive's root directory, unless you know what you are doing -and are prepared to deal with the consequences. It is generally easier -to maintain the Cygwin hierarchy if it is isolated from, say, C:\. For -one thing, you avoid possible collisions with other (non-cygwin) -applications that may create (for example) \bin and \lib directories. -(Maybe you have nothing like that installed now, but who knows about -things you might add in the future?) - - - - -How do anti-virus programs like Cygwin? - - -Users have reported that NAI (formerly McAfee) VirusScan for NT (and -others?) is incompatible with Cygwin. This is because it tries to scan -the newly loaded shared memory in cygwin1.dll, which can cause fork() to -fail, wreaking havoc on many of the tools. (It is not confirmed that -this is still a problem, however.) - -There have been several reports of NAI VirusScan causing the system to -hang when unpacking tar.gz archives. This is surely a bug in VirusScan, -and should be reported to NAI. The only workaround is to disable -VirusScan when accessing these files. This can be an issue during -setup, and is discussed in that FAQ entry. - -Some users report a significant performance hit using Cygwin when their -anti-virus software is enabled. Rather than disable the anti-virus -software completely, it may be possible to specify directories whose -contents are exempt from scanning. In a default installation, this -would be C:\cygwin\bin. Obviously, this could be -exploited by a hostile non-Cygwin program, so do this at your own risk. - -See also -for a list of applications that have been known, at one time or another, to -interfere with the normal functioning of Cygwin. - - - - -Is there a Cygwin port of GNU Emacs? - - -Yes. Install the emacs package. This provides everything you -need in order to run GNU emacs in a terminal window. If you also want -to be able to use the X11 -(http://x.cygwin.com/) -GUI, install the emacs-X11 package. In either case, you run emacs by -typing 'emacs' or '/usr/bin/emacs'. - - - - -Is there a Cygwin port of XEmacs? - - -Yes. It can be used in three different modes: - -X11 (http://x.cygwin.com/) GUI - -You have to set the DISPLAY environment variable -before starting xemacs. - - bash$ DISPLAY=127.0.0.1:0 xemacs & - - -Windows native GUI - -You have to unset the DISPLAY environment variable -before starting xemacs. - - bash$ DISPLAY= xemacs & - - -Console mode - -Start xemacs with -nw in a terminal (native or X11) window - - bash$ xemacs -nw - -The current stable Cygwin version of XEmacs is 21.4.x. But there is also a -Cygwin test release version (21.5.x) available for download via setup.exe. - -To use all the standard packages with XEmacs you should download the following -two packages: - -xemacs-sumo - XEmacs standard packages -xemacs-mule-sumo - XEmacs MULE (MUlti Lingual Emacs) packages - -An alternative native distribution of XEmacs for -Windows based systems can be downloaded from -http://xemacs.org/Download/win32/index.html. -It uses an InnoSetup Kit based installer. - - - -What about NT Emacs? - - -If you want GNU Emacs with a native Microsoft GUI interface, -then you can either use XEmacs (see above), or native -NT Emacs: see section -Where can I get pre-compiled versions? in NT Emacs FAQ. - - -NT Emacs uses the Windows command shell by default. Since it is not a -Cygwin application, it has no knowledge of Cygwin mounts. With those -points in mind, you need to add the following code to your ~/.emacs -(or ~/_emacs) file in order to use Cygwin bash. This is particularly useful -for the JDEE package (http://jdee.sunsite.dk/). The following -settings are for Emacs 21.1: - - - - ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; Initial setup - ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - ;; This assumes that Cygwin is installed in C:\cygwin (the - ;; default) and that C:\cygwin\bin is not already in your - ;; Windows Path (it generally should not be). - - (setq exec-path (cons "C:/cygwin/bin" exec-path)) - (setenv "PATH" (concat "C:\\cygwin\\bin;" (getenv "PATH"))) - - ;; LOGNAME and USER are expected in many Emacs packages - ;; Check these environment variables. - - (if (and (null (getenv "USER")) - ;; Windows includes variable USERNAME, which is copied to - ;; LOGNAME and USER respectively. - (getenv "USERNAME")) - (setenv "USER" (getenv "USERNAME"))) - - (if (and (getenv "LOGNAME") - ;; Bash shell defines only LOGNAME - (null (getenv "USER"))) - (setenv "USER" (getenv "LOGNAME"))) - - (if (and (getenv "USER") - (null (getenv "LOGNAME"))) - (setenv "LOGNAME" (getenv "USER"))) - - ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; (A) M-x shell: This change M-x shell permanently - ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - ;; Would call Windows command interpreter. Change it. - - (setq shell-file-name "bash") - (setenv "SHELL" shell-file-name) - (setq explicit-shell-file-name shell-file-name) - - ;; Remove C-m (^M) characters that appear in output - - (add-hook 'comint-output-filter-functions - 'comint-strip-ctrl-m) - - ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; (B) *OR* call following function with M-x my-bash - ;; The M-x shell would continue to run standard Windows shell - ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - (defun my-bash (&optional buffer) - "Run Cygwin Bash shell in optional BUFFER; default *shell-bash*." - (autoload 'comint-check-proc "comint") - (interactive - (let ((name "*shell-bash*")) - (if current-prefix-arg - (setq name (read-string - (format "Cygwin shell buffer (default %s): " name) - (not 'initial-input) - (not 'history) - name))) - (list name))) - (or buffer - (setq buffer "*shell-bash*")) - (if (comint-check-proc buffer) - (pop-to-buffer buffer) - (let* ((shell-file-name "bash") - (explicit-shell-file-name shell-file-name) - (explicit-sh-args '("--login" "-i")) - (explicit-bash-args explicit-sh-args) - (w32-quote-process-args ?\"));; Use Cygwin quoting rules. - (shell buffer) - ;; By default Emacs sends "\r\n", but bash wants plain "\n" - (set-buffer-process-coding-system 'undecided-dos 'undecided-unix) - ;; With TAB completion, add slash path separator, none to filenames - (make-local-variable 'comint-completion-addsuffix) - (setq comint-completion-addsuffix '("/" . "")) - ;; This variable is local to buffer - (setq comint-prompt-regexp "^[ \n\t]*[$] ?")))) - - - -If you want NT Emacs to understand Cygwin paths, get -cygwin-mount.el from http://www.emacswiki.org/elisp/index.html. - -Note that all of this ``just works'' if you use the Cygwin port of -Emacs or XEmacs from Cygwin Setup. - - - - -Why don't some of my old symlinks work anymore? - - -Beginning with Cygwin 1.7, Cygwin supports multiple character sets. -Symlinks created with Cygwin 1.7 are using the UTF-16 character set, which is -portable across all character sets. Old symlinks were written using your -current Windows codepage, which is not portable across all character sets. -If the target of the symlink doesn't resolve anymore, it's very likely that -the symlink points to a target filename using native, non-ASCII characters, -and you're now using another character set than way back when you created -the symlink. - -Solution: Delete the symlink and create it again under you new Cygwin. -The new symlink will be correctly point to the target no matter what character -set you're using in future. - - - -Why don't symlinks work on Samba-mounted filesystems? - - -Symlinks are marked with "system" file attribute. Samba does not -enable this attribute by default. To enable it, consult your Samba -documentation and then add these lines to your samba configuration -file: - - - map system = yes - create mask = 0775 - - -Note that the 0775 can be anything as long as the 0010 bit is set. - -Alternatively, use Windows shortcuts as symlinks. See the CYGWIN -environment variable option "winsymlinks" -http://cygwin.com/cygwin-ug-net/using-cygwinenv.html - - - - -How do I setup sshd in a domain? - - - -If you want to be able to logon with domain accounts to a domain member -machine, you should make sure that the "cyg_server" account under which -the sshd service is usually running, is a domain account. Otherwise you -might end up with weird problems. For instance, sshd might fail to load -the child process when trying to login with a domain account. A potential, -confirmed error message is - - - - *** fatal error - unable to load user32.dll, Win32 error 1114 -. - - -Here's how you set up a sshd with a domain service account. - - - -First of all, create a new domain account called "cyg_server". This -account must be an administrative account, so make sure it's in the -"Administrators" group. Now create a domain policy which is propagated -to all machines which are supposed to run an sshd service. This domain -policy should give the following user rights to the "cyg_server" account: - - - - Act as part of the operating system (SeTcbPrivilege) - Create a token object (SeCreateTokenPrivilege) - Replace a process level token (SeAssignPrimaryTokenPrivilege) - - - -Now to install sshd on the member machine, logon to that machine as -an admin. Make sure the aforementioend global policy has been propagated -to this machine. Examine the Local Security Policy settings and, if -necessary, call gpupdate. - - - -If everything looks ok, run bash. Starting with Windows Vista, make -sure you're running bash elevated. - - - -If "cyg_server" is not already in /etc/passwd, add it -using mkpasswd. Make sure all domain accounts which are -supposed to be able to logon via ssh are in /etc/passwd. -Also make sure that all important domain groups are in -/etc/group. If in doubt, call - - - - $ mkpasswd -l -d your_domain > /etc/passwd - $ mkgroup -l -d your_domain > /etc/group - - - -Then run ssh-host-config. Answer all questions so that "cyg_server" is -used to run the service. When done, check ownership of -/var/empty and all /etc/ssh* -files. All of them must be owned by "cyg_server". If that's ok, you're -usually all set and you can start the sshd service via - - - - $ cygrunsrv -S sshd - - -or - - - $ net start sshd - - - - - -Why do my Tk programs not work anymore? - - -Previous versions of Tcl/Tk distributed with Cygwin (e.g. tclsh84.exe, -wish84.exe) were not actually "Cygwin versions" of those tools. -They were built as native libraries, which means they did not understand -Cygwin mounts or symbolic links. This lead to all sorts of problems interacting -with true Cygwin programs. - -As of February 2012, this was replaced with a version of Tcl/Tk which -uses Cygwin's POSIX APIs and X11 for GUI functionality. If you get a message -such as this when trying to start a Tk app: - - - Application initialization failed: couldn't connect to display "" - - -Then you need to start an X server, or if one is already running, set the -DISPLAY variable to the proper value. The Cygwin distribution -includes an X server; please see the Cygwin/X User Guide -for installation and startup instructions. - - - -Why do I get "Address family not supported" errors when playing with IPv6? - - -IPv6 is only fully supported and available right from the start -beginning with Windows Vista and Windows Server 2008. - -The previous generation of Windows, -Windows XP and Windows Server 2003, only support IPv6 on an "experimental" -basis. On these Windows versions, the IPv6 TCP/IP stack is not installed -automatically, rather the system administrator has to install it manually. -Unless this has already been done on your machine, your machine is not -IPv6-capable and that's why you see the "Address family not supported" -error message. Note, however, that the IPv6 stack on these systems -don't fully support all features of IPv6. - -For more information about IPv6 on Windows and how to install the -IPv6 stack, see the Microsoft TechNet IPv6 FAQ article - - - -What applications have been found to interfere with Cygwin? - - -From time to time, people have reported strange failures and problems in -Cygwin and Cygwin packages that seem to have no rational explanation. Among -the most common symptoms they report are fork failures, memory leaks, and file -access denied problems. These problems, when they have been traced, often appear -to be caused by interference from other software installed on the same PC. Security -software, in particular, such as anti-virus, anti-spyware, and firewall applications, -often implements its functions by installing hooks into various parts of the system, -including both the Explorer shell and the underlying kernel. Sometimes these hooks -are not implemented in an entirely transparent fashion, and cause changes in the -behaviour which affect the operation of other programs, such as Cygwin. - -Among the software that has been found to cause difficulties are: - -Sonic Solutions burning software containing DLA component (when DLA disabled) -Norton/McAfee/Symantec antivirus or antispyware -Logitech webcam software with "Logitech process monitor" service -Kerio, Agnitum or ZoneAlarm Personal Firewall -Iolo System Mechanic/AntiVirus/Firewall -LanDesk -Windows Defender -Various programs by Wave Systems Corp using wxvault.dll, including Embassy Trust Suite and Embassy Security Center -NOD32 Antivirus -ByteMobile laptop optimization client -Earthlink Total-Access -Spybot S&D TeaTimer -AR Soft RAM Disk -ATI Catalyst (some versions) -NVIDIA GeForce (some versions) -Windows LiveOneCare -Webroot Spy Sweeper with Antivirus -COMODO Firewall Pro -PC Tools Spyware Doctor -Avira AntiVir -Panda Internet Security -BitDefender -Google Desktop -Sophos Anti-Virus 7 -Bufferzone from Trustware -Lenovo IPS Core Service (ipssvc) -Credant Guardian Shield -AVAST (disable FILESYSTEM and BEHAVIOR realtime shields) -Citrix Metaframe Presentation Server/XenApp (see Citrix Support page) - -Sometimes these problems can be worked around, by temporarily or partially -disabling the offending software. For instance, it may be possible to disable -on-access scanning in your antivirus, or configure it to ignore files under the -Cygwin installation root. Often, unfortunately, this is not possible; even disabling -the software may not work, since many applications that hook the operating system -leave their hooks installed when disabled, and simply set them into what is intended -to be a completely transparent pass-through mode. Sometimes this pass-through is not -as transparent as all that, and the hooks still interfere with Cygwin; in these cases, -it may be necessary to uninstall the software altogether to restore normal operation. - -Some of the symptoms you may experience are: - - -Random fork() failures. -Caused by hook DLLs that load themselves into every process in the -system. POSIX fork() semantics require that the memory map of the child process -must be an exact duplicate of the parent process' layout. If one of these DLLs -loads itself at a different base address in the child's memory space as compared -to the address it was loaded at in the parent, it can end up taking the space that -belonged to a different DLL in the parent. When Cygwin can't load the original -DLL at that same address in the child, the fork() call has to fail. - - - -File access problems. -Some programs (e.g., virus scanners with on-access scanning) scan or -otherwise operate on every file accessed by all the other software running on -your computer. In some cases they may retain an open handle on the file even -after the software that is really using the file has closed it. This has been -known to cause operations such as deletes, renames and moves to fail with -access denied errors. In extreme cases it has been known for scanners to leak -file handles, leading to kernel memory starvation. - - - -Networking issues -Firewall software sometimes gets a bit funny about Cygwin. It's not -currently understood why; Cygwin only uses the standard Winsock2 API, but -perhaps in some less-commonly used fashion that doesn't get as well tested -by the publishers of firewalls. Symptoms include mysterious failures to -connect, or corruption of network data being sent or received. - - -Memory and/or handle leaks -Some applications that hook into the Windows operating system exhibit -bugs when interacting with Cygwin that cause them to leak allocated memory -or other system resources. Symptoms include complaints about out-of-memory -errors and even virtual memory exhaustion dialog boxes from the O/S; it is -often possible to see the excess memory allocation using a tool such as -Task Manager or Sysinternals' Process Explorer, although interpreting the -statistics they present is not always straightforward owing to complications -such as virtual memory paging and file caching. - - - - - - How do I fix fork() failures? - - Unfortunately, Windows does not use the fork/exec model of process creation - found in UNIX-like OSes, so it is difficult for Cygwin to implement a reliable and - correct fork(), which can lead to error messages such as: - - unable to remap somedll to same address as parent - couldn't allocate heap - died waiting for dll loading - child -1 - died waiting for longjmp before initialization - STATUS_ACCESS_VIOLATION - resource temporarily unavailable - - Potential solutions for the above errors: - - Restart whatever process is trying (and failing) to use - fork(). Sometimes Windows sets up a process - environment that is even more hostile to fork() than usual. - Ensure that you have eliminated (not just disabled) all - software on the . - - Read the 'rebase' package README in - /usr/share/doc/rebase/, and follow the - instructions there to run 'rebaseall'. - - Please note that installing new packages or updating existing - ones undoes the effects of rebaseall and often causes fork() failures - to reappear. If so, just run rebaseall again. - - See the - process creation section of the User's Guide for the technical reasons it is so - difficult to make fork() work reliably. - - - diff --git a/winsup/doc/faq-what.xml b/winsup/doc/faq-what.xml deleted file mode 100644 index a57e224bc..000000000 --- a/winsup/doc/faq-what.xml +++ /dev/null @@ -1,162 +0,0 @@ - - - - -About Cygwin - - - -What is it? - - -The Cygwin tools are ports of the popular GNU development tools for -Microsoft Windows. They run thanks to the Cygwin library which -provides the POSIX system calls and environment these programs expect. - -With these tools installed, it is possible to write Windows console -or GUI applications that make use of significant parts of the POSIX API. -As a result, it is possible to easily port many Unix programs without the need -for extensive changes to the source code. This includes configuring -and building most of the available GNU software (including the packages -included with the Cygwin development tools themselves) as well as lots -of BSD tools and packages (including OpenSSH). Even if -the development tools are of little to no use to you, you may have -interest in the many standard POSIX utilities provided with the package. -They can be used from one of the provided Unix shells like bash, tcsh or zsh, -as well as from the standard Windows command shell if you have to for some -sad reason. - - - - -What versions of Windows are supported? - - -Cygwin can be expected to run on all modern versions of Windows. -This includes, as of the time of writing this, Windows XP SP3, Windows -Server 2003, Windows Vista, Windows Server 2008, Windows 7, Windows -Server 2012, Windows 8. The 32 bit version also runs in the WOW64 32 bit -environment on released 64 bit versions of Windows -(XP/2003/Vista/2008/7/2008 R2/8/2012). -Since Cygwin is a community-supported free software project, patches to -provide support for other versions would be thoughtfully considered. -Paid support contracts or enhancements are available through Red Hat. For -information about getting a Red Hat support contract, see -. - -Keep in mind that Cygwin can only do as much as the underlying OS -supports. Because of this, Cygwin will behave differently, and -exhibit different limitations, on the various versions of Windows. - - - - -Where can I get it? - - -The home page for the Cygwin project is http://cygwin.com/. -There you should find everything you need for Cygwin, including links -for download and setup, a current list of mirror sites, a User's -Guide, an API Reference, mailing lists and archives, and additional -ported software. - -You can find documentation for the individual GNU tools typically -as man pages or info pages as part of the Cygwin net distribution. -Additionally you can get the latest docs at -. (You should read GNU manuals from a -local mirror. Check -for a list of them.) - - - - -Is it free software? - - -Yes. Parts are GNU software (gcc, gas, ld, etc...), parts are covered -by the standard X11 license, some of it is public domain, some of -it was written by Red Hat (or the former Cygnus Solutions) and placed under -the GPL. None of it is shareware. You don't have to pay anyone to use it -but you should be sure to read the copyright section of the FAQ for more -information on how the GNU General Public License may affect your use of -these tools. - -In particular, if you intend to port a proprietary (non-GPL'd) -application using Cygwin, you will need the proprietary-use license -for the Cygwin library. This is available for purchase from Red Hat; -please visit for more -information. All other questions should be sent to the public project -mailing list cygwin@cygwin.com. - -Note that when we say "free" we mean freedom, not price. The goal of -such freedom is that the people who use a given piece of software -should be able to change it to fit their needs, learn from it, share -it with their friends, etc. The Cygwin license allows you those -freedoms, so it is free software. - - - - -What version of Cygwin is this, anyway? - - -To find the version of the Cygwin DLL installed, you can use -uname as on Linux or cygcheck. Refer to each command's ---help output and the Cygwin User's Guide for more information. - -If you are looking for the version number for the whole Cygwin -release, there is none. Each package in the Cygwin release has its own -version. The packages in Cygwin are continually improving, thanks to -the efforts of net volunteers who maintain the Cygwin binary ports. -Each package has its own version numbers and its own release process. - -So, how do you get the most up-to-date version of Cygwin? Easy. Just -download the Cygwin Setup program by following the instructions -here. The setup program will handle the task -of updating the packages on your system to the latest version. For -more information about using Cygwin's setup.exe, see -Setting Up Cygwin -in the Cygwin User's Guide. - - - -Who's behind the project? - - -(Please note that if you have cygwin-specific -questions, all of these people will appreciate it if you use the cygwin -mailing lists rather than sending personal email.) - - -Christopher Faylor (cgf) is one of the project leads. Chris works for -Netapp but all of his Cygwin activities occur on his own time. He is -most notably responsible for the support of signal handling and -fork/exec in Cygwin. He also administers the site which hosts the -Cygwin project. - - -Corinna Vinschen (corinna) is the other project lead. Corinna is a -senior Red Hat engineer. Corinna is responsible for such important -subsystems as security and networking and has recently added support to -Cygwin for wide characters, increased path length, IPv6, advisory -file locking and more. - - -Yaakov Selkowitz is the Cygwin/X coordinator. Jon Turney serves on the -Cygwin/X team as a developer. - - -The Cygwin setup project is currently maintained by a group of people, most notably, Brian Dessent (brian) and Dave Korn (dave.korn). - -Please note that all of us working on Cygwin try to -be as responsive as possible and deal with patches and questions as we -get them, but realistically we don't have time to answer all of the -email that is sent to the main mailing list. Making Net releases of the -Win32 tools and helping people on the Net out is not our primary job -function, so some email will have to go unanswered. - -Many thanks to everyone using the tools for their many contributions in -the form of advice, bug reports, and code fixes. Keep them coming! - - diff --git a/winsup/doc/faq.xml b/winsup/doc/faq.xml deleted file mode 100644 index 498558907..000000000 --- a/winsup/doc/faq.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - -
- - Cygwin FAQ - - - - - - - - - - - - - -
diff --git a/winsup/doc/fhandler-tut.txt b/winsup/doc/fhandler-tut.txt deleted file mode 100644 index 00a3b4b94..000000000 --- a/winsup/doc/fhandler-tut.txt +++ /dev/null @@ -1,94 +0,0 @@ -fhandler tutorial - -This document will show how to add a new "fhandler" to cygwin, by -showing an example of /dev/zero. - -Files to note: - -fhandler.h - must define a new derived class here and FH_* -devices.in - to notice "/dev/zero" and mark it -fhandler_zero.cc - new -dtable.cc - to create the fhandler instance - -OK, first we have to define what this new fhandler will do. In our -example case, we're going to implement the unix "/dev/zero" device, -which has the following characteristics: - -* writes to /dev/zero are silently discarded -* reads from /dev/zero return all zero bytes -* mmap()ing /dev/zero maps a chunk of zero'd out memory. - -Since windows doesn't have a device that acts like this, we'll be -simulating everything. Thus: - -* writes simply return a success status -* reads memset() the buffer and return success -* we take advantage of the fact that CreateFileMapping can take a - handle of -1, which (1) maps swap memory, and (2) zeros it out for - us (at least, on NT). - -OK, let's start with devices.h. - -We have to create a new entry in the enum fh_devices. The new -devices must get a major and a minor ID. As a rule of thumb, just -copy the ones that are used on a linux system. - -Now, let's continue with fhandler.h. - -First, update the fhandler_union near the end of the file with a -line for the new device. Use existing members, in this case __dev_null -as a template. This union is sorted alphabetically. - -Earlier in that file, we'll copy fhandler_dev_null and edit it to be -fhandler_dev_zero. I chose that one because it's small, but we'll add -more members as we go (since we're simulating the whole thing). In -fact, let's copy the I/O methods from fhandler_windows since we'll -need all those anyway, even though we'll go through the full list -later. - -OK, next we need to edit devices.in. There is a section where each device -is listed with its cygwin path, its structure and its windows path. -"/dev/zero", FH_ZERO, "\\dev\\zero" -This is needed to recognize when the user is trying to open "/dev/zero". -You have to build devices.cc from devices.in now. -There is a script 'gendevices' in the winsup/cygwin directory which may -be called at some time in the future if you use 'make' to build the DLL. -This should rebuild the devices.cc file. You have to have shilka -available to do that; this is part of the cygwin cocom package. - -To go along with that change, we'll need to change dtable.cc. Look for -FH_NULL and add a case for FH_ZERO as well. - -Now we get to fhandler_zero.cc itself. Create the empty file and copy -the "usual" header/copyright/includes from some other fhandler_*.cc -source file. Also, edit Makefile.in to build this new file. Add one -new entry to DLL_OFILES, and a new line for the winsup.h dependencies. - -Since we changed fhandler.h, when you type "make" it will rebuild -everything. Go ahead and do that when you get a chance to let it run, -since we're not changing the headers any more. Note that you won't be -able to link the new dll, as we haven't added all the methods for the -new fhandler class yet, but at least you'll get a lot of compilation -out of the way. - -Next we start adding in the fhandler methods themselves. - -Constructor: This takes a name, and all we do is pass that name back -to the base class, along with the FH_ZERO value. We call set_cb -because all fhandlers call this (it's for exec to copy the fd). - -open: we override the one that takes a name because there are no real -windows devices like /dev/zero, but we ignore the name. We call -set_flags to save the flags. - -write: writes are discarded; we return success. - -read: reads read NUL bytes, so fill the buffer with NULs and return -success. - -lseek/close: just return success. - -dump: this is just for debugging, so we just print something. - -select_*: we don't support this yet, see the myriad examples in -select.cc for examples. The base fhandler's methods will do for now. diff --git a/winsup/doc/filemodes.xml b/winsup/doc/filemodes.xml deleted file mode 100644 index e4cbd448f..000000000 --- a/winsup/doc/filemodes.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - -File permissions - -On FAT or FAT32 filesystems, files are always readable, and Cygwin -uses the DOS read-only attribute to determine if they are writable. Files are -considered to be executable if the filename ends with .bat, .com or .exe, or -if its content starts with #!. Consequently chmod can -only affect the "w" mode, it silently ignores actions involving the other -modes. This means that ls -l -needs to open and read files. It can thus be relatively slow. - -On NTFS, file permissions are evaluated using the Access Control -Lists (ACLs) attached to a file. This can be switched off by using the -"noacl" option to the respective mount point in the -/etc/fstab or /etc/fstab.d/$USER -file. For more information on file permissions, see - - - -. - - - - -On NFS shares, file permissions are exactly the POSIX permissions -transmitted from the server using the NFSv3 protocol, if the NFS client -is the one from Microsoft's "Services For Unix", or the one built into -Windows Vista or later. - - -Only the user and group ownership is not necessarily correct. - - - diff --git a/winsup/doc/fo.xsl b/winsup/doc/fo.xsl deleted file mode 100644 index 4bc255ce8..000000000 --- a/winsup/doc/fo.xsl +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - page - - - - - left - - - - - 85% - - - - - diff --git a/winsup/doc/gcc.xml b/winsup/doc/gcc.xml deleted file mode 100644 index 7edf89f79..000000000 --- a/winsup/doc/gcc.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - -Using GCC with Cygwin - -Standard Usage - -Use gcc to compile, just like under UNIX. Refer to the GCC User's Guide -for information on standard usage and options. Here's a simple example: - - -Building Hello World with GCC - -bash$ gcc hello.c -o hello.exe -bash$ hello.exe -Hello, World - -bash$ - - - - - -Building applications for 64 bit Cygwin - -The 64 bit Cygwin toolchain uses the -Microsoft x64 calling convention -by default, so you can create applications using the Win32 API just as with -the 32 bit Cygwin toolchain. - -There's just one important difference. The 64 bit Cygwin compilers use -a different data model than the Mingw and Microsoft compilers. For reference, -see the Wikipedia entry on -64-bit computing. - -While the Mingw and Microsoft compilers use the LLP64 -data model, Cygwin compilers use the LP64 data model, just -like Linux. This affects the size of the type long. In the -LLP64 model preferred by Microsoft, -sizeof(long) is 4. This applies for the related Win32 -types like LONG, ULONG, -DWORD, etc., too. - -In the LP64 model used by Cygwin, sizeof(long) is 8, -just like the size of pointers or the types size_t/ssize_t. -This simplifies porting Linux applications to 64 bit Cygwin, but it requires -due diligence when calling Windows functions taking LONG, ULONG, DWORD, or any -other equivalent type. This is especially important in conjunction with -pointers. - -Here's an example. The Win32 function ReadFile -returns the number of read bytes via a pointer to a DWORD variable: - - -BOOL WINAPI ReadFile (HANDLE, PVOID, DWORD, PDWORD, LPOVERLAPPED); - - -Note that the forth parameter is a pointer to a DWORD, thus it's a -pointer to a 4 byte type, on 32 as well as on 64 bit Windows. Now we write -our own my_read function using ReadFile: - - -64bit-programming, Using ReadFile, 1st try - -ssize_t -my_read (int fd, void *buffer, size_t bytes_to_read) -{ - HANDLE fh = _get_osfhandle (fd); - ssize_t bytes_read; - - if (ReadFile (fh, buffer, bytes_to_read, (PDWORD) &bytes_read, NULL)) - return bytes_read; - set_errno_from_get_last_error (); - return -1; -} - - - -While this example code works fine on 32 bit Windows, it has in fact -a bad bug. The assumption that the size of ssize_t is the same as the size -of DWORD is wrong for 64 bit. In fact, since -sizeof(ssize_t) is 8, ReadFile -will write the number of read bytes into the lower 4 bytes of the variable -bytes_read, while the upper 4 bytes will contain an -undefined value. my_read will very likely return the -wrong number of read bytes to the caller. - -Here's the fixed version of my_read: - - -64bit-programming, Using ReadFile, 2nd try - -ssize_t -my_read (int fd, void *buffer, size_t bytes_to_read) -{ - HANDLE fh = _get_osfhandle (fd); - DWORD bytes_read; - - if (ReadFile (fh, buffer, bytes_to_read, &bytes_read, NULL)) - return (ssize_t) bytes_read; - set_errno_from_get_last_error (); - return -1; -} - - - - - -GUI Mode Applications - -Cygwin comes with an X server, so usually you should compile your -GUI applications as X applications to allow better interoperability with -other Cygwin GUI applications. - -Other than that, Cygwin allows you to build programs with full access -to the standard Windows API, including the GUI functions as defined in -any Microsoft or off-the-shelf publication. - -The build process is similar to any other build process. The only -difference is that you use gcc -mwindows to link your -program into a GUI application instead of a command-line application. -Here's an example Makefile: - - - - - -Note the use of windres to compile the -Windows resources into a COFF-format .res file. -That will include all the bitmaps, icons, and other resources you -need, into one handy object file. For more information on -windres, consult the Binutils manual. - - - diff --git a/winsup/doc/gdb.xml b/winsup/doc/gdb.xml deleted file mode 100644 index af0c0dd8a..000000000 --- a/winsup/doc/gdb.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - -Debugging Cygwin Programs - -When your program doesn't work right, it usually has a "bug" in -it, meaning there's something wrong with the program itself that is -causing unexpected results or crashes. Diagnosing these bugs and -fixing them is made easy by special tools called -debuggers. In the case of Cygwin, the debugger -is GDB, which stands for "GNU DeBugger". This tool lets you run your -program in a controlled environment where you can investigate the -state of your program while it is running or after it crashes. -Crashing programs sometimes create "core" files. In Cygwin these are -regular text files that cannot be used directly by GDB. - - -Before you can debug your program, you need to prepare your -program for debugging. What you need to do is add --g to all the other flags you use when compiling -your sources to objects. - -Compiling with -g - -bash$ gcc -g -O2 -c myapp.c -bash$ gcc -g myapp.c -o myapp - - - -What this does is add extra information to the objects (they get -much bigger too) that tell the debugger about line numbers, variable -names, and other useful things. These extra symbols and debugging -information give your program enough information about the original -sources so that the debugger can make debugging much easier for -you. - -To invoke GDB, simply type gdb myapp.exe at the -command prompt. It will display some text telling you about itself, -then (gdb) will appear to prompt you to enter -commands. Whenever you see this prompt, it means that gdb is waiting -for you to type in a command, like run or -help. Oh :-) type -help to get help on the commands you can type in, or -read the GDB User's Manual for a complete -description of GDB and how to use it. - -If your program crashes and you're trying to figure out why it -crashed, the best thing to do is type run and let -your program run. After it crashes, you can type -where to find out where it crashed, or -info locals to see the values of all the local -variables. There's also a print that lets you look -at individual variables or what pointers point to. - -If your program is doing something unexpected, you can use the -break command to tell gdb to stop your program when it -gets to a specific function or line number: - -"break" in gdb - -(gdb) break my_function -(gdb) break 47 - - - -Now, when you type run your program will stop -at that "breakpoint" and you can use the other gdb commands to look at -the state of your program at that point, modify variables, and -step through your program's statements one at a -time. - -Note that you may specify additional arguments to the -run command to provide command-line arguments to -your program. These two cases are the same as far as your program is -concerned: - -Debugging with command line arguments - -bash$ myprog -t foo --queue 47 - -bash$ gdb myprog -(gdb) run -t foo --queue 47 - - - - - diff --git a/winsup/doc/highlights.xml b/winsup/doc/highlights.xml deleted file mode 100644 index 5de789a8c..000000000 --- a/winsup/doc/highlights.xml +++ /dev/null @@ -1,384 +0,0 @@ - - - -Highlights of Cygwin Functionality - -Introduction When a binary linked -against the library is executed, the Cygwin DLL is loaded into the -application's text segment. Because we are trying to emulate a UNIX kernel -which needs access to all processes running under it, the first Cygwin DLL to -run creates shared memory areas and global synchronization objects that other -processes using separate instances of the DLL can access. This is used to keep track of open file descriptors and to assist fork and exec, among other -purposes. Every process also has a per_process structure that contains -information such as process id, user id, signal masks, and other similar -process-specific information. - -The DLL is implemented as a standard DLL in the Win32 subsystem. Under -the hood it's using the Win32 API, as well as the native NT API, where -appropriate. - -Some restrictions apply for calls to the Win32 API. -For details, see , -as well as . - -The native NT API is used mainly for speed, as well as to access -NT capabilities which are useful to implement certain POSIX features, but -are hidden to the Win32 API. - - -Due to some restrictions in Windows, it's not always possible -to strictly adhere to existing UNIX standards like POSIX.1. Fortunately -these are mostly corner cases. - -Note that many of the things that Cygwin does to provide POSIX -compatibility do not mesh well with the native Windows API. If you mix -POSIX calls with Windows calls in your program it is possible that you -will see uneven results. In particular, Cygwin signals will not work -with Windows functions which block and Windows functions which accept -filenames may be confused by Cygwin's support for long filenames. - - - -Permissions and Security -Windows NT includes a sophisticated security model based on Access -Control Lists (ACLs). Cygwin maps Win32 file ownership and permissions to -ACLs by default, on file systems supporting them (usually NTFS). Solaris -style ACLs and accompanying function calls are also supported. -The chmod call maps UNIX-style permissions back to the Win32 equivalents. -Because many programs expect to be able to find the -/etc/passwd and -/etc/group files, we provide utilities -that can be used to construct them from the user and group information -provided by the operating system. - -Users with Administrator rights are permitted to chown files. -With version 1.1.3 Cygwin introduced a mechanism for setting real and -effective UIDs. This is described in . As -of version 1.5.13, the Cygwin developers are not aware of any feature in -the Cygwin DLL that would allow users to gain privileges or to access -objects to which they have no rights under Windows. However there is no -guarantee that Cygwin is as secure as the Windows it runs on. Cygwin -processes share some variables and are thus easier targets of denial of -service type of attacks. - - - - -File Access Cygwin supports -both POSIX- and Win32-style paths, using either forward or back slashes as the -directory delimiter. Paths coming into the DLL are translated from POSIX to -native NT as needed. From the application perspective, the file system is -a POSIX-compliant one. The implementation details are safely hidden in the -Cygwin DLL. UNC pathnames (starting with two slashes) are supported for -network paths. - -Since version 1.7.0, the layout of this POSIX view of the Windows file -system space is stored in the /etc/fstab file. Actually, -there is a system-wide /etc/fstab file as well as a -user-specific fstab file /etc/fstab.d/${USER}. - -At startup the DLL has to find out where it can find the -/etc/fstab file. The mechanism used for this is simple. -First it retrieves it's own path, for instance -C:\Cygwin\bin\cygwin1.dll. From there it deduces -that the root path is C:\Cygwin. So it looks for the -fstab file in C:\Cygwin\etc\fstab. -The layout of this file is very similar to the layout of the -fstab file on Linux. Just instead of block devices, -the mount points point to Win32 paths. An installation with -setup.exe installs a fstab file by -default, which can easily be changed using the editor of your choice. - -The fstab file allows mounting arbitrary Win32 -paths into the POSIX file system space. A special case is the so-called -cygdrive prefix. -It's the path under which every available drive in the system is mounted -under its drive letter. The default value is /cygdrive, -so you can access the drives as /cygdrive/c, -/cygdrive/d, etc... The cygdrive prefix can be set to -some other value (/mnt for instance) in the -fstab file(s). - -The library exports several Cygwin-specific functions that can be used -by external programs to convert a path or path list from Win32 to POSIX or vice -versa. Shell scripts and Makefiles cannot call these functions directly. -Instead, they can do the same path translations by executing the -cygpath utility program that we provide with Cygwin. - -Win32 applications handle filenames in a case preserving, but case -insensitive manner. Cygwin supports case sensitivity on file systems -supporting that. Since Windows XP, the OS only supports case -sensitivity when a specific registry value is changed. Therefore, case -sensitivity is not usually the default. - -Cygwin supports creating and reading symbolic links, even on Windows -filesystems and OS versions which don't support them. -See for details. - -Hard links are fully supported on NTFS and NFS file systems. On FAT -and other file systems which don't support hardlinks, the call returns with -an error, just like on other POSIX systems. - -On file systems which don't support unique persistent file IDs (FAT, -older Samba shares) the inode number for a file is calculated by hashing its -full Win32 path. The inode number generated by the stat call always matches -the one returned in d_ino of the dirent -structure. It is worth noting that the number produced by this method is not -guaranteed to be unique. However, we have not found this to be a significant -problem because of the low probability of generating a duplicate inode number. - - -Cygwin 1.7 and later supports Extended Attributes (EAs) via the -linux-specific function calls getxattr, -setxattr, listxattr, and -removexattr. All EAs on Samba or NTFS are treated as -user EAs, so, if the name of an EA is "foo" from the Windows perspective, -it's transformed into "user.foo" within Cygwin. This allows Linux-compatible -EA operations and keeps tools like attr, or -setfattr happy. - - -chroot is supported since Cygwin 1.1.3. -However, chroot is not a concept known by Windows. This implies some serious -restrictions. First of all, the chroot call isn't a -privileged call. Any user may call it. Second, the chroot environment -isn't safe against native windows processes. Given that, chroot in Cygwin -is only a hack which pretends security where there is none. For that reason -the usage of chroot is discouraged. - - - -Text Mode vs. Binary Mode -It is often important that files created by native Windows -applications be interoperable with Cygwin applications. For example, a -file created by a native Windows text editor should be readable by a -Cygwin application, and vice versa. - -Unfortunately, UNIX and Win32 have different end-of-line -conventions in text files. A UNIX text file will have a single newline -character (LF) whereas a Win32 text file will instead use a two -character sequence (CR+LF). Consequently, the two character sequence -must be translated on the fly by Cygwin into a single character newline -when reading in text mode. - -This solution addresses the newline interoperability concern at -the expense of violating the POSIX requirement that text and binary mode -be identical. Consequently, processes that attempt to lseek through -text files can no longer rely on the number of bytes read to be an -accurate indicator of position within the file. For this reason, Cygwin -allows you to choose the mode in which a file is read in several ways. - - -ANSI C Library -We chose to include Red Hat's own existing ANSI C library -"newlib" as part of the library, rather than write all of the lib C -and math calls from scratch. Newlib is a BSD-derived ANSI C library, -previously only used by cross-compilers for embedded systems -development. Other functions, which are not supported by newlib have -been added to the Cygwin sources using BSD implementations as much as -possible. - -The reuse of existing free implementations of such things -as the glob, regexp, and getopt libraries saved us considerable -effort. In addition, Cygwin uses Doug Lea's free malloc -implementation that successfully balances speed and compactness. The -library accesses the malloc calls via an exported function pointer. -This makes it possible for a Cygwin process to provide its own -malloc if it so desires. - - -Process Creation -The fork call in Cygwin is particularly interesting -because it does not map well on top of the Win32 API. This makes it very -difficult to implement correctly. Currently, the Cygwin fork is a -non-copy-on-write implementation similar to what was present in early -flavors of UNIX. - -The first thing that happens when a parent process -forks a child process is that the parent initializes a space in the -Cygwin process table for the child. It then creates a suspended -child process using the Win32 CreateProcess call. Next, the parent -process calls setjmp to save its own context and sets a pointer to -this in a Cygwin shared memory area (shared among all Cygwin -tasks). It then fills in the child's .data and .bss sections by -copying from its own address space into the suspended child's address -space. After the child's address space is initialized, the child is -run while the parent waits on a mutex. The child discovers it has -been forked and longjumps using the saved jump buffer. The child then -sets the mutex the parent is waiting on and blocks on another mutex. -This is the signal for the parent to copy its stack and heap into the -child, after which it releases the mutex the child is waiting on and -returns from the fork call. Finally, the child wakes from blocking on -the last mutex, recreates any memory-mapped areas passed to it via the -shared area, and returns from fork itself. - -While we have some -ideas as to how to speed up our fork implementation by reducing the -number of context switches between the parent and child process, fork -will almost certainly always be inefficient under Win32. Fortunately, -in most circumstances the spawn family of calls provided by Cygwin -can be substituted for a fork/exec pair with only a little effort. -These calls map cleanly on top of the Win32 API. As a result, they -are much more efficient. Changing the compiler's driver program to -call spawn instead of fork was a trivial change and increased -compilation speeds by twenty to thirty percent in our -tests. - -However, spawn and exec present their own set of -difficulties. Because there is no way to do an actual exec under -Win32, Cygwin has to invent its own Process IDs (PIDs). As a -result, when a process performs multiple exec calls, there will be -multiple Windows PIDs associated with a single Cygwin PID. In some -cases, stubs of each of these Win32 processes may linger, waiting for -their exec'd Cygwin process to exit. - - - -Problems with process creation - -The semantics of fork require that a forked -child process have exactly the same address -space layout as its parent. However, Windows provides no native -support for cloning address space between processes and several -features actively undermine a reliable fork -implementation. Three issues are especially prevalent: - - -DLL base address collisions. Unlike *nix shared -libraries, which use "position-independent code", Windows shared -libraries assume a fixed base address. Whenever the hard-wired -address ranges of two DLLs collide (which occurs quite often), the -Windows loader must "rebase" one of them to a different -address. However, it may not resolve collisions consistently, and -may rebase a different dll and/or move it to a different address -every time. Cygwin can usually compensate for this effect when it -involves libraries opened dynamically, but collisions among -statically-linked dlls (dependencies known at compile time) are -resolved before cygwin1.dll initializes and -cannot be fixed afterward. This problem can only be solved by -removing the base address conflicts which cause the problem, -usually using the rebaseall tool. - -Address space layout randomization (ASLR). Starting with -Vista, Windows implements ASLR, which means that thread stacks, -heap, memory-mapped files, and statically-linked dlls are placed -at different (random) locations in each process. This behaviour -interferes with a proper fork, and if an -unmovable object (process heap or system dll) ends up at the wrong -location, Cygwin can do nothing to compensate (though it will -retry a few times automatically). - -DLL injection by - -BLODA. Badly-behaved applications which -inject dlls into other processes often manage to clobber important -sections of the child's address space, leading to base address -collisions which rebasing cannot fix. The only way to resolve this -problem is to remove (usually uninstall) the offending app. See - for the -detect_bloda option, which may be able to identify the -BLODA. - -In summary, current Windows implementations make it -impossible to implement a perfectly reliable fork, and occasional -fork failures are inevitable. - - - - -Signals -When -a Cygwin process starts, the library starts a secondary thread for -use in signal handling. This thread waits for Windows events used to -pass signals to the process. When a process notices it has a signal, -it scans its signal bitmask and handles the signal in the appropriate -fashion. - -Several complications in the implementation arise from the -fact that the signal handler operates in the same address space as the -executing program. The immediate consequence is that Cygwin system -functions are interruptible unless special care is taken to avoid -this. We go to some lengths to prevent the sig_send function that -sends signals from being interrupted. In the case of a process -sending a signal to another process, we place a mutex around sig_send -such that sig_send will not be interrupted until it has completely -finished sending the signal. - -In the case of a process sending -itself a signal, we use a separate semaphore/event pair instead of the -mutex. sig_send starts by resetting the event and incrementing the -semaphore that flags the signal handler to process the signal. After -the signal is processed, the signal handler signals the event that it -is done. This process keeps intraprocess signals synchronous, as -required by POSIX. - -Most standard UNIX signals are provided. Job -control works as expected in shells that support -it. - - -Sockets -Socket-related calls in Cygwin basically call the functions by the -same name in Winsock, Microsoft's implementation of Berkeley sockets, but -with lots of tweaks. All sockets are non-blocking under the hood to allow -to interrupt blocking calls by POSIX signals. Additional bookkeeping is -necessary to implement correct socket sharing POSIX semantics and especially -for the select call. Some socket-related functions are not implemented at -all in Winsock, as, for example, socketpair. Starting with Windows Vista, -Microsoft removed the legacy calls rcmd(3), -rexec(3) and rresvport(3). -Recent versions of Cygwin now implement all these calls internally. - -An especially troublesome feature of Winsock is that it must be -initialized before the first socket function is called. As a result, Cygwin -has to perform this initialization on the fly, as soon as the first -socket-related function is called by the application. In order to support -sockets across fork calls, child processes initialize Winsock if any -inherited file descriptor is a socket. - -AF_UNIX (AF_LOCAL) sockets are not available in Winsock. They are -implemented in Cygwin by using local AF_INET sockets instead. This is -completely transparent to the application. Cygwin's implementation also -supports the getpeereid BSD extension. However, Cygwin does not yet support -descriptor passing. - -IPv6 is supported beginning with Cygwin release 1.7.0. This -support is dependent, however, on the availability of the Windows IPv6 -stack. The IPv6 stack was "experimental", i.e. not feature complete in -Windows 2003 and earlier. Full IPv6 support became available starting -with Windows Vista and Windows Server 2008. Cygwin does not depend on -the underlying OS for the (newly implemented) getaddrinfo -and getnameinfo functions. Cygwin 1.7.0 adds -replacement functions which implement the full functionality for IPv4. - - - -Select -The UNIX select function is another -call that does not map cleanly on top of the Win32 API. Much to our -dismay, we discovered that the Win32 select in Winsock only worked on -socket handles. Our implementation allows select to function normally -when given different types of file descriptors (sockets, pipes, -handles, and a custom /dev/windows Windows messages -pseudo-device). - -Upon entry into the select function, the first -operation is to sort the file descriptors into the different types. -There are then two cases to consider. The simple case is when at -least one file descriptor is a type that is always known to be ready -(such as a disk file). In that case, select returns immediately as -soon as it has polled each of the other types to see if they are -ready. The more complex case involves waiting for socket or pipe file -descriptors to be ready. This is accomplished by the main thread -suspending itself, after starting one thread for each type of file -descriptor present. Each thread polls the file descriptors of its -respective type with the appropriate Win32 API call. As soon as a -thread identifies a ready descriptor, that thread signals the main -thread to wake up. This case is now the same as the first one since -we know at least one descriptor is ready. So select returns, after -polling all of the file descriptors one last time. - - - diff --git a/winsup/doc/legal.xml b/winsup/doc/legal.xml deleted file mode 100644 index f909f4915..000000000 --- a/winsup/doc/legal.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - -Copyright © 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc. - - - -Permission is granted to make and distribute verbatim copies of -this documentation provided the copyright notice and this permission -notice are preserved on all copies. - -Permission is granted to copy and distribute modified versions -of this documentation under the conditions for verbatim copying, -provided that the entire resulting derived work is distributed under -the terms of a permission notice identical to this one. - -Permission is granted to copy and distribute translations of -this documentation into another language, under the above conditions -for modified versions, except that this permission notice may be -stated in a translation approved by the Free Software -Foundation. - - diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml deleted file mode 100644 index 240159565..000000000 --- a/winsup/doc/new-features.xml +++ /dev/null @@ -1,1363 +0,0 @@ - - - -What's new and what changed in Cygwin 1.7 - -What's new and what changed from 1.7.27 to 1.7.28 - - - - -popen now supports the Glibc 'e' flag to set the FD_CLOEXEC flag on the pipe -in a thread-safe way. - - - -New netinet/ip6.h header. - - - -Switch to BSD FILE stream fopen/exit semantics, as in all BSD variants -and Linux/GLibc: Don't fflush/lseek a FILE stream on fclose and exit, -if it only has been read from. - - - - - - -What's new and what changed from 1.7.26 to 1.7.27 - - - - -Don't create native symlinks with target paths having long path prefixes -"\\?\" if the target path is shorter than MAX_PATH characters. This works -around a Windows 8.1 bug: The ShellExecuteW fails if the lpFile parameter -points to a native NTFS symlink with a target path prefixed with "\\?\". - - - - - - -What's new and what changed from 1.7.25 to 1.7.26 - - - - -getaddrinfo now supports glibc-specific International Domain Name (IDN) -extension flags: AI_IDN, AI_CANONIDN, AI_IDN_ALLOW_UNASSIGNED, -AI_IDN_USE_STD3_ASCII_RULES. - - - -getnameinfo now supports glibc-specific International Domain Name (IDN) -extension flags: NI_IDN, NI_IDN_ALLOW_UNASSIGNED, NI_IDN_USE_STD3_ASCII_RULES. - - - -Slightly improve randomness of /dev/random emulation. - - - -Allow to use advisory locking on any device. POSIX fcntl and lockf locking -works with any device, BSD flock locking only with devices backed by an OS -handle. Right now this excludes console windows on pre Windows 8, as well as -almost all virtual files under /proc from BSD flock locking. - - - -The header /usr/include/exceptions.h, containing implementation details for -32 bit Windows' exception handling only, has been removed. - - - -Preliminary, experimental support of the posix_spawn family of functions. -New associated header /usr/include/spawn.h. - - - - - - -What's new and what changed from 1.7.24 to 1.7.25 - - - - -Change magic number associated with process information block so that 32-bit -Cygwin processes don't try to interpret 64-bit information and vice-versa. - - - -Redefine content of mtget tape info struct to allow fetching the number of -partitions on a tape. - - - - - - -What's new and what changed from 1.7.23 to 1.7.24 - - - - -Allow application override of posix_memalign. - - - - - - -What's new and what changed from 1.7.22 to 1.7.23 - - - - -Added CYGWIN environment variable keyword "wincmdln" which causes Cygwin to -send the full windows command line to any subprocesses. - - - - - - -What's new and what changed from 1.7.21 to 1.7.22 - - - - -Support for /dev/mem, /dev/kmem and /dev/port removed, since OS support -was limited to 32 bit Windows XP only. - - - -Added cygwin GetCommandLine wrappers which will allow Cygwin programs to -(appear to) use the Windows command line functions. - - - -regcomp(3) now allows character values >= 0x80 if the current codeset is -ASCII (default codeset in the "C"/"POSIX" locale). This allows patterns -containing arbitrary byte values as GLibc's regcomp. - - - - - - -What's new and what changed from 1.7.20 to 1.7.21 - - - - -New API: rawmemchr. - - - - - - -What's new and what changed from 1.7.18 to 1.7.19 - - - - -Drop support for Windows 2000 and Windows XP pre-SP3. - - - -Add support for building a 64 bit version of Cygwin on x86_64 natively. - - - -Add support for creating native NTFS symlinks starting with Windows Vista -by setting the CYGWIN=winsymlinks:native or CYGWIN=winsymlinks:nativestrict -option. - - - -Add support for AFS filesystem. - - - -Preliminary support for mandatory locking via fcntl/flock/lockf, using Windows -locking semantics. New F_LCK_MANDATORY fcntl command. - - - -New APIs: __b64_ntop, __b64_pton, arc4random, arc4random_addrandom, -arc4random_buf, arc4random_stir, arc4random_uniform. - - - - - - -What's new and what changed from 1.7.17 to 1.7.18 - - - -Added Windows console cursor appearance support. - - - - - Show/Hide Cursor mode (DECTCEM): "ESC[?25h" / "ESC[?25l" - - - - Set cursor style (DECSCUSR): "ESC[n q" (note the space before the q); - where n is 0, 1, 2 for block cursor, 3, 4 for underline cursor (all - disregarding blinking mode), or > 4 to set the cursor height to a - percentage of the cell height. - - - - - - - -For performance reasons, Cygwin does not try to create sparse files -automatically anymore, unless you use the new "sparse" mount option. - - - -New API: cfsetspeed. - - - - - - -What's new and what changed from 1.7.16 to 1.7.17 - - - - -Support the "e" flag to fopen(3). This is a Glibc extension which -allows to fopen the file with the O_CLOEXEC flag set. - - - -Support the "x" flag to fopen(3). This is a Glibc/C11 extension which -allows to open the file with the O_EXCL flag set. - - - - - - -What's new and what changed from 1.7.15 to 1.7.16 - - - - -New API: getmntent_r, memrchr. - - - -Recognize ReFS filesystem. - - - - - - -What's new and what changed from 1.7.14 to 1.7.15 - - - - -CYGWIN=pipe_byte option now forces the opening of pipes in byte mode rather than message mode. - - - - - - -What's new and what changed from 1.7.13 to 1.7.14 - - - - -Add mouse reporting modes 1005, 1006 and 1015 to console window. - - - - - - -What's new and what changed from 1.7.12 to 1.7.13 - - - - -mkpasswd and mkgroup now try to print an entry for the TrustedInstaller -account existing since Windows Vista/Server 2008. - - - -Terminal typeahead when switching from canonical to non-canonical mode -is now properly flushed. - - - - - - -What's new and what changed from 1.7.11 to 1.7.12 - - - - -Cygwin now automatically populates the /dev directory with all existing -POSIX devices. - - - -Add virtual /proc/PID/mountinfo file. - - - -flock now additionally supports the following scenario, which requires - to propagate locks to the parent process: - - ( - flock -n 9 || exit 1 - # ... commands executed under lock ... - } 9>/var/lock/mylockfile - - Only propagation to the direct parent process is supported so far, - not to grand parents or sibling processes. - - - -Add a "detect_bloda" setting for the CYGWIN environment variable to help -finding potential BLODAs. - - - - - - -What's new and what changed from 1.7.10 to 1.7.11 - - - - -New pldd command for listing DLLs loaded by a process. - - - -New API: scandirat. - - - -Change the way remote shares mapped to drive letters are recognized when -creating the cygdrive directory. If Windows claims the drive is -unavailable, don't show it in the cygdrive directory listing. - - - -Raise default stacksize of pthreads from 512K to 1 Meg. It can still be -changed using the pthread_attr_setstacksize call. - - - - - - -What's new and what changed from 1.7.9 to 1.7.10 - - - - -Drop support for Windows NT4. - - - -The CYGWIN environment variable options "envcache", "strip_title", "title", -"tty", and "upcaseenv" have been removed. - - - -If the executable (and the system) is large address aware, the application heap -will be placed in the large memory area. The peflags tool -from the rebase package can be used to set the large -address awareness flag in the executable file header. - - - -The registry setting "heap_chunk_in_mb" has been removed, in favor of a new -per-executable setting in the executable file header which can be set using the -peflags tool. See -for more information. - - - -The CYGWIN=tty mode using pipes to communicate with the console in a pseudo -tty-like mode has been removed. Either just use the normal Windows console -as is, or use a terminal application like mintty. - - - -New getconf command for querying confstr(3), pathconf(3), -sysconf(3), and limits.h configuration. - - - -New tzset utility to generate a POSIX-compatible TZ -environment variable from the Windows timezone settings. - - - -The passwd command now allows an administrator to use the -R command for -other user accounts: passwd -R username. - - - -Pthread spinlocks. New APIs: pthread_spin_destroy, pthread_spin_init, -pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock. - - - -Pthread stack address management. New APIs: pthread_attr_getstack, -pthread_attr_getstackaddr, pthread_attr_getguardsize, pthread_attr_setstack, -pthread_attr_setstackaddr, pthread_attr_setguardsize, pthread_getattr_np. - - - -POSIX Clock Selection option. New APIs: clock_nanosleep, -pthread_condattr_getclock, pthread_condattr_setclock. - - - -clock_gettime(3) and clock_getres(3) accept per-process and per-thread CPU-time -clocks, including CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID. -New APIs: clock_getcpuclockid, pthread_getcpuclockid. - - - -GNU/glibc error.h error reporting functions. New APIs: error, error_at_line. -New exports: error_message_count, error_one_per_line, error_print_progname. -Also, perror and strerror_r no longer clobber strerror storage. - - - -C99 <tgmath.h> type-generic macros. - - - -/proc/loadavg now shows the number of currently running processes and the -total number of processes. - - - -Added /proc/devices and /proc/misc, which lists supported device types and -their device numbers. - - - -Added /proc/swaps, which shows the location and size of Windows paging file(s). - - - -Added /proc/sysvipc/msg, /proc/sysvipc/sem, and /proc/sysvipc/shm which -provide information about System V IPC message queues, semaphores, and -shared memory. - - - -/proc/version now shows the username of whomever compiled the Cygwin DLL -as well as the version of GCC used when compiling. - - - -dlopen now supports the Glibc-specific RTLD_NODELETE and RTLD_NOOPEN flags. - - - -The printf(3) and wprintf(3) families of functions now handle the %m -conversion flag. - - - -Other new API: clock_settime, __fpurge, getgrouplist, get_current_dir_name, -getpt, ppoll, psiginfo, psignal, ptsname_r, sys_siglist, pthread_setschedprio, -pthread_sigqueue, sysinfo. - - - - - - -What's new and what changed from 1.7.8 to 1.7.9 - - - - -New API: strchrnul. - - - - - - -What's new and what changed from 1.7.7 to 1.7.8 - - - - -Drop support for Windows NT4 prior to Service Pack 4. - - - -Reinstantiate Cygwin's ability to delete an empty directory which is the -current working directory of the same or another process. Same for any -other empty directory which has been opened by the same or another process. - - - -Cygwin now ships the C standard library fenv.h header file, and implements the -related APIs (including GNU/glibc extensions): feclearexcept, fedisableexcept, -feenableexcept, fegetenv, fegetexcept, fegetexceptflag, fegetprec, fegetround, -feholdexcept, feraiseexcept, fesetenv, fesetexceptflag, fesetprec, fesetround, -fetestexcept, feupdateenv, and predefines both default and no-mask FP -environments. See the - -GNU C Library manual for full details of this functionality. - - - -Support for the C99 complex functions, except for the "long double" -implementations. New APIs: cacos, cacosf, cacosh, cacoshf, carg, cargf, casin, -casinf, casinh, casinhf, catan, catanf, catanh, catanhf, ccos, ccosf, ccosh, -ccoshf, cexp, cexpf, cimag, cimagf, clog, clogf, conj, conjf, cpow, cpowf, -cproj, cprojf, creal, crealf, csin, csinf, csinh, csinhf, csqrt, csqrtf, ctan, -ctanf, ctanh, ctanhf. - - - -Fix the width of "CJK Ambiguous Width" characters to 1 for singlebyte charsets -and 2 for East Asian multibyte charsets. (For UTF-8, it remains dependent on -the specified language, and the "@cjknarrow" locale modifier can still be used -to force width 1.) - - - -The strerror_r interface now has two flavors; if _GNU_SOURCE is -defined, it retains the previous behavior of returning char * -(but the result is now guaranteed to be NUL-terminated); otherwise -it now obeys POSIX semantics of returning int. - - - -/proc/sys now allows unfiltered access to the native NT namespace. Access -restrictions still apply. Direct device access via /proc/sys is not yet -supported. File system access via block devices works. For instance -(note the trailing slash!) - -bash$ cd /proc/sys/Device/HarddiskVolumeShadowCopy1/ - - - - -Other new APIs: llround, llroundf, madvise, pthread_yield. -Export program_invocation_name, program_invocation_short_name. -Support TIOCGPGRP, TIOCSPGRP ioctls. - - - - - - -What's new and what changed from 1.7.6 to 1.7.7 - - - - -Partially revert the 1.7.6 change to set the Win32 current working directory -(CWD) always to an invalid directory, since it breaks backward compatibility -too much. The Cygwin CWD and the Win32 CWD are now kept in sync again, unless -the Cygwin CWD is not usable as Win32 CWD. See the reworked - for details. - - - -Make sure to follow the Microsoft security advisory concerning DLL hijacking. -See the Microsoft Security Advisory (2269637) "Insecure Library Loading Could Allow Remote Code Execution" for details. - - - -Allow to link against -lbinmode instead of /lib/binmode.o. Same for --ltextmode, -ltextreadmode and -lautomode. -See for details. - - - - - - -What's new and what changed from 1.7.5 to 1.7.6 - - - - -Add new mount options "dos" and "ihash" to allow overriding Cygwin default -behaviour on broken filesystems not recognized by Cygwin. - - - -Add new mount option "bind" to allow remounting parts of the POSIX file -hirarchy somewhere else. - - - -Ttys and ptys are handled as securable objects using file-like permissions -and owner/group information. chmod and -chown now work on ttys/ptys. A new mechanism is used -to propagate pty handles safely to other processes, which does not require -to use Cygserver. - - - -Pass on coresize settings made with setrlimit(2). This allows shells to -disable creating stackdump files in child processes via -ulimit -c 0 in bash or limit coredumpsize 0 -in tcsh. - - - -Locale categories contain all localization strings additionally as wide-char -strings. locale(1) prints these values just as on Linux. nl_langinfo(3) -allows to fetch them. - - - -New interfaces mkostemp(3) and mkostemps(3) are added. - - - -New virtual file /proc/filesystems. - - - -clock_gettime(3) and clock_getres(3) accept CLOCK_MONOTONIC. - - - -DEPRECATED with 1.7.7: Cygwin handles the current working directory entirely -on its own. The Win32 current working directory is set to an invalid path to -be out of the way. [...] - - - - - - -What's new and what changed from 1.7.3 to 1.7.5 - - - - -Support for DEC Backarrow Key Mode escape sequences (ESC [ ? 67 h, ESC [ ? 67 l) -in Windows console. - - - - - - -What's new and what changed from 1.7.2 to 1.7.3 - - - - -Support for GB2312/EUC-CN. These charsets are implemented as aliases to GBK. -GB2312 is now the default charset name for the locales zh_CN and zh_SG, just -as on Linux. - - - -Modification and access timestamps of devices reflect the current time. - - - - - - -What's new and what changed from 1.7.1 to 1.7.2 - - - -Localization support has been much improved. - - - - - Cygwin now handles locales using the underlying Windows locale - support. The locale must exist in Windows to be recognized. - Locale aliases from the file /usr/share/locale/locale.alias are also - allowed, as long as their replacement is supported by the underlying Windows. - - - - New tool "locale" to fetch locale information and default locales based on - the Windows default settings as well as lists of all supported locales - and character sets. - - - - Default charset for locales without explicit charset is now chosen - from a list of Linux-compatible charsets. - - - - For instance: en_US -> ISO-8859-1, ja_JP -> EUC-JP, zh_TW -> Big5. - - - - Added support for the charsets GEORGIAN-PS, PT154, and TIS-620. - - - - Support for the various locale modifiers to switch charsets as on Linux. - - - - Default charset in the "C" or "POSIX" locale has been changed back - from UTF-8 to ASCII, to avoid problems with applications - expecting a singlebyte charset in the "C"/"POSIX" locale. Still use - UTF-8 internally for filename conversion in this case. - - - - LC_COLLATE, LC_MONETARY, LC_NUMERIC, and LC_TIME localization is - enabled via Windows locale support. LC_MESSAGES is enabled via a big - table with localized strings. - - - - fnmatch(3), regcomp(3), regexec(3) calls are now multibyte-aware. - - - - printf(3), wprintf(3) families of functions now handle the grouping - flag, the apostrophe ', per POSIX-1.2008. The - integer portion of the result of a decimal conversion (%i, %d, %u, %f, - %F, %g, %G) will be formatted with thousands' grouping characters. - - - - strftime(3), wcsftime(3), and strptime(3) now handle the E and O format - modifiers to print/scan alternative date and time representations or to - use alternative digits in locales which support this. Additionally these - functions now also support the padding modifiers '0' and '+', as well as - a field width per POSIX-1.2008. - - - - New strfmon(3) call. - - - - - - - -Support open(2) flags O_CLOEXEC and O_TTY_INIT flags. Support fcntl -flag F_DUPFD_CLOEXEC. Support socket flags SOCK_CLOEXEC and SOCK_NONBLOCK. -Add new Linux-compatible API calls accept4(2), dup3(2), and pipe2(2). -Support the signal SIGPWR. - - -Enhanced Windows console support. - - - - - The console's backspace keycode can be changed using 'stty erase'. - - - - Function keys send distinguished escape sequences compatible with rxvt. - Keypad keys send distinguished escape sequences, xterm-style. - - - - Support of combining Alt and AltGr modifiers in console window - (compatible with xterm and mintty), so that e.g. Alt-@ sends ESC @ - also on keyboards where @ is mapped to an AltGr combination. - - - - Report mouse wheel scroll events in mouse reporting mode 1000 (note: - this doesn't seem to work on all systems, assumedly due to driver - interworking issues). - Add mouse reporting mode 1002 to report mouse drag movement. - Add mouse reporting mode 1003 to report any mouse movement. - Add focus event reporting (mode 1004), compatible with xterm and mintty. - - - - Add escape sequences for not bold (22), not invisible (28), not - blinking (25) (compatible with xterm and mintty). - - - - Support VT100 line drawing graphics mode in console window (compatible - with xterm and mintty). - - - - - - - -Handle native DOS paths always as if mounted with "posix=0,noacl". - - - -Handle UNC paths starting with slashes identical to /cygdrive paths. -In other words, use the /cygdrive mount flags for these paths as well. - - - -Recognize NWFS filesystem and workaround broken OS call. - - - -New support for eXtensible Data Record (XDR) encoding and decoding, -as defined by RFCs 1014, 1832, and 4506. The XDR protocol and -functions are useful for cross-platfrom data exchange, and are -commonly used as the core data interchange format for Remote -Procedure Call (RPC) and NFS. - - - - - - -OS related changes - - - - -Windows 95, 98 and Me are not supported anymore. The new Cygwin 1.7 DLL -will not run on any of these systems. - - - -Add support for Windows 7 and Windows Server 2008 R2. - - - - - - -File Access related changes - - - - -Mount points are no longer stored in the registry. Use /etc/fstab and -/etc/fstab.d/$USER instead. Mount points created with mount(1) are only -local to the current session and disappear when the last Cygwin process -in the session exits. - - - -Cygwin creates the mount points for /, /usr/bin, and /usr/lib -automatically from it's own position on the disk. They don't have to be -specified in /etc/fstab. - - - -If a filename cannot be represented in the current character set, the -character will be converted to a sequence Ctrl-X + UTF-8 representation -of the character. This allows to access all files, even those not -having a valid representation of their filename in the current character -set. To always have a valid string, use the UTF-8 charset by -setting the environment variable $LANG, $LC_ALL, or $LC_CTYPE to a valid -POSIX value, such as "en_US.UTF-8". - - - -PATH_MAX is now 4096. Internally, path names can be as long as the -underlying OS can handle (32K). - - - -struct dirent now supports d_type, filled out with DT_REG or DT_DIR. -All other file types return as DT_UNKNOWN for performance reasons. - - - -The CYGWIN environment variable options "ntsec" and "smbntsec" have been -replaced by the per-mount option "acl"/"noacl". - - - -The CYGWIN environment variable option "ntea" has been removed without -substitute. - - - -The CYGWIN environment variable option "check_case" has been removed in -favor of real case-sensitivity on file systems supporting it. - - - -Creating filenames with special DOS characters '"', '*', ':', '<', -'>', '|' is supported. - - - -Creating files with special DOS device filename components ("aux", -"nul", "prn") is supported. - - - -File names are case sensitive if the OS and the underlying file system -supports it. Works on NTFS and NFS. Does not work on FAT and Samba -shares. Requires to change a registry key (see the User's Guide). Can -be switched off on a per-mount basis. - - - -Due to the above changes, managed mounts have been removed. - - - -Incoming DOS paths are always handled case-insensitive and get no POSIX -permission, as if they are mounted with noacl,posix=0 mount flags. - - - -unlink(2) and rmdir(2) try very hard to remove files/directories even if -they are currently accessed or locked. This is done by utilizing the -hidden recycle bin directories and marking the files for deletion. - - - -rename(2) rewritten to be more POSIX conformant. - - - -access(2) now performs checks using the real user ID, as required by -POSIX; the old behavior of querying based on effective user ID is -available through the new faccessat(2) and euidaccess(2) APIs. - - - -Add st_birthtim member to struct stat. - - - -File locking is now advisory, not mandatory anymore. The fcntl(2) and -the new lockf(2) APIs create and maintain locks with POSIX semantics, -the flock(2) API creates and maintains locks with BSD semantics. POSIX -and BSD locks are independent of each other. - - - -Implement atomic O_APPEND mode. - - - -New open(2) flags O_DIRECTORY, O_EXEC and O_SEARCH. - - - -Make the "plain file with SYSTEM attribute set" style symlink default -again when creating symlinks. Only create Windows shortcut style -symlinks if CYGWIN=winsymlinks is set in the environment. - - - -Symlinks now use UTF-16 encoding for the target filename for better -internationalization support. Cygwin 1.7 can read all old style -symlinks, but the new style is not compatible with older Cygwin -releases. - - - -Handle NTFS native symlinks available since Vista/2008 as symlinks (but -don't create Vista/2008 symlinks due to unfortunate OS restrictions). - - - -Recognize NFS shares and handle them using native mechanisms. Recognize -and create real symlinks on NFS shares. Get correct stat(2) information -and set real mode bits on open(2), mkdir(2) and chmod(2). - - - -Recognize MVFS and workaround problems manipulating metadata and handling -DOS attributes. - - - -Recognize Netapp DataOnTap drives and fix inode number handling. - - - -Recognize Samba version beginning with Samba 3.0.28a using the new -extended version information negotiated with the Samba developers. - - - -Stop faking hardlinks by copying the file on filesystems which don't -support hardlinks natively (FAT, FAT32, etc.). Just return an error -instead, just like Linux. - - - -List servers of all accessible domains and workgroups in // instead of -just the servers in the own domain/workgroup. - - - -Support Linux-like extended attributes ([fl]getxattr, [fl]listxattr, -[fl]setxattr, [fl]removexattr). - - - -New file conversion API for conversion from Win32 to POSIX path and vice -versa (cygwin_conv_path, cygwin_create_path, cygwin_conv_path_list). - - - -New openat family of functions: openat, faccessat, fchmodat, fchownat, -fstatat, futimesat, linkat, mkdirat, mkfifoat, mknodat, readlinkat, -renameat, symlinkat, unlinkat. - - - -Other new APIs: posix_fadvise, posix_fallocate, funopen, fopencookie, -open_memstream, open_wmemstream, fmemopen, fdopendir, fpurge, mkstemps, -eaccess, euidaccess, canonicalize_file_name, fexecve, execvpe. - - - - - - -Network related changes - - - - -New implementation for blocking sockets and select on sockets which is -supposed to allow POSIX-compatible sharing of sockets between threads -and processes. - - - -send/sendto/sendmsg now send data in 64K chunks to circumvent an -internal buffer problem in WinSock (KB 201213). - - - -New send/recv option MSG_DONTWAIT. - - - -IPv6 support. New APIs getaddrinfo, getnameinfo, freeaddrinfo, -gai_strerror, in6addr_any, in6addr_loopback. On IPv6-less systems, -replacement functions are available for IPv4. On systems with IPv6 -enabled, the underlying WinSock functions are used. While I tried hard -to get the functionality as POSIXy as possible, keep in mind that a -*fully* conformant implementation of getaddrinfo and other stuff is only -available starting with Windows Vista/2008. - - - -Resolver functions (res_init, res_query, res_search, res_querydomain, -res_mkquery, res_send, dn_comp, dn_expand) are now part of Cygwin. -Applications don't have to link against minires anymore. Actually, this -*is* the former libminires.a. - - - -rcmd is now implemented inside of Cygwin, instead of calling the WinSock -function. This allows rsh(1) usage on Vista/2008 and later, which -dropped this function from WinSock. - - - -Define multicast structures in netinet/in.h. Note that fully conformant -multicast support is only available beginning with Vista/2008. - - - -Improve get_ifconf. Redefine struct ifreq and subsequent datastructures -to be able to keep more information. Support SIOCGIFINDEX, -SIOCGIFDSTADDR and the Cygwin specific SIOCGIFFRNDLYNAM. Support real -interface flags on systems supporting them. - - - -Other new APIs: bindresvport, bindresvport_sa, gethostbyname2, -iruserok_sa, rcmd_af, rresvport_af. getifaddrs, freeifaddrs, -if_nametoindex, if_indextoname, if_nameindex, if_freenameindex. - - - -Add /proc/net/if_inet6. - - - - - - -Device related changes - - - - -Reworked pipe implementation which uses overlapped IO to create more -reliable interruptible pipes and fifos. - - - -The CYGWIN environment variable option "binmode" has been removed. - - - -Improved fifo handling by using native Windows named pipes. - - - -Detect when a stdin/stdout which looks like a pipe is really a tty. -Among other things, this allows a debugged application to recognize that -it is using the same tty as the debugger. - - - -Support UTF-8 in console window. - - - -In the console window the backspace key now emits DEL (0x7f) instead of -BS (0x08), Alt-Backspace emits ESC-DEL (0x1b,0x7f) instead of DEL -(0x7f), same as the Linux console and xterm. Control-Space now emits an -ASCII NUL (0x0) character. - - - -Support up to 64 serial interfaces using /dev/ttyS0 - /dev/ttyS63. - - - -Support up to 128 raw disk drives /dev/sda - /dev/sddx. - - - -New API: cfmakeraw, get_avphys_pages, get_nprocs, get_nprocs_conf, -get_phys_pages, posix_openpt. - - - - - - -Other POSIX related changes - - - - -A lot of character sets are supported now via a call to setlocale(). -The setting of the environment variables $LANG, $LC_ALL or $LC_CTYPE -will be used. For instance, setting $LANG to "de_DE.ISO-8859-15" before -starting a Cygwin session will use the ISO-8859-15 character set in the -entire session. The default locale in the absence of one of the -aforementioned environment variables is "C.UTF-8". - - - -The full list of supported character sets: "ASCII", "ISO-8859-x" with x -in 1-16, except 12, "UTF-8", Windows codepages "CPxxx", with xxx in -(437, 720, 737, 775, 850, 852, 855, 857, 858, 862, 866, 874, 1125, 1250, -1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258), "KOI8-R", "KOI8-U", -"SJIS", "GBK", "eucJP", "eucKR", and "Big5". - - - - - -Allow multiple concurrent read locks per thread for pthread_rwlock_t. - - - -Implement pthread_kill(thread, 0) as per POSIX. - - - -New API for POSIX IPC: Named semaphores: sem_open, sem_close, -sem_unlink. Message queues: mq_open, mq_getattr, mq_setattr, mq_notify, -mq_send, mq_timedsend, mq_receive, mq_timedreceive, mq_close, mq_unlink. -Shared memory: shm_open, shm_unlink. - - - -Only declare expected functions in <strings.h>, don't include -<string.h> from here. - - - -Support for WCONTINUED, WIFCONTINUED() added to waitpid and wait4. - - - -New APIs: _Exit, confstr, insque, remque, sys_sigabbrev, posix_madvise, -posix_memalign, reallocf, exp10, exp10f, pow10, pow10f, lrint, lrintf, -rint, rintf, llrint, llrintf, llrintl, lrintl, rintl, mbsnrtowcs, -strcasestr, stpcpy, stpncpy, wcpcpy, wcpncpy, wcsnlen, wcsnrtombs, -wcsftime, wcstod, wcstof, wcstoimax, wcstok, wcstol, wcstoll, wcstoul, -wcstoull, wcstoumax, wcsxfrm, wcscasecmp, wcsncasecmp, fgetwc, fgetws, -fputwc, fputws, fwide, getwc, getwchar, putwc, putwchar, ungetwc, -asnprintf, dprintf, vasnprintf, vdprintf, wprintf, fwprintf, swprintf, -vwprintf, vfwprintf, vswprintf, wscanf, fwscanf, swscanf, vwscanf, -vfwscanf, vswscanf. - - - - - - -Security related changes - - - - -Getting a domain user's groups is hopefully more bulletproof now. - - - -Cygwin now comes with a real LSA authentication package. This must be -manually installed by a privileged user using the /bin/cyglsa-config -script. The advantages and disadvantages are noted in -http://cygwin.com/ml/cygwin-developers/2006-11/msg00000.html - - - -Cygwin now allows storage and use of user passwords in a hidden area of -the registry. This is tried first when Cygwin is called by privileged -processes to switch the user context. This allows, for instance, ssh -public key sessions with full network credentials to access shares on -other machines. - - - -New options have been added to the mkpasswd and mkgroup tools to ease -use in multi-machine and multi-domain environments. The existing -options have a slightly changed behaviour. - - - - - - -Miscellaneous - - - - -New ldd utility, similar to Linux. - - - -New link libraries libdl.a, libresolv.a, librt.a. - - - -Fallout from the long path names: If the current working directory is -longer than 260 bytes, or if the current working directory is a virtual -path (like /proc, /cygdrive, //server), don't call native Win32 programs -since they don't understand these paths. - - - -On the first usage of a DOS path (C:\foo, \\foo\bar), the Cygwin DLL -emits a scary warning that DOS paths shouldn't be used. This warning -may be disabled via the new CYGWIN=nodosfilewarning setting. - - - -The CYGWIN environment variable option "server" has been removed. -Cygwin automatically uses cygserver if it's available. - - - -Allow environment of arbitrary size instead of a maximum of 32K. - - - -Don't force uppercase environment when started from a non-Cygwin -process. Except for certain Windows and POSIX variables which are -always uppercased, preserve environment case. Switch back to old -behaviour with the new CYGWIN=upcaseenv setting. - - - -Detect and report a missing DLL on process startup. - - - -Add /proc/registry32 and /proc/registry64 paths to access 32 bit and 64 -bit registry on 64 bit systems. - - - -Add the ability to distinguish registry keys and registry values with -the same name in the same registry subtree. The key is called "foo" and -the value will be called "foo%val" in this case. - - - -Align /proc/cpuinfo more closly to Linux content. - - - -Add /proc/$PID/mounts entries and a symlink /proc/mounts pointing to -/proc/self/mounts as on Linux. - - - -Optimized strstr and memmem implementation. - - - -Remove backwards compatibility with old signal masks. (Some *very* old -programs which use signal masks may no longer work correctly). - - - -Cygwin now exports wrapper functions for libstdc++ operators new and -delete, to support the toolchain in implementing full C++ standards -conformance when working with shared libraries. - - - -Different Cygwin installations in different paths can be run in parallel -without knowing of each other. The path of the Cygwin DLL used in a -process is a key used when creating IPC objects. So different Cygwin -DLLs are running in different namespaces. - - - -Each Cygwin DLL stores its path and installation key in the registry. -This allows troubleshooting of problems which could be a result of -having multiple concurrent Cygwin installations. - - - - - - - diff --git a/winsup/doc/ntsec.xml b/winsup/doc/ntsec.xml deleted file mode 100644 index 72cf7bb89..000000000 --- a/winsup/doc/ntsec.xml +++ /dev/null @@ -1,889 +0,0 @@ - - - -Using Windows security in Cygwin - -This section discusses how the Windows security model is -utilized in Cygwin to implement POSIX-like permissions, as well as how -the Windows authentication model is used to allow cygwin applications -to switch users in a POSIX-like fashion. - -The setting of POSIX-like file and directory permissions is -controlled by the mount option -(no)acl which is set to acl by -default. - -We start with a short overview. Note that this overview must -be necessarily short. If you want to learn more about the Windows security -model, see the Access Control article in MSDN documentation. - -POSIX concepts and in particular the POSIX security model are not -discussed here, but assumed to be understood by the reader. If you -don't know the POSIX security model, search the web for beginner -documentation. - -Overview - -In the Windows security model, almost any "object" is securable. -"Objects" are files, processes, threads, semaphores, etc. - -Every object has a data structure attached, called a "security -descriptor" (SD). The SD contains all information necessary to control -who can access an object, and to determine what they are allowed to do -to or with it. The SD of an object consists of five parts: - - -Flags which control several aspects of this SD. This is -not discussed here. -The SID of the object owner. -The SID of the object owner group. -A list of "Access Control Entries" (ACE), called the -"Discretionary Access Control List" (DACL). -Another list of ACEs, called the "Security Access Control List" -(SACL), which doesn't matter for our purpose. We ignore it here. - - -Every ACE contains a so-called "Security IDentifier" (SID) and -other stuff which is explained a bit later. Let's talk about the SID first. - - -A SID is a unique identifier for users, groups, computers and -Active Directory (AD) domains. SIDs are basically comparable to POSIX -user ids (UIDs) and group ids (GIDs), but are more complicated because -they are unique across multiple machines or domains. A SID is a -structure of multiple numerical values. There's a convenient convention -to type SIDs, as a string of numerical fields separated by hyphen -characters. Here's an example: - -SID of a machine "foo": - - - S-1-5-21-165875785-1005667432-441284377 - - -SID of a user "johndoe" of the system "foo": - - - S-1-5-21-165875785-1005667432-441284377-1023 - - -The first field is always "S", which is just a notational convention -to show that this is a SID. The second field is the version number of -the SID structure, So far there exists only one version of SIDs, so this -field is always 1. The third and fourth fields represent the "authority" -which can be thought of as a type or category of SIDs. There are a -couple of builtin accounts and accounts with very special meaning which -have certain well known values in these third and fourth fields. -However, computer and domain SIDs always start with "S-1-5-21". The -next three fields, all 32 bit values, represent the unique 96 bit -identifier of the computer system. This is a hopefully unique value all -over the world, but in practice it's sufficient if the computer SIDs are -unique within a single Windows network. - -As you can see in the above example, SIDs of users (and groups) -are identical to the computer SID, except for an additional part, the -so-called "relative identifier" (RID). So the SID of a user is always -uniquely attached to the system on which the account has been generated. - -It's a bit different in domains. The domain has its own SID, and -that SID is identical to the SID of the first domain controller, on -which the domain is created. Domain user SIDs look exactly like the -computer user SIDs, the leading part is just the domain SID and the RID -is created when the user is created. - -Ok, consider you created a new domain "bar" on some new domain -controller and you would like to create a domain account "johndoe": - -SID of a domain "bar.local": - - - S-1-5-21-186985262-1144665072-740312968 - - -SID of a user "johndoe" in the domain "bar.local": - - - S-1-5-21-186985262-1144665072-740312968-1207 - - -So you now have two accounts called johndoe, one account -created on the machine "foo", one created in the domain "bar.local". -Both have different SIDs and not even the RID is the same. How do -the systems know it's the same account? After all, the name is -the same, right? The answer is, these accounts are not identical. All machines on the network will -treat these SIDs as identifying two separate accounts. One is -"FOO\johndoe", the other one is "BAR\johndoe" or "johndoe@bar.local". -Different SID, different account. Full stop. - -The last part of the SID, the so called "Relative IDentifier" (RID), -is by default used as UID and/or GID under Cygwin when you create the -/etc/passwd and /etc/group -files using the mkpasswd and mkgroup -tools. Domain account UIDs and GIDs are offset by 10000 by default -which might be a bit low for very big organizations. Fortunately there's -an option in both tools to change the offset... - -Do you still remember the SIDs with special meaning? In offical -notation they are called "well-known SIDs". For example, POSIX has no GID -for the group of "all users" or "world" or "others". The last three rwx -bits in a unix-style permission value just represent the permissions for -"everyone who is not the owner or is member of the owning group". -Windows has a SID for these poor souls, the "Everyone" SID. Other -well-known SIDs represent circumstances under which a process is -running, rather than actual users or groups. Here are a few examples -for well-known SIDs: - - -Everyone S-1-1-0 Simply everyone... -Batch S-1-5-3 Processes started via the task - scheduler are member of this group. -Interactive S-1-5-4 Only processes of users which are - logged in via an interactive - session are members here. -Authenticated Users S-1-5-11 Users which have gone through - the authentication process and - survived. Anonymously accessing - users are not incuded here. -SYSTEM S-1-5-18 A special account which has all - kinds of dangerous rights, sort of - an uber-root account. - - -For a full list please refer to the MSDN document Well-known -SIDs. The Cygwin package called "csih" provides a tool, -/usr/lib/csih/getAccountName.exe, which can be used to print the -(possibly localized) name for the various well-known SIDS. - -Naturally, well-known SIDs are the same on each machine, so they are -not unique to a machine or domain. They have the same meaning across -the Windows network. - -Additionally, there are a couple of well-known builtin groups, -which have the same SID on every machine and which have certain user -rights by default: - - -administrators S-1-5-32-544 -users S-1-5-32-545 -guests S-1-5-32-546 -... - - -For instance, every account is usually member in the "Users" -group. All administrator accounts are member of the "Administrators" -group. That's all about it as far as single machines are involved. In -a domain environment it's a bit more tricky. Since these SIDs are not -unique to a machine, every domain user and every domain group can be a -member of these well known groups. Consider the domain group "Domain -Admins". This group is by default in the "Administrators" group. Let's -assume the above computer called "foo" is a member machine of the domain -"bar.local". If you stick the user "BAR\johndoe" into the group "Domain -Admins", this guy will automatically be a member of the administrators -group on "foo" when logging on to "foo". Neat, isn't it? - -Back to ACE and ACL. POSIX is able to create three different -permissions, the permissions for the owner, for the group and for the -world. In contrast the Windows ACL has a potentially infinite number of -members... as long as they fit into 64K. Every member is an ACE. -ACE consist of three parts: - - -The type of the ACE (allow ACE or deny ACE). -Permission bits, 32 of them. -The SID for which the permissions are allowed or denied. - - -The two (for us) important types of ACEs are the "access allowed -ACE" and the "access denied ACE". As the names imply, the allow ACE -tells the system to allow the given permissions to the SID, the deny ACE -results in denying the specific permission bits. - -The possible permissions on objects are more detailed than in -POSIX. For example, the permission to delete an object is different -from the permission to change object data, and even changing object data -can be separated into different permission bits for different kind of -data. But there's a problem with the definition of a "correct" ACL -which disallows mapping of certain POSIX permissions cleanly. See -. - -POSIX is able to create only three different permissions? Not quite. -Newer operating systems and file systems on POSIX systems also provide -access control lists. Two different APIs exist for accessing these -ACLs, the Solaris API and the POSIX API. Cygwin implements the Solaris -API to access Windows ACLs in a Unixy way. At the time of writing this -document, the Cygwin implementation of the Solaris API isn't quite up -to speed. For instance, it doesn't handle access denied ACEs gracefully. -So, use with care. Online man pages for the Solaris ACL API can be -found on http://docs.sun.com. - - - -File permissions - -On NTFS and if the noacl mount option is not -specified for a mount point, Cygwin sets file permissions as in POSIX. -Basically this is done by defining a SD with the matching owner and group -SIDs, and a DACL which contains ACEs for the owner, the group and for -"Everyone", which represents what POSIX calls "others". - -To use Windows security correctly, Cygwin depends on the files -/etc/passwd and /etc/group. -These files define the translation between the Cygwin uid/gid and the -Windows SID. The SID is stored in the pw_gecos field in -/etc/passwd, and in the gr_passwd field in -/etc/group. Since the pw_gecos field can contain -more information than just a SID, there are some rules for the layout. -It's required that the SID is the last entry of the pw_gecos field, -assuming that the entries in pw_gecos are comma-separated. The -commands mkpasswd and mkgroup -usually do this for you. - -Another interesting entry in the pw_gecos field (which is also -usually created by running mkpasswd) is the Windows user -name entry. It takes the form "U-domain\username" and is sometimes used -by services to authenticate a user. Logging in through -telnet is a common scenario. - -A typical snippet from /etc/passwd: - - -/etc/passwd: - -SYSTEM:*:18:544:,S-1-5-18:: -Administrators:*:544:544:,S-1-5-32-544:: -Administrator:unused:500:513:U-FOO\Administrator,S-1-5-21-790525478-115176313-839522115-500:/home/Administrator:/bin/bash -corinna:unused:11001:11125:U-BAR\corinna,S-1-5-21-2913048732-1697188782-3448811101-1001:/home/corinna:/bin/tcsh - - - -The SYSTEM entry is usually needed by services. The Administrators -entry (Huh? A group in /etc/passwd?) is only here to allow -ls and similar commands to print some file ownerships -correctly. Windows doesn't care if the owner of a file is a user or a -group. In older versions of Windows NT the default ownership for files -created by an administrator account was set to the group Administrators -instead of to the creating user account. This has changed, but you can -still switch to this setting on newer systems. So it's convenient to -have the Administrators group in -/etc/passwd. - -The really interesting entries are the next two. The Administrator -entry is for the local administrator, the corinna entry matches the corinna -account in the domain BAR. The information given in the pw_gecos field -are all we need to exactly identify an account, and to have a two way -translation, from Windows account name/SID to Cygwin account name uid and -vice versa. Having this complete information allows us to choose a Cygwin -user name and uid which doesn't have to match the Windows account at all. As -long as the pw_gecos information is available, we're on the safe side: - - -/etc/passwd, tweaked: - -root:unused:0:513:U-FOO\Administrator,S-1-5-21-790525478-115176313-839522115-500:/home/Administrator:/bin/bash -thursday_next:unused:11001:11125:U-BAR\corinna,S-1-5-21-2913048732-1697188782-3448811101-1001:/home/corinna:/bin/tcsh - - - - The above /etc/passwd will still work fine. -You can now login via ssh as the user "root", and -Cygwin dutifully translates "root" into the Windows user -"FOO\Administrator" and files owned by FOO\Administrator are shown to -have the uid 0 when calling ls -ln. All you do you're -actually doing as Administrator. Files created as root will be owned by -FOO\Administrator. And the domain user BAR\corinna can now happily -pretend to be Thursday Next, but will wake up sooner or later finding -out she's still actually the domain user BAR\corinna... - -Do I have to mention that you can also rename groups in -/etc/group? As long as the SID is present and correct, -all is well. This allows you to, for instance, rename the "Administrators" -group to "root" as well: - - -/etc/group, tweaked: - -root:S-1-5-32-544:544: - - - -Last but not least, you can also change the primary group of a user -in /etc/passwd. The only requirement is that the user -is actually a member of the new primary group in Windows. For instance, -normal users in a domain environment are members in the group "Domain Users", -which in turn belongs to the well-known group "Users". So, if it's -more convenient in your environment for the user's primary group to be -"Users", just set the user's primary group in /etc/passwd -to the Cygwin uid of "Users" (see in /etc/group, -default 545) and let the user create files with a default group ownership -of "Users". - - -If you wish to make these kind of changes to /etc/passwd and /etc/group, -do so only if you feel comfortable with the concepts. Otherwise, do not -be surprised if things break in either subtle or surprising ways! If you -do screw things up, revert to copies of /etc/passwd -and /etc/group files created by -mkpasswd and mkgroup. (Make -backup copies of these files before modifying them.) Especially, don't -change the UID or the name of the user SYSTEM. It may mostly work, but -some Cygwin applications running as a local service under that account -could suddenly start behaving strangely. - - - - -Special values of user and group ids - -If the current user is not present in -/etc/passwd, that user's uid is set to a -special value of 400. The user name for the current user will always be -shown correctly. If another user (or a Windows group, treated as a -user) is not present in /etc/passwd, the uid of -that user will have a special value of -1 (which would be shown by -ls as 65535). The user name shown in this case will -be '????????'. - -If the current user is not present in -/etc/passwd, that user's login gid is set to a -special value of 401. The gid 401 is shown as 'mkpasswd', -indicating the command that should be run to alleviate the -situation. - -If another user is not present in -/etc/passwd, that user's login gid is set to a -special value of -1. If the user is present in -/etc/passwd, but that user's group is not in -/etc/group and is not the login group of that user, -the gid is set to a special value of -1. The name of this group -(id -1) will be shown as '????????'. - -If the current user is present in -/etc/passwd, but that user's login group is not -present in /etc/group, the group name will be shown -as 'mkgroup', again indicating the appropriate command. - -A special case is if the current user's primary group SID is noted -in the user's /etc/passwd entry using another group -id than the group entry of the same group SID in -/etc/group. This should be noted and corrected. -The group name printed in this case is -'passwd/group_GID_clash(PPP/GGG)', with PPP being the gid as noted -in /etc/passwd and GGG the gid as noted in -/etc/group. - -To summarize: - - -If the current user doesn't show up in -/etc/passwd, it's group will -be named 'mkpasswd'. - -Otherwise, if the login group of the current user isn't -in /etc/group, it will be named 'mkgroup'. - - -Otherwise a group not in /etc/group -will be shown as '????????' and a user not in -/etc/passwd will be shown as "????????". - - -If different group ids are used for a group with the same -SID, the group name is shown as 'passwd/group_GID_clash(PPP/GGG)' with -PPP and GGG being the different group ids. - - - - -Note that, since the special user and group names are just indicators, -nothing prevents you from actually having a user named `mkpasswd' in -/etc/passwd (or a group named `mkgroup' in -/etc/group). If you do that, however, be aware of -the possible confusion. - - - - - -The POSIX permission mapping leak - -As promised earlier, here's the problem when trying to map the -POSIX permission model onto the Windows permission model. - -There's a leak in the definition of a "correct" ACL which -disallows a certain POSIX permission setting. The official -documentation explains in short the following: - - -The requested permissions are checked against all -ACEs of the user as well as all groups the user is member of. The -permissions given in these user and groups access allowed ACEs are -accumulated and the resulting set is the set of permissions of that -user given for that object. - -The order of ACEs is important. The system reads them in -sequence until either any single requested permission is denied or all -requested permissions are granted. Reading stops when this condition is -met. Later ACEs are not taken into account. - -All access denied ACEs should precede any access allowed ACE. ACLs -following this rule are called "canonical" - - -Note that the last rule is a preference or a definition of -correctness. It's not an absolute requirement. All Windows kernels -will correctly deal with the ACL regardless of the order of allow and -deny ACEs. The second rule is not modified to get the ACEs in the -preferred order. - -Unfortunately the security tab in the file properties dialog of -the Windows Explorer insists to rearrange the order of the ACEs to -canonical order before you can read them. Thank God, the sort order -remains unchanged if one presses the Cancel button. But don't even -think of pressing OK... - -Canonical ACLs are unable to reflect each possible combination -of POSIX permissions. Example: - - -rw-r-xrw- - - -Ok, so here's the first try to create a matching ACL, assuming -the Windows permissions only have three bits, as their POSIX counterpart: - - - -UserAllow: 110 -GroupAllow: 101 -OthersAllow: 110 - - -Hmm, because of the accumulation of allow rights the user may -execute because the group may execute. - -Second try: - - -UserDeny: 001 -GroupAllow: 101 -OthersAllow: 110 - - -Now the user may read and write but not execute. Better? No! -Unfortunately the group may write now because others may write. - -Third try: - - -UserDeny: 001 -GroupDeny: 010 -GroupAllow: 001 -OthersAllow: 110 - - -Now the group may not write as intended but unfortunately the user may -not write anymore, either. How should this problem be solved? According to -the canonical order a UserAllow has to follow the GroupDeny but it's -easy to see that this can never be solved that way. - -The only chance: - - -UserDeny: 001 -UserAllow: 010 -GroupDeny: 010 -GroupAllow: 001 -OthersAllow: 110 - - -Again: This works on all existing versions of Windows NT, at the -time of writing from at least Windows XP up to Server 2012. Only -the GUIs aren't able (or willing) to deal with that order. - - - -Switching the user context - -Since Windows XP, Windows users have been accustomed to the -"Switch User" feature, which switches the entire desktop to another user -while leaving the original user's desktop "suspended". Another Windows -feature is the "Run as..." context menu entry, which allows you to start -an application using another user account when right-clicking on applications -and shortcuts. - -On POSIX systems, this operation can be performed by processes -running under the privileged user accounts (usually the "root" user -account) on a per-process basis. This is called "switching the user -context" for that process, and is performed using the POSIX -setuid and seteuid system -calls. - -While this sort of feature is available on Windows as well, -Windows does not support the concept of these calls in a simple fashion. -Switching the user context in Windows is generally a tricky process with -lots of "behind the scenes" magic involved. - -Windows uses so-called `access tokens' to identify a user and its -permissions. Usually the access token is created at logon time and then -it's attached to the starting process. Every new process within a session -inherits the access token from its parent process. Every thread can -get its own access token, which allows, for instance, to define threads -with restricted permissions. - - - -Switching the user context with password authentication - -To switch the user context, the process has to request such an access -token for the new user. This is typically done by calling the Win32 API -function LogonUser with the user name and the user's -cleartext password as arguments. If the user exists and the password was -specified correctly, the access token is returned and either used in -ImpersonateLoggedOnUser to change the user context of -the current thread, or in CreateProcessAsUser to -change the user context of a spawned child process. - -Later versions of Windows define new functions in this context and -there are also functions to manipulate existing access tokens (usually -only to restrict them). Windows Vista also adds subtokens which are -attached to other access tokens which plays an important role in the UAC -(User Access Control) facility of Vista and later. However, none of -these extensions to the original concept are important for this -documentation. - -Back to this logon with password, how can this be used to -implement set(e)uid? Well, it requires modification -of the calling application. Two Cygwin functions have been introduced -to support porting setuid applications which only -require login with passwords. You only give Cygwin the right access -token and then you can call seteuid or -setuid as usual in POSIX applications. Porting such -a setuid application is illustrated by a short -example: - - - -#include -#endif - -[...] - - struct passwd *user_pwd_entry = getpwnam (username); - char *cleartext_password = getpass ("Password:"); - -[...] - -#ifdef __CYGWIN__ - /* Patch the typical password test. */ - { - HANDLE token; - - /* Try to get the access token from Windows. */ - token = cygwin_logon_user (user_pwd_entry, cleartext_password); - if (token == INVALID_HANDLE_VALUE) - error_exit; - /* Inform Cygwin about the new impersonation token. */ - cygwin_set_impersonation_token (token); - /* Cygwin is now able, to switch to that user context by setuid or seteuid calls. */ - } -#else - /* Use standard method on non-Cygwin systems. */ - hashed_password = crypt (cleartext_password, salt); - if (!user_pwd_entry || - strcmp (hashed_password, user_pwd_entry->pw_password)) - error_exit; -#endif /* CYGWIN */ - -[...] - - /* Everything else remains the same! */ - - setegid (user_pwd_entry->pw_gid); - seteuid (user_pwd_entry->pw_uid); - execl ("/bin/sh", ...); -]]> - - - - - -Switching the user context without password, Method 1: Create a token from scratch - -An unfortunate aspect of the implementation of -set(e)uid is the fact that the calling process -requires the password of the user to which to switch. Applications such as -sshd wishing to switch the user context after a -successful public key authentication, or the cron -application which, again, wants to switch the user without any authentication -are stuck here. But there are other ways to get new user tokens. - -One way is just to create a user token from scratch. This is -accomplished by using an (officially undocumented) function on the NT -function level. The NT function level is used to implement the Win32 -level, and, as such is closer to the kernel than the Win32 level. The -function of interest, NtCreateToken, allows you to -specify user, groups, permissions and almost everything you need to -create a user token, without the need to specify the user password. The -only restriction for using this function is that the calling process -needs the "Create a token object" user right, which only the SYSTEM user -account has by default, and which is considered the most dangerous right -a user can have on Windows systems. - -That sounds good. We just start the servers which have to switch -the user context (sshd, inetd, -cron, ...) as Windows services under the SYSTEM -(or LocalSystem in the GUI) account and everything just works. -Unfortunately that's too simple. Using NtCreateToken -has a few drawbacks. - -First of all, beginning with Windows Server 2003, -the permission "Create a token object" gets explicitly removed from -the SYSTEM user's access token, when starting services under that -account. That requires us to create a new account with this specific -permission just to run this kind of services. But that's a minor -problem. - -A more important problem is that using NtCreateToken -is not sufficient to create a new logon session for the new user. What -does that mean? Every logon usually creates a new logon session. -A logon session has a couple of attributes which are unique to the -session. One of these attributes is the fact, that Windows functions -identify the user domain and user name not by the SID of the access -token owner, but only by the logon session the process is running under. - -This has the following unfortunate consequence. Consider a -service started under the SYSTEM account (up to Windows XP) switches the -user context to DOMAIN\my_user using a token created directly by calling -the NtCreateToken function. A process running under -this new access token might want to know under which user account it's -running. The corresponding SID is returned correctly, for instance -S-1-5-21-1234-5678-9012-77777. However, if the same process asks the OS -for the user name of this SID something wierd happens. For instance, -the LookupAccountSid function will not return -"DOMAIN\my_user", but "NT AUTHORITY\SYSTEM" as the user name. - -You might ask "So what?" After all, this only looks bad, but functionality and permission-wise -everything should be ok. And Cygwin knows about this shortcoming so it -will return the correct Cygwin username when asked. Unfortunately this -is more complicated. Some native, non-Cygwin Windows applications will -misbehave badly in this situation. A well-known example are certain versions -of Visual-C++. - -Last but not least, you don't have the usual comfortable access -to network shares. The reason is that the token has been created -without knowing the password. The password are your credentials -necessary for network access. Thus, if you logon with a password, the -password is stored hidden as "token credentials" within the access token -and used as default logon to access network resources. Since these -credentials are missing from the token created with -NtCreateToken, you only can access network shares -from the new user's process tree by using explicit authentication, on -the command line for instance: - - -bash$ net use '\\server\share' /user:DOMAIN\my_user my_users_password - - -Note that, on some systems, you can't even define a drive letter -to access the share, and under some circumstances the drive letter you -choose collides with a drive letter already used in another session. -Therefore it's better to get used to accessing these shares using the UNC -path as in - - -bash$ grep foo //server/share/foofile - - - - -Switching the user context without password, Method 2: LSA authentication package - -We're looking for another way to switch the user context without -having to provide the password. Another technique is to create an -LSA authentication package. LSA is an acronym for "Local Security Authority" -which is a protected part of the operating system which only allows changes -to become active when rebooting the system after the change. Also, as soon as -the LSA encounters serious problems (for instance, one of the protected -LSA processes died), it triggers a system reboot. LSA is the part of -the OS which cares for the user logons and which also creates logon -sessions. - -An LSA authentication package is a DLL which has to be installed -as part of the LSA. This is done by tweaking a special registry key. -Cygwin provides such an authentication package. It has to be installed -and the machine has to be rebooted to activate it. This is the job of the -shell script /usr/bin/cyglsa-config which is part of -the Cygwin package. - -After running /usr/bin/cyglsa-config and -rebooting the system, the LSA authentication package is used by Cygwin -when set(e)uid is called by an application. The -created access token using this method has its own logon session. - -This method has two advantages over the NtCreateToken -method. - -The very special and very dangerous "Create a token object" user -right is not required by a user using this method. Other privileged -user rights are still necessary, especially the "Act as part of the -operating system" right, but that's just business as usual. - -The user is correctly identified, even by delicate native applications -which choke on that using the NtCreateToken method. - -Disadvantages? Yes, sure, this is Windows. The access token -created using LSA authentication still lacks the credentials for network -access. After all, there still hasn't been any password authentication -involved. The requirement to reboot after every installation or -deinstallation of the cygwin LSA authentication DLL is just a minor -inconvenience compared to that... - -Nevertheless, this is already a lot better than what we get by -using NtCreateToken, isn't it? - - - -Switching the user context without password, Method 3: With password - -Ok, so we have solved almost any problem, except for the network -access problem. Not being able to access network shares without -having to specify a cleartext password on the command line or in a -script is a harsh problem for automated logons for testing purposes -and similar stuff. - -Fortunately there is a solution, but it has its own drawbacks. -But, first things first, how does it work? The title of this section -says it all. Instead of trying to logon without password, we just logon -with password. The password gets stored two-way encrypted in a hidden, -obfuscated area of the registry, the LSA private registry area. This -part of the registry contains, for instance, the passwords of the Windows -services which run under some non-default user account. - -So what we do is to utilize this registry area for the purpose of -set(e)uid. The Cygwin command passwd -R allows a user to specify -his/her password for storage in this registry area. When this user -tries to login using ssh with public key authentication, Cygwin's -set(e)uid examines the LSA private registry area and -searches for a Cygwin specific key which contains the password. If it -finds it, it calls LogonUser under the hood, using -this password. If that works, LogonUser returns an -access token with all credentials necessary for network access. - -For good measure, and since this way to implement -set(e)uid is not only used by Cygwin but also by -Microsoft's SFU (Services for Unix), we also look for a key stored by -SFU (using the SFU command regpwd) and use that if it's -available. - -We got it. A full access token with its own logon session, with -all network credentials. Hmm, that's heaven... - -Back on earth, what about the drawbacks? - -First, adding a password to the LSA private registry area -requires administrative access. So calling passwd -R -as a normal user will fail! Cygwin provides a workaround for -this. If cygserver is started as a service running -under the SYSTEM account (which is the default way to run -cygserver) you can use passwd -R -as normal, non-privileged user as well. - -Second, as aforementioned, the password is two-way encrypted in a -hidden, obfuscated registry area. Only SYSTEM has access to this area -for listing purposes, so, even as an administrator, you can't examine -this area with regedit. Right? No. Every administrator can start -regedit as SYSTEM user: - - -bash$ date -Tue Dec 2 16:28:03 CET 2008 -bash$ at 16:29 /interactive regedit.exe - - -Additionally, if an administrator knows under which name -the private key is stored (which is well-known since the algorithms -used to create the Cygwin and SFU keys are no secret), every administrator -can access the password of all keys stored this way in the registry. - -Conclusion: If your system is used exclusively by you, and if -you're also the only administrator of your system, and if your system is -adequately locked down to prevent malicious access, you can safely use -this method. If your machine is part of a network which has -dedicated administrators, and you're not one of these administrators, -but you (think you) can trust your administrators, you can probably -safely use this method. - -In all other cases, don't use this method. You have been warned. - - - -Switching the user context, how does it all fit together? - -Now we learned about four different ways to switch the user -context using the set(e)uid system call, but -how does set(e)uid really work? Which method does it -use now? - -The answer is, all four of them. So here's a brief overview -what set(e)uid does under the hood: - - - -When set(e)uid is called, it tests if the -user context had been switched by an earlier call already, and if the -new user account is the privileged user account under which the process -had been started originally. If so, it just switches to the original -access token of the process it had been started with. - - - - -Next, it tests if an access token has been stored by an earlier call -to cygwin_set_impersonation_token. If so, it tests -if that token matches the requested user account. If so, the stored -token is used for the user context switch. - - -If not, there's no predefined token which can just be used for -the user context switch, so we have to create a new token. The order -is as follows. - - - -Check if the user has stored the logon password in the LSA -private registry area, either under a Cygwin key, or under a SFU key. -If so, use this to call LogonUser. If this -succeeds, we use the resulting token for the user context switch. - - - -Otherwise, check if the Cygwin-specifc LSA authentication package -has been installed and is functional. If so, use the appropriate LSA -calls to communicate with the Cygwin LSA authentication package and -use the returned token. - - - -Last chance, try to use the NtCreateToken call -to create a token. If that works, use this token. - - - -If all of the above fails, our process has insufficient privileges -to switch the user context at all, so set(e)uid -fails and returns -1, setting errno to EPERM. - - - - - - diff --git a/winsup/doc/ov-ex-unix.xml b/winsup/doc/ov-ex-unix.xml deleted file mode 100644 index e1debabdd..000000000 --- a/winsup/doc/ov-ex-unix.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - -Quick Start Guide for those more experienced with UNIX - -If you are an experienced UNIX user who misses a powerful command-line -environment, you will enjoy Cygwin. -Developers coming from a UNIX background will find a set of utilities -they are already comfortable using, including a working UNIX shell. The -compiler tools are the standard GNU compilers most people will have previously -used under UNIX, only ported to the Windows host. Programmers wishing to port -UNIX software to Windows NT will find that the Cygwin library provides -an easy way to port many UNIX packages, with only minimal source code -changes. - - -Note that there are some workarounds that cause Cygwin to behave differently -than most UNIX-like operating systems; these are described in more detail in -. - - -Use the graphical command setup.exe any time you want -to update or install a Cygwin package. This program must be run -manually every time you want to check for updated packages since Cygwin -does not currently include a mechanism for automatically detecting -package updates. - - -By default, setup.exe only installs a minimal subset of -packages. Add any other packages by clicking on the + -next to the Category name and selecting the package from the displayed -list. You may search for specfic tools by using the -Setup Package Search -at the Cygwin web site. - - -Another option is to install everything by clicking on the -Default field next to the All -category. However, be advised that this will download and install -several hundreds of megabytes of software to your computer. The best -plan is probably to click on individual categories and install either -entire categories or packages from the categories themselves. -After installation, you can find Cygwin-specific documentation in -the /usr/share/doc/Cygwin/ directory. - - -For more information about what each option in -setup.exe means, see . - - - diff --git a/winsup/doc/ov-ex-win.xml b/winsup/doc/ov-ex-win.xml deleted file mode 100644 index c9371a971..000000000 --- a/winsup/doc/ov-ex-win.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - -Quick Start Guide for those more experienced with Windows - -If you are new to the world of UNIX, you may find it difficult to -understand at first. This guide is not meant to be comprehensive, -so we recommend that you use the many available Internet resources -to become acquainted with UNIX basics (search for "UNIX basics" or -"UNIX tutorial"). - - -To install a basic Cygwin environment, run the -setup.exe program and click Next -at each page. The default settings are correct for most users. If you -want to know more about what each option means, see -. Use setup.exe -any time you want to update or install a Cygwin package. If you are -installing Cygwin for a specific purpose, use it to install the tools -that you need. For example, if you want to compile C++ programs, you -need the gcc-g++ package and probably a text -editor like nano. When running -setup.exe, clicking on categories and packages in the -package installation screen will provide you with the ability to control -what is installed or updated. - - -Another option is to install everything by clicking on the -Default field next to the All -category. However, be advised that this will download and install -several hundreds of megabytes of software to your computer. The best -plan is probably to click on individual categories and install either -entire categories or packages from the categories themselves. -After installation, you can find Cygwin-specific documentation in -the /usr/share/doc/Cygwin/ directory. - - -Developers coming from a Windows background will be able to write -console or GUI executables that rely on the Microsoft Win32 API instead -of Cygwin using the mingw32 or mingw64 cross-compiler toolchains. The --shared option to GCC allows to write Windows Dynamically -Linked Libraries (DLLs). The resource compiler windres -is also provided. - - diff --git a/winsup/doc/overview.xml b/winsup/doc/overview.xml deleted file mode 100644 index f43a69719..000000000 --- a/winsup/doc/overview.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - -Cygwin Overview - -What is it? - - -Cygwin is a Linux-like environment for Windows. It consists of a DLL -(cygwin1.dll), which acts as an emulation layer -providing substantial POSIX -(Portable Operating System Interface) system call functionality, and a -collection of tools, which provide a Linux look and feel. The Cygwin DLL -works with all x86 and AMD64 versions of Windows NT since Windows XP SP3. -The API follows the -Single -Unix Specification as much as possible, and then Linux practice. -The major differences between Cygwin and Linux is the C library -(newlib instead of glibc). - - -With Cygwin installed, users have access to many standard UNIX -utilities. They can be used from one of the provided shells such -as bash or from the Windows Command Prompt. -Additionally, programmers may write Win32 console or GUI applications -that make use of the standard Microsoft Win32 API and/or the Cygwin API. -As a result, it is possible to easily port many significant UNIX -programs without the need for extensive changes to the source code. -This includes configuring and building most of the available GNU -software (including the development tools included with the Cygwin -distribution). - - - - - - -Are the Cygwin tools free software? - -Yes. Parts are GNU software -(gcc, gas, ld, etc.), -parts are covered by the standard -X11 license, -some of it is public domain, some of it was written by Red Hat and placed under -the GNU General Public -License (GPL). None of it is shareware. You don't have to pay anyone to -use it but you should be sure to read the copyright section of the FAQ for more -information on how the GNU GPL may affect your use of these -tools. If you intend to port a proprietary application using the Cygwin -library, you may want the Cygwin proprietary-use license. -For more information about the proprietary-use license, please go to -http://www.redhat.com/services/custom/cygwin/. -Customers of the native Win32 GNUPro should feel free to submit bug -reports and ask questions through Red Hat channels. All other -questions should be sent to the project mailing list -cygwin@cygwin.com. - - - -A brief history of the Cygwin project - - - -A historical look into the first years of Cygwin development is -Geoffrey J. Noer's 1998 paper, "Cygwin32: A Free Win32 Porting Layer for -UNIX® Applications" which can be found at the -2nd USENIX Windows NT Symposium Online Proceedings. - - - -Cygwin began development in 1995 at Cygnus Solutions (now part of Red Hat, -Inc.). The first thing done was to enhance the development tools -(gcc, gdb, gas, -etc.) so that they could generate and interpret Win32 native -object files. -The next task was to port the tools to Win NT/9x. We could have -done this by rewriting large portions of the source to work within the -context of the Win32 API. But this would have meant spending a huge -amount of time on each and every tool. Instead, we took a -substantially different approach by writing a shared library -(the Cygwin DLL) that adds the necessary UNIX-like functionality -missing from the Win32 API (fork, -spawn, signals, -select, sockets, etc.). We call this -new interface the Cygwin API. Once written, it was possible to build working -Win32 tools using UNIX-hosted cross-compilers, linking against this -library. - -From this point, we pursued the goal of producing Windows-hosted tools -capable of rebuilding themselves under Windows 9x and NT (this is -often called self-hosting). Since neither OS ships with standard UNIX -user tools (fileutils, textutils, bash, etc...), we had to get the GNU -equivalents working with the Cygwin API. Many of these tools were -previously only built natively so we had to modify their configure -scripts to be compatible with cross-compilation. Other than the -configuration changes, very few source-level changes had to be -made since Cygwin provided a UNIX-like API. Running bash with the development tools and user tools in place, -Windows 9x and NT looked like a flavor of UNIX from the perspective of -the GNU configure mechanism. Self hosting was achieved as of the beta -17.1 release in October 1996. - - -The entire Cygwin toolset was available as a monolithic install. In -April 2000, the project announced a - -New Cygwin Net Release which provided the native non-Cygwin Win32 program -setup.exe to install and upgrade each package -separately. Since then, the Cygwin DLL and setup.exe -have seen continuous development. - - - -The biggest major improvement in this development is the 1.7 release in -2009, which dropped Windows 95/98/Me support in favor of using Windows -NT features more extensively. It adds a lot of new features like -case-sensitive filenames, NFS interoperability, IPv6 support and much -more. - -The latest big improvement is the 64 bit Cygwin DLL which -allows to run natively on AMD64 Windows machines. The first release -available in a 64 bit version is 1.7.19. - - - - - - - diff --git a/winsup/doc/pathnames.xml b/winsup/doc/pathnames.xml deleted file mode 100644 index 3647253e2..000000000 --- a/winsup/doc/pathnames.xml +++ /dev/null @@ -1,570 +0,0 @@ - - - -Mapping path names - -Introduction - -Cygwin supports both POSIX- and Win32-style paths. Directory -delimiters may be either forward slashes or backslashes. Paths using -backslashes or starting with a drive letter are always handled as -Win32 paths. POSIX paths must only use forward slashes as delimiter, -otherwise they are treated as Win32 paths and file access might fail -in surprising ways. - -The usage of Win32 paths, though possible, is deprecated, -since it circumvents important internal path handling mechanisms. -See and - for more information. - - -POSIX operating systems (such as Linux) do not have the concept -of drive letters. Instead, all absolute paths begin with a -slash (instead of a drive letter such as "c:") and all file systems -appear as subdirectories (for example, you might buy a new disk and -make it be the /disk2 directory). - -Because many programs written to run on UNIX systems assume -the existence of a single unified POSIX file system structure, Cygwin -maintains a special internal POSIX view of the Win32 file system -that allows these programs to successfully run under Windows. Cygwin -uses this mapping to translate from POSIX to Win32 paths as -necessary. - - - -The Cygwin Mount Table - -The /etc/fstab file is used to map Win32 -drives and network shares into Cygwin's internal POSIX directory tree. -This is a similar concept to the typical UNIX fstab file. The mount -points stored in /etc/fstab are globally set for -all users. Sometimes there's a requirement to have user specific -mount points. The Cygwin DLL supports user specific fstab files. -These are stored in the directory /etc/fstab.d -and the name of the file is the Cygwin username of the user, as it's -stored in the /etc/passwd file. The structure of the -user specific file is identical to the system-wide -fstab file. - -The file fstab contains descriptive information about the various file -systems. fstab is only read by programs, and not written; it is the -duty of the system administrator to properly create and maintain this -file. Each filesystem is described on a separate line; fields on each -line are separated by tabs or spaces. Lines starting with '#' are -comments. - -The first field describes the block special device or -remote filesystem to be mounted. On Cygwin, this is the native Windows -path which the mount point links in. As path separator you MUST use a -slash. Usage of a backslash might lead to unexpected results. UNC -paths (using slashes, not backslashes) are allowed. If the path -contains spaces these can be escaped as '\040'. - -The second field describes the mount point for the filesystem. -If the name of the mount point contains spaces these can be -escaped as '\040'. - -The third field describes the type of the filesystem. Cygwin supports -any string here, since the file system type is usually not evaluated. So it -doesn't matter if you write FAT into this field even if -the filesystem is NTFS. Cygwin figures out the filesystem type and its -capabilities by itself. - -The only exception is the file system type cygdrive. This type is -used to set the cygdrive prefix. For a description of the cygdrive prefix -see - -The fourth field describes the mount options associated -with the filesystem. It is formatted as a comma separated list of -options. It contains at least the type of mount (binary or text) plus -any additional options appropriate to the filesystem type. Recognized -options are binary, text, nouser, user, exec, notexec, cygexec, nosuid, -posix=[0|1]. The meaning of the options is as follows. - - - acl - Cygwin uses the filesystem's access control lists (ACLs) to - implement real POSIX permissions (default). This flag only - affects filesystems supporting ACLs (NTFS, for instance) and - is ignored otherwise. - auto - Ignored. - binary - Files default to binary mode (default). - bind - Allows to remount part of the file hierarchy somewhere else. - In contrast to other entries, the first field in the fstab - line specifies an absolute POSIX path. This path is remounted - to the POSIX path specified as the second path. The conversion - to a Win32 path is done on the fly. Only the root path and - paths preceding the bind entry in the fstab file are used to - convert the POSIX path in the first field to an absolute Win32 - path. Note that symlinks are ignored while performing this path - conversion. - cygexec - Treat all files below mount point as cygwin executables. - dos - Always convert leading spaces and trailing dots and spaces to - characters in the UNICODE private use area. This allows to use - broken filesystems which only allow DOS filenames, even if they - are not recognized as such by Cygwin. - exec - Treat all files below mount point as executable. - ihash - Always fake inode numbers rather than using the ones returned - by the filesystem. This allows to use broken filesystems which - don't return unambiguous inode numbers, even if they are not - recognized as such by Cygwin. - noacl - Cygwin ignores filesystem ACLs and only fakes a subset of - permission bits based on the DOS readonly attribute. This - behaviour is the default on FAT and FAT32. The flag is - ignored on NFS filesystems. - nosuid - No suid files are allowed (currently unimplemented). - notexec - Treat all files below mount point as not executable. - nouser - Mount is a system-wide mount. - override - Force the override of an immutable mount point (currently "/"). - posix=0 - Switch off case sensitivity for paths under this mount point - (default for the cygdrive prefix). - posix=1 - Switch on case sensitivity for paths under this mount point - (default for all other mount points). - sparse - Switch on support for sparse files. This option only makes - sense on NTFS and then only if you really need sparse files. - Cygwin does not try to create sparse files by default for - performance reasons. - text - Files default to CRLF text mode line endings. - user - Mount is a user mount. - - -While normally the execute permission bits are used to evaluate -executability, this is not possible on filesystems which don't support -permissions at all (like FAT/FAT32), or if ACLs are ignored on filesystems -supporting them (see the aforementioned acl mount option). -In these cases, the following heuristic is used to evaluate if a file is -executable: Files ending in certain extensions (.exe, .com, .bat, .btm, -.cmd) are assumed to be executable. Files whose first two characters begin -with '#!' are also considered to be executable. -The exec option is used to instruct Cygwin that the -mounted file is "executable". If the exec option is used -with a directory then all files in the directory are executable. -This option allows other files to be marked as executable and avoids the -overhead of opening each file to check for a '#!'. The -cygexec option is very similar to exec, -but also prevents Cygwin from setting up commands and environment variables -for a normal Windows program, adding another small performance gain. The -opposite of these options is the notexec option, which -means that no files should be marked as executable under that mount point. -A correct root directory is quite essential to the operation of -Cygwin. A default root directory is evaluated at startup so a -fstab entry for the root directory is not necessary. -If it's wrong, nothing will work as expected. Therefore, the root directory -evaluated by Cygwin itself is treated as an immutable mount point and can't -be overridden in /etc/fstab... unless you think you really know what you're -doing. In this case, use the override flag in the options -field in the /etc/fstab file. Since this is a dangerous -thing to do, do so at your own risk. - -/usr/bin and /usr/lib are -by default also automatic mount points generated by the Cygwin DLL similar -to the way the root directory is evaluated. /usr/bin -points to the directory the Cygwin DLL is installed in, -/usr/lib is supposed to point to the -/lib directory. This choice is safe and usually -shouldn't be changed. An fstab entry for them is not required. - -nouser mount points are not overridable by a later -call to mount. -Mount points given in /etc/fstab are by default -nouser mount points, unless you specify the option -user. This allows the administrator to set certain -paths so that they are not overridable by users. In contrast, all mount -points in the user specific fstab file are user mount -points. - -The fifth and sixth field are ignored. They are -so far only specified to keep a Linux-like fstab file layout. - -Note that you don't have to specify an fstab entry for the root dir, -unless you want to have the root dir pointing to somewhere entirely -different (hopefully you know what you're doing), or if you want to -mount the root dir with special options (for instance, as text mount). - -Example entries: - - - - Just a normal mount point: - c:/foo /bar fat32 binary 0 0 - - - A mount point for a textmode mount with case sensitivity switched off: - C:/foo /bar/baz ntfs text,posix=0 0 0 - - - A mount point for a Windows directory with spaces in it: - C:/Documents\040and\040Settings /docs ext3 binary 0 0 - - - A mount point for a remote directory, don't store POSIX permissions in ACLs: - //server/share/subdir /srv/subdir smbfs binary,noacl 0 0 - - - This is just a comment: - # This is just a comment - - - Set the cygdrive prefix to /mnt: - none /mnt cygdrive binary 0 0 - - - Remount /var to /usr/var: - /var /usr/var none bind - Assuming /var points to - C:/cygwin/var, /usr/var now - also points to C:/cygwin/var. This is equivalent - to the Linux bind option available since - Linux 2.4.0. - - - -Whenever Cygwin generates a Win32 path from a POSIX one, it uses -the longest matching prefix in the mount table. Thus, if -C: is mounted as /c and also -as /, then Cygwin would translate -C:/foo/bar to /c/foo/bar. -This translation is normally only used when trying to derive the -POSIX equivalent current directory. Otherwise, the handling of MS-DOS -filenames bypasses the mount table. - - -If you want to see the current set of mount points valid in your -session, you can invoke the Cygwin tool mount without -arguments: - - -Displaying the current set of mount points - - bash$ mount - f:/cygwin/bin on /usr/bin type ntfs (binary,auto) - f:/cygwin/lib on /usr/lib type ntfs (binary,auto) - f:/cygwin on / type ntfs (binary,auto) - e:/src on /usr/src type vfat (binary) - c: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto) - e: on /cygdrive/e type vfat (binary,posix=0,user,noumount,auto) - - - -You can also use the mount command to add -new mount points, and the umount to delete -them. However, since they are only stored in memory, these mount -points will disappear as soon as your last Cygwin process ends. -See and for more -information. - - -When you upgrade an existing older Cygwin installation to Cygwin 1.7, -your old system mount points (stored in the HKEY_LOCAL_MACHINE branch -of your registry) are read by a script and the /etc/fstab -file is generated from these entries. Note that entries for -/, /usr/bin, and -/usr/lib are never -generated. - - - -The old user mount points in your HKEY_CURRENT_USER branch of the registry -are not used to generate /etc/fstab. If you want -to create a user specific /etc/fstab.d/${USER} file -from your old entries, there's a script available which does exactly -that for you, /bin/copy-user-registry-fstab. Just -start the script and it will create your user specific fstab file. Stop -all your Cygwin processes and restart them, and you can simply use your -old user mount points as before. - - - - -UNC paths - -Apart from the unified POSIX tree starting at the / -directory, UNC pathnames starting with two slashes and a server name -(//machine/share/...) are supported as well. -They are handled as POSIX paths if only containing forward slashes. There's -also a virtual directory // which allows to enumerate -the fileservers known to the local machine with ls. -Same goes for the UNC paths of the type //machine, -which allow to enumerate the shares provided by the server -machine. For often used UNC paths it makes sense to -add them to the mount table (see so -they are included in the unified POSIX path tree. - - - -The cygdrive path prefix - -As already outlined in , you can -access arbitary drives on your system by using the cygdrive path prefix. -The default value for this prefix is /cygdrive, and -a path to any drive can be constructed by using the cygdrive prefix and -appending the drive letter as subdirectory, like this: - - - bash$ ls -l /cygdrive/f/somedir - - -This lists the content of the directory F:\somedir. - -The cygdrive prefix is a virtual directory under which all drives -on a system are subsumed. The mount options of the cygdrive prefix is -used for all file access through the cygdrive prefixed drives. For instance, -assuming the cygdrive mount options are binary,posix=0, -then any file /cygdrive/x/file will be opened in -binary mode by default (mount option binary), and the case -of the filename doesn't matter (mount option posix=0). - - -The cygdrive prefix flags are also used for all UNC paths starting with -two slashes, unless they are accessed through a mount point. For instance, -consider these /etc/fstab entries: - - - //server/share /mysrv ntfs posix=1,acl 0 0 - none /cygdrive cygdrive posix=0,noacl 0 0 - - -Assume there's a file \\server\share\foo on the -share. When accessing it as /mysrv/foo, then the flags -posix=1,acl of the /mysrv mount point are used. When -accessing it as //server/share/foo, then the flags -for the cygdrive prefix, posix=0,noacl are used. - -This only applies to UNC paths using forward slashes. When -using backslashes the flags for native paths are used. See -. - -The cygdrive prefix may be changed in the fstab file as outlined above. -Please note that you must not use the cygdrive prefix for any other mount -point. For instance this: - - - none /cygdrive cygdrive binary 0 0 - D: /cygdrive/d somefs text 0 0 - - -will not make file access using the /mnt/d path prefix suddenly using -textmode. If you want to mount any drive explicitly in another mode than -the cygdrive prefix, use a distinct path prefix: - - - none /cygdrive cygdrive binary 0 0 - D: /mnt/d somefs text 0 0 - - - - -Symbolic links - -Symbolic links are not present and supported on Windows until Windows -Vista/Server 2008, and then only on some filesystems. Since POSIX applications -are rightfully expecting to use symlinks and the -symlink(2) system call, Cygwin had to find a -workaround for this Windows flaw. - -Cygwin creates symbolic links potentially in multiple different -ways: - - - - -The default symlinks are plain files containing a magic cookie -followed by the path to which the link points. They are marked with the -DOS SYSTEM attribute so that only files with that attribute have to be -read to determine whether or not the file is a symbolic link. - -Starting with Cygwin 1.7, symbolic links are using UTF-16 to encode -the filename of the target file, to better support internationalization. -Symlinks created by older Cygwin releases can be read just fine. However, -you could run into problems with them if you're now using another character -set than the one you used when creating these symlinks -(see ). Please note that this -new UTF-16 style of symlinks is not compatible with older Cygwin release, -which can't read the target filename correctly. - - - -The shortcut style symlinks are Windows .lnk -shortcut files with a special header and the DOS READONLY attribute set. -This symlink type is created if the environment variable -CYGWIN (see ) -is set to contain the string winsymlinks or -winsymlinks:lnk. On the MVFS filesystem, which does -not support the DOS SYSTEM attribute, this is the one and only supported -symlink type, independently from the winsymlinks -setting. - - - -Native Windows symlinks are only created on Windows Vista/2008 and later, -and only on filesystems supporting reparse points. Due to to their weird -restrictions and behaviour, they are only created if the user -explicitely requests creating them. This is done by setting the -environment variable CYGWIN to contain the string -winsymlinks:native or -winsymlinks:nativestrict. For the difference between -these two settings, see . -On AFS, native symlinks are the only supported type of symlink due to -AFS lacking support for DOS attributes. This is independent from the -winsymlinks setting. - - - -On the NFS filesystem, Cygwin always creates real NFS symlinks. - - - - -All of the above four symlink types are recognized and used as symlinks -under all circumstances. However, if the default plain file symlink type -is lacking its DOS SYSTEM bit, or if the shortcut file is lacking the DOS -READONLY attribute, they are not recognized as symlink. - -Apart from these four types, there's also a fifth type, which is -recognized as symlink but never generated by Cygwin, directory -junctions. This is an older reparse point type, supported by Windows -since Windows 2000. Filesystem junctions on the other hand are not -handled as symlinks, since otherwise they would not be recognized as -filesystem borders by commands like find -xdev. - - - -Using native Win32 paths - -Using native Win32 paths in Cygwin, while possible, is generally -inadvisable. Those paths circumvent all internal integrity checking and -bypass the information given in the Cygwin mount table. - -The following paths are treated as native Win32 paths in Cygwin: - - - - All paths starting with a drive specifier - - C:\foo - C:/foo - - - - All paths containing at least one backslash as path component - - C:/foo/bar\baz/... - - - - UNC paths using backslashes - - \\server\share\... - - - - -When accessing files using native Win32 paths as above, Cygwin uses a -default setting for the mount flags. All paths using DOS notation will be -treated as case insensitive, and permissions are just faked as if the -underlying drive is a FAT drive. This also applies to NTFS and other -filesystems which usually are capable of case sensitivity and storing -permissions. - - - -Using the Win32 file API in Cygwin applications - -Special care must be taken if your application uses Win32 file API -functions like CreateFile to access files using -relative pathnames, or if your application uses functions like -CreateProcess or ShellExecute -to start other applications. - -When a Cygwin application is started, the Windows idea of the current -working directory (CWD) is not necessarily the same as the Cygwin CWD. -There are a couple of restrictions in the Win32 API, which disallow certain -directories as Win32 CWD: - - - - The Windows subsystem only supports CWD paths of up to 258 chars. - This restriction doesn't apply for Cygwin processes, at least not as - long as they use the POSIX API (chdir, getcwd). This means, if a Cygwin - process has a CWD using an absolute path longer than 258 characters, the - Cygwin CWD and the Windows CWD differ. - - - - The Win32 API call to set the current directory, - SetCurrentDirectory, fails for directories for which - the user has no permissions, even if the user is an administrator. This - restriction doesn't apply for Cygwin processes, if they are running under - an administrator account. - - - - SetCurrentDirectory does not support - case-sensitive filenames. - - - - - Last, but not least, SetCurrentDirectory can't - work on virtual Cygwin paths like /proc or /cygdrive. These paths only - exists in the Cygwin realm so they have no meaning to a native Win32 - process. - - - -As long as the Cygwin CWD is usable as Windows CWD, the Cygwin and -Windows CWDs are in sync within a process. However, if the Cygwin process -changes its working directory into one of the directories which are -unusable as Windows CWD, we're in trouble. If the process uses the -Win32 API to access a file using a relative pathname, the resulting -absolute path would not match the expectations of the process. In the -worst case, the wrong files are deleted. - -To workaround this problem, Cygwin sets the Windows CWD to a special -directory in this case. This special directory points to a virtual -filesystem within the native NT namespace (\??\PIPE\). -Since it's not a real filesystem, the deliberate effect is that a call to, -for instance, CreateFile ("foo", ...); will fail, -as long as the processes CWD doesn't work as Windows CWD. - -So, in general, don't use the Win32 file API in Cygwin applications. -If you really need to access files using -the Win32 API, or if you really have to use -CreateProcess to start applications, rather than -the POSIX exec(3) family of functions, you have to -make sure that the Cygwin CWD is set to some directory which is valid as -Win32 CWD. - - - -Additional Path-related Information - -The cygpath program provides the ability to -translate between Win32 and POSIX pathnames in shell scripts. See - for the details. - -The HOME, PATH, and -LD_LIBRARY_PATH environment variables are automatically -converted from Win32 format to POSIX format (e.g. from -c:/cygwin\bin to /bin, if -there was a mount from that Win32 path to that POSIX path) when a Cygwin -process first starts. - -Symbolic links can also be used to map Win32 pathnames to POSIX. -For example, the command -ln -s //pollux/home/joe/data /data would have about -the same effect as creating a mount point from -//pollux/home/joe/data to /data -using mount, except that symbolic links cannot set -the default file access mode. Other differences are that the mapping is -distributed throughout the file system and proceeds by iteratively -walking the directory tree instead of matching the longest prefix in a -kernel table. Note that symbolic links will only work on network -drives that are properly configured to support the "system" file -attribute. Many do not do so by default (the Unix Samba server does -not by default, for example). - - - - diff --git a/winsup/doc/programming.xml b/winsup/doc/programming.xml deleted file mode 100644 index 4b65c4090..000000000 --- a/winsup/doc/programming.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Programming with Cygwin - - - - - - diff --git a/winsup/doc/setup-env.xml b/winsup/doc/setup-env.xml deleted file mode 100644 index ab3d50bdc..000000000 --- a/winsup/doc/setup-env.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - -Environment Variables - -Overview - - -All Windows environment variables are imported when Cygwin starts. -Apart from that, you may wish to specify settings of several important -environment variables that affect Cygwin's operation. - - -The CYGWIN variable is used to configure a few global -settings for the Cygwin runtime system. Typically you can leave -CYGWIN unset, but if you want to set one ore more -options, you can set it using a syntax like this, depending on the shell -in which you're setting it. Here is an example in CMD syntax: - - -C:\> set CYGWIN=error_start:C:\cygwin\bin\gdb.exe glob - - - -This is, of course, just an example. For the recognized settings of the -CYGWIN environment variable, see -. - - - -Locale support is controlled by the LANG and -LC_xxx environment variables. Since Cygwin 1.7.2, all of -them are honored and have a meaning. For a more detailed description see -. - - - -The PATH environment variable is used by Cygwin -applications as a list of directories to search for executable files -to run. This environment variable is converted from Windows format -(e.g. C:\Windows\system32;C:\Windows) to UNIX format -(e.g., /cygdrive/c/Windows/system32:/cygdrive/c/Windows) -when a Cygwin process first starts. -Set it so that it contains at least the x:\cygwin\bin -directory where "x:\cygwin is the "root" of your -cygwin installation if you wish to use cygwin tools outside of bash. -This is usually done by the batch file you're starting your shell with. - - - -The HOME environment variable is used by many programs to -determine the location of your home directory and we recommend that it be -defined. This environment variable is also converted from Windows format -when a Cygwin process first starts. It's usually set in the shell -profile scripts in the /etc directory. - - - -The TERM environment variable specifies your terminal -type. It is automatically set to cygwin if you have -not set it to something else. - - -The LD_LIBRARY_PATH environment variable is used by -the Cygwin function dlopen () as a list of -directories to search for .dll files to load. This environment variable -is converted from Windows format to UNIX format when a Cygwin process -first starts. Most Cygwin applications do not make use of the -dlopen () call and do not need this variable. - - - -In addition to PATH, HOME, -and LD_LIBRARY_PATH, there are three other environment -variables which, if they exist in the Windows environment, are -converted to UNIX format: TMPDIR, TMP, -and TEMP. The first is not set by default in the -Windows environment but the other two are, and they point to the -default Windows temporary directory. If set, these variables will be -used by some Cygwin applications, possibly with unexpected results. -You may therefore want to unset them by adding the following two lines -to your ~/.bashrc file: - - -unset TMP -unset TEMP - - -This is done in the default ~/.bashrc file. -Alternatively, you could set TMP -and TEMP to point to /tmp or to -any other temporary directory of your choice. For example: - - -export TMP=/tmp -export TEMP=/tmp - - - - - -Restricted Win32 environment - -There is a restriction when calling Win32 API functions which -require a fully set up application environment. Cygwin maintains its own -environment in POSIX style. The Win32 environment is usually stripped -to a bare minimum and not at all kept in sync with the Cygwin POSIX -environment. - -If you need the full Win32 environment set up in a Cygwin process, -you have to call - - -#include <sys/cygwin.h> - -cygwin_internal (CW_SYNC_WINENV); - - -to synchronize the Win32 environment with the Cygwin environment. -Note that this only synchronizes the Win32 environment once with the -Cygwin environment. Later changes using the setenv -or putenv calls are not reflected in the Win32 -environment. In these cases, you have to call the aforementioned -cygwin_internal call again. - - - - diff --git a/winsup/doc/setup-files.xml b/winsup/doc/setup-files.xml deleted file mode 100644 index 3fc4d0ccb..000000000 --- a/winsup/doc/setup-files.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - -Customizing bash - - -To set up bash so that cut and paste work properly, click on the -"Properties" button of the window, then on the "Misc" tab. Make sure -that "QuickEdit mode" and "Insert mode" are checked. These settings -will be remembered next time you run bash from that shortcut. Similarly -you can set the working directory inside the "Program" tab. The entry -"%HOME%" is valid, but requires that you set HOME in -the Windows environment. - - - -Your home directory should contain three initialization files -that control the behavior of bash. They are -.profile, .bashrc and -.inputrc. The Cygwin base installation creates -stub files when you start bash for the first time. - - -.profile (other names are also valid, see the bash man -page) contains bash commands. It is executed when bash is started as login -shell, e.g. from the command bash --login. -This is a useful place to define and -export environment variables and bash functions that will be used by bash -and the programs invoked by bash. It is a good place to redefine -PATH if needed. We recommend adding a ":." to the end of -PATH to also search the current working directory (contrary -to DOS, the local directory is not searched by default). Also to avoid -delays you should either unset MAILCHECK -or define MAILPATH to point to your existing mail inbox. - - - -.bashrc is similar to -.profile but is executed each time an interactive -bash shell is launched. It serves to define elements that are not -inherited through the environment, such as aliases. If you do not use -login shells, you may want to put the contents of -.profile as discussed above in this file -instead. - - - - -shopt -s nocaseglob - -will allow bash to glob filenames in a case-insensitive manner. -Note that .bashrc is not called automatically for login -shells. You can source it from .profile. - - - -.inputrc controls how programs using the readline -library (including bash) behave. It is loaded -automatically. For full details see the Function and Variable -Index section of the GNU readline manual. -Consider the following settings: - -# Ignore case while completing -set completion-ignore-case on -# Make Bash 8bit clean -set meta-flag on -set convert-meta off -set output-meta on - -The first command makes filename completion case insensitive, which can -be convenient in a Windows environment. The next three commands allow -bash to display 8-bit characters, useful for -languages with accented characters. Note that tools that do not use -readline for display, such as -less and ls, require additional -settings, which could be put in your .bashrc: - -alias less='/bin/less -r' -alias ls='/bin/ls -F --color=tty --show-control-chars' - - - - - diff --git a/winsup/doc/setup-locale.xml b/winsup/doc/setup-locale.xml deleted file mode 100644 index de0532f62..000000000 --- a/winsup/doc/setup-locale.xml +++ /dev/null @@ -1,432 +0,0 @@ - - - -Internationalization - -Overview - - -Internationalization support is controlled by the LANG and -LC_xxx environment variables. You can set all of them -but Cygwin itself only honors the variables LC_ALL, -LC_CTYPE, and LANG, in this order, according -to the POSIX standard. The content of these variables should follow the -POSIX standard for a locale specifier. The correct form of a locale -specifier is - - - language[[_TERRITORY][.charset][@modifier]] - - -"language" is a lowercase two character string per ISO 639-1, or, -if there is no ISO 639-1 code for the language (for instance, "Lower Sorbian"), -a three character string per ISO 639-3. - -"TERRITORY" is an uppercase two character string per ISO 3166, charset is -one of a list of supported character sets. The modifier doesn't matter -here (though some are recognized, see below). If you're interested in the -exact description, you can find it in the online publication of the POSIX -manual pages on the homepage of the -Open Group. - -Typical locale specifiers are - - - "de_CH" language = German, territory = Switzerland, default charset - "fr_FR.UTF-8" language = french, territory = France, charset = UTF-8 - "ko_KR.eucKR" language = korean, territory = South Korea, charset = eucKR - "syr_SY" language = Syriac, territory = Syria, default charset - - - -If the locale specifier does not follow the above form, Cygwin checks -if the locale is one of the locale aliases defined in the file -/usr/share/locale/locale.alias. If so, and if -the replacement localename is supported by the underlying Windows, -the locale is accepted, too. So, given the default content of the -/usr/share/locale/locale.alias file, the below -examples would be valid locale specifiers as well. - - - - "catalan" defined as "ca_ES.ISO-8859-1" in locale.alias - "japanese" defined as "ja_JP.eucJP" in locale.alias - "turkish" defined as "tr_TR.ISO-8859-9" in locale.alias - - -The file /usr/share/locale/locale.alias is -provided by the gettext package under Cygwin. - - -At application startup, the application's locale is set to the default -"C" or "POSIX" locale. Under Cygwin 1.7.2 and later, this locale defaults -to the ASCII character set on the application level. If you want to stick -to the "C" locale and only change to another charset, you can define this -by setting one of the locale environment variables to "C.charset". For -instance - - - "C.ISO-8859-1" - - -The default locale in the absence of the aforementioned locale -environment variables is "C.UTF-8". - -Windows uses the UTF-16 charset exclusively to store the names -of any object used by the Operating System. This is especially important -with filenames. Cygwin uses the setting of the locale environment variables -LC_ALL, LC_CTYPE, and LANG, to -determine how to convert Windows filenames from their UTF-16 representation -to the singlebyte or multibyte character set used by Cygwin. - - -The setting of the locale environment variables at process startup -is effective for Cygwin's internal conversions to and from the Windows UTF-16 -object names for the entire lifetime of the current process. Changing -the environment variables to another value changes the way filenames are -converted in subsequently started child processes, but not within the same -process. - - -However, even if one of the locale environment variables is set to -some other value than "C", this does only affect -how Cygwin itself converts filenames. As the POSIX standard requires, -it's the application's responsibility to activate that locale for its -own purposes, typically by using the call - - - setlocale (LC_ALL, ""); - - -early in the application code. Again, so that this doesn't get -lost: If the application calls setlocale as above, and there is none -of the important locale variables set in the environment, the locale -is set to the default locale, which is "C.UTF-8". - -But what about applications which are not locale-aware? Per POSIX, -they are running in the "C" or "POSIX" locale, which implies the ASCII -charset. The Cygwin DLL itself, however, will nevertheless use the locale -set in the environment (or the "C.UTF-8" default locale) for converting -filenames etc. - -When the locale in the environment specifies an ASCII charset, -for example "C" or "en_US.ASCII", Cygwin will still use UTF-8 -under the hood to translate filenames. This allows for easier -interoperability with applications running in the default "C.UTF-8" locale. - - - -Starting with Cygwin 1.7.2, the language and territory are used to -fetch locale-dependent information from Windows. If the language and -territory are not known to Windows, the setlocale -function fails. - -The following modifiers are recognized. Any other modifier is simply -ignored for now. - - - - -For locales which use the Euro (EUR) as currency, the modifier "@euro" -can be added to enforce usage of the ISO-8859-15 character set, which -includes a character for the "Euro" currency sign. - - - -The default script used for all Serbian language locales (sr_BA, sr_ME, sr_RS, -and the deprecated sr_CS and sr_SP) is cyrillic. With the "@latin" modifier -it gets switched to the latin script with the respective collation behaviour. - - - -The default charset of the "be_BY" locale (Belarusian/Belarus) is CP1251. -With the "@latin" modifier it's UTF-8. - - - -The default charset of the "tt_RU" locale (Tatar/Russia) is ISO-8859-5. -With the "@iqtelif" modifier it's UTF-8. - - - -The default charset of the "uz_UZ" locale (Uzbek/Uzbekistan) is ISO-8859-1. -With the "@cyrillic" modifier it's UTF-8. - - - -There's a class of characters in the Unicode character set, called the -"CJK Ambiguous Width" characters. For these characters, the width -returned by the wcwidth/wcswidth functions is usually 1. This can be a -problem with East-Asian languages, which historically use character sets -where these characters have a width of 2. Therefore, wcwidth/wcswidth -return 2 as the width of these characters when an East-Asian charset such -as GBK or SJIS is selected, or when UTF-8 is selected and the language is -specified as "zh" (Chinese), "ja" (Japanese), or "ko" (Korean). This is -not correct in all circumstances, hence the locale modifier "@cjknarrow" -can be used to force wcwidth/wcswidth to return 1 for the ambiguous width -characters. - - - - - - -How to set the locale - - - - -Assume that you've set one of the aforementioned environment variables to some -valid POSIX locale value, other than "C" and "POSIX". Assume further that -you're living in Japan. You might want to use the language code "ja" and the -territory "JP", thus setting, say, LANG to "ja_JP". You didn't -set a character set, so what will Cygwin use now? Starting with Cygwin 1.7.2, -the default character set is determined by the default Windows ANSI codepage -for this language and territory. Cygwin uses a character set which is the -typical Unix-equivalent to the Windows ANSI codepage. For instance: - - - "en_US" ISO-8859-1 - "el_GR" ISO-8859-7 - "pl_PL" ISO-8859-2 - "pl_PL@euro" ISO-8859-15 - "ja_JP" EUCJP - "ko_KR" EUCKR - "te_IN" UTF-8 - - - - -You don't want to use the default character set? In that case you have to -specify the charset explicitly. For instance, assume you're from Japan and -don't want to use the japanese default charset EUC-JP, but the Windows -default charset SJIS. What you can do, for instance, is to set the -LANG variable in the mintty Cygwin Terminal -in the "Text" section of its "Options" dialog. If you're starting your -Cygwin session via a batch file or a shortcut to a batch file, you can also -just set LANG there: - - - @echo off - - C: - chdir C:\cygwin\bin - set LANG=ja_JP.SJIS - bash --login -i - - -For a list of locales supported by your Windows machine, use the new -locale -a command, which is part of the Cygwin package. -For a description see - -For a list of supported character sets, see - - - - - -Last, but not least, most singlebyte or doublebyte charsets have a big -disadvantage. Windows filesystems use the Unicode character set in the -UTF-16 encoding to store filename information. Not all characters -from the Unicode character set are available in a singlebyte or doublebyte -charset. While Cygwin has a workaround to access files with unusual -characters (see ), a better -workaround is to use always the UTF-8 character set. - -UTF-8 is the only multibyte character set which can represent -every Unicode character. - - - set LANG=es_MX.UTF-8 - - -For a description of the Unicode standard, see the homepage of the -Unicode Consortium. - - - - - - -The Windows Console character set - -Sometimes the Windows console is used to run Cygwin applications. -While terminal emulations like the Cygwin Terminal mintty -or xterm have a distinct way to set the character set -used for in- and output, the Windows console hasn't such a way, since it's -not an application in its own right. - -This problem is solved in Cygwin as follows. When a Cygwin -process is started in a Windows console (either explicitly from cmd.exe, -or implicitly by, for instance, running the -C:\cygwin\Cygwin.bat batch file), the Console character -set is determined by the setting of the aforementioned -internationalization environment variables, the same way as described in -. - -What is that good for? Why not switch the console character set with -the applications requirements? After all, the application knows if it uses -localization or not. However, what if a non-localized application calls -a remote application which itself is localized? This can happen with -ssh or rlogin. Both commands don't -have and don't need localization and they never call -setlocale. Setting one of the internationalization -environment variable to the same charset as the remote machine before -starting ssh or rlogin fixes that -problem. - - - -Potential Problems when using Locales - - -You can set the above internationalization variables not only when -starting the first Cygwin process, but also in your Cygwin shell on the -fly, even switch to yet another character set, and yet another. In bash -for instance: - - - bash$ export LC_CTYPE="nl_BE.UTF-8" - - -However, here's a problem. At the start of the first Cygwin process -in a session, the Windows environment is converted from UTF-16 to UTF-8. -The environment is another of the system objects stored in UTF-16 in -Windows. - -As long as the environment only contains ASCII characters, this is -no problem at all. But if it contains native characters, and you're planning -to use, say, GBK, the environment will result in invalid characters in -the GBK charset. This would be especially a problem in variables like -PATH. To circumvent the worst problems, Cygwin converts -the PATH environment variable to the charset set in the -environment, if it's different from the UTF-8 charset. - -Per POSIX, the name of an environment variable should only -consist of valid ASCII characters, and only of uppercase letters, digits, and -the underscore for maximum portability. - -Symbolic links, too, may pose a problem when switching charsets on -the fly. A symbolic link contains the filename of the target file the -symlink points to. When a symlink had been created with older versions -of Cygwin, the current ANSI or OEM character set had been used to store -the target filename, dependent on the old CYGWIN -environment variable setting codepage (see . If the target filename -contains non-ASCII characters and you use another character set than -your default ANSI/OEM charset, the target filename of the symlink is now -potentially an invalid character sequence in the new character set. -This behaviour is not different from the behaviour in other Operating -Systems. So, if you suddenly can't access a symlink anymore which -worked all these years before, maybe it's because you switched to -another character set. This doesn't occur with symlinks created with -Cygwin 1.7 or later. - -Another problem you might encounter is that older versions of -Windows did not install all charsets by default. If you are running -Windows XP or older, you can open the "Regional and Language Options" -portion of the Control Panel, select the "Advanced" tab, and select -entries from the "Code page conversion tables" list. The following -entries are useful to cygwin: 932/SJIS, 936/GBK, 949/EUC-KR, 950/Big5, -20932/EUC-JP. - - - -List of supported character sets - -Last but not least, here's the list of currently supported character -sets. The left-hand expression is the name of the charset, as you would use -it in the internationalization environment variables as outlined above. -Note that charset specifiers are case-insensitive. EUCJP -is equivalent to eucJP or eUcJp. -Writing the charset in the exact case as given in the list below is a -good convention, though. - - -The right-hand side is the number of the equivalent Windows -codepage as well as the Windows name of the codepage. They are only -noted here for reference. Don't try to use the bare codepage number or -the Windows name of the codepage as charset in locale specifiers, unless -they happen to be identical with the left-hand side. Especially in case -of the "CPxxx" style charsets, always use them with the trailing "CP". - -This works: - - - set LC_ALL=en_US.CP437 - - -This does not work: - - - set LC_ALL=en_US.437 - - -You can find a full list of Windows codepages on the Microsoft MSDN page -Code Page Identifiers. - - - Charset Codepage - ------------------- ------------------------------------------- - ASCII 20127 (US_ASCII) - - CP437 437 (OEM United States) - CP720 720 (DOS Arabic) - CP737 737 (OEM Greek) - CP775 775 (OEM Baltic) - CP850 850 (OEM Latin 1, Western European) - CP852 852 (OEM Latin 2, Central European) - CP855 855 (OEM Cyrillic) - CP857 857 (OEM Turkish) - CP858 858 (OEM Latin 1 + Euro Symbol) - CP862 862 (OEM Hebrew) - CP866 866 (OEM Russian) - CP874 874 (ANSI/OEM Thai) - CP932 932 (Shift_JIS, not exactly identical to SJIS) - CP1125 1125 (OEM Ukraine) - CP1250 1250 (ANSI Central European) - CP1251 1251 (ANSI Cyrillic) - CP1252 1252 (ANSI Latin 1, Western European) - CP1253 1253 (ANSI Greek) - CP1254 1254 (ANSI Turkish) - CP1255 1255 (ANSI Hebrew) - CP1256 1256 (ANSI Arabic) - CP1257 1257 (ANSI Baltic) - CP1258 1258 (ANSI/OEM Vietnamese) - - ISO-8859-1 28591 (ISO-8859-1) - ISO-8859-2 28592 (ISO-8859-2) - ISO-8859-3 28593 (ISO-8859-3) - ISO-8859-4 28594 (ISO-8859-4) - ISO-8859-5 28595 (ISO-8859-5) - ISO-8859-6 28596 (ISO-8859-6) - ISO-8859-7 28597 (ISO-8859-7) - ISO-8859-8 28598 (ISO-8859-8) - ISO-8859-9 28599 (ISO-8859-9) - ISO-8859-10 - (not available) - ISO-8859-11 - (not available) - ISO-8859-13 28603 (ISO-8859-13) - ISO-8859-14 - (not available) - ISO-8859-15 28605 (ISO-8859-15) - ISO-8859-16 - (not available) - - Big5 950 (ANSI/OEM Traditional Chinese) - EUCCN or euc-CN 936 (ANSI/OEM Simplified Chinese) - EUCJP or euc-JP 20932 (EUC Japanese) - EUCKR or euc-KR 949 (EUC Korean) - GB2312 936 (ANSI/OEM Simplified Chinese) - GBK 936 (ANSI/OEM Simplified Chinese) - GEORGIAN-PS - (not available) - KOI8-R 20866 (KOI8-R Russian Cyrillic) - KOI8-U 21866 (KOI8-U Ukrainian Cyrillic) - PT154 - (not available) - SJIS - (not available, almost, but not exactly CP932) - TIS620 or TIS-620 874 (ANSI/OEM Thai) - - UTF-8 or utf8 65001 (UTF-8) - - - - - diff --git a/winsup/doc/setup-maxmem.xml b/winsup/doc/setup-maxmem.xml deleted file mode 100644 index 1f5ee31a6..000000000 --- a/winsup/doc/setup-maxmem.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - -Changing Cygwin's Maximum Memory - - -Cygwin's heap is extensible. However, it does start out at a fixed size -and attempts to extend it may run into memory which has been previously -allocated by Windows. In some cases, this problem can be solved by -changing a field in the file header which is utilized by Cygwin since -version 1.7.10 to keep the initial size of the application heap. If the -field contains 0, which is the default, the application heap defaults to -a size of 384 Megabyte. If the field is set to any other value between 4 and -2048, Cygwin tries to reserve as much Megabytes for the application heap. -The field used for this is the "LoaderFlags" field in the NT-specific -PE header structure ((IMAGE_NT_HEADER)->OptionalHeader.LoaderFlags). - - -This value can be changed for any executable by using a more recent version -of the peflags tool from the rebase -Cygwin package. Example: - - -$ peflags --cygwin-heap foo.exe -foo.exe: initial Cygwin heap size: 0 (0x0) MB -$ peflags --cygwin-heap=500 foo.exe -foo.exe: initial Cygwin heap size: 500 (0x1f4) MB - - - - -Heap memory can be allocated up to the size of the biggest available free -block in the processes virtual memory (VM). By default, the VM per process -is 2 GB for 32 processes. To get more VM for a process, the executable -must have the "large address aware" flag set in the file header. You can -use the aforementioned peflags tool to set this flag. -On 64 bit systems this results in a 4 GB VM for a process started from that -executable. On 32 bit systems you also have to prepare the system to allow -up to 3 GB per process. See the Microsoft article -4-Gigabyte Tuning -for more information. - - - - -Older Cygwin releases only supported a global registry setting to -change the initial heap size for all Cygwin processes. This setting is -not used anymore. However, if you're running an older Cygwin release -than 1.7.10, you can add the DWORD value -heap_chunk_in_mb and set it to the desired memory limit -in decimal MB. You have to stop all Cygwin processes for this setting to -have any effect. It is preferred to do this in Cygwin using the -regtool program included in the Cygwin package. -(see ) This example sets the memory limit -to 1024 MB for all Cygwin processes (use HKCU instead of HKLM if you -want to set this only for the current user): - - -$ regtool -i set /HKLM/Software/Cygwin/heap_chunk_in_mb 1024 -$ regtool -v list /HKLM/Software/Cygwin - - - - - diff --git a/winsup/doc/setup-net.xml b/winsup/doc/setup-net.xml deleted file mode 100644 index fff9abe32..000000000 --- a/winsup/doc/setup-net.xml +++ /dev/null @@ -1,291 +0,0 @@ - - - - -Setting Up Cygwin - - -Internet Setup -To install the Cygwin net release, go to http://cygwin.com/ and run either -setup-x86.exe -to install the 32 bit version of Cygwin, or -setup-x86_64.exe -to install the 64 bit version of Cygwin. This will download a GUI -installer which can be run to download a complete cygwin installation -via the internet. Follow the instructions on each screen to install Cygwin. - - - - -For easier reading the installer is called setup.exe -throughout the following sections. This refers likewise to both -installer applications, -setup-x86.exe -for 32 bit, as well as -setup-x86_64.exe -for 64 bit. Apart from the target architecture they are the same thing. - - - - -The setup.exe installer is designed to be easy -for new users to understand while remaining flexible for the -experienced. The volunteer development team is constantly working -on setup.exe; before requesting a new feature, -check the wishlist in the CVS README -. It may already be present in the CVS version! - - - -On Windows Vista and later, setup.exe will check by -default if it runs with administrative privileges and, if not, will try -to elevate the process. If you want to avoid this behaviour and install -under an unprivileged account just for your own usage, run -setup.exe with the --no-admin option. - - - -Since the default value for each option is the logical choice for -most installations, you can get a working minimal Cygwin environment -installed by simply clicking the Next button -at each page. The only exception to this is choosing a Cygwin mirror, -which you can choose by experimenting with those listed at - -http://cygwin.com/mirrors.html -. For more details about each of page of the -setup.exe installation, read on below. -Please note that this guide assumes that you have a basic understanding -of Unix (or a Unix-like OS). If you are new to Unix, you will also want -to make use of -other resources. - - -Download Source - -Cygwin uses packages to manage installing various software. When -the default Install from Internet option is chosen, -setup.exe creates a local directory to store -the packages before actually installing the contents. -Download from Internet performs only the first -part (storing the packages locally), while -Install from Local Directory performs only the -second (installing the contents of the packages). - - -The Download from Internet option is mainly -for creating a base Cygwin package tree on one computer for -installation on several machines with -Install from Local Directory; copy the -entire local package tree to another machine with the directory -tree intact. For example, you might create a C:\cache\ -directory and place setup.exe in it. Run -setup.exe to Install from Internet -or Download from Internet, then copy the whole -C:\cache\ to each machine and instead choose -Install from Local Directory. - - -Though this provides some basic mirroring functionality, if you -are managing a large Cygwin installation, to keep up to date we recommend -using a mirroring tool such as wget. A helpful user on -the Cygwin mailing list created a simple demonstration script to accomplish -this; search the list for mkcygwget for ideas. - - - -Selecting an Install Directory - -The Root Directory for Cygwin (default -C:\cygwin) will become / -within your Cygwin installation. You must have write access to -the parent directory, and any ACLs on the parent directory will -determine access to installed files. - - -The Install For options of All Users -or Just Me should always be left on the default -All Users, unless you do not have write access to -HKEY_LOCAL_MACHINE in the registry or the All Users -Start Menu. This is true even if you are the only user planning to use Cygwin -on the machine. Selecting Just Me will cause problems -for programs such as crond and sshd. -If you do not have the necessary permissions, but still want to use these -programs, consult the Cygwin mailing list archives about others' experiences. - - - - -Local Package Directory - -The Local Package Directory is the cache where -setup.exe stores the packages before they are -installed. The cache must not be the same folder as the Cygwin -root. Within the cache, a separate directory is created for each -Cygwin mirror, which allows setup.exe to use -multiple mirrors and custom packages. After installing Cygwin, -the cache is no longer necessary, but you may want to retain the -packages as backups, for installing Cygwin to another system, -or in case you need to reinstall a package. - - - -Connection Method - -The Direct Connection method of downloading will -directly download the packages, while the IE5 method will leverage your -IE5 cache for performance. If your organisation uses a proxy server or -auto-configuration scripts, the IE5 method also uses these settings. -If you have a proxy server, you can manually type it into -the Use Proxy section. Unfortunately, -setup.exe does not currently support password -authorization for proxy servers. - - - -Choosing Mirrors - -Since there is no way of knowing from where you will be downloading -Cygwin, you need to choose at least one mirror site. Cygwin mirrors -are geographically distributed around the world; check the list at http://cygwin.com/mirrors.html -to find one near you. You can select multiple mirrors by holding down -CTRL and clicking on each one. If you have the URL of -an unlisted mirror (for example, if your organization has an internal Cygwin -mirror) you can add it. - - - -Choosing Packages - -For each selected mirror site, setup.exe downloads a -small text file called setup.bz2 that contains a list -of packages available from that site along with some basic information about -each package which setup.exe parses and uses to create the -chooser window. For details about the format of this file, see -the -setup.exe homepage. - - -The chooser is the most complex part of setup.exe. -Packages are grouped into categories, and one package may belong to multiple -categories (assigned by the volunteer package maintainer). Each package -can be found under any of those categories in the hierarchical chooser view. -By default, setup.exe -will install only the packages in the Base category -and their dependencies, resulting in a minimal Cygwin installation. -However, this will not include many commonly used tools such as -gcc (which you will find in the Devel -category). Since setup.exe automatically selects -dependencies, be careful not to unselect any required packages. In -particular, everything in the Base category is -required. - - -You can change setup.exe's view style, which is helpful -if you know the name of a package you want to install but not which -category it is in. -Click on the View button and it will rotate between -Category (the default), Full (all -packages), and Pending (only packages to be -installed, removed or upgraded). -If you are familiar with Unix, you will probably want to at least glance -through the Full listing for your favorite tools. - - -Once you have an existing Cygwin installation, the setup.exe -chooser is also used to manage your Cygwin installation. -Information on installed packages is kept in the -/etc/setup/ directory of your Cygwin installation; if -setup.exe cannot find this directory it will act as if -you have no Cygwin installation. If setup.exe -finds a newer version of an installed package available, it will automatically -mark it to be upgraded. -To Uninstall, Reinstall, or get the -Source for an existing package, click on -Keep to toggle it. -Also, to avoid the need to reboot after upgrading, make sure -to close all Cygwin windows and stop all Cygwin processes before -setup.exe begins to install the upgraded package. - - -To avoid unintentionally upgrading, use the Pending -view to see which packages have been marked for upgrading. If you -don't want to upgrade a package, click on the new version number to -toggle it until it says Keep. All packages can be -set to stay at the installed version by pressing the Keep -button in the top right part of the chooser window. - - -A previous version of each package is usually available, in case downgrading -is required to avoid a serious bug in the current version of the package. -Packages also occasionally have testing (or "experimental") versions available. -Previous and experimental versions can be chosen by clicking on the package's -New column until the required version appears. - - -All available experimental packages can be selected by pressing the -Exp in the top right part of the chooser window. -Be warned, however, that the next time you run setup.exe -it will try to replace all old or experimental versions with the current -version, unless told otherwise. - - - -Download and Installation Progress - -First, setup.exe will download all selected packages -to the local directory chosen earlier. Before installing, -setup.exe performs a checksum on each package. If the -local directory is a slow medium (such as a network drive) this can take -a long time. During the download and installation, setup.exe -shows progress bars for the current task and total remaining disk space. - - - -Shortcuts - -You may choose to install "Cygwin Terminal" shortcuts on the Desktop -and/or Start Menu. These shortcuts run mintty, -which will start your default shell as specified -in /etc/passwd. - - - -Post-Install Scripts - -Last of all, setup.exe will run any post-install -scripts to finish correctly setting up installed packages. Since each -script is run separately, several windows may pop up. If you are -interested in what is being done, see the Cygwin Package Contributor's -Guide at http://cygwin.com/setup.html -When the last post-install script is completed, setup.exe -will display a box announcing the completion. A few packages, such as -the OpenSSH server, require some manual site-specific configuration. -Relevant documentation can be found in the /usr/doc/Cygwin/ -or /usr/share/doc/Cygwin/ directory. - - -Troubleshooting - -Unfortunately, the complex setup process means that odd problems can -occur. If you're having trouble downloading packages, it may be network -congestion, so try a different mirror and/or a different protocol (i.e., -HTTP instead of FTP). If you notice something is not working after -running setup, you can check the setup.exe log file -at /var/log/setup.log.full. Make a backup of this -file before running setup.exe again, and follow the -steps for Reporting -Problems with Cygwin. - - - - - - - - - - diff --git a/winsup/doc/specialnames.xml b/winsup/doc/specialnames.xml deleted file mode 100644 index 543a4f127..000000000 --- a/winsup/doc/specialnames.xml +++ /dev/null @@ -1,513 +0,0 @@ - - - -Special filenames - -Special files in /etc - -Certain files in Cygwin's /etc directory are -read by Cygwin before the mount table has been established. The list -of files is - - - /etc/fstab - /etc/fstab.d/$USER - /etc/passwd - /etc/group - - -These file are read using native Windows NT functions which have -no notion of Cygwin symlinks or POSIX paths. For that reason -there are a few requirements as far as /etc is -concerned. - -To access these files, the Cygwin DLL evaluates it's own full -Windows path, strips off the innermost directory component and adds -"\etc". Let's assume the Cygwin DLL is installed as -C:\cygwin\bin\cygwin1.dll. First the DLL name as -well as the innermost directory (bin) is stripped -off: C:\cygwin\. Then "etc" and the filename to -look for is attached: C:\cygwin\etc\fstab. So the -/etc directory must be parallel to the directory in which the cygwin1.dll -exists and /etc must not be a Cygwin symlink -pointing to another directory. Consequentially none of the files from -the above list, including the directory /etc/fstab.d -is allowed to be a Cygwin symlink either. - -However, native NTFS symlinks and reparse points are transparent -when accessing the above files so all these files as well as -/etc itself may be NTFS symlinks or reparse -points. - -Last but not least, make sure that these files are world-readable. -Every process of any user account has to read these files potentially, -so world-readability is essential. The only exception are the user -specific files /etc/fstab.d/$USER, which only have -to be readable by the $USER user account itself. - - - -Invalid filenames - -Filenames invalid under Win32 are not necessarily invalid -under Cygwin since release 1.7.0. There are a few rules which -apply to Windows filenames. Most notably, DOS device names like -AUX, COM1, -LPT1 or PRN (to name a few) -cannot be used as filename or extension in a native Win32 application. -So filenames like prn.txt or foo.aux -are invalid filenames for native Win32 applications. - -This restriction doesn't apply to Cygwin applications. Cygwin -can create and access files with such names just fine. Just don't try -to use these files with native Win32 applications. - - - - -Forbidden characters in filenames - -Some characters are disallowed in filenames on Windows filesystems. -These forbidden characters are the ASCII control characters from ASCII -value 1 to 31, plus the following characters which have a special meaning -in the Win32 API: - - - " * : < > ? | \ - - -Cygwin can't fix this, but it has a method to workaround this -restriction. All of the above characters, except for the backslash, -are converted to special UNICODE characters in the range 0xf000 to 0xf0ff -(the "Private use area") when creating or accessing files. - -The backslash has to be exempt from this conversion, because Cygwin -accepts Win32 filenames including backslashes as path separators on input. -Converting backslashes using the above method would make this impossible. - -Additionally Win32 filenames can't contain trailing dots and spaces -for DOS backward compatibility. When trying to create files with trailing -dots or spaces, all of them are removed before the file is created. This -restriction only affects native Win32 applications. Cygwin applications -can create and access files with trailing dots and spaces without problems. - - -An exception from this rule are some network filesystems (NetApp, -NWFS) which choke on these filenames. They return with an error like -"No such file or directory" when trying to create such files. Starting -with Cygwin 1.7.6, Cygwin recognizes these filesystems and works around -this problem by applying the same rule as for the other forbidden characters. -Leading spaces and trailing dots and spaces will be converted to UNICODE -characters in the private use area. This behaviour can be switched on -explicitely for a filesystem or a directory tree by using the mount option -dos. - - - - -Filenames with unusual (foreign) characters - - Windows filesystems use Unicode encoded as UTF-16 -to store filename information. If you don't use the UTF-8 -character set (see ) then there's a -chance that a filename is using one or more characters which have no -representation in the character set you're using. - -In the default "C" locale, Cygwin creates filenames using -the UTF-8 charset. This will always result in some valid filename by -default, but again might impose problems when switching to a non-"C" -or non-"UTF-8" charset. - -To avoid this scenario altogether, always use UTF-8 as the -character set. - -If you don't want or can't use UTF-8 as character set for whatever -reason, you will nevertheless be able to access the file. How does that -work? When Cygwin converts the filename from UTF-16 to your character -set, it recognizes characters which can't be converted. If that occurs, -Cygwin replaces the non-convertible character with a special character -sequence. The sequence starts with an ASCII CAN character (hex code -0x18, equivalent Control-X), followed by the UTF-8 representation of the -character. The result is a filename containing some ugly looking -characters. While it doesn't look nice, it -is nice, because Cygwin knows how to convert -this filename back to UTF-16. The filename will be converted using your -usual character set. However, when Cygwin recognizes an ASCII CAN -character, it skips over the ASCII CAN and handles the following bytes as -a UTF-8 character. Thus, the filename is symmetrically converted back to -UTF-16 and you can access the file. - -Please be aware that this method is not entirely foolproof. -In some character set combinations it might not work for certain native -characters. - -Only by using the UTF-8 charset you can avoid this problem safely. - - - - - -Case sensitive filenames - -In the Win32 subsystem filenames are only case-preserved, but not -case-sensitive. You can't access two files in the same directory which -only differ by case, like Abc and -aBc. While NTFS (and some remote filesystems) -support case-sensitivity, the NT kernel starting with Windows XP does -not support it by default. Rather, you have to tweak a registry setting -and reboot. For that reason, case-sensitivity can not be supported by Cygwin, -unless you change that registry value. - -If you really want case-sensitivity in Cygwin, you can switch it -on by setting the registry value - - -HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\obcaseinsensitive - - -to 0 and reboot the machine. - - - -When installing Microsoft's Services For Unix (SFU), you're asked if -you want to use case-sensitive filenames. If you answer "yes" at this point, -the installer will change the aforementioned registry value to 0, too. So, if -you have SFU installed, there's some chance that the registry value is already -set to case sensitivity. - - - -After you set this registry value to 0, Cygwin will be case-sensitive -by default on NTFS and NFS filesystems. However, there are limitations: -while two programs Abc.exe -and aBc.exe can be created and accessed like other files, -starting applications is still case-insensitive due to Windows limitations -and so the program you try to launch may not be the one actually started. Also, -be aware that using two filenames which only differ by case might -result in some weird interoperability issues with native Win32 applications. -You're using case-sensitivity at your own risk. You have been warned! - -Even if you use case-sensitivity, it might be feasible to switch to -case-insensitivity for certain paths for better interoperability with -native Win32 applications (even if it's just Windows Explorer). You can do -this on a per-mount point base, by using the "posix=0" mount option in -/etc/fstab, or your /etc/fstab.d/$USER -file. - -/cygdrive paths are case-insensitive by default. -The reason is that the native Windows %PATH% environment variable is not -always using the correct case for all paths in it. As a result, if you use -case-sensitivity on the /cygdrive prefix, your shell -might claim that it can't find Windows commands like attrib -or net. To ease the pain, the /cygdrive -path is case-insensitive by default and you have to use the "posix=1" setting -explicitly in /etc/fstab or -/etc/fstab.d/$USER to switch it to case-sensitivity, -or you have to make sure that the native Win32 %PATH% environment variable -is using the correct case for all paths throughout. - -Note that mount points as well as device names and virtual -paths like /proc are always case-sensitive! The only exception are -the subdirectories and filenames under /proc/registry, /proc/registry32 -and /proc/registry64. Registry access is always case-insensitive. -Read on for more information. - - - - POSIX devices -While there is no need to create a POSIX /dev -directory, the directory is automatically created as part of a Cygwin -installation. It's existence is often a prerequisit to run certain -applications which create symbolic links, fifos, or UNIX sockets in -/dev. Also, the directories /dev/shm -and /dev/mqueue are required to exist to use named POSIX -semaphores, shared memory, and message queues, so a system without a real -/dev directory is functionally crippled. - - -Apart from that, Cygwin automatically simulates POSIX devices -internally. Up to Cygwin 1.7.11, these devices couldn't be seen with the -command ls /dev/ although commands such as -ls /dev/tty worked fine. Starting with Cygwin 1.7.12, -the /dev directory is automagically populated with -existing POSIX devices by Cygwin in a way comparable with a -udev based virtual -/dev directory under Linux. - - -Cygwin supports the following character devices commonly found on POSIX systems: - - - -/dev/null -/dev/zero -/dev/full - -/dev/console Pseudo device name for the current console window of a session. - Up to Cygwin 1.7.9, this was the only name for a console. - Different consoles were indistinguishable. - Cygwin's /dev/console is not quite comparable with the console - device on UNIX machines. - -/dev/cons0 Starting with Cygwin 1.7.10, Console sessions are numbered from -/dev/cons1 /dev/cons0 upwards. Console device names are pseudo device -... names, only accessible from processes within this very console - session. This is due to a restriction in Windows. - -/dev/tty The current controlling tty of a session. - -/dev/ptmx Pseudo tty master device. - -/dev/pty0 Pseudo ttys are numbered from /dev/pty0 upwards as they are -/dev/pty1 requested. -... - -/dev/ttyS0 Serial communication devices. ttyS0 == Win32 COM1, -/dev/ttyS1 ttyS1 == COM2, etc. -... - -/dev/pipe -/dev/fifo - -/dev/kmsg Kernel message pipe, for usage with sys logger services. - -/dev/random Random number generator. -/dev/urandom - -/dev/dsp Default sound device of the system. - - - -Cygwin also has several Windows-specific devices: - - - -/dev/com1 The serial ports, starting with COM1 which is the same as ttyS0. -/dev/com2 Please use /dev/ttySx instead. -... - -/dev/conin Same as Windows CONIN$. -/dev/conout Same as Windows CONOUT$. -/dev/clipboard The Windows clipboard, text only -/dev/windows The Windows message queue. - - - -Block devices are accessible by Cygwin processes using fixed POSIX device -names. These POSIX device names are generated using a direct conversion -from the POSIX namespace to the internal NT namespace. -E.g. the first harddisk is the NT internal device \device\harddisk0\partition0 -or the first partition on the third harddisk is \device\harddisk2\partition1. -The first floppy in the system is \device\floppy0, the first CD-ROM is -\device\cdrom0 and the first tape drive is \device\tape0. - -The mapping from physical device to the name of the device in the -internal NT namespace can be found in various places. For hard disks and -CD/DVD drives, the Windows "Disk Management" utility (part of the -"Computer Management" console) shows that the mapping of "Disk 0" is -\device\harddisk0. "CD-ROM 2" is \device\cdrom2. Another place to find -this mapping is the "Device Management" console. Disks have a -"Location" number, tapes have a "Tape Symbolic Name", etc. -Unfortunately, the places where this information is found is not very -well-defined. - - -For external disks (USB-drives, CF-cards in a cardreader, etc) you can use -Cygwin to show the mapping. /proc/partitions -contains a list of raw drives known to Cygwin. The df -command shows a list of drives and their respective sizes. If you match -the information between /proc/partitions and the -df output, you should be able to figure out which -external drive corresponds to which raw disk device name. - -Apart from tape devices which are not block devices and are -by default accessed directly, accessing mass storage devices raw -is something you should only do if you know what you're doing and know how to -handle the information. Writing to a raw -mass storage device you should only do if you -really know what you're doing and are aware -of the fact that any mistake can destroy important information, for the -device, and for you. So, please, handle this ability with care. -You have been warned. - - -Last but not least, the mapping from POSIX /dev namespace to internal -NT namespace is as follows: - - - -POSIX device name Internal NT device name - -/dev/st0 \device\tape0, rewind -/dev/nst0 \device\tape0, no-rewind -/dev/st1 \device\tape1 -/dev/nst1 \device\tape1 -... -/dev/st15 -/dev/nst15 - -/dev/fd0 \device\floppy0 -/dev/fd1 \device\floppy1 -... -/dev/fd15 - -/dev/sr0 \device\cdrom0 -/dev/sr1 \device\cdrom1 -... -/dev/sr15 - -/dev/scd0 \device\cdrom0 -/dev/scd1 \device\cdrom1 -... -/dev/scd15 - -/dev/sda \device\harddisk0\partition0 (whole disk) -/dev/sda1 \device\harddisk0\partition1 (first partition) -... -/dev/sda15 \device\harddisk0\partition15 (fifteenth partition) - -/dev/sdb \device\harddisk1\partition0 -/dev/sdb1 \device\harddisk1\partition1 - -[up to] - -/dev/sddx \device\harddisk127\partition0 -/dev/sddx1 \device\harddisk127\partition1 -... -/dev/sddx15 \device\harddisk127\partition15 - - - -if you don't like these device names, feel free to create symbolic -links as they are created on Linux systems for convenience: - - - -ln -s /dev/sr0 /dev/cdrom -ln -s /dev/nst0 /dev/tape -... - - - - -The .exe extension - -Win32 executable filenames end with .exe -but the .exe need not be included in the command, -so that traditional UNIX names can be used. However, for programs that -end in .bat and .com, you -cannot omit the extension. - -As a side effect, the ls filename gives -information about filename.exe if -filename.exe exists and filename -does not. In the same situation the function call -stat("filename",..) gives information about -filename.exe. The two files can be distinguished -by examining their inodes, as demonstrated below. - -bash$ ls * -a a.exe b.exe -bash$ ls -i a a.exe -445885548 a 435996602 a.exe -bash$ ls -i b b.exe -432961010 b 432961010 b.exe - -If a shell script myprog and a program -myprog.exe coexist in a directory, the shell -script has precedence and is selected for execution of -myprog. Note that this was quite the reverse up to -Cygwin 1.5.19. It has been changed for consistency with the rest of Cygwin. - - -The gcc compiler produces an executable named -filename.exe when asked to produce -filename. This allows many makefiles written -for UNIX systems to work well under Cygwin. - - - -The /proc filesystem - -Cygwin, like Linux and other similar operating systems, supports the -/proc virtual filesystem. The files in this -directory are representations of various aspects of your system, -for example the command cat /proc/cpuinfo -displays information such as what model and speed processor you have. - - -One unique aspect of the Cygwin /proc filesystem -is /proc/registry, see next section. - - -The Cygwin /proc is not as complete as the -one in Linux, but it provides significant capabilities. The -procps package contains several utilities -that use it. - - - -The /proc/registry filesystem - -The /proc/registry filesystem provides read-only -access to the Windows registry. It displays each KEY -as a directory and each VALUE as a file. As anytime -you deal with the Windows registry, use caution since changes may result -in an unstable or broken system. There are additionally subdirectories called -/proc/registry32 and /proc/registry64. -They are identical to /proc/registry on 32 bit -host OSes. On 64 bit host OSes, /proc/registry32 -opens the 32 bit processes view on the registry, while -/proc/registry64 opens the 64 bit processes view. - - -Reserved characters ('/', '\', ':', and '%') or reserved names -(. and ..) are converted by -percent-encoding: - -bash$ regtool list -v '\HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices' -... -\DosDevices\C: (REG_BINARY) = cf a8 97 e8 00 08 fe f7 -... -bash$ cd /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM -bash$ ls -l MountedDevices -... --r--r----- 1 Admin SYSTEM 12 Dec 10 11:20 %5CDosDevices%5CC%3A -... -bash$ od -t x1 MountedDevices/%5CDosDevices%5CC%3A -0000000 cf a8 97 e8 00 08 fe f7 01 00 00 00 - -The unnamed (default) value of a key can be accessed using the filename -@. - - -If a registry key contains a subkey and a value with the same name -foo, Cygwin displays the subkey as -foo and the value as foo%val. - - - -The @pathnames -To circumvent the limitations on shell line length in the native -Windows command shells, Cygwin programs, when invoked by non-Cygwin processes, expand their arguments -starting with "@" in a special way. If a file -pathname exists, the argument -@pathname expands recursively to the content of -pathname. Double quotes can be used inside the -file to delimit strings containing blank space. -In the following example compare the behaviors -/bin/echo when run from bash and from the Windows command prompt. - - Using @pathname - -bash$ /bin/echo 'This is "a long" line' > mylist -bash$ /bin/echo @mylist -@mylist -bash$ cmd -c:\> c:\cygwin\bin\echo @mylist -This is a long line - - - - diff --git a/winsup/doc/textbinary.xml b/winsup/doc/textbinary.xml deleted file mode 100644 index 112042f82..000000000 --- a/winsup/doc/textbinary.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - -Text and Binary modes - - The Issue - -On a UNIX system, when an application reads from a file it gets -exactly what's in the file on disk and the converse is true for writing. -The situation is different in the DOS/Windows world where a file can -be opened in one of two modes, binary or text. In the binary mode the -system behaves exactly as in UNIX. However on writing in text mode, a -NL (\n, ^J) is transformed into the sequence CR (\r, ^M) NL. - - -This can wreak havoc with the seek/fseek calls since the number -of bytes actually in the file may differ from that seen by the -application. - -The mode can be specified explicitly as explained in the Programming -section below. In an ideal DOS/Windows world, all programs using lines as -records (such as bash, make, -sed ...) would open files (and change the mode of their -standard input and output) as text. All other programs (such as -cat, cmp, tr ...) -would use binary mode. In practice with Cygwin, programs that deal -explicitly with object files specify binary mode (this is the case of -od, which is helpful to diagnose CR problems). Most -other programs (such as sed, cmp, -tr) use the default mode. - - - -The default Cygwin behavior - -The Cygwin system gives us some flexibility in deciding how files -are to be opened when the mode is not specified explicitly. -The rules are evolving, this section gives the design goals. - - - -If the filename is specified as a POSIX path and it appears to -reside on a file system that is mounted (i.e. if its pathname starts -with a directory displayed by mount), then the -default is specified by the mount flag. If the file is a symbolic link, -the mode of the target file system applies. - - - -If the file is specified via a MS-DOS pathname (i.e., it contains a -backslash or a colon), the default is binary. - - - - -Pipes, sockets and non-file devices are opened in binary mode. -For pipes opened through the pipe() system call you can use the setmode() -function (see to switch to textmode. -For pipes opened through popen(), you can simply specify text or binary -mode just like in calls to fopen(). - - - -Sockets and other non-file devices are always opened in binary mode. - - - - - When redirecting, the Cygwin shells uses rules (a-d). -Non-Cygwin shells always pipe and redirect with binary mode. With -non-Cygwin shells the commands cat filename | program -and program < filename are not equivalent when -filename is on a text-mounted partition. -The programs u2d and d2u can -be used to add or remove CR's from a file. u2d add's CR's before a NL. -d2u removes CR's. Use the --help option to these commands -for more information. - - - - - -Binary or text? - -UNIX programs that have been written for maximum portability -will know the difference between text and binary files and act -appropriately under Cygwin. Most programs included in the official -Cygwin distributions should work well in the default mode. - -Binmode is the best choice usually since it's faster and -easier to handle, unless you want to exchange files with native Win32 -applications. It makes most sense to keep the Cygwin distribution -and your Cygwin home directory in binmode and generate text files in -binmode (with UNIX LF lineendings). Most Windows applications can -handle binmode files just fine. A notable exception is the mini-editor -Notepad, which handles UNIX lineendings incorrectly -and only produces output files with DOS CRLF lineendings. - -You can convert files between CRLF and LF lineendings by using -certain tools in the Cygwin distribution like d2u and -u2d from the cygutils package. You can also specify -a directory in the mount table to be mounted in textmode so you can use -that directory for exchange purposes. - -As application programmer you can decide on a file by file base, -or you can specify default open modes depending on the purpose for which -the application open files. See the next section for a description of -your choices. - - - -Programming - -In the open() function call, binary mode can be -specified with the flag O_BINARY and text mode with -O_TEXT. These symbols are defined in -fcntl.h. - -The mkstemp() and mkstemps() -calls force binary mode. Use mkostemp() or -mkostemps() with the same flags -as open() for more control on temporary files. - -In the fopen() and popen() -function calls, binary mode can be specified by adding a b -to the mode string. Text mode is specified by adding a t -to the mode string. - -The mode of a file can be changed by the call -setmode(fd,mode) where fd is a file -descriptor (an integer) and mode is -O_BINARY or O_TEXT. The function -returns O_BINARY or O_TEXT depending -on the mode before the call, and EOF on error. - -There's also a convenient way to set the default open modes used -in an application by just linking against various object files provided -by Cygwin. For instance, if you want to make sure that all files are -always opened in binary mode by an application, regardless of the mode -of the underlying mount point, just add the file -/lib/binmode.o to the link stage of the application -in your project, like this: - - - $ gcc my_tiny_app.c /lib/binmode.o -o my_tiny_app - - -Starting with Cygwin 1.7.7, you can use the even simpler: - - - $ gcc my_tiny_app.c -lbinmode -o my_tiny_app - - -This adds code which sets the default open mode for all files -opened by my_tiny_app to binary for reading and -writing. - -Cygwin provides the following libraries and object files to set the -default open mode just by linking an application against them: - - - - - -/lib/libautomode.a - Open files for reading in textmode, -/lib/automode.o open files for writing in binary mode - - - - - -/lib/libbinmode.a - Open files for reading and writing in binary mode -/lib/binmode.o - - - - - -/lib/libtextmode.a - Open files for reading and writing in textmode -/lib/textmode.o - - - - - -/lib/libtextreadmode.a - Open files for reading in textmode, -/lib/textreadmode.o keep default behaviour for writing. - - - - - - - - diff --git a/winsup/doc/ug-info.xml b/winsup/doc/ug-info.xml deleted file mode 100644 index c5b4a67c8..000000000 --- a/winsup/doc/ug-info.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - 2001-22-03 - Cygwin User's Guide - - - Joshua Daniel - Franklin - - - Corinna - Vinschen - - - Christopher - Faylor - - - DJ - Delorie - - - Pierre - Humblet - - - Geoffrey - Noer - - - - - diff --git a/winsup/doc/using.xml b/winsup/doc/using.xml deleted file mode 100644 index 1795acccd..000000000 --- a/winsup/doc/using.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - -Using Cygwin - -This chapter explains some key differences between the Cygwin -environment and traditional UNIX systems. It assumes a working -knowledge of standard UNIX commands. - - - - - - - - - - - diff --git a/winsup/doc/windres.xml b/winsup/doc/windres.xml deleted file mode 100644 index 4b2a13ef7..000000000 --- a/winsup/doc/windres.xml +++ /dev/null @@ -1,172 +0,0 @@ - - - -Defining Windows Resources - -windres reads a Windows resource file -(*.rc) and converts it to a res or coff file. -The syntax and semantics of the input file are the same as for any -other resource compiler, so please refer to any publication describing -the Windows resource format for details. Also, the -windres program itself is fully documented in the -Binutils manual. Here's an example of using it in a project: - - - - - - -What follows is a quick-reference to the syntax -windres supports. - - - -id ACCELERATORS suboptions -BEG -"^C" 12 -"Q" 12 -65 12 -65 12 , VIRTKEY ASCII NOINVERT SHIFT CONTROL ALT -65 12 , VIRTKEY, ASCII, NOINVERT, SHIFT, CONTROL, ALT -(12 is an acc_id) -END - -SHIFT, CONTROL, ALT require VIRTKEY - - -id BITMAP memflags "filename" -memflags defaults to MOVEABLE - - -id CURSOR memflags "filename" -memflags defaults to MOVEABLE,DISCARDABLE - - -id DIALOG memflags exstyle x,y,width,height styles BEG controls END -id DIALOGEX memflags exstyle x,y,width,height styles BEG controls END -id DIALOGEX memflags exstyle x,y,width,height,helpid styles BEG controls END - -memflags defaults to MOVEABLE -exstyle may be EXSTYLE=number -styles: CAPTION "string" - CLASS id - STYLE FOO | NOT FOO | (12) - EXSTYLE number - FONT number, "name" - FONT number, "name",weight,italic - MENU id - CHARACTERISTICS number - LANGUAGE number,number - VERSIONK number -controls: - AUTO3STATE params - AUTOCHECKBOX params - AUTORADIOBUTTON params - BEDIT params - CHECKBOX params - COMBOBOX params - CONTROL ["name",] id, class, style, x,y,w,h [,exstyle] [data] - CONTROL ["name",] id, class, style, x,y,w,h, exstyle, helpid [data] - CTEXT params - DEFPUSHBUTTON params - EDITTEXT params - GROUPBOX params - HEDIT params - ICON ["name",] id, x,y [data] - ICON ["name",] id, x,y,w,h, style, exstyle [data] - ICON ["name",] id, x,y,w,h, style, exstyle, helpid [data] - IEDIT params - LISTBOX params - LTEXT params - PUSHBOX params - PUSHBUTTON params - RADIOBUTTON params - RTEXT params - SCROLLBAR params - STATE3 params - USERBUTTON "string", id, x,y,w,h, style, exstyle -params: - ["name",] id, x, y, w, h, [data] - ["name",] id, x, y, w, h, style [,exstyle] [data] - ["name",] id, x, y, w, h, style, exstyle, helpid [data] - -[data] is optional BEG (string|number) [,(string|number)] (etc) END - - -id FONT memflags "filename" -memflags defaults to MOVEABLE|DISCARDABLE - -id ICON memflags "filename" -memflags defaults to MOVEABLE|DISCARDABLE - -LANGUAGE num,num - -id MENU options BEG items END -items: - "string", id, flags - SEPARATOR - POPUP "string" flags BEG menuitems END -flags: - CHECKED - GRAYED - HELP - INACTIVE - MENUBARBREAK - MENUBREAK - -id MENUEX suboptions BEG items END -items: - MENUITEM "string" - MENUITEM "string", id - MENUITEM "string", id, type [,state] - POPUP "string" BEG items END - POPUP "string", id BEG items END - POPUP "string", id, type BEG items END - POPUP "string", id, type, state [,helpid] BEG items END - -id MESSAGETABLE memflags "filename" -memflags defaults to MOVEABLE - -id RCDATA suboptions BEG (string|number) [,(string|number)] (etc) END - -STRINGTABLE suboptions BEG strings END -strings: - id "string" - id, "string" - -(User data) -id id suboptions BEG (string|number) [,(string|number)] (etc) END - -id VERSIONINFO stuffs BEG verblocks END -stuffs: FILEVERSION num,num,num,num - PRODUCTVERSION num,num,num,num - FILEFLAGSMASK num - FILEOS num - FILETYPE num - FILESUBTYPE num -verblocks: - BLOCK "StringFileInfo" BEG BLOCK BEG vervals END END - BLOCK "VarFileInfo" BEG BLOCK BEG vertrans END END -vervals: VALUE "foo","bar" -vertrans: VALUE num,num - - - -suboptions: - memflags - CHARACTERISTICS num - LANGUAGE num,num - VERSIONK num - -memflags are MOVEABLE/FIXED PURE/IMPURE PRELOAD/LOADONCALL DISCARDABLE - - - - diff --git a/winsup/doc/xidepend b/winsup/doc/xidepend deleted file mode 100755 index 2a1fc831d..000000000 --- a/winsup/doc/xidepend +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -if [ "$1" = "-r" ] -then - # We're being called recursively by another xidepend instance, so - # suppress outputs that only happen at the top level. - shift - subproc=1 -else - subproc=0 -fi - -for f in "$@" -do - if fgrep -q 'xi:include' "$f" - then - # This file uses XIncludes. Let's chase its deps recursively. - base=`basename "$f" .xml` - if [ $subproc -eq 0 ] ; then echo -n "$base/$base.html:" ; fi - - deps=`grep 'xi:include.*href' "$f" | cut -f2 -d\" | tr '\n' ' '` - echo -n " $deps" - for d in $deps - do - # Call ourselves recursively to continue to collect deps. - # The -r flag tells our subprocess that it is merely - # contributing to a dependency line in progress. - $0 -r $d - done - - # If we're at the top recursion level, we have nothing else to - # add to this dependency line other than the newline. - if [ $subproc -eq 0 ] ; then echo ; fi - fi -done diff --git a/winsup/install-sh b/winsup/install-sh deleted file mode 100755 index 6781b987b..000000000 --- a/winsup/install-sh +++ /dev/null @@ -1,520 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2009-04-28.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 - 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 - 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 - trap '(exit $?); exit' 1 2 13 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 starting with `-'. - 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 - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac - - # 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 -z "$d" && 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: diff --git a/winsup/lsaauth/ChangeLog b/winsup/lsaauth/ChangeLog deleted file mode 100644 index 020e972f0..000000000 --- a/winsup/lsaauth/ChangeLog +++ /dev/null @@ -1,165 +0,0 @@ -2013-12-03 Christopher Faylor - - * configure.ac: Back out stupid change. - * configure: Regenerate. - -2013-12-03 Christopher Faylor - - * configure.ac: Don't require 64-bit compiler for 32-bit builds. - * configure: Regenerate. - -2013-07-29 Corinna Vinschen - - * Makefile.in (cyglsa.dll): Explicitely specify DLL entry point to - harden against gcc function and block reordering optimizations. - (cyglsa64.dll): Ditto. - -2013-04-23 Corinna Vinschen - - * Merge in cygwin-64bit-branch. See ChangeLog.64bit for details. - -2012-11-26 Christopher Faylor - - * configure.ac: Rename from configure.in. - * configure.in: Delete. - * configure: Regenerate. - -2012-11-23 Christopher Faylor - - * Makefile.in: Use /bin/mkdir to make directories. - -2012-10-24 Corinna Vinschen - - * configure.in: Add AC_NO_EXECUTABLES. - * configure: Regenerate. - -2012-10-24 Kai Tietz - Yaakov Selkowitz - - * configure.in: Check for MINGW32_CC and MINGW64_CC. - * configure: Regenerate. - * Makefile.in: Use MINGW32_CC and MINGW64_CC to build 32-bit and - 64-bit DLLs. Remove references to mingw and w32api directories. - * cyglsa64.dll: Remove from version control. - * make-64bit-version-with-mingw-w64.sh: Remove. - -2012-05-29 Corinna Vinschen - - * Makefile.in (LIBS): Re-add advapi32.dll. Explain why. - * make-64bit-version-with-mingw-w64.sh (LIBS): Ditto. - * cyglsa.c: Drop NTDLL function declarations. Use equivalent advapi32 - functions again, throughout. - * cyglsa64.dll: Regenerate. - -2011-05-10 Corinna Vinschen - - * Makefile.in: Don't override CC. - * cyglsa.c: Don't include wchar.h. Declare wcscpy and wcslen instead. - * cyglsa64.dll: Rebuild. - -2011-03-31 Corinna Vinschen - - * Makefile.in (LIBS): Remove advapi32.dll. - (clean): Remove cyglsa.def. - * cyglsa.c: Drop definitions required for VC++. Don't include ntddk.h. - Declare functions from NTDLL here. Explain why. Use NTDLL functions - in place of ADVAPI32 functions. - * cyglsa64.def: New file. - * cyglsa64.dll: Regenerate. - * make-64bit-version-with-mingw-w64.sh (LIBS): Remove advapi32.dll. - Reference cyglsa64.def instead of mslsa.def. - * make-64bit-version-with-visual-c.bat: Remove. - * mslsa.def: Remove. - -2011-03-31 Yaakov Selkowitz - - * cyglsa.c: Fix compilation with MinGW-w64 toolchains. - * make-64bit-version-with-mingw-w64.sh: New file. - * cyglsa64.dll: Regenerate with MinGW-w64-gc. - -2010-12-10 Illia Bobyr - - * cyglsa-config: Unset GREP_OPTIONS when calling grep. - -2010-01-29 Corinna Vinschen - - * cyglsa.c: Include lmcons.h instead of lm.h to make newer WinDDK happy. - (LsaApLogonUserEx): Use CYG_LSA_MAGIC as checksum start value to - decouple from Cygwin release. - * make-64bit-version-with-visual-c.bat: Avoid compiler warning. - * cyglsa64.dll: New build. - -2009-02-23 Sjors Gielen - - * Makefile.in: Add DESTDIR functionality. - -2008-10-12 Christopher Faylor - - * Makefile.in: Rearrange to avoid -mno-cygwin. - * configure.in: Use mingw front-end from utils directory as compiler - front-end. - * configure: Regenerate. - * cyglsa.c (cyglsa_printf): Rename from 'printf' to avoid a compiler - error. - (print_sid, print_groups, print_privs, print_dacl, print_tokinf, - LsaApLogonUserEx): Ditto. - -2008-08-13 Corinna Vinschen - - * cyglsa-config: Copy the DLL instead of moving. - -2008-07-16 Corinna Vinschen - - * cyglsa-config: Always create a /bin/cyglsa directory and copy the - LSA DLL there. Register this copy in the registry. - -2008-07-15 Corinna Vinschen - - * cyglsa.c: Include ntddk.h again, but only if __MINGW32__ is defined. - * cyglsa64.dll: Regenerate. - * make-64bit-version-with-visual-c.bat: Fix comment. - -2008-07-13 Corinna Vinschen - - * cyglsa.c: Don't include ntddk.h. - (RtlInitEmptyUnicodeString): Use Visual-C compatible "__inline" instead - of "inline". - (uni_alloc): Change second argument to USHORT. - (printf): Move definition of ap to make Visual-C++ happy. - (LsaApLogonUserEx): Compute size of datastructure returned to - LSA on 64 bit systems correctly to avoid heap corruption. - * cyglsa64.dll: Regenerate. - * make-64bit-version-with-visual-c.bat: Accommodate newer Microsoft - toolchains. Add more comment. - * mslsa.def: Export LsaApLogonUserEx instead of LsaApLogonUser. - -2008-07-11 Corinna Vinschen - - * cyglsa.c (LsaApLogonUserEx): Accommodate the fact that authinf->domain - and authinf->username are now of type WCHAR. Change sam_username and - sam_u size to be deifned in terms of MAX_DOMAIN_NAME_LEN instead of - INTERNET_MAX_HOST_NAME_LENGTH. - -2008-07-10 Corinna Vinschen - - * cyglsa.c: Revamp debugging output. - (LsaApInitializePackage): Open debugging output file here. - (LsaApLogonUserEx): Replace LsaApLogonUser. Add debugging output. - Create machine name for accounting. Add (disabled) code to fetch - a token from GetAuthDataForUser/ConvertAuthDataToToken. - * cyglsa.din: Relace LsaApLogonUser with LsaApLogonUserEx. - -2006-11-27 Corinna Vinschen - - Initial release of the Cygwin LSA authentication package. - * ChangeLog: New file. - * Makefile.in: Ditto. - * aclocal.m4: Ditto. - * configure.in: Ditto. - * configure: Ditto. Generated from configure.in. - * cyglsa-config: Ditto. - * cyglsa.c: Ditto. - * cyglsa.din: Ditto. - * cyglsa64.dll: Ditto. - * make-64bit-version-with-visual-c.bat: Ditto. - * mslsa.def: Ditto. diff --git a/winsup/lsaauth/ChangeLog.64bit b/winsup/lsaauth/ChangeLog.64bit deleted file mode 100644 index 32ef85710..000000000 --- a/winsup/lsaauth/ChangeLog.64bit +++ /dev/null @@ -1,13 +0,0 @@ -2013-02-22 Yaakov Selkowitz - - * configure.ac: Skip check for i686-w64-mingw32-g++ on x86_64. - * configure: Regenerate. - -2013-02-21 Corinna Vinschen - - * Makefile.in (target_cpu): Define. Check for target_cpu rather than - target_alias for conditional compilation issues. - -2013-02-15 Yaakov Selkowitz - - * Makefile.in: Do not build or install 32bit DLL for 64bit target. diff --git a/winsup/lsaauth/Makefile.in b/winsup/lsaauth/Makefile.in deleted file mode 100644 index 53e91c406..000000000 --- a/winsup/lsaauth/Makefile.in +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright (c) 2006, 2008, 2009, 2011, 2012, 2013 Red Hat, 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 of the License, or -# (at your option) any later version. -# -# A copy of the GNU General Public License can be found at -# http://www.gnu.org/ -# -# Written by Corinna Vinschen -# -# Makefile for Cygwin subauthentication DLL. - -SHELL := @SHELL@ - -srcdir := @srcdir@ -VPATH := @srcdir@ -prefix := @prefix@ -exec_prefix := @exec_prefix@ - -bindir := @bindir@ -etcdir := $(exec_prefix)/etc - -INSTALL := @INSTALL@ -INSTALL_PROGRAM := @INSTALL_PROGRAM@ -INSTALL_DATA := @INSTALL_DATA@ - -CC := @CC@ -CC_FOR_TARGET := $(CC) - -MINGW32_CC := @MINGW32_CC@ -MINGW64_CC := @MINGW64_CC@ - -CFLAGS := @CFLAGS@ - -include $(srcdir)/../Makefile.common - -target_cpu:=@target_cpu@ - -WIN32_INCLUDES := -I. -I$(srcdir) -WIN32_CFLAGS := $(CFLAGS) $(WIN32_INCLUDES) -WIN32_LDFLAGS := $(CFLAGS) -nostdlib -Wl,-shared - -# Never again try to remove advapi32. It does not matter if the DLL calls -# advapi32 functions or the equivalent ntdll functions. -# But if the LSA authentication DLL is not linked against advapi32, it's -# not recognized by LSA. -LIBS := -ladvapi32 -lkernel32 -lntdll - -ifneq ($(target_cpu),x86_64) -DLL32 := cyglsa.dll -DEF32 := cyglsa.def -OBJ32 := cyglsa.o -endif - -DLL64 := cyglsa64.dll -DEF64 := cyglsa64.def -OBJ64 := cyglsa64.o - -.SUFFIXES: -.NOEXPORT: - -all: Makefile $(DLL32) $(DLL64) - -$(DEF32): cyglsa.din config.status - $(SHELL) config.status - -$(DLL32): $(OBJ32) $(DEF32) - $(MINGW32_CC) -s $(WIN32_LDFLAGS) -e _DllMain@12 -o $@ $^ $(LIBS) - -$(OBJ32): cyglsa.c - $(MINGW32_CC) $(WIN32_CFLAGS) -c -o $@ $< - -$(DLL64): $(OBJ64) $(DEF64) - $(MINGW64_CC) -s $(WIN32_LDFLAGS) -e DllMain -o $@ $^ $(LIBS) - -$(OBJ64): cyglsa.c - $(MINGW64_CC) $(WIN32_CFLAGS) -c -o $@ $< - -.PHONY: all install clean realclean - -realclean: clean - rm -f Makefile config.cache - -clean: - rm -f *.o *.dll cyglsa.def - -install: all - /bin/mkdir -p $(DESTDIR)$(bindir) -ifneq ($(target_cpu),x86_64) - $(INSTALL_PROGRAM) $(DLL32) $(DESTDIR)$(bindir)/$(DLL32) -endif - $(INSTALL_PROGRAM) $(DLL64) $(DESTDIR)$(bindir)/$(DLL64) - $(INSTALL_PROGRAM) $(srcdir)/cyglsa-config $(DESTDIR)$(bindir)/cyglsa-config diff --git a/winsup/lsaauth/aclocal.m4 b/winsup/lsaauth/aclocal.m4 deleted file mode 100644 index ecef4244c..000000000 --- a/winsup/lsaauth/aclocal.m4 +++ /dev/null @@ -1,875 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p6 - -dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -# lib-prefix.m4 serial 4 (gettext-0.14.2) -dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) - -# lib-link.m4 serial 6 (gettext-0.14.3) -dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -AC_PREREQ(2.50) - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - undefine([Name]) - undefine([NAME]) -]) - -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. If found, it -dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and -dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIB[]NAME" - AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - undefine([Name]) - undefine([NAME]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, -dnl hardcode_direct, hardcode_minus_L. -AC_DEFUN([AC_LIB_RPATH], -[ - dnl Tell automake >= 1.10 to complain if config.rpath is missing. - m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE(rpath, - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib$1-prefix], -[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib - --without-lib$1-prefix don't search for lib$1 in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) - -# lib-ld.m4 serial 3 (gettext-0.13) -dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi -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 GCC]) - 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. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path 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(acl_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; - *) - test "$with_gnu_ld" != yes && break ;; - esac - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) - -dnl This provides configure definitions used by all the winsup -dnl configure.in files. - -# FIXME: We temporarily define our own version of AC_PROG_CC. This is -# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We -# are probably using a cross compiler, which will not be able to fully -# link an executable. This should really be fixed in autoconf -# itself. - -AC_DEFUN([LIB_AC_PROG_CC_GNU], -[AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc, -[dnl The semicolon is to pacify NeXT's syntax-checking cpp. -cat > conftest.c </dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi])]) - -AC_DEFUN([LIB_AC_PROG_CC], -[AC_BEFORE([$0], [AC_PROG_CPP])dnl -AC_CHECK_TOOL(CC, gcc, gcc) -: ${CC:=gcc} -AC_PROG_CC -test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) -]) - -AC_DEFUN([LIB_AC_PROG_CXX], -[AC_BEFORE([$0], [AC_PROG_CPP])dnl -AC_CHECK_TOOL(CXX, g++, g++) -if test -z "$CXX"; then - AC_CHECK_TOOL(CXX, g++, c++, , , ) - : ${CXX:=g++} - AC_PROG_CXX - test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) -fi - -CXXFLAGS='$(CFLAGS)' -]) - diff --git a/winsup/lsaauth/configure b/winsup/lsaauth/configure deleted file mode 100755 index 6073a2d61..000000000 --- a/winsup/lsaauth/configure +++ /dev/null @@ -1,4218 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69. -# -# -# Copyright (C) 1992-1996, 1998-2012 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 - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # 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 -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+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -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 -test -x / || 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" - 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 : - export CONFIG_SHELL - # 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 -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+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -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 about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a 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_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_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; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # 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 -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -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 - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# 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'" - - -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= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="Makefile.in" -ac_no_link=no -ac_subst_vars='LTLIBOBJS -LIBOBJS -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -MINGW64_CC -MINGW32_CC -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -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 -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS' - - -# 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}' -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 - 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 this package 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/PACKAGE] - --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] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -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 - -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 the package provider. -_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 -configure -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 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 -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 $as_me, which was -generated by GNU Autoconf 2.69. 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 - -# 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 - - - -ac_aux_dir= -for ac_dir in ../.. "$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\"/../.." "$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. - - - - -# 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 - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if ${ac_cv_target+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - -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 as_fn_executable_p "$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 as_fn_executable_p "$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="gcc" - 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 - -: ${CC:=gcc} -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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 -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 - ac_no_link=no - 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 - -else - rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.o conftest.obj conftest.dSYM - ac_no_link=yes - # Setting cross_compile will disable run tests; it will - # also disable AC_CHECK_FILE but that's generally - # correct if we can't link. - cross_compiling=yes - EXEEXT= - # 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; } - -fi -{ $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 -struct stat; -/* 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 - -test -z "$CC" && as_fn_error $? "no acceptable cc found in \$PATH" "$LINENO" 5 - - -case "$target_cpu" in -i?86) - for ac_prog in i686-w64-mingw32-gcc -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_MINGW32_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MINGW32_CC"; then - ac_cv_prog_MINGW32_CC="$MINGW32_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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_MINGW32_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 -MINGW32_CC=$ac_cv_prog_MINGW32_CC -if test -n "$MINGW32_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MINGW32_CC" >&5 -$as_echo "$MINGW32_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$MINGW32_CC" && break -done - - test -z "$MINGW32_CC" && as_fn_error $? "no acceptable mingw32 cc found in \$PATH" "$LINENO" 5 - ;; -esac - -for ac_prog in x86_64-w64-mingw32-gcc -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_MINGW64_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MINGW64_CC"; then - ac_cv_prog_MINGW64_CC="$MINGW64_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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_MINGW64_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 -MINGW64_CC=$ac_cv_prog_MINGW64_CC -if test -n "$MINGW64_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MINGW64_CC" >&5 -$as_echo "$MINGW64_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$MINGW64_CC" && break -done - -test -z "$MINGW64_CC" && as_fn_error $? "no acceptable mingw64 cc found in \$PATH" "$LINENO" 5 - -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"` - - -# 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 as_fn_executable_p "$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' - - -ac_config_files="$ac_config_files Makefile cyglsa.def:cyglsa.din" - -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}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.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 - - - -: "${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 -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -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 - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# 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 $as_me, which was -generated by GNU Autoconf 2.69. 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 - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_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 - -Configuration files: -$config_files - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 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' -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;; - --he | --h | --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 -_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 - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "cyglsa.def") CONFIG_FILES="$CONFIG_FILES cyglsa.def:cyglsa.din" ;; - - *) 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 -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" - - -eval set X " :F $CONFIG_FILES " -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 -_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 -$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 - ;; - - - - 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 - diff --git a/winsup/lsaauth/configure.ac b/winsup/lsaauth/configure.ac deleted file mode 100644 index fe2e30bf0..000000000 --- a/winsup/lsaauth/configure.ac +++ /dev/null @@ -1,42 +0,0 @@ -dnl Copyright (c) 2006, Red Hat, Inc. -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 2 of the License, or -dnl (at your option) any later version. -dnl -dnl A copy of the GNU General Public License can be found at -dnl http://www.gnu.org/ -dnl -dnl Written by Christopher Faylor -dnl Changed for lsa subdir by Corinna Vinschen - -dnl Autoconf configure script for Cygwin utilities. -dnl -dnl Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59) -AC_INIT(Makefile.in) - -AC_CONFIG_AUX_DIR(../..) - -AC_NO_EXECUTABLES -AC_CANONICAL_SYSTEM - -LIB_AC_PROG_CC - -case "$target_cpu" in -i?86) - AC_CHECK_PROGS(MINGW32_CC, i686-w64-mingw32-gcc) - test -z "$MINGW32_CC" && AC_MSG_ERROR([no acceptable mingw32 cc found in \$PATH]) - ;; -esac - -AC_CHECK_PROGS(MINGW64_CC, x86_64-w64-mingw32-gcc) -test -z "$MINGW64_CC" && AC_MSG_ERROR([no acceptable mingw64 cc found in \$PATH]) - -AC_ARG_PROGRAM - -AC_PROG_INSTALL - -AC_OUTPUT(Makefile cyglsa.def:cyglsa.din) diff --git a/winsup/lsaauth/cyglsa-config b/winsup/lsaauth/cyglsa-config deleted file mode 100755 index 076a16694..000000000 --- a/winsup/lsaauth/cyglsa-config +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# -# cyglsa-config, Copyright 2006, 2010 Red Hat 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 of the License, or -# (at your option) any later version. -# -# A copy of the GNU General Public License can be found at -# http://www.gnu.org/ -# -# This file is part of the Cygwin LSA authentication package. - -request() -{ - if [ "${auto_answer}" = "yes" ] - then - echo "$1 (yes/no) yes" - return 0 - elif [ "${auto_answer}" = "no" ] - then - echo "$1 (yes/no) no" - return 1 - fi - - answer="" - while [ "X${answer}" != "Xyes" -a "X${answer}" != "Xno" ] - do - echo -n "$1 (yes/no) " - read -e answer - done - if [ "X${answer}" = "Xyes" ] - then - return 0 - else - return 1 - fi -} - -# Check if running under at least Windows 2000 -_nt_too_old=`uname | awk -F- '{print ( $2 < 5.0 ) ? 1 : 0;}'` -if [ ${_nt_too_old} -eq 1 ] -then - echo "Cygwin LSA authentication not supported on Windows NT4 or older. Exiting." - exit 1 -fi - -# Directory in which cyglsa DLL is installed as DOS path. -bindir=`cygpath -w /`\\bin - -# Check if we're running on 64 bit Windows. If so, we need the 64 bit -# cyglsa DLL. -dll=cyglsa.dll -test -d `cygpath -p ${SYSTEMROOT}`/SysWOW64 && dll=cyglsa64.dll - -# Check if the DLL is actually installed. If not, bail out. -if [ ! -f /bin/${dll} ] -then - echo "Required Cygwin authentication DLL /bin/${dll} doesn't exist. Exiting." - exit 1 -fi - -echo -echo "Warning: Registering the Cygwin LSA authentication package requires" -echo "administrator privileges! You also have to reboot the machine to" -echo "activate the change." -echo -request "Are you sure you want to continue?" || exit 0 - -# The registry value which keeps the authentication packages. -value='/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Lsa/Authentication Packages' - -[ -f /bin/cyglsa -a ! -d /bin/cyglsa ] && rm -rf /bin/cyglsa -if [ ! -d /bin/cyglsa ] -then - if ! mkdir -m 755 /bin/cyglsa - then - echo "Creating the /bin/cyglsa directory failed. Exiting." - exit 1 - fi -fi -if ! cp -b "/bin/${dll}" "/bin/cyglsa/${dll}" -then - echo "Copying the new LSA authentication package /bin/${dll} to" - echo "/bin/cyglsa/${dll} failed. Exiting." - exit 1 -fi - -# Get old content, remove every trace of "cyglsa" from it and write the -# content back to the registry with the new, correct path to the cyglsa DLL. -old=`regtool get "${value}"` -new=`for i in ${old} -do - echo $i | GREP_OPTIONS="" grep -v cyglsa -done` -if ! regtool set "${value}" ${new} "${bindir}\\cyglsa\\${dll}" -then - echo "Setting the new registry value failed. Exiting." - exit 1 -fi - -echo -echo "Cygwin LSA authentication package registered." -echo -echo "Activating Cygwin's LSA authentication package requires to reboot." -if [ -x /bin/shutdown ] -then - if request "Do you want to do this immediately?" - then - echo - echo "Other users might still be working on this machine." - echo - if request "Are you sure?" - then - echo - echo "Ok, will reboot in 30 seconds." - echo - echo "If you change your mind, call 'shutdown -a' within 30 seconds" - shutdown -r 30 - fi - fi -fi diff --git a/winsup/lsaauth/cyglsa.c b/winsup/lsaauth/cyglsa.c deleted file mode 100644 index 341fdd12c..000000000 --- a/winsup/lsaauth/cyglsa.c +++ /dev/null @@ -1,633 +0,0 @@ -/* cyglsa.c: LSA authentication module for Cygwin - - Copyright 2006, 2008, 2010, 2011, 2012 Red Hat, Inc. - - Written by Corinna Vinschen - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ - -#define WINVER 0x0600 -#include -#include -#include -#include -#include -#include -#include "../cygwin/cyglsa.h" -#include "../cygwin/include/cygwin/version.h" - -static PLSA_SECPKG_FUNCS funcs; -static BOOL must_create_logon_sid; - -BOOL APIENTRY -DllMain (HINSTANCE inst, DWORD reason, LPVOID res) -{ - switch (reason) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - -/* Declare NTDLL functions here to avoid problems with different - header file layout in different compiler environments. */ -#ifndef NT_SUCCESS -#define NT_SUCCESS(s) ((s) >= 0) -#endif -/* These standard POSIX functions are implemented in NTDLL and exported. - There's just no header to define them and using wchar.h from mingw - or Cygwin seems wrong somehow. */ -wchar_t *__cdecl wcscpy (wchar_t *, const wchar_t *); -size_t __cdecl wcslen (const wchar_t *); - -#ifndef RtlInitEmptyUnicodeString -__inline VOID NTAPI -RtlInitEmptyUnicodeString(PUNICODE_STRING dest, PCWSTR buf, USHORT len) -{ - dest->Length = 0; - dest->MaximumLength = len; - dest->Buffer = (PWSTR) buf; -} -#endif - -static PUNICODE_STRING -uni_alloc (PWCHAR src, USHORT len) -{ - PUNICODE_STRING tgt; - - if (!(tgt = funcs->AllocateLsaHeap (sizeof (UNICODE_STRING)))) - return NULL; - tgt->Length = len * sizeof (WCHAR); - tgt->MaximumLength = tgt->Length + sizeof (WCHAR); - if (!(tgt->Buffer = funcs->AllocateLsaHeap (tgt->MaximumLength))) - { - funcs->FreeLsaHeap (tgt); - return NULL; - } - wcscpy (tgt->Buffer, src); - return tgt; -} - -/* No, I don't want to include stdio.h so I take what ntdll offers. */ -extern int _vsnprintf (char *, size_t, const char *, va_list); - -static HANDLE fh = INVALID_HANDLE_VALUE; - -static int -cyglsa_printf (const char *format, ...) -{ - char buf[256]; - DWORD wr; - int ret; - va_list ap; - - if (fh == INVALID_HANDLE_VALUE) - return 0; - - va_start (ap, format); - ret = _vsnprintf (buf, 256, format, ap); - va_end (ap); - if (ret <= 0) - return ret; - if (ret > 256) - ret = 255; - buf[255] = '\0'; - WriteFile (fh, buf, ret, &wr, NULL); - return wr; -} - -static void -print_sid (const char *prefix, int idx, PISID sid) -{ - DWORD i; - - cyglsa_printf ("%s", prefix); - if (idx >= 0) - cyglsa_printf ("[%d] ", idx); - cyglsa_printf ("(0x%08x) ", (INT_PTR) sid); - if (!sid) - cyglsa_printf ("NULL\n"); - else if (IsBadReadPtr (sid, 8)) - cyglsa_printf ("INVALID POINTER\n"); - else if (!IsValidSid ((PSID) sid)) - cyglsa_printf ("INVALID SID\n"); - else if (IsBadReadPtr (sid, 8 + sizeof (DWORD) * sid->SubAuthorityCount)) - cyglsa_printf ("INVALID POINTER SPACE\n"); - else - { - cyglsa_printf ("S-%d-%d", sid->Revision, sid->IdentifierAuthority.Value[5]); - for (i = 0; i < sid->SubAuthorityCount; ++i) - cyglsa_printf ("-%lu", sid->SubAuthority[i]); - cyglsa_printf ("\n"); - } -} - -static void -print_groups (PTOKEN_GROUPS grps) -{ - DWORD i; - - cyglsa_printf ("Groups: (0x%08x) ", (INT_PTR) grps); - if (!grps) - cyglsa_printf ("NULL\n"); - else if (IsBadReadPtr (grps, sizeof (DWORD))) - cyglsa_printf ("INVALID POINTER\n"); - else if (IsBadReadPtr (grps, sizeof (DWORD) + sizeof (SID_AND_ATTRIBUTES) - * grps->GroupCount)) - cyglsa_printf ("INVALID POINTER SPACE\n"); - else - { - cyglsa_printf ("Count: %lu\n", grps->GroupCount); - for (i = 0; i < grps->GroupCount; ++i) - { - cyglsa_printf ("(attr: 0x%lx)", grps->Groups[i].Attributes); - print_sid (" ", i, (PISID) grps->Groups[i].Sid); - } - } -} - -static void -print_privs (PTOKEN_PRIVILEGES privs) -{ - DWORD i; - - cyglsa_printf ("Privileges: (0x%08x) ", (INT_PTR) privs); - if (!privs) - cyglsa_printf ("NULL\n"); - else if (IsBadReadPtr (privs, sizeof (DWORD))) - cyglsa_printf ("INVALID POINTER\n"); - else if (IsBadReadPtr (privs, sizeof (DWORD) + sizeof (LUID_AND_ATTRIBUTES) - * privs->PrivilegeCount)) - cyglsa_printf ("INVALID POINTER SPACE\n"); - else - { - cyglsa_printf ("Count: %lu\n", privs->PrivilegeCount); - for (i = 0; i < privs->PrivilegeCount; ++i) - cyglsa_printf ("Luid: {%ld, %lu} Attributes: 0x%lx\n", - privs->Privileges[i].Luid.HighPart, - privs->Privileges[i].Luid.LowPart, - privs->Privileges[i].Attributes); - } -} - -static void -print_dacl (PACL dacl) -{ - DWORD i; - - cyglsa_printf ("DefaultDacl: (0x%08x) ", (INT_PTR) dacl); - if (!dacl) - cyglsa_printf ("NULL\n"); - else if (IsBadReadPtr (dacl, sizeof (ACL))) - cyglsa_printf ("INVALID POINTER\n"); - else if (IsBadReadPtr (dacl, dacl->AclSize)) - cyglsa_printf ("INVALID POINTER SPACE\n"); - else - { - cyglsa_printf ("Rev: %d, Count: %d\n", dacl->AclRevision, dacl->AceCount); - for (i = 0; i < dacl->AceCount; ++i) - { - PVOID vace; - PACCESS_ALLOWED_ACE ace; - - if (!GetAce (dacl, i, &vace)) - cyglsa_printf ("[%lu] GetAce error %lu\n", i, GetLastError ()); - else - { - ace = (PACCESS_ALLOWED_ACE) vace; - cyglsa_printf ("Type: %x, Flags: %x, Access: %lx,", - ace->Header.AceType, ace->Header.AceFlags, (DWORD) ace->Mask); - print_sid (" ", i, (PISID) &ace->SidStart); - } - } - } -} - -static void -print_tokinf (PLSA_TOKEN_INFORMATION_V2 ptok, size_t size, - PVOID got_start, PVOID gotinf_start, PVOID gotinf_end) -{ - if (fh == INVALID_HANDLE_VALUE) - return; - - cyglsa_printf ("INCOMING: start: 0x%08x infstart: 0x%08x infend: 0x%08x\n", - (INT_PTR) got_start, (INT_PTR) gotinf_start, - (INT_PTR) gotinf_end); - - cyglsa_printf ("LSA_TOKEN_INFORMATION_V2: 0x%08x - 0x%08x\n", - (INT_PTR) ptok, (INT_PTR) ptok + size); - - /* User SID */ - cyglsa_printf ("User: (attr: 0x%lx)", ptok->User.User.Attributes); - print_sid (" ", -1, (PISID) ptok->User.User.Sid); - - /* Groups */ - print_groups (ptok->Groups); - - /* Primary Group SID */ - print_sid ("Primary Group: ", -1, (PISID)ptok->PrimaryGroup.PrimaryGroup); - - /* Privileges */ - print_privs (ptok->Privileges); - - /* Owner */ - print_sid ("Owner: ", -1, (PISID) ptok->Owner.Owner); - - /* Default DACL */ - print_dacl (ptok->DefaultDacl.DefaultDacl); - - // CloseHandle (fh); -} - -NTSTATUS NTAPI -LsaApInitializePackage (ULONG authp_id, PLSA_SECPKG_FUNCS dpt, - PLSA_STRING dummy1, PLSA_STRING dummy2, - PLSA_STRING *authp_name) -{ - PLSA_STRING name = NULL; - DWORD vers, major, minor; - - /* Set global pointer to lsa helper function table. */ - funcs = dpt; - - /* Allocate and set the name of the authentication package. This is the - name which has to be used in LsaLookupAuthenticationPackage. */ - if (!(name = funcs->AllocateLsaHeap (sizeof *name))) - return STATUS_NO_MEMORY; - if (!(name->Buffer = funcs->AllocateLsaHeap (sizeof (CYG_LSA_PKGNAME)))) - { - funcs->FreeLsaHeap (name); - return STATUS_NO_MEMORY; - } - name->Length = sizeof (CYG_LSA_PKGNAME) - 1; - name->MaximumLength = sizeof (CYG_LSA_PKGNAME); - strcpy (name->Buffer, CYG_LSA_PKGNAME); - (*authp_name) = name; - - vers = GetVersion (); - major = LOBYTE (LOWORD (vers)); - minor = HIBYTE (LOWORD (vers)); - /* Check if we're running on Windows 2000 or lower. If so, we must create - the logon sid in the group list by ourselves. */ - if (major < 5 || (major == 5 && minor == 0)) - must_create_logon_sid = TRUE; - -#ifdef DEBUGGING - fh = CreateFile ("C:\\cyglsa.dbgout", GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - cyglsa_printf ("Initialized\n"); -#endif /* DEBUGGING */ - - return STATUS_SUCCESS; -} - -NTSTATUS NTAPI -LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type, - PVOID auth, PVOID client_auth_base, ULONG auth_len, - PVOID *pbuf, PULONG pbuf_len, PLUID logon_id, - PNTSTATUS sub_stat, PLSA_TOKEN_INFORMATION_TYPE tok_type, - PVOID *tok, PUNICODE_STRING *account, - PUNICODE_STRING *authority, PUNICODE_STRING *machine) -{ - DWORD checksum, i; - PDWORD csp, csp_end; - NTSTATUS stat; - SECPKG_CLIENT_INFO clinf; - PLSA_TOKEN_INFORMATION_V2 tokinf; - - cyglsa_t *authinf = (cyglsa_t *) auth; - - /* Check if the caller has the SeTcbPrivilege, otherwise refuse service. */ - stat = funcs->GetClientInfo (&clinf); - if (stat != STATUS_SUCCESS) - { - cyglsa_printf ("GetClientInfo failed: 0x%08lx\n", stat); - return stat; - } - if (!clinf.HasTcbPrivilege) - { - cyglsa_printf ("Client has no TCB privilege. Access denied.\n"); - return STATUS_ACCESS_DENIED; - } - - /* Make a couple of validity checks. */ - if (auth_len < sizeof *authinf - || authinf->magic != CYG_LSA_MAGIC - || !authinf->username[0] - || !authinf->domain[0]) - { - cyglsa_printf ("Invalid authentication parameter.\n"); - return STATUS_INVALID_PARAMETER; - } - checksum = CYG_LSA_MAGIC; - csp = (PDWORD) &authinf->username; - csp_end = (PDWORD) ((PBYTE) authinf + auth_len); - while (csp < csp_end) - checksum += *csp++; - if (authinf->checksum != checksum) - { - cyglsa_printf ("Invalid checksum.\n"); - return STATUS_INVALID_PARAMETER_3; - } - - /* Set account to username and authority to domain resp. machine name. - The name of the logon account name as returned by LookupAccountSid - is created from here as "authority\account". */ - authinf->username[UNLEN] = '\0'; - authinf->domain[MAX_DOMAIN_NAME_LEN] = '\0'; - if (account && !(*account = uni_alloc (authinf->username, - wcslen (authinf->username)))) - { - cyglsa_printf ("No memory trying to create account.\n"); - return STATUS_NO_MEMORY; - } - if (authority && !(*authority = uni_alloc (authinf->domain, - wcslen (authinf->domain)))) - { - cyglsa_printf ("No memory trying to create authority.\n"); - return STATUS_NO_MEMORY; - } - if (machine) - { - WCHAR mach[MAX_COMPUTERNAME_LENGTH + 1]; - DWORD msize = MAX_COMPUTERNAME_LENGTH + 1; - if (!GetComputerNameW (mach, &msize)) - wcscpy (mach, L"UNKNOWN"); - if (!(*machine = uni_alloc (mach, wcslen (mach)))) - { - cyglsa_printf ("No memory trying to create machine.\n"); - return STATUS_NO_MEMORY; - } - } - /* Create a fake buffer in pbuf which is free'd again in the client. - Windows 2000 tends to crash when setting this pointer to NULL. */ - if (pbuf) - { -#ifdef JUST_ANOTHER_NONWORKING_SOLUTION - cygprf_t prf; - WCHAR sam_username[MAX_DOMAIN_NAME_LEN + UNLEN + 2]; - SECURITY_STRING sam_user, prefix; - PUCHAR user_auth; - ULONG user_auth_size; - WCHAR flatname[UNLEN + 1]; - UNICODE_STRING flatnm; - TOKEN_SOURCE ts; - HANDLE token; -#endif /* JUST_ANOTHER_NONWORKING_SOLUTION */ - - stat = funcs->AllocateClientBuffer (request, 64UL, pbuf); - if (!LSA_SUCCESS (stat)) - { - cyglsa_printf ("AllocateClientBuffer failed: 0x%08lx\n", stat); - return stat; - } -#ifdef JUST_ANOTHER_NONWORKING_SOLUTION - prf.magic_pre = MAGIC_PRE; - prf.token = NULL; - prf.magic_post = MAGIC_POST; - -#if 0 - /* That's how it was supposed to work according to MSDN... */ - wcscpy (sam_username, authinf->domain); - wcscat (sam_username, L"\\"); - wcscat (sam_username, authinf->username); -#else - /* That's the only solution which worked, and then it only worked - for machine local accounts. No domain authentication possible. - STATUS_NO_SUCH_USER galore! */ - wcscpy (sam_username, authinf->username); -#endif - RtlInitUnicodeString (&sam_user, sam_username); - RtlInitUnicodeString (&prefix, L""); - RtlInitEmptyUnicodeString (&flatnm, flatname, - (UNLEN + 1) * sizeof (WCHAR)); - - stat = funcs->GetAuthDataForUser (&sam_user, SecNameSamCompatible, - NULL, &user_auth, - &user_auth_size, &flatnm); - if (!NT_SUCCESS (stat)) - { - char sam_u[MAX_DOMAIN_NAME_LEN + UNLEN + 2]; - wcstombs (sam_u, sam_user.Buffer, sizeof (sam_u)); - cyglsa_printf ("GetAuthDataForUser (%u,%u,%s) failed: 0x%08lx\n", - sam_user.Length, sam_user.MaximumLength, sam_u, stat); - return stat; - } - - memcpy (ts.SourceName, "Cygwin.1", 8); - ts.SourceIdentifier.HighPart = 0; - ts.SourceIdentifier.LowPart = 0x0104; - RtlInitEmptyUnicodeString (&flatnm, flatname, - (UNLEN + 1) * sizeof (WCHAR)); - stat = funcs->ConvertAuthDataToToken (user_auth, user_auth_size, - SecurityDelegation, &ts, - Interactive, *authority, - &token, logon_id, &flatnm, - sub_stat); - if (!NT_SUCCESS (stat)) - { - cyglsa_printf ("ConvertAuthDataToToken failed: 0x%08lx\n", stat); - return stat; - } - - stat = funcs->DuplicateHandle (token, &prf.token); - if (!NT_SUCCESS (stat)) - { - cyglsa_printf ("DuplicateHandle failed: 0x%08lx\n", stat); - return stat; - } - - stat = funcs->CopyToClientBuffer (request, sizeof prf, *pbuf, &prf); - if (!NT_SUCCESS (stat)) - { - cyglsa_printf ("CopyToClientBuffer failed: 0x%08lx\n", stat); - return stat; - } - funcs->FreeLsaHeap (user_auth); -#endif /* JUST_ANOTHER_NONWORKING_SOLUTION */ - } - if (pbuf_len) - *pbuf_len = 64UL; - - /* A PLSA_TOKEN_INFORMATION_V2 is allocated in one piece, so... */ -#if defined (__x86_64__) || defined (_M_AMD64) - { - /* ...on 64 bit systems we have to convert the incoming 32 bit offsets - into 64 bit pointers. That requires to re-evaluate the size of the - outgoing tokinf structure and a somewhat awkward procedure to copy - the information over. */ - LONG_PTR base; - PBYTE tptr; - DWORD size, newsize; - PSID src_sid; - PCYG_TOKEN_GROUPS src_grps; - PTOKEN_GROUPS grps; - PTOKEN_PRIVILEGES src_privs; - PACL src_acl; - - base = (LONG_PTR) &authinf->inf; - - newsize = authinf->inf_size; - newsize += sizeof (TOKEN_USER) - sizeof (CYG_TOKEN_USER); /* User SID */ - newsize += sizeof (PTOKEN_GROUPS) - sizeof (OFFSET); /* Groups */ - src_grps = (PCYG_TOKEN_GROUPS) (base + authinf->inf.Groups); - newsize += src_grps->GroupCount /* Group SIDs */ - * (sizeof (SID_AND_ATTRIBUTES) - - sizeof (CYG_SID_AND_ATTRIBUTES)); - newsize += sizeof (PSID) - sizeof (OFFSET); /* Primary Group SID */ - newsize += sizeof (PTOKEN_PRIVILEGES) - sizeof (OFFSET); /* Privileges */ - newsize += 0; /* Owner SID */ - newsize += sizeof (PACL) - sizeof (OFFSET); /* Default DACL */ - - if (!(tokinf = funcs->AllocateLsaHeap (newsize))) - return STATUS_NO_MEMORY; - tptr = (PBYTE)(tokinf + 1); - - tokinf->ExpirationTime = authinf->inf.ExpirationTime; - /* User SID */ - src_sid = (PSID) (base + authinf->inf.User.User.Sid); - size = GetLengthSid (src_sid); - CopySid (size, (PSID) tptr, src_sid); - tokinf->User.User.Sid = (PSID) tptr; - tptr += size; - tokinf->User.User.Attributes = authinf->inf.User.User.Attributes; - /* Groups */ - grps = (PTOKEN_GROUPS) tptr; - tokinf->Groups = grps; - grps->GroupCount = src_grps->GroupCount; - tptr += sizeof grps->GroupCount - + grps->GroupCount * sizeof (SID_AND_ATTRIBUTES); - /* Group SIDs */ - for (i = 0; i < src_grps->GroupCount; ++i) - { - src_sid = (PSID) (base + src_grps->Groups[i].Sid); - size = GetLengthSid (src_sid); - CopySid (size, (PSID) tptr, src_sid); - tokinf->Groups->Groups[i].Sid = (PSID) tptr; - tptr += size; - tokinf->Groups->Groups[i].Attributes = src_grps->Groups[i].Attributes; - } - /* Primary Group SID */ - src_sid = (PSID) (base + authinf->inf.PrimaryGroup.PrimaryGroup); - size = GetLengthSid (src_sid); - CopySid (size, (PSID) tptr, src_sid); - tokinf->PrimaryGroup.PrimaryGroup = (PSID) tptr; - tptr += size; - /* Privileges */ - src_privs = (PTOKEN_PRIVILEGES) (base + authinf->inf.Privileges); - size = sizeof src_privs->PrivilegeCount - + src_privs->PrivilegeCount * sizeof (LUID_AND_ATTRIBUTES); - memcpy (tptr, src_privs, size); - tokinf->Privileges = (PTOKEN_PRIVILEGES) tptr; - tptr += size; - /* Owner */ - tokinf->Owner.Owner = NULL; - /* Default DACL */ - src_acl = (PACL) (base + authinf->inf.DefaultDacl.DefaultDacl); - size = src_acl->AclSize; - memcpy (tptr, src_acl, size); - tokinf->DefaultDacl.DefaultDacl = (PACL) tptr; - } -#else - { - /* ...on 32 bit systems we just allocate tokinf with the same size as - we get, copy the whole structure and convert offsets into pointers. */ - - /* Allocate LUID for usage in the logon SID on Windows 2000. This is - not done in the 64 bit code above for hopefully obvious reasons... */ - LUID logon_sid_id; - - if (must_create_logon_sid && !AllocateLocallyUniqueId (&logon_sid_id)) - return STATUS_INSUFFICIENT_RESOURCES; - - if (!(tokinf = funcs->AllocateLsaHeap (authinf->inf_size))) - return STATUS_NO_MEMORY; - memcpy (tokinf, &authinf->inf, authinf->inf_size); - - /* User SID */ - tokinf->User.User.Sid = (PSID) - ((PBYTE) tokinf + (LONG_PTR) tokinf->User.User.Sid); - /* Groups */ - tokinf->Groups = (PTOKEN_GROUPS) - ((PBYTE) tokinf + (LONG_PTR) tokinf->Groups); - /* Group SIDs */ - for (i = 0; i < tokinf->Groups->GroupCount; ++i) - { - tokinf->Groups->Groups[i].Sid = (PSID) - ((PBYTE) tokinf + (LONG_PTR) tokinf->Groups->Groups[i].Sid); - if (must_create_logon_sid - && tokinf->Groups->Groups[i].Attributes & SE_GROUP_LOGON_ID - && *GetSidSubAuthorityCount (tokinf->Groups->Groups[i].Sid) == 3 - && *GetSidSubAuthority (tokinf->Groups->Groups[i].Sid, 0) - == SECURITY_LOGON_IDS_RID) - { - *GetSidSubAuthority (tokinf->Groups->Groups[i].Sid, 1) - = logon_sid_id.HighPart; - *GetSidSubAuthority (tokinf->Groups->Groups[i].Sid, 2) - = logon_sid_id.LowPart; - } - } - - /* Primary Group SID */ - tokinf->PrimaryGroup.PrimaryGroup = (PSID) - ((PBYTE) tokinf + (LONG_PTR) tokinf->PrimaryGroup.PrimaryGroup); - /* Privileges */ - tokinf->Privileges = (PTOKEN_PRIVILEGES) - ((PBYTE) tokinf + (LONG_PTR) tokinf->Privileges); - /* Owner SID */ - tokinf->Owner.Owner = NULL; - /* Default DACL */ - tokinf->DefaultDacl.DefaultDacl = (PACL) - ((PBYTE) tokinf + (LONG_PTR) tokinf->DefaultDacl.DefaultDacl); - - } -#endif - - *tok = (PVOID) tokinf; - *tok_type = LsaTokenInformationV2; - - print_tokinf (tokinf, authinf->inf_size, authinf, &authinf->inf, - (PVOID)((LONG_PTR) &authinf->inf + authinf->inf_size)); - - /* Create logon session. */ - if (!AllocateLocallyUniqueId (logon_id)) - { - funcs->FreeLsaHeap (*tok); - *tok = NULL; - cyglsa_printf ("AllocateLocallyUniqueId failed: Win32 error %lu\n", - GetLastError ()); - return STATUS_INSUFFICIENT_RESOURCES; - } - stat = funcs->CreateLogonSession (logon_id); - if (stat != STATUS_SUCCESS) - { - funcs->FreeLsaHeap (*tok); - *tok = NULL; - cyglsa_printf ("CreateLogonSession failed: 0x%08lx\n", stat); - return stat; - } - - cyglsa_printf ("BINGO!!!\n", stat); - return STATUS_SUCCESS; -} - -VOID NTAPI -LsaApLogonTerminated(PLUID LogonId) -{ -} - -NTSTATUS NTAPI -LsaApCallPackage (PLSA_CLIENT_REQUEST request, PVOID authinf, - PVOID client_auth_base, ULONG auth_len, PVOID *ret_buf, - PULONG ret_buf_len, PNTSTATUS ret_stat) -{ - return STATUS_NOT_IMPLEMENTED; -} diff --git a/winsup/lsaauth/cyglsa.din b/winsup/lsaauth/cyglsa.din deleted file mode 100644 index 69eece0cb..000000000 --- a/winsup/lsaauth/cyglsa.din +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY "cyglsa" - -EXPORTS -LsaApInitializePackage = LsaApInitializePackage@20 -LsaApLogonUserEx = LsaApLogonUserEx@56 -LsaApLogonTerminated = LsaApLogonTerminated@4 -LsaApCallPackage = LsaApCallPackage@28 -LsaApCallPackagePassthrough = LsaApCallPackage@28 -LsaApCallPackageUntrusted = LsaApCallPackage@28 diff --git a/winsup/lsaauth/cyglsa64.def b/winsup/lsaauth/cyglsa64.def deleted file mode 100644 index 7b2d5921e..000000000 --- a/winsup/lsaauth/cyglsa64.def +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY "cyglsa64" - -EXPORTS -LsaApInitializePackage -LsaApLogonUserEx -LsaApLogonTerminated -LsaApCallPackage -LsaApCallPackagePassthrough = LsaApCallPackage -LsaApCallPackageUntrusted = LsaApCallPackage diff --git a/winsup/testsuite/ChangeLog b/winsup/testsuite/ChangeLog deleted file mode 100644 index 262971ea0..000000000 --- a/winsup/testsuite/ChangeLog +++ /dev/null @@ -1,790 +0,0 @@ -2012-11-26 Christopher Faylor - - * configure.ac: Rename from configure.in. - * configure.in: Delete. - * configure: Regenerate. - -2012-11-23 Christopher Faylor - - * Makefile.in: Remove old Makefile.common'isms. Don't rely on - in-build tools. - -2012-04-24 Yaakov Selkowitz - - * configure: Regenerate. - -2011-03-21 Corinna Vinschen - - * libltp/lib/get_high_address.c: Align copyright with upstream. - -2009-11-01 Christopher Faylor - - * Makefile.in: Use utils mingw front-end to generate non-cygwin binary. - -2008-11-26 Christopher Faylor - - * Revert erroneous checkin. - -2006-07-23 Christopher Faylor - - * Makefile.in: Update copyright. Remove unused stuff. - -2006-07-17 Christopher Faylor - - * Makefile.in: Simplify a little. - -2006-06-12 Pierre Humblet Pierre.Humblet@ieee.org - - * winsup.api/user_malloc.c: New file. - -2006-05-30 Christopher Faylor - - * winsup.api/cygload.h: Increase padding to 32768. - -2006-05-24 Christopher Faylor - - * configure.in: Update to newer autoconf. - (thanks to Steve Ellcey) - * configure: Regenerate. - * aclocal.m4: New file. - -2006-03-23 Christopher Faylor - - * winsup.api/checksignal.c (main): Add test for siginterrupt. - -2006-01-02 Christopher Faylor - - * cygload/README: Delete. - * cygload/cygload.cc: Move to winsup.api. Add comments from README. - * cygload/cygload.h: Move to winsup.api. - * cygload/cygload.exp: Move to winsup.api. - * Makefile.in: Remove cygload. - * winsup.api/winsup.exp: If a .exp file is detected, run it rather than - using standard compile. - - * winsup.api/resethand.c (main): Use printf to print status or expect - thinks something is wrong. - -2006-01-01 Christopher Faylor - - * winsup.api/resethand.c (main): Remove core dump flag from exit - status. - -2006-01-01 Christopher Faylor - - * winsup.api/resethand.c (main): Coerce argument to pointer to stop gcc - complaint. - -2006-01-01 Christopher Faylor - - * winsup.api/resethand.c: Use SIGSEGV for the signal to test. - -2006-01-01 Christopher Faylor - - * winsup.api/resethand.c: New file. - -2005-12-11 Christopher Faylor - - * winsup.api/ltp/dup03.c (cleanup): Fix longstanding off-by-one error - when setting array element to -1. - -2005-06-11 Christopher Faylor - - * winsup.api/pthread/cancel2.c: Use explicit initializer for mutex. - * winsup.api/pthread/mutex4.c (main): Ditto. - * winsup.api/pthread/mutex5.c: Reflect change in cygwin default mutex type. - * winsup.api/pthread/mutex6d.c: Ditto. - -2005-06-10 Christopher Faylor - - * winsup.api/winsup.exp: Remove (temporarily?) -nostdinc from build - since it causes compile failures with gcc 3.4.4. - -2005-06-06 Christopher Faylor - - * cygload/cygload.exp: .cpp -> .cc. - -2005-06-06 Max Kaehn - - * Makefile.in: Test cygload. - * cygload: New directory. - * cygload/README: New file. - * cygload/Makefile: Ditto. - * cygload/cygload.h: Ditto. - * cygload/cygload.cc: Ditto. - * cygload/cygload.exp: Ditto. - -2005-05-17 Brian Dessent - - * winsup.api/signal-into-win32-api.c (main): Use 'NULL' instead of '0' - in argument list to avoid compiler warning with gcc4. - * winsup.api/ltp/execle01.c (main): Ditto. - * winsup.api/ltp/execlp01.c (main): Ditto. - * winsup.api/ltp/fcntl07.c (do_exec): Ditto. - * winsup.api/ltp/fcntl07B.c (do_exec): Ditto. - -2005-02-10 Christopher Faylor - - * winsup.api/known_bugs.tcl: Remove dup05, fcntl07B, lseek04, select03, - unlink06. - * winsup.api/mmaptest03.c: Make a little more verbose so that it is - easier to figure out where something failed. - -2005-01-09 Christopher Faylor - - * cygrun.c (main): Fix exit code so that it reflects UNIX style. - * winsup.api/ltp/fork04.c (setup): Accommodate change in putenv - declaration. - -2004-08-24 Corinna Vinschen - - * winsup.api/mmaptest01.c (main): Accomodate 9x memory usage. - -2004-08-24 Corinna Vinschen - - * winsup.api/ltp/symlink01.c (do_link): Print inode numbers using %llu - format specifier. - -2004-08-17 Gerd Spalink - Pierre Humblet - - * devdsp.c: Outputs the names of the main test functions. - (forkrectest): Expect child success. - (forkplaytest): Ditto. - (syncwithchild): Output the child status and the desired value. - (sinegenw): Reduce volume of the beep. - (sinegenb): Ditto. - (dup_test): New test. - -2004-04-13 Gerd Spalink - - * winsup.api/devdsp.c (forkrectest): Move synchronization with child - so that test passes also under high CPU load. - (forkplaytest): Ditto. - (abortplaytest): New function to test ioctl code SNDCTL_DSP_RESET. - -2004-04-04 Gerd Spalink - - * winsup.api/devdsp.c (ioctltest): Add 2 tests for ioctl codes - SNDCTL_DSP_CHANNELS and SNDCTL_DSP_GETCAPS. - -2004-03-24 Gerd Spalink - - * winsup.api/devdsp.c: New file, testing fhandler_dev_dsp code. - * winsup.api/devdsp_okay.h: Ditto. - -2004-03-06 Christopher Faylor - - * winsup.api/known_bugs.tcl: Remove mknod01 since mknod now works. - * winsup.api/ltp/mknod01.c: Remove root check when running on cygwin. - -2004-03-04 Thomas Pfaff - - * winsup.api/pthread/mutex8e.c: New testcase. - * winsup.api/pthread/mutex8n.c: Ditto. - * winsup.api/pthread/mutex8r.c: Ditto. - -2003-12-23 Christopher Faylor - - * winsup.api/pthread/rwlock7.c (main): Don't assume that result of rand - operation is non-zero. - -2003-12-01 Corinna Vinschen - - * winsup.api/known_bugs.tcl: Remove fcntl09 and fcntl10. These - tests had a compatibility bug. - * winsup.api/ltp/fcntl09.c: Don't use F_RDLCK | F_WRLCK but only - F_WRLCK to set a write lock. - * winsup.api/ltp/fcntl10.c: Ditto. - -2003-11-25 Christopher Faylor - - * winsup.api/known_bugs.tcl: Remove lseek10 since mknod now works. - -2003-11-20 Corinna Vinschen - - * winsup.api/msgtest.c (main): Revert to use the SIGSYS signal handler. - * winsup.api/semtest.c (main): Ditto. - * winsup.api/shmtest.c (main): Ditto. - -2003-11-19 Corinna Vinschen - - * winsup.api/msgtest.c: New file derived from FreeBSD, testing - XSI Message Queue support. - * winsup.api/semtest.c: Ditto, testing XSI Semaphore support. - * winsup.api/shmtest.c: Ditto, testing XSI Shared Memory support. - -2003-07-06 Christopher Faylor - - * winsup.api/known_bugs.tcl: Remove gethostid01 from list of known - bugs. - -2003-07-06 Christopher Faylor - - * Makefile.in: Remove .dat files when cleaning. - -2003-07-06 Christopher Faylor - - * Makefile.in: Remove .d files when cleaning. - -2003-05-09 Corinna Vinschen - - * libltp/include/test.h: Remove gethostid declaration. - -2003-04-08 Thomas Pfaff - - * winsup.api/pthread/condvar9.c: Fix test. - -2003-03-27 Thomas Pfaff - - * winsup.api/pthread/rwlock1.c: Remove pthreads-win32 header. - * winsup.api/pthread/rwlock2.c: Ditto. - * winsup.api/pthread/rwlock3.c: Ditto. - * winsup.api/pthread/rwlock4.c: Ditto. - * winsup.api/pthread/rwlock5.c: Ditto. - * winsup.api/pthread/rwlock6.c: Ditto. - -2003-03-27 Brian Ford - - * winsup.api/pthread/condvar7.c (mythread): Cast - pthread_mutex_unlock argument of pthread_cleanup_push - to void *, preventing a compiler warning / testsuite failure. - * winsup.api/pthread/condvar9.c (mythread): Likewise. - * winsup.api/pthread/rwlock7.c (main): Use ftime instead of - _ftime. - -2003-03-18 Thomas Pfaff - - * winsup.api/pthread/rwlock1.c: New test. - * winsup.api/pthread/rwlock2.c: Ditto. - * winsup.api/pthread/rwlock3.c: Ditto. - * winsup.api/pthread/rwlock4.c: Ditto. - * winsup.api/pthread/rwlock5.c: Ditto. - * winsup.api/pthread/rwlock6.c: Ditto. - * winsup.api/pthread/rwlock7.c: Ditto. - -2003-03-18 Thomas Pfaff - - * winsup.api/pthread/condvar7.c: New test. - * winsup.api/pthread/condvar9.c: Ditto. - -2003-03-18 Thomas Pfaff - - * winsup.api/pthread/mutex1n.c: New test. - * winsup.api/pthread/mutex6n.c: Ditto. - * winsup.api/pthread/mutex7n.c: Ditto. - -2003-03-09 Christopher Faylor - - * winsup.api/winsup.exp: Use -nostdinc when compiling. - * Makefile.in: Specifically search compiler include directory since it - is now stripped via -nostdinc. - -2003-03-09 Corinna Vinschen - - * winsup.api/ltp/fork10.c (main): Remove non-portable declaration - of lseek. - -2003-03-09 Christopher Faylor - - * Makefile.in: Use "cygwin0" rather than "new-cygwin" to denote - in-build-tree version of library or dll. - * config/default.exp: Ditto. - * winsup.api/winsup.exp: Ditto. - -2003-03-07 Corinna Vinschen - - * winsup.api/known_bugs.tcl: Remove fsync01, setregid01 and setreuid01 - from list of known bugs. - -2003-02-19 Vaclav Haisman - - * winsup.api/crlf.c: Fix C signed/unsigned compare warning. - * winsup.api/mmaptest01.c: Ditto. - * winsup.api/ltp/chmod01.c: Ditto. - * winsup.api/ltp/fork04.c: Ditto. - * winsup.api/ltp/lseek03.c: Ditto. - * winsup.api/ltp/lseek06.c: Ditto. - * winsup.api/ltp/lseek07.c: Ditto. - * winsup.api/ltp/lseek08.c: Ditto. - * winsup.api/ltp/mmap001.c: Ditto. - * winsup.api/ltp/mmap02.c: Ditto. - * winsup.api/ltp/mmap03.c: Ditto. - * winsup.api/ltp/mmap04.c: Ditto. - * winsup.api/ltp/mmap05.c: Ditto. - * winsup.api/ltp/mmap06.c: Ditto. - * winsup.api/ltp/mmap07.c: Ditto. - * winsup.api/ltp/mmap08.c: Ditto. - * winsup.api/ltp/pipe11.c: Ditto. - * winsup.api/ltp/poll01.c: Ditto. - * winsup.api/ltp/sync02.c: Ditto. - * winsup.api/ltp/times03.c: Ditto. - * winsup.api/ltp/umask03.c: Ditto. - * winsup.api/ltp/getpgid01.c: Remove unused obsolete include. - * winsup.api/ltp/getpgid02.c: Ditto. - -2003-02-08 Christopher Faylor - - * winsup.api/winsup.exp (ws_spawn): Tweak slightly to work with tcl - 8.4.1. - -2003-02-07 Christopher Faylor - - * libltp/lib/parse_opts.c: Deal with C warnings. - * winsup.api/pthread/cancel12.c: Ditto. - * winsup.api/winsup.exp: Don't use -g3. - -2003-02-04 Thomas Pfaff - - * winsup.api/pthread/cancel11.c: New test. - * winsup.api/pthread/cancel12.c: Ditto. - -2003-01-23 Christopher Faylor - - * Makefile.in: Don't filter out -g. Actually pass correct CFLAGS to - site.exp. - * winsup.api/winsup.exp: Use -g flag from CFLAGS. - -2003-01-23 Christopher Faylor - - * Makefile.in: Turn off all optimizations. - * libltp/lib/parse_opts.c (TEST_VALID_ENO): Move define outside of - conditional. - (TEST_ERRNO): Ditto. - (btime): Ditto. - (etime): Ditto. - (tmptime): Ditto. - -2003-01-23 Christopher Faylor - - * libltp/include/usctest.h: Add externs to some variables that need it. - * winsup.api/ltp/mmap05.c (main): Make file_content volatile to avoid - optimization glitch. - -2003-01-23 Christopher Faylor - - * winsup.api/mmaptest03.c (main): Mark variables as volatile to avoid - optimization induced problems. - -2003-01-23 Christopher Faylor - - * Makefile (check): Add cygrun.exe dependency. - -2003-01-23 Christopher Faylor - - Perform more C warning fixup on all C source files and headers. - -2003-01-23 Christopher Faylor - - * libltp/include/test.h: Fix C warnings. - * winsup.api/checksignal.c: Ditto. - * winsup.api/crlf.c: Ditto. - * winsup.api/devzero.c: Ditto. - * winsup.api/iospeed.c: Ditto. - * winsup.api/mmaptest01.c: Ditto. - * winsup.api/mmaptest02.c: Ditto. - * winsup.api/mmaptest03.c: Ditto. - * winsup.api/mmaptest04.c: Ditto. - * winsup.api/nullgetcwd.c: Ditto. - * winsup.api/sigchld.c: Ditto. - * winsup.api/signal-into-win32-api.c: Ditto. - * winsup.api/systemcall.c: Ditto. - * winsup.api/waitpid.c: Ditto. - * winsup.api/pthread/mainthreadexits.c: Ditto. - * winsup.api/pthread/test.h: Ditto. - * winsup.api/pthread/threadidafterfork.c: Ditto. - - * Makefile.in: Remove cygrun.exe from RUNTIME since it is built here - now. - -2003-01-23 Christopher Faylor - - * Makefile.in: Use ALL_CFLAGS to build test programs so that correct - libraries and other options are used. - -2003-01-22 Corinna Vinschen - - * cygrun.c: Move here from ../cygwin. - * Makefile.in: Build cygrun.exe. - * winsup.api/winsup.exp: Expect cygrun.exe in $rootme. - -2003-01-21 Christopher Faylor - - * Makefile.in: Find tcl library in the right place. - -2003-01-21 Thomas Pfaff - - * winsup.api/pthread/cancel9.c: Make child pid static global. - (main): Wait in mainthread until child process has terminated. - -2003-01-14 Thomas Pfaff - - * winsup.api/pthread/cancel10.c: New test. - -2003-01-14 Thomas Pfaff - - * winsup.api/pthread/cancel9.c: New test. - -2003-01-14 Thomas Pfaff - - * winsup.api/pthread/cancel7.c: New test. - * winsup.api/pthread/cancel8.c: Ditto. - -2003-01-14 Thomas Pfaff - - * winsup.api/pthread/cancel6.c: New test. - -2003-01-09 Thomas Pfaff - - * winsup.api/pthread/mutex1d.c: New test. Port from pthreads-win32 - project. - * winsup.api/pthread/mutex1e.c: Ditto. - * winsup.api/pthread/mutex4.c: Ditto. - * winsup.api/pthread/mutex5.c: Ditto. - * winsup.api/pthread/mutex6d.c: Ditto. - * winsup.api/pthread/mutex6e.c: Ditto. - * winsup.api/pthread/mutex7.c: Ditto. - * winsup.api/pthread/mutex7d.c: Ditto. - * winsup.api/pthread/mutex7e.c: Ditto. - * winsup.api/pthread/mutex7r.c: Ditto. - -2002-11-25 Robert Collins - - * readme: Document running portions of the test suite (Thanks Egor!). - * winsup.api/pthread/mainthreadexits.c: New file, derived from - Thomas Pfaff's test cases. - * winsup.api/pthread/threadidafterfork.c: Ditto. - -2002-08-25 Christopher Faylor - - * Makefile.in (RUNTEST): Use Makefile's srcdir and bupdir* macros, - where appropriate. - * winsup.api/winsup.exp: Use -nodefaultlibs when linking executable to - avoid potentially linking installed dll. - -2002-07-06 Christopher Faylor - - * testsuite/winsup.api/winsup.exp: Add -mwin32 to gcc flags so - windows.h will be found. - -2002-07-04 Egor Duda - - * winsup.api/pthread/cancel1.c: New test. Port from pthreads-win32 - project. - * winsup.api/pthread/cancel2.c: Ditto. - * winsup.api/pthread/cancel3.c: Ditto. - * winsup.api/pthread/cancel4.c: Ditto. - * winsup.api/pthread/cancel5.c: Ditto. - -2002-07-03 Christopher Faylor - - * Makefile.in: Eliminate unneeded Makefile recreation rule. - -2002-02-27 Christopher Faylor - - * winsup.api/systemcall.c (main): Ensure that stdin is redirected. - -2001-11-18 Egor Duda - - * winsup.api/pthread/condvar3_1.c: Fix debugging output. - -2001-11-15 Egor Duda - - * winsup.api/pthread/: New directory. Ports of pthread functionality - tests from pthreads-win32 project. - * winsup.api/pthread/test.h: Commmon declaraions for pthread tests. - * winsup.api/pthread/cleanup2.c: New test. - * winsup.api/pthread/cleanup3.c: Ditto. - * winsup.api/pthread/condvar1.c: Ditto. - * winsup.api/pthread/condvar2.c: Ditto. - * winsup.api/pthread/condvar2_1.c: Ditto. - * winsup.api/pthread/condvar3.c: Ditto. - * winsup.api/pthread/condvar3_1.c: Ditto. - * winsup.api/pthread/condvar3_2.c: Ditto. - * winsup.api/pthread/condvar3_3.c: Ditto. - * winsup.api/pthread/condvar4.c: Ditto. - * winsup.api/pthread/condvar5.c: Ditto. - * winsup.api/pthread/condvar6.c: Ditto. - * winsup.api/pthread/condvar8.c: Ditto. - * winsup.api/pthread/count1.c: Ditto. - * winsup.api/pthread/create1.c: Ditto. - * winsup.api/pthread/create2.c: Ditto. - * winsup.api/pthread/equal1.c: Ditto. - * winsup.api/pthread/exit1.c: Ditto. - * winsup.api/pthread/exit2.c: Ditto. - * winsup.api/pthread/exit3.c: Ditto. - * winsup.api/pthread/inherit1.c: Ditto. - * winsup.api/pthread/join0.c: Ditto. - * winsup.api/pthread/join1.c: Ditto. - * winsup.api/pthread/join2.c: Ditto. - * winsup.api/pthread/mutex1.c: Ditto. - * winsup.api/pthread/mutex1r.c: Ditto. - * winsup.api/pthread/mutex2.c: Ditto. - * winsup.api/pthread/mutex3.c: Ditto. - * winsup.api/pthread/mutex6r.c: Ditto. - * winsup.api/pthread/once1.c: Ditto. - * winsup.api/pthread/priority1.c: Ditto. - * winsup.api/pthread/priority2.c: Ditto. - * winsup.api/pthread/self1.c: Ditto. - * winsup.api/pthread/self2.c: Ditto. - * winsup.api/pthread/tsd1.c: Ditto. - -2001-11-08 Corinna Vinschen - - * checksignal.c: New testcase. - -2001-11-04 Christopher Faylor - - * Makefile.in: Oops. Revert previous change. Add Makefile/Makefile.in - dependency. - -2001-11-04 Christopher Faylor - - * Makefile.in: Add check target. - -2001-11-02 Egor Duda - - * libltp/lib/forker.c: Include proper header to avoid compiler - warning. - -2001-10-29 Egor Duda - - * winsup.api/ltp/stat03.c: Supress compiler warning. - -2001-10-29 Egor Duda - - * winsup.api/signal-into-win32-api.c: Supress compiler warning. - -Mon Oct 8 14:15:00 2001 Corinna Vinschen - - * winsup.api/mmaptest01.c: Add several tests on mmaps. Use libltp. - * winsup.api/winsup.exp: Link all tests agains libltp. - -Fri Oct 5 11:15:55 2001 Christopher Faylor - - * winsup.api/nullgetcwd.c: New file. Check that NULL first argument to - getcwd works. - -Thu Oct 4 22:47:51 2001 Christopher Faylor - - * winsup.api/systemcall.c (main): Change some messages for clarity. - -Thu Oct 4 22:19:39 2001 Christopher Faylor - - * winsup.api/systemcall.c: New file. Check for system call problems. - -2001-09-20 Egor Duda - - * libltp/lib/get_high_address.c (get_high_address): Get inaccessible - address more robustly. - * winsup.api/ltp/stat06.c (high_address_setup): Use generic function - from ltp library to obtain inaccessible address. - -2001-09-15 Egor Duda - - * winsup.api/ltp/sbrk01.c (main): Force output at startup to - make sure that stdio file buffer get allocated. - * winsup.api/ltp/stat06.c (high_address_setup): On cygwin, area - after sbrk(0) may be available, use 0xffff0000 as "high address". - * winsup.api/ltp/symlink01.c: Perform all tests. Mark those tests that - don't work on cygwin with '-1'. Close open files so that temporary - directory can be deleted on exit. - * winsup.api/ltp/vfork01.c: New test. - -2001-09-13 Egor Duda - - * winsup.api/winsup.exp: Run only selected test if environment - variable CYGWIN_TESTSUITE_TESTS is set. Use its value as regular - expression to filter test names. - * winsup.api/ltp/symlink01.c (creat_path_max): Provide explicit - buffer to getcwd to conform to standards and avoid memory leak. - (do_chdir): Ditto. - -2001-09-13 Egor Duda - - * libltp/lib/tst_sig.c: Pass SIGSEGV to application to consider - whether it's expected or not. - * winsup.api/known_bugs.tcl: lseek10 is known to fail because mknod - is not implemented. - * winsup.api/ltp/rename02.c: Fix formatting. - * libltp/lib/libtestsuite.c: New file. - * winsup.api/signal-into-win32-api.c: New test. - * winsup.api/ltp/access04.c: Ditto. - * winsup.api/ltp/access05.c: Ditto. - * winsup.api/ltp/alarm07.c: Ditto. - * winsup.api/ltp/chdir04.c: Ditto. - * winsup.api/ltp/chmod01.c: Ditto. - * winsup.api/ltp/close01.c: Ditto. - * winsup.api/ltp/close02.c: Ditto. - * winsup.api/ltp/creat01.c: Ditto. - * winsup.api/ltp/creat03.c: Ditto. - * winsup.api/ltp/exit01.c: Ditto. - * winsup.api/ltp/exit02.c: Ditto. - * winsup.api/ltp/fchdir01.c: Ditto. - * winsup.api/ltp/fchdir02.c: Ditto. - * winsup.api/ltp/fork02.c: Ditto. - * winsup.api/ltp/fork03.c: Ditto. - * winsup.api/ltp/fork06.c: Ditto. - * winsup.api/ltp/fork07.c: Ditto. - * winsup.api/ltp/fork09.c: Ditto. - * winsup.api/ltp/fork10.c: Ditto. - * winsup.api/ltp/fork11.c: Ditto. - * winsup.api/ltp/fstat02.c: Ditto. - * winsup.api/ltp/fstat03.c: Ditto. - * winsup.api/ltp/fstat04.c: Ditto. - * winsup.api/ltp/ftruncate01.c: Ditto. - * winsup.api/ltp/ftruncate02.c: Ditto. - * winsup.api/ltp/ftruncate03.c: Ditto. - * winsup.api/ltp/getgid02.c: Ditto. - * winsup.api/ltp/getgid03.c: Ditto. - * winsup.api/ltp/getpgid01.c: Ditto. - * winsup.api/ltp/getpgid02.c: Ditto. - * winsup.api/ltp/getpid02.c: Ditto. - * winsup.api/ltp/getppid02.c: Ditto. - * winsup.api/ltp/getuid02.c: Ditto. - * winsup.api/ltp/getuid03.c: Ditto. - * winsup.api/ltp/kill01.c: Ditto. - * winsup.api/ltp/kill02.c: Ditto. - * winsup.api/ltp/kill03.c: Ditto. - * winsup.api/ltp/kill04.c: Ditto. - * winsup.api/ltp/lseek06.c: Ditto. - * winsup.api/ltp/lseek07.c: Ditto. - * winsup.api/ltp/lseek08.c: Ditto. - * winsup.api/ltp/lseek09.c: Ditto. - * winsup.api/ltp/lseek10.c: Ditto. - * winsup.api/ltp/mmap02.c: Ditto. - * winsup.api/ltp/mmap03.c: Ditto. - * winsup.api/ltp/mmap04.c: Ditto. - * winsup.api/ltp/mmap05.c: Ditto. - * winsup.api/ltp/mmap06.c: Ditto. - * winsup.api/ltp/mmap07.c: Ditto. - * winsup.api/ltp/mmap08.c: Ditto. - * winsup.api/ltp/munmap01.c: Ditto. - * winsup.api/ltp/munmap02.c: Ditto. - * winsup.api/ltp/open02.c: Ditto. - * winsup.api/ltp/pipe01.c: Ditto. - * winsup.api/ltp/pipe08.c: Ditto. - * winsup.api/ltp/pipe09.c: Ditto. - * winsup.api/ltp/pipe10.c: Ditto. - * winsup.api/ltp/pipe11.c: Ditto. - * winsup.api/ltp/poll01.c: Ditto. - * winsup.api/ltp/read04.c: Ditto. - * winsup.api/ltp/readlink01.c: Ditto. - * winsup.api/ltp/readlink03.c: Ditto. - * winsup.api/ltp/rename01.c: Ditto. - * winsup.api/ltp/rename08.c: Ditto. - * winsup.api/ltp/rename10.c: Ditto. - * winsup.api/ltp/rmdir01.c: Ditto. - * winsup.api/ltp/stat01.c: Ditto. - * winsup.api/ltp/stat02.c: Ditto. - * winsup.api/ltp/stat03.c: Ditto. - * winsup.api/ltp/symlink03.c: Ditto. - * winsup.api/ltp/symlink04.c: Ditto. - * winsup.api/ltp/symlink05.c: Ditto. - * winsup.api/ltp/sync02.c: Ditto. - * winsup.api/ltp/time02.c: Ditto. - * winsup.api/ltp/times02.c: Ditto. - * winsup.api/ltp/times03.c: Ditto. - * winsup.api/ltp/truncate01.c: Ditto. - * winsup.api/ltp/truncate02.c: Ditto. - * winsup.api/ltp/umask02.c: Ditto. - * winsup.api/ltp/umask03.c: Ditto. - * winsup.api/ltp/wait401.c: Ditto. - * winsup.api/ltp/wait402.c: Ditto. - * winsup.api/ltp/write02.c: Ditto. - * winsup.api/ltp/write03.c: Ditto. - -2001-09-09 Egor Duda - - * winsup.api/ltp/dup03.c: New test. - * winsup.api/ltp/lseek03.c: Ditto. - * winsup.api/ltp/mmap001.c: Ditto. - * winsup.api/ltp/read01.c: Ditto. - * winsup.api/ltp/readdir01.c: Ditto. - * winsup.api/ltp/rmdir05.c: Ditto. - * winsup.api/ltp/sbrk01.c: Ditto. - * winsup.api/ltp/select02.c: Ditto. - * winsup.api/ltp/select03.c: Ditto. - * winsup.api/ltp/signal03.c: Ditto. - * winsup.api/ltp/stat06.c: Ditto. - * winsup.api/ltp/unlink08.c: Ditto. - * winsup.api/known_bugs.tcl: Update to reflect new test's known - failures. - * winsup.api/winsup.exp: Don't delete executable in case of - unexpected pass, as well as in case of unexpected failure. - * README: Update paragraph about expected failures. - -2001-05-21 Corinna Vinschen - - * winsup.api/mmaptest01.c: Add log output. - * winsup.api/mmaptest02.c: Write log output to stdout. - * winsup.api/mmaptest03.c: Ditto. - -2001-05-15 Corinna Vinschen - - * winsup.api/winsup.exp: Force linking all tests against binmode.o. - -2001-04-27 Corinna Vinschen - - * winsup.api/mmaptest04.c: Take care for binmode explicitely. - -2001-04-19 Corinna Vinschen - - * winsup.api/mmaptest02.c: New test. - * winsup.api/mmaptest03.c: Ditto. - * winsup.api/mmaptest04.c: Ditto. - -2001-04-03 Corinna Vinschen - - * winsup.api/mmaptest01.c: New test. - -2001-03-10 Egor Duda - - * winsup.api/ltp/access01.c: Avoid compilation error if X_OK - isn't declared as a constant. - -2001-03-09 Egor Duda - - * config/default.exp: Remove unneeded debugging output. - * Makefile.in: Use correct path to find dejagnu in local tree. - -2000-09-06 Egor Duda - - Add 'const' qualifiers where needed to avoid compiler warnings. - * libltp/lib/tst_sig.c (tst_sig): Don't attempt to cleanup on - fatal errors. - * libltp/lib/parse_opts.c (parse_opts): Initialize allocated - string to prevent heap corruption. - -2000-09-04 Egor Duda - - * Makefile.in: Always add libltp headers directory to headers - search path. - -2000-09-02 Egor Duda - - * moved here everything from cygwin/testsuite/ - * configure.in: New file - * configure: New file, generated from configure.in - with autoconf 2.13 - * Makefile.in: New file - * libltp/: New directory. Contains a support library - and headers for tests in winsup.api/ltp/ - * config/default.exp: Print value of CYGWIN environment - variable when test completed - * winsup.api/samples/xf-sample-fail.c renamed to - winsup.api/samples/sample-fail.c - * winsup.api/samples/xf-sample-miscompile.c renamed to - winsup.api/samples/sample-miscompile.c - * winsup.api/known_bugs.tcl: New file. - * winsup.api/winsup.exp: Xfail test if its name is in - list from known_bugs.tcl - * winsup.api/winsup.exp: Don't stop if compiled test executable - can't be deleted - * winsup.api/winsup.exp: If in verbose mode, write test output - to .log - * winsup.api/ltp/: New directory. Contains cygwin port of testsuite - from Linux Testing Project - * winsup.api/sigchld.c: New file. Test if process recieves SIGCHLD - signal when its child terminates. - * winsup.api/waitpid.c: New file. Test if waitpid function works diff --git a/winsup/testsuite/Makefile.in b/winsup/testsuite/Makefile.in deleted file mode 100644 index 04ff99bc0..000000000 --- a/winsup/testsuite/Makefile.in +++ /dev/null @@ -1,170 +0,0 @@ -# Makefile.in for Cygwin's testsuite. -# Copyright 2000, 2001, 2002, 2003, 2005, 2006, 2009, 2012 Red Hat, Inc. -# -# This file is part of Cygwin. -# -# This software is a copyrighted work licensed under the terms of the -# Cygwin license. Please consult the file "CYGWIN_LICENSE" for -# details. - -# This makefile requires GNU make. - -SHELL:=@SHELL@ -srcdir:=@srcdir@ -objdir:=. -libltp_srcdir=$(srcdir)/libltp - -VPATH:=$(srcdir):$(libltp_srcdir)/lib - -target_alias:=@target_alias@ -build_alias:=@build_alias@ -host_alias:=@host_alias@ - -DESTDIR= -prefix:=${DESTDIR}@prefix@ - -program_transform_name:=@program_transform_name@ -exec_prefix:=${DESTDIR}@exec_prefix@ -bindir:=${DESTDIR}@bindir@ -libdir:=${DESTDIR}@libdir@ -ifeq ($(target_alias),$(host_alias)) -ifeq ($(build_alias),$(host_alias)) -tooldir:=$(exec_prefix) -else -tooldir:=$(exec_prefix)/$(target_alias) -endif -else -tooldir:=$(exec_prefix)/$(target_alias) -endif -datadir:=${DESTDIR}@datadir@ -infodir:=${DESTDIR}@infodir@ -includedir:=${DESTDIR}@includedir@ - -TESTSUP_INCLUDES:=-I$(libltp_srcdir)/include - -# -# --enable options from configure -# - -CC:=@CC@ -# FIXME: Which is it, CC or CC_FOR_TARGET? -CC_FOR_TARGET:=$(CC) -ifneq (,$(CFLAGS)) - override CFLAGS+= -MD $(TESTSUP_INCLUDES) -else - CFLAGS:=@CFLAGS@ -MD $(TESTSUP_INCLUDES) -endif - -AR:=@AR@ -AR_FLAGS:=qv -MINGW_FE:=$(dir ${srcdir})/utils/mingw - -# -# Include common definitions for winsup directory -# -include $(srcdir)/../Makefile.common - -override CC:=$(CC) $(GCC_INCLUDE) -export CC - -RUNTESTFLAGS = - -ifdef VERBOSE - RUNTESTFLAGS = -v -endif - -RUNTIME=$(cygwin_build)/cygwin0.dll $(cygwin_build)/libcygwin0.a - -TESTSUP_LIB_NAME:=libltp.a -TESTSUP_OFILES:=${sort ${addsuffix .o,${basename ${notdir ${wildcard $(libltp_srcdir)/lib/*.c}}}}} - -override ALL_CFLAGS:=${filter-out -O%,$(ALL_CFLAGS)} -override COMPILE_CC:=${filter-out -O%,$(COMPILE_CC)} -override CFLAGS:=${filter-out -O%,$(CFLAGS)} -export CFLAGS - -.PHONY: all force dll_ofiles install all_target install_target install_host - -.SUFFIXES: -.SUFFIXES: .c .cc .def .a .o .d - -all: $(TESTSUP_LIB_NAME) - -force: - -install: - -install_host: - -clean: - -rm -f *.o *.dll *.a *.exp junk *.bak *.base *.exe testsuite/* *.d *.dat - -maintainer-clean realclean: clean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -rm -fr configure - -# Rule to build libltp.a - -$(TESTSUP_LIB_NAME): $(TESTSUP_OFILES) - $(AR) rcv temp.a $(TESTSUP_OFILES) - mv temp.a $(TESTSUP_LIB_NAME) - -$(RUNTIME) : $(cygwin_build)/Makefile - @$(MAKE) --no-print-dir -C $(@D) $(@F) - -# Rule to make stub library used by "make check" - -# - -# These targets are for the dejagnu testsuites. The file site.exp -# contains global variables that all the testsuites will use. - -# Set to $(target_alias)/ for cross. -target_subdir = @target_subdir@ - -site.exp: ./config.status Makefile - @echo "Making a new config file..." - -@rm -f ./tmp? - @touch site.exp - -@mv site.exp site.bak - @echo "## these variables are automatically generated by make ##" > ./tmp0 - @echo "# Do not edit here. If you wish to override these values" >> ./tmp0 - @echo "# add them to the last section" >> ./tmp0 - @echo "set rootme \"`pwd`\"" >> ./tmp0 - @echo "set runtime_root \"\$$rootme/../cygwin\"" >> ./tmp0 - @echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0 - @echo "set host_triplet $(host_canonical)" >> ./tmp0 - @echo "set build_triplet $(build_canonical)" >> ./tmp0 - @echo "set target_triplet $(target)" >> ./tmp0 - @echo "set target_alias $(target_alias)" >> ./tmp0 - @echo "set CC \"$(CC)\"" >> ./tmp0 -# CFLAGS is set even though it's empty to show we reserve the right to set it. - @echo "set CFLAGS \"$(ALL_CFLAGS)\"" >> ./tmp0 - echo "set tmpdir $(objdir)/testsuite" >> ./tmp0 - @echo "set ltp_includes \"$(libltp_srcdir)/include\"" >> ./tmp0 - @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0 - @cat ./tmp0 > site.exp - @cat site.bak | sed \ - -e '1,/^## All variables above are.*##/ d' >> site.exp - -@rm -f ./tmp? - -testsuite/site.exp: site.exp - if [ -d testsuite ]; then \ - true; \ - else \ - mkdir testsuite; \ - fi - rm -rf testsuite/site.exp - cp site.exp testsuite/site.exp - -# Note: we set the PATH so that we can pick up cygwin0.dll - -check: $(TESTSUP_LIB_NAME) $(RUNTIME) cygrun.exe testsuite/site.exp - cd testsuite; runtest --tool winsup $(RUNTESTFLAGS) - -cygrun.o: cygrun.c - ${MINGW_FE} $(CC) $(MINGW_CFLAGS) -o $@ -c $< - -cygrun.exe : cygrun.o - ${MINGW_FE} $(CC) ${MINGW_LDFLAGS} -o $@ $< diff --git a/winsup/testsuite/README b/winsup/testsuite/README deleted file mode 100644 index 2f6749bb8..000000000 --- a/winsup/testsuite/README +++ /dev/null @@ -1,40 +0,0 @@ -1999-12-23 DJ Delorie - -Here are some notes about adding and using this testsuite. - -First, all the programs are linked with libcygwin0.a, which is just -like libcygwin.a, except that it wants cygwin0.dll, not -cygwin1.dll. The testsuite adds the winsup build directory to the -PATH so that cygwin0.dll can be found by windows during testing. - -Because we'll probably run into complaints about using two DLLs, we -run cygrun.exe for each test. All this does is run the test with -CreateProcess() so that we don't attempt to do the special code for -when a cygwin program calls another cygwin program, as this might be a -"multiple cygwins" problem. - -Any test that needs to test command line args or redirection needs to -run such a child program itself, as the testsuite will not do any -arguments or redirection for it. Same for fork, signals, etc. - -The testsuite/winsup.api subdirectory is for testing the API to -cygwin1.dll ONLY. Create other subdirs under testsuite/ for other -classes of testing. - -Tests in winsup.api/*.c or winsup.api/*/*.c (only one subdirectory -level is allowed) either compile, run, and exit(0) or they fail. -Either abort or exit with a non-zero code to indicate failure. Don't -print anything to the screen if you can avoid it (except for failure -reasons, of course). One .c file per test, no compile options are -allowed (we're testing the api, not the compiler). - -Tests whose filename is mentioned in known-bugs.tcl will be *expected* -to fail, and will "fail" if they compile, run, and return zero. - -"make check" will only work if you run it *on* an NT machine. -Cross-checking is not supported. - -To test a subset of the test-suite, use -$ make check CYGWIN_TESTSUITE_TESTS=regexp - - diff --git a/winsup/testsuite/aclocal.m4 b/winsup/testsuite/aclocal.m4 deleted file mode 100644 index 177c0134b..000000000 --- a/winsup/testsuite/aclocal.m4 +++ /dev/null @@ -1,831 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p6 - -dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -# lib-prefix.m4 serial 4 (gettext-0.14.2) -dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) - -# lib-link.m4 serial 6 (gettext-0.14.3) -dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -AC_PREREQ(2.50) - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - undefine([Name]) - undefine([NAME]) -]) - -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. If found, it -dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and -dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIB[]NAME" - AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - undefine([Name]) - undefine([NAME]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, -dnl hardcode_direct, hardcode_minus_L. -AC_DEFUN([AC_LIB_RPATH], -[ - dnl Tell automake >= 1.10 to complain if config.rpath is missing. - m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE(rpath, - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib$1-prefix], -[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib - --without-lib$1-prefix don't search for lib$1 in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) - -# lib-ld.m4 serial 3 (gettext-0.13) -dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi -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 GCC]) - 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. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path 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(acl_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; - *) - test "$with_gnu_ld" != yes && break ;; - esac - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) - diff --git a/winsup/testsuite/config/default.exp b/winsup/testsuite/config/default.exp deleted file mode 100644 index 3936979a6..000000000 --- a/winsup/testsuite/config/default.exp +++ /dev/null @@ -1,13 +0,0 @@ -proc winsup_version {} { - global env - global rootme - clone_output "\n[exec grep ^%%% $rootme/../cygwin/cygwin0.dll]\n" - if { [info exists env(CYGWIN)] } { - clone_output "CYGWIN=$env(CYGWIN)\n" - } else { - clone_output "CYGWIN=\n" - } -} - -proc winsup_exit {} { -} diff --git a/winsup/testsuite/configure b/winsup/testsuite/configure deleted file mode 100644 index f0767845a..000000000 --- a/winsup/testsuite/configure +++ /dev/null @@ -1,3937 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68. -# -# -# 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" - 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 about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a 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'" - - -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= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="Makefile.in" -ac_subst_vars='LTLIBOBJS -LIBOBJS -AR -CPP -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -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 -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# 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}' -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 this package 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/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -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 - -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 the package provider. -_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 -configure -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 -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 $as_me, 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 - -# 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 - - - -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 - -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 - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; 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}ar" - $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 - - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; 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="ar" - $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 - - if test "x$ac_ct_AR" = x; then - AR="" - 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 -else - AR="$ac_cv_prog_AR" -fi - - -ac_config_files="$ac_config_files 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}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.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 - - - -: "${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 $as_me, 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 - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_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 - -Configuration files: -$config_files - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -config.status -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' -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;; - --he | --h | --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 -_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 - "Makefile") CONFIG_FILES="$CONFIG_FILES 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 -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" - - -eval set X " :F $CONFIG_FILES " -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 - # - -_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 -$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 - ;; - - - - 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 - diff --git a/winsup/testsuite/configure.ac b/winsup/testsuite/configure.ac deleted file mode 100755 index 37190f9d9..000000000 --- a/winsup/testsuite/configure.ac +++ /dev/null @@ -1,19 +0,0 @@ -dnl Autoconf configure script for Cygwin's testsuite. -dnl Copyright 2000 Red Hat, Inc. -dnl -dnl This file is part of Cygwin. -dnl -dnl This software is a copyrighted work licensed under the terms of the -dnl Cygwin license. Please consult the file "CYGWIN_LICENSE" for -dnl details. -dnl -dnl Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59) -AC_INIT(Makefile.in) - -AC_PROG_CC -AC_PROG_CPP -AC_CHECK_TOOL(AR,ar) - -AC_OUTPUT(Makefile) diff --git a/winsup/testsuite/cygrun.c b/winsup/testsuite/cygrun.c deleted file mode 100644 index 60330ca33..000000000 --- a/winsup/testsuite/cygrun.c +++ /dev/null @@ -1,69 +0,0 @@ -/* cygrun.c: testsuite support program - - Copyright 1999, 2000, 2001, 2002 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -/* This program is intended to be used only by the testsuite. It runs - programs without using the cygwin api, so that the just-built dll - can be tested without interference from the currently installed - dll. */ - -#include -#include -#include - -int -main (int argc, char **argv) -{ - STARTUPINFO sa; - PROCESS_INFORMATION pi; - DWORD ec = 1; - char *p; - - if (argc < 2) - { - fprintf (stderr, "Usage: cygrun [program]\n"); - exit (0); - } - - SetEnvironmentVariable ("CYGWIN_TESTING", "1"); - if ((p = getenv ("CYGWIN")) == NULL || (strstr (p, "ntsec") == NULL)) - { - char buf[4096]; - if (!p) - { - p = buf; - p[0] = '\0'; - } - else - { - strcpy (buf, p); - strcat (buf, " "); - } - strcat(buf, "ntsec"); - SetEnvironmentVariable ("CYGWIN", buf); - } - - memset (&sa, 0, sizeof (sa)); - memset (&pi, 0, sizeof (pi)); - if (!CreateProcess (0, argv[1], 0, 0, 1, 0, 0, 0, &sa, &pi)) - { - fprintf (stderr, "CreateProcess %s failed\n", argv[1]); - exit (1); - } - - WaitForSingleObject (pi.hProcess, INFINITE); - - GetExitCodeProcess (pi.hProcess, &ec); - - CloseHandle (pi.hProcess); - CloseHandle (pi.hThread); - if (ec > 0xff) - ec >>= 8; - return ec; -} diff --git a/winsup/testsuite/libltp/include/dataascii.h b/winsup/testsuite/libltp/include/dataascii.h deleted file mode 100644 index cd75245e4..000000000 --- a/winsup/testsuite/libltp/include/dataascii.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _DATAASCII_H_ -#define _DATAASCII_H_ - -/*********************************************************************** - * int dataasciigen(listofchars, buffer, size, offset) - * - * This function fills buffer with ascii characters. - * The ascii characters are obtained from listofchars or the CHARS array - * if listofchars is NULL. - * Each char is selected by an index. The index is the remainder - * of count divided by the array size. - * This method allows more than one process to write to a location - * in a file without corrupting it for another process' point of view. - * - * The return value will be the number of character written in buffer - * (size). - * - ***********************************************************************/ -int dataasciigen(char *, char *, int, int); - -/*********************************************************************** - * int dataasciichk(listofchars, buffer, size, count, errmsg) - * - * This function checks the contents of a buffer produced by - * dataasciigen. - * - * return values: - * >= 0 : error at character count - * < 0 : no error - ***********************************************************************/ - -int dataasciichk(char *, char *, int, int, char**); - -#endif diff --git a/winsup/testsuite/libltp/include/databin.h b/winsup/testsuite/libltp/include/databin.h deleted file mode 100644 index b71fbc0c1..000000000 --- a/winsup/testsuite/libltp/include/databin.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _DATABIN_H_ -#define _DATABIN_H_ - -/******************************************************************************* -* NAME -* databingen - fill a buffer with a data pattern -* -* SYNOPSIS -* (void) databingen(mode, buffer, bsize, offset) -* int mode; -* char *buffer; -* int bsize; -* int offset; -* -* DESCRIPTION -* datagen fills the buffer pointed to by 'buffer' with 'bsize' bytes -* of data of the form indicated by 'mode'. -* All modes (expect r -random) are file offset based. -* This allows more than process to do writing to the file without -* corrupting it if the same modes were used. -* They data modes to choose from, these are: -* -* 'a' - writes an alternating bit pattern (i.e. 0x5555555...) -* -* 'c' - writes a checkerboard pattern (i.e. 0xff00ff00ff00...) -* -* 'C' - writes counting pattern (i.e. 0 - 07, 0 - 07, ...); -* -* 'o' - writes all bits set (i.e. 0xffffffffffffff...) -* -* 'z' - writes all bits cleared (i.e. 0x000000000...); -* -* 'r' - writes random integers -* -* RETURN VALUE -* None -* -*******************************************************************************/ - -void databingen( int mode, unsigned char *buffer, int bsize, int offset ); - -void databinchedk( int mode, unsigned char *buffer, int bsize, int offset, char **errmsg); - -#endif diff --git a/winsup/testsuite/libltp/include/file_lock.h b/winsup/testsuite/libltp/include/file_lock.h deleted file mode 100644 index 8c9a94835..000000000 --- a/winsup/testsuite/libltp/include/file_lock.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _FILE_LOCK_H_ -#define _FILE_LOCK_H_ - -extern char Fl_syscall_str[128]; - -int file_lock( int , int, char ** ); -int record_lock( int , int , int , int , char ** ); - -#endif /* _FILE_LOCK_H_ */ diff --git a/winsup/testsuite/libltp/include/forker.h b/winsup/testsuite/libltp/include/forker.h deleted file mode 100644 index effd5d66e..000000000 --- a/winsup/testsuite/libltp/include/forker.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _FORKER_H_ -#define _FORKER_H_ - -#define FORKER_MAX_PIDS 4098 - -extern int Forker_pids[FORKER_MAX_PIDS]; /* holds pids of forked processes */ -extern int Forker_npids; /* number of entries in Forker_pids */ - -/* - * This function will fork and the parent will exit zero and - * the child will return. This will orphan the returning process - * putting it in the background. - */ -int background( char * ); - -/* - * Forker will fork ncopies-1 copies of self. - * - * arg 1: Number of copies of the process to be running after return. - * This value minus one is the number of forks performed. - * arg 2: mode: 0 - all children are first generation descendents. - * 1 - each subsequent child is a descendent of another - * descendent, resulting in only one direct descendent of the - * parent and each other child is a child of another child in - * relation to the parent. - * arg 3: prefix: string to preceed any error messages. A value of NULL - * results in no error messages on failure. - * returns: returns to parent the number of children forked. - */ -int forker( int , int , char * ); - -#endif /* _FORKER_H_ */ diff --git a/winsup/testsuite/libltp/include/open_flags.h b/winsup/testsuite/libltp/include/open_flags.h deleted file mode 100644 index 87fe6ff1d..000000000 --- a/winsup/testsuite/libltp/include/open_flags.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _OPEN_FLAGS_H_ -#define _OPEN_FLAGS_H_ - -/*********************************************************************** - * This function attempts to convert open flag bits into human readable - * symbols (i.e. O_TRUNC). If there are more than one symbol, - * the string will be placed as a separator between symbols. - * Commonly used separators would be a comma "," or pipe "|". - * If is one and not all bits can be converted to - * symbols, the "UNKNOWN" symbol will be added to return string. - * - * Return Value - * openflags2symbols will return the indentified symbols. - * If no symbols are recognized the return value will be a empty - * string or the "UNKNOWN" symbol. - * - * Limitations - * Currently (05/96) all known symbols are coded into openflags2symbols. - * If new open flags are added this code will have to updated - * to know about them or they will not be recognized. - * - * The Open_symbols must be large enough to hold all possible symbols - * for a given system. - * - ***********************************************************************/ -char *openflags2symbols( int, char *, int ); - -/*********************************************************************** - * This function will take a string of comma separated open flags symbols - * and translate them into an open flag bitmask. - * If any symbol is not valid, -1 is returned. On this error condition - * the badname pointer is updated if not NULL. badname will point - * to the beginning location of where the invalid symbol was found. - * string will be returned unchanged. - * - * A signal received while parsing string could cause the string to - * contain a NULL character in the middle of it. - * - ***********************************************************************/ -int parse_open_flags( char *, char ** ); - -#endif diff --git a/winsup/testsuite/libltp/include/pattern.h b/winsup/testsuite/libltp/include/pattern.h deleted file mode 100644 index 74f841cae..000000000 --- a/winsup/testsuite/libltp/include/pattern.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _PATTERN_H_ -#define _PATTERN_H_ - -/* - * pattern_check(buf, buflen, pat, patlen, patshift) - * - * Check a buffer of length buflen against repeated occurrances of - * a pattern whose length is patlen. Patshift can be used to rotate - * the pattern by patshift bytes to the left. - * - * Patshift may be greater than patlen, the pattern will be rotated by - * (patshift % patshift) bytes. - * - * pattern_check returns -1 if the buffer does not contain repeated - * occurrances of the indicated pattern (shifted by patshift). - * - * The algorithm used to check the buffer relies on the fact that buf is - * supposed to be repeated copies of pattern. The basic algorithm is - * to validate the first patlen bytes of buf against the pat argument - * passed in - then validate the next patlen bytes against the 1st patlen - * bytes - the next (2*patlen) bytes against the 1st (2*pathen) bytes, and - * so on. This algorithm only works when the assumption of a buffer full - * of repeated copies of a pattern holds, and gives MUCH better results - * then walking the buffer byte by byte. - * - * Performance wise, It appears to be about 5% slower than doing a straight - * memcmp of 2 buffers, but the big win is that it does not require a - * 2nd comparison buffer, only the pattern. - */ -int pattern_check( char * , int , char * , int , int ); - -/* - * pattern_fill(buf, buflen, pat, patlen, patshift) - * - * Fill a buffer of length buflen with repeated occurrances of - * a pattern whose length is patlen. Patshift can be used to rotate - * the pattern by patshift bytes to the left. - * - * Patshift may be greater than patlen, the pattern will be rotated by - * (patshift % patlen) bytes. - * - * If buflen is not a multiple of patlen, a partial pattern will be written - * in the last part of the buffer. This implies that a buffer which is - * shorter than the pattern length will receive only a partial pattern ... - * - * pattern_fill always returns 0 - no validation of arguments is done. - * - * The algorithm used to fill the buffer relies on the fact that buf is - * supposed to be repeated copies of pattern. The basic algorithm is - * to fill the first patlen bytes of buf with the pat argument - * passed in - then copy the next patlen bytes with the 1st patlen - * bytes - the next (2*patlen) bytes with the 1st (2*pathen) bytes, and - * so on. This algorithm only works when the assumption of a buffer full - * of repeated copies of a pattern holds, and gives MUCH better results - * then filling the buffer 1 byte at a time. - */ -int pattern_fill( char * , int , char * , int , int ); - -#endif diff --git a/winsup/testsuite/libltp/include/random_range.h b/winsup/testsuite/libltp/include/random_range.h deleted file mode 100644 index d3e1cceb8..000000000 --- a/winsup/testsuite/libltp/include/random_range.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _RANDOM_RANGE_H_ -#define _RANDOM_RANGE_H_ - -int parse_ranges ( char *, int, int, int, int (*)(), char **, char ** ); -int range_min ( char *, int ); -int range_max ( char *, int ); -int range_mult ( char *, int ); -long random_range ( int, int, int, char ** ); -long random_rangel ( long, long, long, char ** ); -long long random_rangell ( long long, long long, long long, char ** ); -void random_range_seed( long ); -long random_bit ( long ); - -#endif diff --git a/winsup/testsuite/libltp/include/rmobj.h b/winsup/testsuite/libltp/include/rmobj.h deleted file mode 100644 index 4808ca258..000000000 --- a/winsup/testsuite/libltp/include/rmobj.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _RMOBJ_H_ -#define _RMOBJ_H_ - -/* - * rmobj() - Remove the specified object. If the specified object is a - * directory, recursively remove everything inside of it. If - * there are any problems, set errmsg (if it is not NULL) and - * return -1. Otherwise return 0. - */ -int rmobj( char *object , char **errmesg ); - -#endif diff --git a/winsup/testsuite/libltp/include/search_path.h b/winsup/testsuite/libltp/include/search_path.h deleted file mode 100644 index 58b7a36d2..000000000 --- a/winsup/testsuite/libltp/include/search_path.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - - -int search_path(const char *cmd, const char *res_path, int access_mode, int fullpath); diff --git a/winsup/testsuite/libltp/include/str_to_bytes.h b/winsup/testsuite/libltp/include/str_to_bytes.h deleted file mode 100644 index 100d37df5..000000000 --- a/winsup/testsuite/libltp/include/str_to_bytes.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _STR_TO_BYTES_ -#define _STR_TO_BYTES_ - -int str_to_bytes ( char * ); -long str_to_lbytes ( char * ); -long long str_to_llbytes( char * ); - -#endif diff --git a/winsup/testsuite/libltp/include/string_to_tokens.h b/winsup/testsuite/libltp/include/string_to_tokens.h deleted file mode 100644 index 9c0935ec5..000000000 --- a/winsup/testsuite/libltp/include/string_to_tokens.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _STRING_TO_TOKENS_H_ -#define _STRING_TO_TOKENS_H_ - -/* - * string_to_tokens() - * - * This function parses the string 'arg_string', placing pointers to - * the 'separator' separated tokens into the elements of 'arg_array'. - * The array is terminated with a null pointer. - * - * NOTE: This function uses strtok() to parse 'arg_string', and thus - * physically alters 'arg_string' by placing null characters where the - * separators originally were. - */ -int string_to_tokens(char *, char **, int, char *); - -#endif diff --git a/winsup/testsuite/libltp/include/test.h b/winsup/testsuite/libltp/include/test.h deleted file mode 100644 index 8cffea4cb..000000000 --- a/winsup/testsuite/libltp/include/test.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - *. - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -#ifndef __TEST_H__ -#define __TEST_H__ - -#define execve execve_foo -#define execv execv_foo -#define execvp execvp_foo -#include -#include -#include -#include -#include -#undef execvp -#undef execv -#undef execve - -int execve(const char *, const char * const [], char * const *); -int execv(const char *, const char * const []); -int execvp(const char *, const char * const []); - -/* CGF: Avoid compilation warnings for undefined functions */ -extern int setregid (gid_t, gid_t); -int setreuid (uid_t, uid_t); - -#define TPASS 0 /* Test passed flag */ -#define TFAIL 1 /* Test failed flag */ -#define TBROK 2 /* Test broken flag */ -#define TWARN 4 /* Test warning flag */ -#define TRETR 8 /* Test retire flag */ -#define TINFO 16 /* Test information flag */ -#define TCONF 32 /* Test not appropriate for configuration flag */ - -/* - * To determine if you are on a Umk or Unicos system, - * use sysconf(_SC_CRAY_SYSTEM). But since _SC_CRAY_SYSTEM - * is not defined until 90, it will be define here if not already - * defined. - * if ( sysconf(_SC_CRAY_SYSTEM) == 1 ) - * on UMK - * else # returned 0 or -1 - * on Unicos - * This is only being done on CRAY systems. - */ -#ifdef CRAY -#ifndef _SC_CRAY_SYSTEM -#define _SC_CRAY_SYSTEM 140 -#endif /* ! _SC_CRAY_SYSTEM */ -#endif /* CRAY */ - -/* - * Ensure that NUMSIGS is defined. - * It should be defined in signal.h or sys/signal.h on - * UNICOS/mk and IRIX systems. On UNICOS systems, - * it is not defined, thus it is being set to UNICOS's NSIG. - * Note: IRIX's NSIG (signals are 1-(NSIG-1)) - * is not same meaning as UNICOS/UMK's NSIG (signals 1-NSIG) - */ -#ifndef NUMSIGS -#define NUMSIGS NSIG -#endif - - -/* defines for unexpected signal setup routine (set_usig.c) */ -#define FORK 1 /* SIGCLD is to be ignored */ -#define NOFORK 0 /* SIGCLD is to be caught */ -#define DEF_HANDLER 0 /* tells set_usig() to use default signal handler */ - -/* - * The following defines are used to control tst_res and t_result reporting. - */ - -#define TOUTPUT "TOUTPUT" /* The name of the environment variable */ - /* that can be set to one of the following */ - /* strings to control tst_res output */ - /* If not set, TOUT_VERBOSE_S is assumed */ - -#define TOUT_VERBOSE_S "VERBOSE" /* All test cases reported */ -#define TOUT_CONDENSE_S "CONDENSE" /* ranges are used where identical messages*/ - /* occur for sequential test cases */ -#define TOUT_NOPASS_S "NOPASS" /* No pass test cases are reported */ -#define TOUT_DISCARD_S "DISCARD" /* No output is reported */ - -#define TST_NOBUF "TST_NOBUF" /* The name of the environment variable */ - /* that can be set to control whether or not */ - /* tst_res will buffer output into 4096 byte */ - /* blocks of output */ - /* If not set, buffer is done. If set, no */ - /* internal buffering will be done in tst_res */ - /* t_result does not have internal buffering */ - -/* - * The following defines are used to control tst_tmpdir, tst_wildcard and t_mkchdir - */ - -#define TDIRECTORY "TDIRECTORY" /* The name of the environment variable */ - /* that if is set, the value (directory) */ - /* is used by all tests as their working */ - /* directory. tst_rmdir and t_rmdir will */ - /* not attempt to clean up. */ - /* This environment variable should only */ - /* be set when doing system testing since */ - /* tests will collide and break and fail */ - /* because of setting it. */ - -#define TEMPDIR "/tmp" /* This is the default temporary directory. */ - /* The environment variable TMPDIR is */ - /* used prior to this valid by tempnam(3). */ - /* To control the base location of the */ - /* temporary directory, set the TMPDIR */ - /* environment variable to desired path */ - -/* - * The following contains support for error message passing. - * See test_error.c for details. - */ -#define TST_ERR_MESG_SIZE 1023 /* max size of error message */ -#define TST_ERR_FILE_SIZE 511 /* max size of module name used by compiler */ -#define TST_ERR_FUNC_SIZE 127 /* max size of func name */ - -typedef struct { - int te_line; /* line where last error was reported. Use */ - /* "__LINE__" and let compiler do the rest */ - int te_level; /* If set, will prevent current stored */ - /* error to not be overwritten */ - char te_func[TST_ERR_FUNC_SIZE+1]; /* name of function of last error */ - /* Name of function or NULL */ - char te_file[TST_ERR_FILE_SIZE+1]; /* module of last error. Use */ - /* "__FILE__" and let compiler do the rest */ - char te_mesg[TST_ERR_MESG_SIZE+1]; /* string of last error */ - -} _TST_ERROR; - -extern _TST_ERROR Tst_error; /* defined in test_error.c */ -#if __STDC__ -extern void tst_set_error(char *file, int line, char *func, char *fmt, ...); -#else -extern void tst_set_error(); -#endif -extern void tst_clear_error(); - - -/* - * The following define contains the name of an environmental variable - * that can be used to specify the number of iterations. - * It is supported in parse_opts.c and USC_setup.c. - */ -#define USC_ITERATION_ENV "USC_ITERATIONS" - -/* - * The following define contains the name of an environmental variable - * that can be used to specify to iteration until desired time - * in floating point seconds has gone by. - * Supported in USC_setup.c. - */ -#define USC_LOOP_WALLTIME "USC_LOOP_WALLTIME" - -/* - * The following define contains the name of an environmental variable - * that can be used to specify that no functional checks are wanted. - * It is supported in parse_opts.c and USC_setup.c. - */ -#define USC_NO_FUNC_CHECK "USC_NO_FUNC_CHECK" - -/* - * The following define contains the name of an environmental variable - * that can be used to specify the delay between each loop iteration. - * The value is in seconds (fractional numbers are allowed). - * It is supported in parse_opts.c. - */ -#define USC_LOOP_DELAY "USC_LOOP_DELAY" - -/* - * The following prototypes are needed to remove compile errors - * on IRIX systems when compiled with -n32 and -64. - */ -extern void tst_res(int ttype, const char *fname, const char *arg_fmt, ...); -extern void tst_resm(int ttype, const char *arg_fmt, ...); -extern void tst_brk(int ttype, char *fname, void (*func)(), - const char *arg_fmt, ...); -extern void tst_brkloop(int ttype, char *fname, void (*func)(), - const char *arg_fmt, ...); -extern void tst_brkm(int ttype, void (*func)(), const char *arg_fmt, ...); -extern void tst_brkloopm(int ttype, void (*func)(), const char *arg_fmt, ...); - -extern int tst_environ(); -extern void tst_exit() __attribute__ ((noreturn)); -extern void tst_flush(); - -/* prototypes for the t_res.c functions */ -extern void t_result(char *tcid, int tnum, int ttype, char *tmesg); -extern void tt_exit(); -extern int t_environ(); -extern void t_breakum(char *tcid, int total, int typ, char *msg, void (*fnc)()); - -extern void tst_sig(int fork_flag, void (*handler)(), void (*cleanup)()); -extern void tst_tmpdir(); -extern void tst_rmdir(); - -#endif /* end of __TEST_H__ */ diff --git a/winsup/testsuite/libltp/include/tlibio.h b/winsup/testsuite/libltp/include/tlibio.h deleted file mode 100644 index ac0d5705c..000000000 --- a/winsup/testsuite/libltp/include/tlibio.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -#define LIO_IO_SYNC 00001 /* read/write */ -#define LIO_IO_ASYNC 00002 /* reada/writea/aio_write/aio_read */ -#define LIO_IO_SLISTIO 00004 /* single stride sync listio */ -#define LIO_IO_ALISTIO 00010 /* single stride async listio */ -#define LIO_IO_SYNCV 00020 /* single-buffer readv/writev */ -#define LIO_IO_SYNCP 00040 /* pread/pwrite */ - -#ifdef sgi -#define LIO_IO_ATYPES 00077 /* all io types */ -#define LIO_IO_TYPES 00061 /* all io types, non-async */ -#endif /* sgi */ -#ifdef linux -#define LIO_IO_TYPES 00021 /* all io types */ -#endif /* linux */ -#ifdef CRAY -#define LIO_IO_TYPES 00017 /* all io types */ -#endif /* CRAY */ - -#define LIO_WAIT_NONE 00010000 /* return asap -- use with care */ -#define LIO_WAIT_ACTIVE 00020000 /* spin looking at iosw fields, or EINPROGRESS */ -#define LIO_WAIT_RECALL 00040000 /* call recall(2)/aio_suspend(3) */ -#define LIO_WAIT_SIGPAUSE 00100000 /* call pause */ -#define LIO_WAIT_SIGACTIVE 00200000 /* spin waiting for signal */ -#ifdef sgi -#define LIO_WAIT_CBSUSPEND 00400000 /* aio_suspend waiting for callback */ -#define LIO_WAIT_SIGSUSPEND 01000000 /* aio_suspend waiting for signal */ -#define LIO_WAIT_ATYPES 01760000 /* all async wait types, except nowait */ -#define LIO_WAIT_TYPES 00020000 /* all sync wait types (sorta) */ -#endif /* sgi */ -#ifdef linux -#define LIO_WAIT_TYPES 00300000 /* all wait types, except nowait */ -#endif /* linux */ -#ifdef CRAY -#define LIO_WAIT_TYPES 00360000 /* all wait types, except nowait */ -#endif /* CRAY */ - -/* meta wait io */ -/* 00 000 0000 */ - -#ifdef sgi -/* all callback wait types */ -#define LIO_WAIT_CBTYPES (LIO_WAIT_CBSUSPEND) -/* all signal wait types */ -#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE|LIO_WAIT_SIGSUSPEND) -/* all aio_{read,write} or lio_listio */ -#define LIO_IO_ASYNC_TYPES (LIO_IO_ASYNC|LIO_IO_SLISTIO|LIO_IO_ALISTIO) -#endif /* sgi */ -#ifdef linux -/* all signal wait types */ -#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE) -#endif /* linux */ -#ifdef CRAY -/* all signal wait types */ -#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE) -#endif /* CRAY */ - -/* - * This bit provides a way to randomly pick an io type and wait method. - * lio_read_buffer() and lio_write_buffer() functions will call - * lio_random_methods() with the given method. - */ -#define LIO_RANDOM 010000000 - -/* - * This bit provides a way for the programmer to use async i/o with - * signals and to use their own signal handler. By default, - * the signal will only be given to the system call if the wait - * method is LIO_WAIT_SIGPAUSE or LIO_WAIT_SIGACTIVE. - * Whenever these wait methods are used, libio signal handler - * will be used. - */ -#define LIO_USE_SIGNAL 020000000 - -/* - * prototypes/structures for functions in the libio.c module. See comments - * in that module, or man page entries for information on the individual - * functions. - */ - -int stride_bounds(int offset, int stride, int nstrides, - int bytes_per_stride, int *min_byte, int *max_byte); - -int lio_set_debug(int level); -int lio_parse_io_arg1(char *string); -void lio_help1(char *prefex); -int lio_parse_io_arg2(char *string, char **badtoken); -void lio_help2(char *prefex); -int lio_write_buffer(int fd, int method, char *buffer, int size, - int sig, char **errmsg, long wrd); - -int lio_read_buffer(int fd, int method, char *buffer, int size, - int sig, char **errmsg, long wrd); -int lio_random_methods(long mask); - -#if CRAY -#include -int lio_wait4asyncio(int method, int fd, struct iosw **statptr); -int lio_check_asyncio(char *io_type, int size, struct iosw *status); -#endif /* CRAY */ -#ifdef sgi -#include -int lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp); -int lio_check_asyncio(char *io_type, int size, aiocb_t *aiocbp, int method); -#endif /* sgi */ - -/* - * Define the structure that contains the infomation that is used - * by the parsing and help functions. - */ -struct lio_info_type { - char *token; - int bits; - char *desc; -}; - - diff --git a/winsup/testsuite/libltp/include/usctest.h b/winsup/testsuite/libltp/include/usctest.h deleted file mode 100644 index 6a095db1c..000000000 --- a/winsup/testsuite/libltp/include/usctest.h +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -/********************************************************** - * - * IRIX/Linux Feature Test and Evaluation - Silicon Graphics, Inc. - * - * FUNCTION NAME : usctest.h - * - * FUNCTION TITLE : System Call Test Macros - * - * SYNOPSIS: - * See DESCRIPTION below. - * - * AUTHOR : William Roske - * - * INITIAL RELEASE : UNICOS 7.0 - * - * DESCRIPTION - * TEST(SCALL) - calls a system call - * TEST_VOID(SCALL) - same as TEST() but for syscalls with no return value. - * TEST_CLEANUP - print the log of errno return counts if STD_ERRNO_LOG - * is set. - * TEST_PAUSEF(HAND) - Pause for SIGUSR1 if the pause flag is set. - * Use "hand" as the interrupt handling function - * TEST_PAUSE - Pause for SIGUSR1 if the pause flag is set. - * Use internal function to do nothing on signal and go on. - * TEST_LOOPING(COUNTER) - Conditional to check if test should - * loop. Evaluates to TRUE (1) or FALSE (0). - * TEST_ERROR_LOG(eno) - log that this errno was received, - * if STD_ERRNO_LOG is set. - * TEST_EXP_ENOS(array) - set the bits in TEST_VALID_ENO array at - * positions specified in integer "array" - * - * RETURN VALUE - * TEST(SCALL) - Global Variables set: - * int TEST_RETURN=return code from SCALL - * int TEST_ERRNO=value of errno at return from SCALL - * TEST_VOID(SCALL) - Global Variables set: - * int TEST_ERRNO=value of errno at return from SCALL - * TEST_CLEANUP - None. - * TEST_PAUSEF(HAND) - None. - * TEST_PAUSE - None. - * TEST_LOOPING(COUNTER) - True if COUNTER < STD_LOOP_COUNT or - * STD_INFINITE is set. - * TEST_ERROR_LOG(eno) - None - * TEST_EXP_ENOS(array) - None - * - * KNOWN BUGS - * If you use the TEST_PAUSE or TEST_LOOPING macros, you must - * link in parse_opts.o, which contains the code for those functions. - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#ifndef __USCTEST_H__ -#define __USCTEST_H__ 1 - -#ifndef _SC_CLK_TCK -#include -#endif - -#include - -/* - * Ensure that PATH_MAX is defined - */ -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - -#ifndef CRAY -#ifndef BSIZE -#define BSIZE BBSIZE -#endif -#endif - -/*********************************************************************** - * Define option_t structure type. - * Entries in this struct are used by the parse_opts routine - * to indicate valid options and return option arguments - ***********************************************************************/ -typedef struct { - const char *option; /* Valid option string (one option only) like "a:" */ - int *flag; /* pointer to location to set true if option given */ - char **arg; /* pointer to location to place argument, if needed */ -} option_t; - -/*********************************************************************** - * The following globals are defined in parse_opts.c but must be - * externed here because they are used in the macros defined below. - ***********************************************************************/ -extern int STD_FUNCTIONAL_TEST, /* turned off by -f to not do functional test */ - STD_TIMING_ON, /* turned on by -t to print timing stats */ - STD_PAUSE, /* turned on by -p to pause before loop */ - STD_INFINITE, /* turned on by -c0 to loop forever */ - STD_LOOP_COUNT, /* changed by -cn to set loop count to n */ - STD_ERRNO_LOG, /* turned on by -e to log errnos returned */ - STD_ERRNO_LIST[], /* counts of errnos returned. indexed by errno */ - STD_COPIES, - STD_argind; - -extern float STD_LOOP_DURATION, /* wall clock time to iterate */ - STD_LOOP_DELAY; /* delay time after each iteration */ - -#define USC_MAX_ERRNO 2000 - -/********************************************************************** - * Prototype for parse_opts routine - **********************************************************************/ -extern const char *parse_opts(int ac, char **av, option_t *user_optarr, void (*uhf)()); - - -/* - * define a structure - */ -struct usc_errno_t { - int flag; -}; - -/*********************************************************************** - **** - **** - **** - **********************************************************************/ -#ifdef _USC_LIB_ - -extern int TEST_RETURN; -extern int TEST_ERRNO; - -#else -/*********************************************************************** - * Global array of bit masks to indicate errnos that are expected. - * Bits set by TEST_EXP_ENOS() macro and used by TEST_CLEANUP() macro. - ***********************************************************************/ -extern struct usc_errno_t TEST_VALID_ENO[USC_MAX_ERRNO]; - -/*********************************************************************** - * Globals for returning the return code and errno from the system call - * test macros. - ***********************************************************************/ -extern int TEST_RETURN; -extern int TEST_ERRNO; - -/*********************************************************************** - * temporary variables for determining max and min times in TEST macro - ***********************************************************************/ -extern long btime, etime, tmptime; - -#endif /* _USC_LIB_ */ - -/*********************************************************************** - * structure for timing accumulator and counters - ***********************************************************************/ -struct tblock { - long tb_max; - long tb_min; - long tb_total; - long tb_count; -}; - -/*********************************************************************** - * The following globals are externed here so that they are accessable - * in the macros that follow. - ***********************************************************************/ -extern struct tblock tblock; -extern void STD_go(); -extern int (*_TMP_FUNC)(void); -extern void STD_opts_help(); - - -/*********************************************************************** - * TEST: calls a system call - * - * parameters: - * SCALL = system call and parameters to execute - * - ***********************************************************************/ -#define TEST(SCALL) TEST_RETURN = (unsigned) SCALL; TEST_ERRNO=errno; - -/*********************************************************************** - * TEST_VOID: calls a system call - * - * parameters: - * SCALL = system call and parameters to execute - * - * Note: This is IDENTICAL to the TEST() macro except that it is intended - * for use with syscalls returning no values (void syscall()). The - * Typecasting nothing (void) into an unsigned integer causes compilation - * errors. - * - ***********************************************************************/ -#define TEST_VOID(SCALL) SCALL; TEST_ERRNO=errno; - -/*********************************************************************** - * TEST_CLEANUP: print system call timing stats and errno log entries - * to stdout if STD_TIMING_ON and STD_ERRNO_LOG are set, respectively. - * Do NOT print ANY information if no system calls logged. - * - * parameters: - * none - * - ***********************************************************************/ -#define TEST_CLEANUP \ -if ( STD_ERRNO_LOG ) { \ - for (tmptime=0; tmptime--> - * --> - * - * The maximum length of this record is defined by the WLOG_REC_MAX_SIZE - * record. Note that the 2-byte record length forces this to be - * <= 64k bytes. - * - * Note that there is lots of bit-masking done here. The w_pathlen, - * w_hostlen, and w_patternlen fields MUST have enough bits to hold - * WLOG_MAX_PATH, WLOG_MAX_HOST, and WLOG_MAX_PATTERN bytes respectivly. - */ - -struct wlog_rec_disk { -#ifdef CRAY - uint w_offset : 44; /* file offset */ - uint w_extra0 : 20; /* EXTRA BITS IN WORD 0 */ -#else - uint w_offset : 32; /* file offset */ - uint w_extra0 : 32; /* EXTRA BITS IN WORD 0 */ -#endif - - uint w_nbytes : 32; /* # bytes written */ - uint w_oflags : 32; /* low-order open() flags */ - - uint w_pid : 17; /* pid doing the write */ - uint w_pathlen : 7; /* length of file path */ - uint w_patternlen: 6; /* length of pattern */ - uint w_hostlen : 4; /* length of host */ - uint w_done : 1; /* 1 if io confirmed done */ - uint w_async : 1; /* 1 if async write (writea) */ - uint w_extra2 : 28; /* EXTRA BITS IN WORD 2 */ -}; - -/* - * write log file datatype. wlog_open() initializes this structure - * which is then passed around to the various wlog_xxx routines. - */ - -struct wlog_file { - int w_afd; /* append fd */ - int w_rfd; /* random-access fd */ - char w_file[1024]; /* name of the write_log */ -}; - -/* - * return value defines for the user-supplied function to - * wlog_scan_backward(). - */ - -#define WLOG_STOP_SCAN 0 -#define WLOG_CONTINUE_SCAN 1 - -/* - * wlog prototypes - */ - -#if __STDC__ -extern int wlog_open(struct wlog_file *wfile, int trunc, int mode); -extern int wlog_close(struct wlog_file *wfile); -extern int wlog_record_write(struct wlog_file *wfile, - struct wlog_rec *wrec, long offset); -extern int wlog_scan_backward(struct wlog_file *wfile, int nrecs, - int (*func)(struct wlog_rec *rec), - long data); -#else -int wlog_open(); -int wlog_close(); -int wlog_record_write(); -int wlog_scan_backward(); -#endif - -extern char Wlog_Error_String[]; - -#endif /* _WRITE_LOG_H_ */ - diff --git a/winsup/testsuite/libltp/lib/dataascii.c b/winsup/testsuite/libltp/lib/dataascii.c deleted file mode 100644 index 5bc201852..000000000 --- a/winsup/testsuite/libltp/lib/dataascii.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#include -#include -#include "dataascii.h" - -#define CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghjiklmnopqrstuvwxyz\n" -#define CHARS_SIZE sizeof(CHARS) - -#ifdef UNIT_TEST -#include /* malloc */ -#endif - -static char Errmsg[80]; - -int -dataasciigen(listofchars, buffer, bsize, offset) -char *listofchars; /* a null terminated list of characters */ -char *buffer; -int bsize; -int offset; -{ - int cnt; - int total; - int ind; /* index into CHARS array */ - char *chr; - int chars_size; - const char *charlist; - - chr=buffer; - total=offset+bsize; - - if ( listofchars == NULL ) { - charlist=CHARS; - chars_size=CHARS_SIZE; - } - else { - charlist=listofchars; - chars_size=strlen(listofchars); - } - - for(cnt=offset; cnt -#include -#include /* memset */ -#include /* rand */ -#include "databin.h" - -#if UNIT_TEST -#include -#endif - -static char Errmsg[80]; - -void -databingen (mode, buffer, bsize, offset) -int mode; /* either a, c, r, o, z or C */ -unsigned char *buffer; /* buffer pointer */ -int bsize; /* size of buffer */ -int offset; /* offset into the file where buffer starts */ -{ -int ind; - - switch (mode) - { - default: - case 'a': /* alternating bit pattern */ - memset(buffer,0x55,bsize); - break; - - case 'c': /* checkerboard pattern */ - memset(buffer,0xf0,bsize); - break; - - case 'C': /* */ - for (ind=0;ind< bsize;ind++) { - buffer[ind] = ((offset+ind)%8 & 0177); - } - break; - - case 'o': - memset(buffer,0xff,bsize); - break; - - case 'z': - memset(buffer,0x0,bsize); - break; - - case 'r': /* random */ - for (ind=0;ind< bsize;ind++) { - buffer[ind] = (rand () & 0177) | 0100; - } - } -} - -/*********************************************************************** - * - * return values: - * >= 0 : error at byte offset into the file, offset+buffer[0-(bsize-1)] - * < 0 : no error - ***********************************************************************/ -int -databinchk(mode, buffer, bsize, offset, errmsg) -int mode; /* either a, c, r, z, o, or C */ -unsigned char *buffer; /* buffer pointer */ -int bsize; /* size of buffer */ -int offset; /* offset into the file where buffer starts */ -char **errmsg; -{ - int cnt; - unsigned char *chr; - int total; - long expbits; - long actbits; - - chr=buffer; - total=bsize; - - if ( errmsg != NULL ) { - *errmsg = Errmsg; - } - - switch (mode) - { - default: - case 'a': /* alternating bit pattern */ - expbits=0x55; - break; - - case 'c': /* checkerboard pattern */ - expbits=0xf0; - break; - - case 'C': /* counting pattern */ - for (cnt=0;cnt< bsize;cnt++) { - expbits = ((offset+cnt)%8 & 0177); - - if ( buffer[cnt] != expbits ) { - sprintf(Errmsg, - "data mismatch at offset %d, exp:%#lo, act:%#o", - offset+cnt, expbits, buffer[cnt]); - return offset+cnt; - } - } - sprintf(Errmsg, "all %d bytes match desired pattern", bsize); - return -1; - - case 'o': - expbits=0xff; - break; - - case 'z': - expbits=0; - break; - - case 'r': - return -1; /* no check can be done for random */ - } - - for (cnt=0; cnt< word-offset in file (same #) >< pid > - -1234567890123456789012345678901234567890123456789012345678901234 -________________________________________________________________ -< pid >< offset in file of this word >< pid > - - -8 bits to a bytes == character - NBPW 8 -************/ - -#include -#include -#ifdef UNIT_TEST -#include -#include -#endif - -static char Errmsg[80]; - -#define LOWER16BITS(X) (X & 0177777) -#define LOWER32BITS(X) (X & 0xffffffff) - -/*** -#define HIGHBITS(WRD, bits) ( (-1 << (64-bits)) & WRD) -#define LOWBITS(WRD, bits) ( (-1 >> (64-bits)) & WRD) -****/ - -#define NBPBYTE 8 /* number bits per byte */ - -#ifndef DEBUG -#define DEBUG 0 -#endif - -/*********************************************************************** - * - * - * 1 2 3 4 5 6 7 8 9 10 11 12 13 14 14 15 bytes - * 1234567890123456789012345678901234567890123456789012345678901234 bits - * ________________________________________________________________ 1 word - * < pid >< offset in file of this word >< pid > - * - * the words are put together where offset zero is the start. - * thus, offset 16 is the start of the second full word - * Thus, offset 8 is in middle of word 1 - ***********************************************************************/ -int -datapidgen(pid, buffer, bsize, offset) -int pid; -char *buffer; -int bsize; -int offset; -{ -#if CRAY - - int cnt; - int tmp; - char *chr; - long *wptr; - long word; - int woff; /* file offset for the word */ - int boff; /* buffer offset or index */ - int num_full_words; - - num_full_words = bsize/NBPW; - boff = 0; - - if ( cnt=(offset % NBPW) ) { /* partial word */ - - woff = offset - cnt; -#if DEBUG -printf("partial at beginning, cnt = %d, woff = %d\n", cnt, woff); -#endif - - word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid)); - - chr = (char *)&word; - - for (tmp=0; tmp minus one copies - * of the current process. There are two modes in how the forks - * will be done. Mode 0 (default) will have all new processes - * be childern of the parent process. Using Mode 1, - * the parent process will have one child and that child will - * fork the next process, if necessary, and on and on. - * The forker function will return the number of successful - * forks. This value will be different for the parent and each child. - * Using mode 0, the parent will get the total number of successful - * forks. Using mode 1, the newest child will get the total number - * of forks. The parent will get a return value of 1. - * - * The forker function also updates the global variables - * Forker_pids[] and Forker_npids. The Forker_pids array will - * be updated to contain the pid of each new process. The - * Forker_npids variable contains the number of entries - * in Forker_pids. Note, not all processes will have - * access to all pids via Forker_pids. If using mode 0, only the - * parent process and the last process will have all information. - * If using mode 1, only the last child process will have all information. - * - * If the prefix parameter is not NULL and the fork system call fails, - * a error message will be printed to stderr. The error message - * the be preceeded with prefix string. If prefix is NULL, - * no error message is printed. - * - * SPECIAL REQUIREMENTS - * None. - * - * UPDATE HISTORY - * This should contain the description, author, and date of any - * "interesting" modifications (i.e. info should helpful in - * maintaining/enhancing this module). - * username description - * ---------------------------------------------------------------- - * rrl This functions will first written during - * the SFS testing days, 1993. - * - * BUGS/LIMITATIONS - * The child pids are stored in the fixed array, Forker_pids. - * The array only has space for 4098 pids. Only the first - * 4098 pids will be stored in the array. - * - **************************************************************/ - -#include -#include -#include /* fork, getpid, sleep */ -#include -#include -#include "forker.h" - -extern int errno; - -int Forker_pids[FORKER_MAX_PIDS]; /* holds pids of forked processes */ -int Forker_npids=0; /* number of entries in Forker_pids */ - -/*********************************************************************** - * - * This function will fork and the parent will exit zero and - * the child will return. This will orphan the returning process - * putting it in the background. - * - * Return Value - * 0 : if fork did not fail - * !0 : if fork failed, the return value will be the errno. - ***********************************************************************/ -int -background(prefix) -char *prefix; -{ - switch (fork()) { - case -1: - if ( prefix != NULL ) - fprintf(stderr, "%s: In %s background(), fork() failed, errno:%d %s\n", - prefix, __FILE__, errno, strerror(errno)); - exit(errno); - - case 0: /* child process */ - break; - - default: - exit(0); - } - - return 0; - -} /* end of background */ - -/*********************************************************************** - * Forker will fork ncopies-1 copies of self. - * - ***********************************************************************/ -int -forker(ncopies, mode, prefix) -int ncopies; -int mode; /* 0 - all childern of parent, 1 - only 1 direct child */ -char *prefix; /* if ! NULL, an message will be printed to stderr */ - /* if fork fails. The prefix (program name) will */ - /* preceed the message */ -{ - int cnt; - int pid; - static int ind = 0; - - Forker_pids[ind]=0; - - for ( cnt=1; cnt < ncopies; cnt++ ) { - - switch ( mode ) { - case 1 : /* only 1 direct child */ - if ( (pid = fork()) == -1 ) { - if ( prefix != NULL ) - fprintf(stderr, "%s: %s,forker(): fork() failed, errno:%d %s\n", - prefix, __FILE__, errno, strerror(errno)); - return 0; - } - Forker_npids++; - - switch (pid ) { - case 0: /* child - continues the forking */ - - if ( Forker_npids < FORKER_MAX_PIDS ) - Forker_pids[Forker_npids-1]=getpid(); - break; - - default: /* parent - stop the forking */ - if ( Forker_npids < FORKER_MAX_PIDS ) - Forker_pids[Forker_npids-1]=pid; - return cnt-1; - } - - break; - - default : /* all new processes are childern of parent */ - if ( (pid = fork()) == -1 ) { - if ( prefix != NULL ) - fprintf(stderr, "%s: %s,forker(): fork() failed, errno:%d %s\n", - prefix, __FILE__, errno, strerror(errno)); - return cnt-1; - } - Forker_npids++; - - switch (pid ) { - case 0: /* child - stops the forking */ - if ( Forker_npids < FORKER_MAX_PIDS ) - Forker_pids[Forker_npids-1]=getpid(); - return cnt; - - default: /* parent - continues the forking */ - if ( Forker_npids < FORKER_MAX_PIDS ) - Forker_pids[Forker_npids-1]=pid; - break; - } - break; - } - } - - if ( Forker_npids < FORKER_MAX_PIDS ) - Forker_pids[Forker_npids]=0; - return cnt-1; - -} /* end of forker */ - - -#if UNIT_TEST - -/* - * The following is a unit test main for the background and forker - * functions. - */ - -int -main(argc, argv) -int argc; -char **argv; -{ - int ncopies=1; - int mode=0; - int ret; - int ind; - - if ( argc == 1 ) { - printf("Usage: %s ncopies [mode]\n", argv[0]); - exit(1); - } - - if ( sscanf(argv[1], "%i", &ncopies) != 1 ) { - printf("%s: ncopies argument must be integer\n", argv[0]); - exit(1); - } - - if ( argc == 3 ) - if ( sscanf(argv[2], "%i", &mode) != 1 ) { - printf("%s: mode argument must be integer\n", argv[0]); - exit(1); - } - - printf("Starting Pid = %d\n", getpid()); - ret=background(argv[0]); - printf("After background() ret:%d, pid = %d\n", ret, getpid()); - - ret=forker(ncopies, mode, argv[0]); - - printf("forker(%d, %d, %s) ret:%d, pid = %d, sleeping 30 seconds.\n", - ncopies, mode, argv[0], ret, getpid()); - - printf("%d My version of Forker_pids[], Forker_npids = %d\n", - getpid(), Forker_npids); - - for (ind=0; ind -#ifdef __CYGWIN__ -#include -#endif - -char * -get_high_address() -{ -#ifdef __CYGWIN__ - return VirtualAlloc (NULL, 4096, MEM_COMMIT, PAGE_NOACCESS) + 2048; -#else - return (char *)sbrk(0) + 16384; -#endif -} diff --git a/winsup/testsuite/libltp/lib/libtestsuite.c b/winsup/testsuite/libltp/lib/libtestsuite.c deleted file mode 100644 index e741d25f6..000000000 --- a/winsup/testsuite/libltp/lib/libtestsuite.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * libtestsuite.c - * - * DESCRIPTION - * file containing generic routines which are used by some of the LTP - * testsuite tests. Currently, the following routines are present in - * this library: - * - * my_getpwnam(), do_file_setup() - * - */ -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -struct passwd * -my_getpwnam(char *name) -{ - struct passwd *saved_pwent; - struct passwd *pwent; - - if ((pwent = getpwnam(name)) == NULL) { - perror("getpwnam"); - tst_brkm(TBROK, NULL, "getpwnam() failed"); - } - saved_pwent = (struct passwd *)malloc(sizeof(struct passwd)); - - *saved_pwent = *pwent; - - return(saved_pwent); -} - -void -do_file_setup(char *fname) -{ - int fd; - - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_resm(TBROK, "open(%s, O_RDWR|O_CREAT,0700) Failed, " - "errno=%d : %s", fname, errno, strerror(errno)); - } - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed on file create, errno=%d : " - "%s", fname, errno, strerror(errno)); - } -} diff --git a/winsup/testsuite/libltp/lib/open_flags.c b/winsup/testsuite/libltp/lib/open_flags.c deleted file mode 100644 index 3105955d4..000000000 --- a/winsup/testsuite/libltp/lib/open_flags.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/************************************************************** - * - * OS Testing - Silicon Graphics, Inc. - * - * FUNCTION NAME : parse_open_flags - * openflags2symbols - * - * FUNCTION TITLE : converts open flag symbols into bitmask - * converts open flag bitmask into symbols - * - * SYNOPSIS: - * int parse_open_flags(symbols, badname) - * char *symbols; - * char **badname; - * - * char *openflags2symbols(openflags, sep, mode) - * int openflags; - * char *sep; - * int mode; - * - * AUTHOR : Richard Logan - * - * CO-PILOT(s) : Dean Roehrich - * - * INITIAL RELEASE : UNICOS 8.0 - * - * DESIGN DESCRIPTION - * The parse_open_flags function can be used to convert - * a list of comma separated open(2) flag symbols (i.e. O_TRUNC) - * into the bitmask that can be used by open(2). - * If a symbol is unknown and is not NULL, - * will updated to point that symbol in . - * Parse_open_flags will return -1 on this error. - * Otherwise parse_open_flags will return the open flag bitmask. - * If parse_open_flags returns, will left unchanged. - * - * The openflags2symbols function attempts to convert open flag - * bits into human readable symbols (i.e. O_TRUNC). If there - * are more than one symbol, the string will be placed as - * a separator between symbols. Commonly used separators would - * be a comma "," or pipe "|". If is one and not all - * bits can be converted to symbols, the "UNKNOWN" - * symbol will be added to return string. - * Openflags2symbols will return the indentified symbols. - * If no symbols are recognized the return value will be a empty - * string or the "UNKNOWN" symbol. - * - * SPECIAL REQUIREMENTS - * None. - * - * UPDATE HISTORY - * This should contain the description, author, and date of any - * "interesting" modifications (i.e. info should helpful in - * maintaining/enhancing this module). - * username description - * ---------------------------------------------------------------- - * rrl This code was first created during the beginning - * of the SFS testing days. I think that was in 1993. - * This code was updated in 05/96. - * (05/96) openflags2symbols was written. - * - * BUGS/LIMITATIONS - * Currently (05/96) all known symbols are coded into openflags2symbols. - * If new open flags are added this code will have to updated - * to know about them or they will not be recognized. - * - **************************************************************/ - -#include -#include -#include -#include -#include /* strcat */ -#include "open_flags.h" - -#define UNKNOWN_SYMBOL "UNKNOWN" - -static char Open_symbols[512]; /* space for openflags2symbols return value */ - -struct open_flag_t { - const char *symbol; - int flag; -}; - -static struct open_flag_t Open_flags[] = { - { "O_RDONLY", O_RDONLY }, - { "O_WRONLY", O_WRONLY }, - { "O_RDWR", O_RDWR }, - { "O_SYNC", O_SYNC }, - { "O_CREAT", O_CREAT }, - { "O_TRUNC", O_TRUNC }, - { "O_EXCL", O_EXCL }, - { "O_APPEND", O_APPEND }, - { "O_NONBLOCK", O_NONBLOCK }, -#if O_NOCTTY - { "O_NOCTTY", O_NOCTTY }, -#endif -#if O_DSYNC - { "O_DSYNC", O_DSYNC }, -#endif -#if O_RSYNC - { "O_RSYNC", O_RSYNC }, -#endif -#if O_ASYNC - { "O_ASYNC", O_ASYNC }, -#endif -#if O_PTYIGN - { "O_PTYIGN", O_PTYIGN }, -#endif -#if O_NDELAY - { "O_NDELAY", O_NDELAY }, -#endif -#if O_RAW - { "O_RAW", O_RAW }, -#endif -#ifdef O_SSD - { "O_SSD", O_SSD }, -#endif -#if O_BIG - { "O_BIG", O_BIG }, -#endif -#if O_PLACE - { "O_PLACE", O_PLACE }, -#endif -#if O_RESTART - { "O_RESTART", O_RESTART }, -#endif -#if O_SFSXOP - { "O_SFSXOP", O_SFSXOP }, -#endif -#if O_SFS_DEFER_TM - { "O_SFS_DEFER_TM", O_SFS_DEFER_TM }, -#endif -#if O_WELLFORMED - { "O_WELLFORMED", O_WELLFORMED }, -#endif -#if O_LDRAW - { "O_LDRAW", O_LDRAW }, -#endif -#if O_T3D - { "O_T3D", O_T3D }, -#endif /* O_T3D */ -#if O_PARALLEL - { "O_PARALLEL", O_PARALLEL }, - { "O_FSA", O_PARALLEL|O_WELLFORMED|O_RAW }, /* short cut */ -#endif /* O_PARALLEL */ -#ifdef O_LARGEFILE - { "O_LARGEFILE", O_LARGEFILE }, -#endif -#ifdef O_DIRECT - { "O_DIRECT", O_DIRECT }, -#endif -#ifdef O_PRIV - { "O_PRIV", O_PRIV }, -#endif - -}; - -int -parse_open_flags(char *string, char **badname) -{ - int bits = 0; - char *name; - char *cc; - char savecc; - int found; - int ind; - - name=string; - cc=name; - - while ( 1 ) { - - for(; ((*cc != ',') && (*cc != '\0')); cc++); - savecc = *cc; - *cc = '\0'; - - found = 0; - - for(ind=0; ind < sizeof(Open_flags)/sizeof(struct open_flag_t); ind++) { - if ( strcmp(name, Open_flags[ind].symbol) == 0 ) { - bits |= Open_flags[ind].flag; - found=1; - break; - } - } - - *cc = savecc; /* restore string */ - - if ( found == 0 ) { /* invalid name */ - if ( badname != NULL ) - *badname = name; - return -1; - } - - if ( savecc == '\0' ) - break; - - name = ++cc; - - } /* end while */ - - return bits; - -} /* end of parse_open_flags */ - - -char * -openflags2symbols(int openflags, char *sep, int mode) -{ - int ind; - int size; - int bits = openflags; - int havesome=0; - - Open_symbols[0]='\0'; - - size=sizeof(Open_flags)/sizeof(struct open_flag_t); - - /* - * Deal with special case of O_RDONLY. If O_WRONLY nor O_RDWR - * bits are not set, assume O_RDONLY. - */ - - if ( (bits & (O_WRONLY | O_RDWR)) == 0 ) { - strcat(Open_symbols, "O_RDONLY"); - havesome=1; - } - - /* - * Loop through all but O_RDONLY elments of Open_flags - */ - for(ind=1; ind < size; ind++) { - - if ( (bits & Open_flags[ind].flag) == Open_flags[ind].flag ) { - if ( havesome ) - strcat(Open_symbols, sep); - - strcat(Open_symbols, Open_flags[ind].symbol); - havesome++; - - /* remove flag bits from bits */ - bits = bits & (~Open_flags[ind].flag); - } - } - - /* - * If not all bits were identified and mode was equal to 1, - * added UNKNOWN_SYMBOL to return string - */ - if ( bits && mode == 1 ) { /* not all bits were identified */ - if ( havesome ) - strcat(Open_symbols, sep); - strcat(Open_symbols, UNKNOWN_SYMBOL); - } - - return Open_symbols; - -} /* end of openflags2symbols */ - - -#ifdef UNIT_TEST - -/* - * The following code provides a UNIT test main for - * parse_open_flags and openflags2symbols functions. - */ - -int -main(argc, argv) -int argc; -char **argv; -{ - int bits; - int ret; - char *err; - - if (argc == 1 ) { - printf("Usage: %s openflagsbits\n\t%s symbols\n", argv[0], argv[0]); - exit(1); - } - - if ( sscanf(argv[1], "%i", &bits) == 1 ) { - printf("openflags2symbols(%#o, \",\", 1) returned %s\n", - bits, openflags2symbols(bits, ",", 1)); - - } else { - ret=parse_open_flags(argv[1], &err); - if ( ret == -1 ) - printf("parse_open_flags(%s, &err) returned -1, err = %s\n", - argv[0], err); - else - printf("parse_open_flags(%s, &err) returned %#o\n", argv[0], ret); - } - - exit(0); -} - -#endif /* end of UNIT_TEST */ diff --git a/winsup/testsuite/libltp/lib/parse_opts.c b/winsup/testsuite/libltp/lib/parse_opts.c deleted file mode 100644 index 4a8058938..000000000 --- a/winsup/testsuite/libltp/lib/parse_opts.c +++ /dev/null @@ -1,876 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -/********************************************************** - * - * OS Testing - Silicon Graphics, Inc. - * - * FUNCTION NAME : parse_opts - * - * FUNCTION TITLE : parse standard & user options for system call tests - * - * SYNOPSIS: - * #include "usctest.h" - * - * char *parse_opts(ac, av, user_optarr, uhf) - * int ac; - * char **av; - * option_t user_optarr[]; - * void (*uhf)(); - * - * AUTHOR : William Roske/Richard Logan - * - * INITIAL RELEASE : UNICOS 7.0 - * - * DESCRIPTION - * The parse_opts library routine takes that argc and argv parameters - * recevied by main() and an array of structures defining user options. - * It parses the command line setting flag and argument locations - * associated with the options. It uses getopt to do the actual cmd line - * parsing. uhf() is a function to print user define help - * - * This module contains the functions usc_global_setup_hook and - * usc_test_looping, which are called by marcos defined in usctest.h. - * - * RETURN VALUE - * parse_opts returns a pointer to an error message if an error occurs. - * This pointer is (char *)NULL if parsing is successful. - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ -#include -#include -#include -#include -#include -#include - -#ifdef __CYGWIN__ -#include -#endif - - -#if UNIT_TEST -#include -#endif /* UNIT_TEST */ - -#include "test.h" -#define _USC_LIB_ 1 /* indicates we are the library to the usctest.h include */ -#include "usctest.h" - -#ifndef USC_COPIES -#define USC_COPIES "USC_COPIES" -#endif - -#ifndef UNIT_TEST -#define UNIT_TEST 0 -#endif - -#ifndef DEBUG -#define DEBUG 0 -#endif - -/* - * Code from usctest.h that not part of this file since we are the library. - */ - -struct usc_errno_t TEST_VALID_ENO[USC_MAX_ERRNO]; - - /*********************************************************************** - * Globals for returning the return code and errno from the system call - * test macros. - ***********************************************************************/ -int TEST_RETURN; -int TEST_ERRNO; - - /*********************************************************************** - * temporary variables for determining max and min times in TEST macro - ***********************************************************************/ -long btime, etime, tmptime; - -/* The timing information block. */ -struct tblock tblock={0,((long) -1)>>1,0,0}; - - -/* Define flags and args for standard options */ -int STD_FUNCTIONAL_TEST=1, /* flag indicating to do functional testing code */ - STD_TIMING_ON=0, /* flag indicating to print timing stats */ - STD_PAUSE=0, /* flag indicating to pause before actual start, */ - /* for contention mode */ - STD_INFINITE=0, /* flag indciating to loop forever */ - STD_LOOP_COUNT=1, /* number of iterations */ - STD_COPIES=1, /* number of copies */ - STD_ERRNO_LOG=0; /* flag indicating to do errno logging */ - -float STD_LOOP_DURATION=0.0, /* duration value in fractional seconds */ - STD_LOOP_DELAY=0.0; /* loop delay value in fractional seconds */ - - -char **STD_opt_arr = NULL; /* array of option strings */ -int STD_nopts=0, /* number of elements in STD_opt_arr */ - STD_argind=1; /* argv index to next argv element */ - /* (first argument) */ - /* To getopt users, it is like optind */ - -/* - * The following variables are to support system testing additions. - */ -static int STD_TP_barrier=0; /* flag to do barrier in TEST_PAUSE */ - /* 2 - wait_barrier(), 3 - set_barrier(), * - barrier() */ -static int STD_LP_barrier=0; /* flag to do barrier in TEST_LOOPING */ - /* 2 - wait_barrier(), 3 - set_barrier(), * - barrier() */ -static int STD_TP_shmem_sz=0; /* shmalloc this many words per pe in TEST_PAUSE */ -static int STD_LD_shmem=0; /* flag to do shmem_puts and shmem_gets during delay */ -static int STD_LP_shmem=0; /* flag to do shmem_puts and gets during TEST_LOOPING */ -static int STD_LD_recfun=0; /* do recressive function calls in loop delay */ -static int STD_LP_recfun=0; /* do recressive function calls in TEST_LOOPING */ -static int STD_TP_sbrk=0; /* do sbrk in TEST_PAUSE */ -static int STD_LP_sbrk=0; /* do sbrk in TEST_LOOPING */ -static char *STD_start_break=0; /* original sbrk size */ -static int Debug=0; - -struct std_option_t { - const char *optstr; - const char *help; - char *flag; - char **arg; -} std_options[] = { - { "c:", " -c n Run n copies concurrently\n", NULL, NULL}, - { "e" , " -e Turn on errno logging\n", NULL, NULL}, - { "f" , " -f Turn off functional testing\n", NULL, NULL}, - { "h" , " -h Show this help screen\n", NULL, NULL}, - { "i:", " -i n Execute test n times\n", NULL, NULL}, - { "I:", " -I x Execute test for x seconds\n", NULL, NULL}, - { "p" , " -p Pause for SIGUSR1 before starting\n", NULL, NULL}, - { "P:", " -P x Pause for x seconds between iterations\n", NULL, NULL}, - { "t" , " -t Turn on syscall timing\n", NULL, NULL}, - {NULL, NULL, NULL, NULL}}; - -void print_help(void (*user_help)()); - -/* - * Structure for usc_recressive_func argument - */ -struct usc_bigstack_t { - char space[4096]; -}; - -static struct usc_bigstack_t *STD_bigstack=NULL; - -/* - * Counter of errnos returned (-e option). Indexed by errno. - * Make the array USC_MAX_ERRNO long. That is the first Fortran - * Lib errno. No syscall should return an errno that high. - */ -int STD_ERRNO_LIST[USC_MAX_ERRNO]; - -/* define the string length for Mesg and Mesg2 strings */ -#define STRLEN 2048 - -static char Mesg2[STRLEN]; /* holds possible return string */ -static void usc_recressive_func(); - -/* - * Define bits for options that might have env variable default - */ -#define OPT_iteration 01 -#define OPT_nofunccheck 02 -#define OPT_duration 04 -#define OPT_delay 010 -#define OPT_copies 020 - - -/********************************************************************** - * parse_opts: - **********************************************************************/ -const char * -parse_opts(int ac, char **av, option_t *user_optarr, void (*uhf)()) -{ - int found; /* flag to indicate that an option specified was */ - /* found in the user's list */ - int k; /* scratch integer for returns and short time usage */ - float ftmp; /* tmp float for parsing env variables */ - char *ptr; /* used in getting env variables */ - int options=0; /* no options specified */ - int optstrlen, i; - char *optionstr; - int opt; /* return of getopt */ - - /* - * If not the first time this function is called, release the old STD_opt_arr - * vector. - */ - - if ( STD_opt_arr != NULL ) { - free(STD_opt_arr); - STD_opt_arr=NULL; - } - /* Calculate how much space we need for the option string */ - optstrlen = 0; - for (i = 0; std_options[i].optstr; ++i) - optstrlen += strlen(std_options[i].optstr); - if (user_optarr) - for (i = 0; user_optarr[i].option; ++i) { - if (strlen(user_optarr[i].option) > 2) - return "parse_opts: ERROR - Only short options are allowed"; - optstrlen += strlen(user_optarr[i].option); - } - optstrlen += 1; - - /* Create the option string for getopt */ - optionstr = (char *)malloc(optstrlen); - if (!optionstr) - return "parse_opts: ERROR - Could not allocate memory for optionstr"; - - optionstr[0] = '\0'; - - for (i = 0; std_options[i].optstr; ++i) - strcat(optionstr, std_options[i].optstr); - if (user_optarr) - for (i = 0; user_optarr[i].option; ++i) - /* only add the option if it wasn't there already */ - if (strchr(optionstr, user_optarr[i].option[0]) == NULL) - strcat(optionstr, user_optarr[i].option); - -#if DEBUG > 1 - printf("STD_nopts = %d\n", STD_nopts); -#endif - - /* - * Loop through av parsing options. - */ - while ( (opt = getopt(ac, av, optionstr)) > 0) { - - STD_argind = optind; -#if DEBUG > 0 - printf("parse_opts: getopt returned '%c'\n", opt); -#endif - - switch (opt) { - case '?': /* Unknown option */ - return "Unknown option"; - break; - case ':': /* Missing Arg */ - return "Missing argument"; - break; - case 'i': /* Iterations */ - options |= OPT_iteration; - STD_LOOP_COUNT = atoi(optarg); - if (STD_LOOP_COUNT == 0) STD_INFINITE = 1; - break; - case 'P': /* Delay between iterations */ - options |= OPT_delay; - STD_LOOP_DELAY = atof(optarg); - break; - case 'I': /* Time duration */ - options |= OPT_duration; - STD_LOOP_DURATION = atof(optarg); - if ( STD_LOOP_DURATION == 0.0 ) STD_INFINITE=1; - break; - case 'c': /* Copies */ - options |= OPT_copies; - STD_COPIES = atoi(optarg); - break; - case 'f': /* Functional testing */ - STD_FUNCTIONAL_TEST = 0; - break; - case 'p': /* Pause for SIGUSR1 */ - STD_PAUSE = 1; - break; - case 't': /* syscall timing */ - STD_TIMING_ON = 1; - break; - case 'e': /* errno loggin */ - STD_ERRNO_LOG = 1; - break; - case 'h': /* Help */ - print_help(uhf); - exit(0); - break; - default: - - /* Check all the user specified options */ - found=0; - for(i = 0; user_optarr[i].option; ++i) { - - if (opt == user_optarr[i].option[0]) { - /* Yup, This is a user option, set the flag and look for argument */ - if ( user_optarr[i].flag ) { - *user_optarr[i].flag=1; - } - found++; - - /* save the argument at the user's location */ - if ( user_optarr[i].option[strlen(user_optarr[i].option)-1] == ':' ) { - *user_optarr[i].arg=optarg; - } - break; /* option found - break out of the for loop */ - } - } - /* This condition "should never happen". SO CHECK FOR IT!!!! */ - if ( ! found ) { - sprintf(Mesg2, - "parse_opts: ERROR - option:\"%c\" NOT FOUND... INTERNAL ERROR", opt); - return(Mesg2); - } - } - - } /* end of while */ - - STD_argind = optind; - - /* - * Turn on debug - */ - if ( (ptr=getenv("USC_DEBUG")) != NULL ) { - Debug=1; - printf("env USC_DEBUG is defined, turning on debug\n"); - } - if ( (ptr=getenv("USC_VERBOSE")) != NULL ) { - Debug=1; - printf("env USC_VERBOSE is defined, turning on debug\n"); - } - - /* - * If the USC_ITERATION_ENV environmental variable is set to - * a number, use that number as iteration count (same as -c option). - * The -c option with arg will be used even if this env var is set. - */ - if ( !(options & OPT_iteration) && (ptr=getenv(USC_ITERATION_ENV)) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1) { - if ( k == 0 ) { /* if arg is 0, set infinite loop flag */ - STD_INFINITE=1; - if ( Debug ) - printf("Using env %s, set STD_INFINITE to 1\n", - USC_ITERATION_ENV); - } else { /* else, set the loop count to the arguement */ - STD_LOOP_COUNT=k; - if ( Debug ) - printf("Using env %s, set STD_LOOP_COUNT to %d\n", - USC_ITERATION_ENV, k); - } - } - } - - /* - * If the USC_NO_FUNC_CHECK environmental variable is set, we'll - * unset the STD_FUNCTIONAL_TEST variable. - */ - if ( !(options & OPT_nofunccheck) && (ptr=getenv(USC_NO_FUNC_CHECK)) != NULL ) { - STD_FUNCTIONAL_TEST=0; /* Turn off functional testing */ - if ( Debug ) - printf("Using env %s, set STD_FUNCTIONAL_TEST to 0\n", - USC_NO_FUNC_CHECK); - } - - /* - * If the USC_LOOP_WALLTIME environmental variable is set, - * use that number as duration (same as -I option). - * The -I option with arg will be used even if this env var is set. - */ - - if ( !(options & OPT_duration) && (ptr=getenv(USC_LOOP_WALLTIME)) != NULL ) { - if ( sscanf(ptr, "%f", &ftmp) == 1 && ftmp >= 0.0 ) { - STD_LOOP_DURATION=ftmp; - if ( Debug ) - printf("Using env %s, set STD_LOOP_DURATION to %f\n", - USC_LOOP_WALLTIME, ftmp); - if ( STD_LOOP_DURATION == 0.0 ) { /* if arg is 0, set infinite loop flag */ - STD_INFINITE=1; - if ( Debug ) - printf("Using env %s, set STD_INFINITE to 1\n", USC_LOOP_WALLTIME); - } - } - } - if ( !(options & OPT_duration) && (ptr=getenv("USC_DURATION")) != NULL ) { - if ( sscanf(ptr, "%f", &ftmp) == 1 && ftmp >= 0.0 ) { - STD_LOOP_DURATION=ftmp; - if ( Debug ) - printf("Using env USC_DURATION, set STD_LOOP_DURATION to %f\n", ftmp); - if ( STD_LOOP_DURATION == 0.0 ) { /* if arg is 0, set infinite loop flag */ - STD_INFINITE=1; - if ( Debug ) - printf("Using env USC_DURATION, set STD_INFINITE to 1\n"); - } - } - } - /* - * If the USC_LOOP_DELAY environmental variable is set, - * use that number as delay in factional seconds (same as -P option). - * The -P option with arg will be used even if this env var is set. - */ - if ( !(options & OPT_delay) && (ptr=getenv(USC_LOOP_DELAY)) != NULL ) { - if ( sscanf(ptr, "%f", &ftmp) == 1 && ftmp >= 0.0 ) { - STD_LOOP_DELAY=ftmp; - if ( Debug ) - printf("Using env %s, set STD_LOOP_DELAY = %f\n", - USC_LOOP_DELAY, ftmp); - } - } - - /* - * If the USC_COPIES environmental variable is set, - * use that number as copies (same as -c option). - * The -c option with arg will be used even if this env var is set. - */ - if ( !(options & OPT_copies) && (ptr=getenv(USC_COPIES)) != NULL ) { - if ( sscanf(ptr, "%d", &STD_COPIES) == 1 && STD_COPIES >= 0 ) { - if ( Debug ) - printf("Using env %s, set STD_COPIES = %d\n", - USC_COPIES, STD_COPIES); - } - } - - /* - * The following are special system testing envs to turn on special - * hooks in the code. - */ - if ( (ptr=getenv("USC_TP_BARRIER")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_TP_barrier=k; - } - else - STD_TP_barrier=1; - if ( Debug ) - printf("using env USC_TP_BARRIER, Set STD_TP_barrier to %d\n", - STD_TP_barrier); - } - - if ( (ptr=getenv("USC_LP_BARRIER")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LP_barrier=k; - } - else - STD_LP_barrier=1; - if ( Debug ) - printf("using env USC_LP_BARRIER, Set STD_LP_barrier to %d\n", - STD_LP_barrier); - } - - if ( (ptr=getenv("USC_TP_SHMEM")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_TP_shmem_sz=k; - if ( Debug ) - printf("Using env USC_TP_SHMEM, Set STD_TP_shmem_sz to %d\n", - STD_TP_shmem_sz); - } - } - - if ( (ptr=getenv("USC_LP_SHMEM")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LP_shmem=k; - if ( Debug ) - printf("Using env USC_LP_SHMEM, Set STD_LP_shmem to %d\n", - STD_LP_shmem); - } - } - - if ( (ptr=getenv("USC_LD_SHMEM")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LD_shmem=k; - if ( Debug ) - printf("Using env USC_LD_SHMEM, Set STD_LD_shmem to %d\n", - STD_LD_shmem); - } - } - - if ( (ptr=getenv("USC_TP_SBRK")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_TP_sbrk=k; - if ( Debug ) - printf("Using env USC_TP_SBRK, Set STD_TP_sbrk to %d\n", - STD_TP_sbrk); - } - } - - if ( (ptr=getenv("USC_LP_SBRK")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LP_sbrk=k; - if ( Debug ) - printf("Using env USC_LP_SBRK, Set STD_LP_sbrk to %d\n", - STD_LP_sbrk); - } - } - - if ( (ptr=getenv("USC_LP_RECFUN")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LP_recfun=k; - if ( STD_bigstack != (struct usc_bigstack_t *)NULL ) - STD_bigstack=(struct usc_bigstack_t *) - malloc(sizeof(struct usc_bigstack_t)); - if ( Debug ) - printf("Using env USC_LP_RECFUN, Set STD_LP_recfun to %d\n", - STD_LP_recfun); - } - } - - if ( (ptr=getenv("USC_LD_RECFUN")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LD_recfun=k; - if ( STD_bigstack != (struct usc_bigstack_t *)NULL ) - STD_bigstack=(struct usc_bigstack_t *) - malloc(sizeof(struct usc_bigstack_t)); - if ( Debug ) - printf("Using env USC_LD_RECFUN, Set STD_LD_recfun to %d\n", - STD_LD_recfun); - } - } - -#if UNIT_TEST - printf("The following variables after option and env parsing:\n"); - printf("STD_FUNCTIONAL_TEST = %d\n", STD_FUNCTIONAL_TEST); - printf("STD_LOOP_DURATION = %f\n", STD_LOOP_DURATION); - printf("STD_LOOP_DELAY = %f\n", STD_LOOP_DELAY); - printf("STD_COPIES = %d\n", STD_COPIES); - printf("STD_LOOP_COUNT = %d\n", STD_LOOP_COUNT); - printf("STD_INFINITE = %d\n", STD_INFINITE); - printf("STD_TIMING_ON = %d\n", STD_TIMING_ON); - printf("STD_ERRNO_LOG = %d\n", STD_ERRNO_LOG); - printf("STD_PAUSE = %d\n", STD_PAUSE); -#endif - - return((char *) NULL); - -} /* end of parse_opts */ - -/********************************************************************* - * print_help() - print help message and user help message - *********************************************************************/ -void print_help(void (*user_help)()) -{ - STD_opts_help(); - - if (user_help) user_help(); -} - -/********************************************************************* - * STD_opts_help() - return a help string for the STD_OPTIONS. - *********************************************************************/ -void -STD_opts_help() -{ - int i; - - for(i = 0; std_options[i].optstr; ++i) { - if (std_options[i].help) - printf(std_options[i].help); - } -} - -/* - * routine to goto when we get the SIGUSR1 for STD_PAUSE - */ -void STD_go(int sig) -{ - return; -} - -/*********************************************************************** - * This function will do desired end of global setup test - * hooks. - * Currently it will only do a pause waiting for sigusr1 if - * STD_PAUSE is set. - * - ***********************************************************************/ -int -usc_global_setup_hook() -{ - int cnt; - /* temp variable to store old signal action to be restored after pause */ - int (*_TMP_FUNC)(void); - - /* - * Fork STD_COPIES-1 copies. - */ - for(cnt=1;cnt -#include "pattern.h" - -/* - * The routines in this module are used to fill/check a data buffer - * with/against a known pattern. - */ - -int -pattern_check(buf, buflen, pat, patlen, patshift) -char *buf; -int buflen; -char *pat; -int patlen; -int patshift; -{ - int nb, ncmp, nleft; - char *cp; - - if (patlen) - patshift = patshift % patlen; - - cp = buf; - nleft = buflen; - - /* - * The following 2 blocks of code are to compare the first patlen - * bytes of buf. We need 2 checks if patshift is > 0 since we - * must check the last (patlen - patshift) bytes, and then the - * first (patshift) bytes. - */ - - nb = patlen - patshift; - if (nleft < nb) { - return (memcmp(cp, pat + patshift, nleft) ? -1 : 0); - } else { - if (memcmp(cp, pat + patshift, nb)) - return -1; - - nleft -= nb; - cp += nb; - } - - if (patshift > 0) { - nb = patshift; - if (nleft < nb) { - return (memcmp(cp, pat, nleft) ? -1 : 0); - } else { - if (memcmp(cp, pat, nb)) - return -1; - - nleft -= nb; - cp += nb; - } - } - - /* - * Now, verify the rest of the buffer using the algorithm described - * in the function header. - */ - - ncmp = cp - buf; - while (ncmp < buflen) { - nb = (ncmp < nleft) ? ncmp : nleft; - if (memcmp(buf, cp, nb)) - return -1; - - cp += nb; - ncmp += nb; - nleft -= nb; - } - - return 0; -} - -int -pattern_fill(buf, buflen, pat, patlen, patshift) -char *buf; -int buflen; -char *pat; -int patlen; -int patshift; -{ - int trans, ncopied, nleft; - char *cp; - - if (patlen) - patshift = patshift % patlen; - - cp = buf; - nleft = buflen; - - /* - * The following 2 blocks of code are to fill the first patlen - * bytes of buf. We need 2 sections if patshift is > 0 since we - * must first copy the last (patlen - patshift) bytes into buf[0]..., - * and then the first (patshift) bytes of pattern following them. - */ - - trans = patlen - patshift; - if (nleft < trans) { - memcpy(cp, pat + patshift, nleft); - return 0; - } else { - memcpy(cp, pat + patshift, trans); - nleft -= trans; - cp += trans; - } - - if (patshift > 0) { - trans = patshift; - if (nleft < trans) { - memcpy(cp, pat, nleft); - return 0; - } else { - memcpy(cp, pat, trans); - nleft -= trans; - cp += trans; - } - } - - /* - * Now, fill the rest of the buffer using the algorithm described - * in the function header comment. - */ - - ncopied = cp - buf; - while (ncopied < buflen) { - trans = (ncopied < nleft) ? ncopied : nleft; - memcpy(cp, buf, trans); - cp += trans; - ncopied += trans; - nleft -= trans; - } - - return(0); -} diff --git a/winsup/testsuite/libltp/lib/rmobj.c b/winsup/testsuite/libltp/lib/rmobj.c deleted file mode 100644 index 63122c446..000000000 --- a/winsup/testsuite/libltp/lib/rmobj.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -/********************************************************** - * - * OS Testing - Silicon Graphics, Inc. - * - * FUNCTION NAME : rmobj() - * - * FUNCTION TITLE : Remove an object - * - * SYNOPSIS: - * int rmobj(char *obj, char **errmsg) - * - * AUTHOR : Kent Rogers - * - * INITIAL RELEASE : UNICOS 7.0 - * - * USER DESCRIPTION - * This routine will remove the specified object. If the specified - * object is a directory, it will recursively remove the directory - * and everything underneath it. It assumes that it has privilege - * to remove everything that it tries to remove. If rmobj() encounters - * any problems, and errmsg is not NULL, errmsg is set to point to a - * string explaining the error. - * - * DETAILED DESCRIPTION - * Allocate space for the directory and its contents - * Open the directory to get access to what is in it - * Loop through the objects in the directory: - * If the object is not "." or "..": - * Determine the file type by calling lstat() - * If the object is not a directory: - * Remove the object with unlink() - * Else: - * Call rmobj(object) to remove the object's contents - * Determine the link count on object by calling lstat() - * If the link count >= 3: - * Remove the directory with unlink() - * Else - * Remove the directory with rmdir() - * Close the directory and free the pointers - * - * RETURN VALUE - * If there are any problems, rmobj() will set errmsg (if it was not - * NULL) and return -1. Otherwise it will return 0. - * - ************************************************************/ -#include /* for errno */ -#include /* for NULL */ -#include /* for malloc() */ -#include /* for string function */ -#include /* for PATH_MAX */ -#include /* for opendir(), readdir(), closedir(), stat() */ -#include /* for [l]stat() */ -#include /* for opendir(), readdir(), closedir() */ -#include /* for rmdir(), unlink() */ -#include "rmobj.h" - -#define SYSERR strerror(errno) - -int -rmobj(char *obj, char **errmsg) -{ - int ret_val = 0; /* return value from this routine */ - DIR *dir; /* pointer to a directory */ - struct dirent *dir_ent; /* pointer to directory entries */ - char dirobj[PATH_MAX]; /* object inside directory to modify */ - struct stat statbuf; /* used to hold stat information */ - static char err_msg[1024]; /* error message */ - - /* Determine the file type */ - if ( lstat(obj, &statbuf) < 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "lstat(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } - - /* Take appropriate action, depending on the file type */ - if ( (statbuf.st_mode & S_IFMT) == S_IFDIR ) { - /* object is a directory */ - - /* Do NOT perform the request if the directory is "/" */ - if ( !strcmp(obj, "/") ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "Cannot remove /"); - *errmsg = err_msg; - } - return -1; - } - - /* Open the directory to get access to what is in it */ - if ( (dir = opendir(obj)) == NULL ) { - if ( rmdir(obj) != 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "rmdir(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } else { - return 0; - } - } - - /* Loop through the entries in the directory, removing each one */ - for ( dir_ent = (struct dirent *)readdir(dir); - dir_ent != NULL; - dir_ent = (struct dirent *)readdir(dir)) { - - /* Don't remove "." or ".." */ - if ( !strcmp(dir_ent->d_name, ".") || !strcmp(dir_ent->d_name, "..") ) - continue; - - /* Recursively call this routine to remove the current entry */ - sprintf(dirobj, "%s/%s", obj, dir_ent->d_name); - if ( rmobj(dirobj, errmsg) != 0 ) - ret_val = -1; - } - - /* Close the directory */ - closedir(dir); - - /* If there were problems removing an entry, don't attempt to - remove the directory itself */ - if ( ret_val == -1 ) - return -1; - - /* Get the link count, now that all the entries have been removed */ - if ( lstat(obj, &statbuf) < 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "lstat(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } - - /* Remove the directory itself */ - if ( statbuf.st_nlink >= 3 ) { - /* The directory is linked; unlink() must be used */ - if ( unlink(obj) < 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "unlink(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } - } else { - /* The directory is not linked; rmdir() can be used */ - if ( rmdir(obj) < 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "rmdir(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } - } - } else { - /* object is not a directory; just use unlink() */ - if ( unlink(obj) < 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "unlink(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } - } /* if obj is a directory */ - - /* - * Everything must have went ok. - */ - return 0; -} /* rmobj() */ diff --git a/winsup/testsuite/libltp/lib/search_path.c b/winsup/testsuite/libltp/lib/search_path.c deleted file mode 100644 index 775c7b1a6..000000000 --- a/winsup/testsuite/libltp/lib/search_path.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * (C) COPYRIGHT CRAY RESEARCH, INC. - * UNPUBLISHED PROPRIETARY INFORMATION. - * ALL RIGHTS RESERVED. - */ -/********************************************************** - * - * UNICOS Feature Test and Evaluation - Cray Research, Inc. - * - * FUNCTION NAME : search_path - * - * FUNCTION TITLE : search PATH locations for desired filename - * - * SYNOPSIS: - * int search_path(cmd, res_path, access_mode, fullpath) - * char *cmd; - * char *res_path; - * int access_mode; - * int fullpath; - * - * AUTHOR : Richard Logan - * - * INITIAL RELEASE : UNICOS 7.0 - * - * DESCRIPTION - * Search_path will walk through PATH and attempt to find "cmd". If cmd is - * a full or relative path, it is checked but PATH locations are not scanned. - * search_path will put the resulting path in res_path. It is assumed - * that res_path points to a string that is at least PATH_MAX - * (or MAXPATHLEN on the suns) in size. Access_mode is just as is - * says, the mode to be used on access to determine if cmd can be found. - * If fullpath is set, res_path will contain the full path to cmd. - * If it is not set, res_path may or may not contain the full path to cmd. - * If fullpath is not set, the path in PATH prepended to cmd is used, - * which could be a relative path. If fullpath is set, the current - * directory is prepended to path/cmd before access is called. - * If cmd is found, search_path will return 0. If cmd cannot be - * found, 1 is returned. If an error has occurred, -1 is returned - * and an error mesg is placed in res_path. - * If the length of path/cmd is larger then PATH_MAX, then that path - * location is skipped. - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include - -extern int errno; - -struct stat stbuf; - -#ifndef AS_CMD -#define AS_CMD 0 -#endif - -/* - * Make sure PATH_MAX is defined. Define it to MAXPATHLEN, if set. Otherwise - * set it to 1024. - */ -#ifndef PATH_MAX -#ifndef MAXPATHLEN -#define PATH_MAX 1024 -#else /* MAXPATHLEN */ -#define PATH_MAX MAXPATHLEN -#endif /* MAXPATHLEN */ -#endif /* PATH_MAX */ - - -#if AS_CMD -main(argc, argv) -int argc; -char **argv; -{ - char path[PATH_MAX]; - int ind; - - if (argc <= 1 ) { - printf("missing argument\n"); - exit(1); - } - - for(ind=1;ind < argc; ind++) { - if ( search_path(argv[ind], path, F_OK, 0) < 0 ) { - printf("ERROR: %s\n", path); - } - else { - printf("path of %s is %s\n", argv[ind], path); - } - } - -} - -#endif - -/* - */ -int -search_path(cmd, res_path, access_mode, fullpath) -const char *cmd; /* The requested filename */ -char *res_path; /* The resulting path or error mesg */ -int access_mode; /* the mode used by access(2) */ -int fullpath; /* if set, cwd will be prepended to all non-full paths */ -{ - char *cp; /* used to scan PATH for directories */ - int ret; /* return value from access */ - char *pathenv; - char tmppath[PATH_MAX]; - char curpath[PATH_MAX]; - char *path; - int lastpath; - int toolong=0; - -#if DEBUG -printf("search_path: cmd = %s, access_mode = %d, fullpath = %d\n", cmd, access_mode, fullpath); -#endif - - /* - * full or relative path was given - */ - if ( (cmd[0] == '/') || ( (cp=strchr(cmd, '/')) != NULL )) { - if ( access(cmd, access_mode) == 0 ) { - - if ( cmd[0] != '/' ) { /* relative path */ - if ( getcwd(curpath, PATH_MAX) == NULL ) { - strcpy(res_path, curpath); - return -1; - } - if ( (strlen(curpath) + strlen(cmd) + 1) > (size_t)PATH_MAX ) { - sprintf(res_path, "cmd (as relative path) and cwd is longer than %d", - PATH_MAX); - return -1; - } - sprintf(res_path, "%s/%s", curpath, cmd); - } - else - strcpy(res_path, cmd); - return 0; - } - else { - sprintf(res_path, "file %s not found", cmd); - return -1; - } - } - - /* get the PATH variable */ - if ( (pathenv=getenv("PATH")) == NULL) { - /* no path to scan, return */ - sprintf(res_path, "Unable to get PATH env. variable"); - return -1; - } - - /* - * walk through each path in PATH. - * Each path in PATH is placed in tmppath. - * pathenv cannot be modified since it will affect PATH. - * If a signal came in while we have modified the PATH - * memory, we could create a problem for the caller. - */ - - curpath[0]='\0'; - - cp = pathenv; - path = pathenv; - lastpath = 0; - for (;;) { - - if ( lastpath ) - break; - - if ( cp != pathenv ) - path = ++cp; /* already set on first iteration */ - - /* find end of current path */ - - for (; ((*cp != ':') && (*cp != '\0')); cp++); - - /* - * copy path to tmppath so it can be NULL terminated - * and so we do not modify path memory. - */ - strncpy(tmppath, path, (cp-path) ); - tmppath[cp-path]='\0'; -#if DEBUG -printf("search_path: tmppath = %s\n", tmppath); -#endif - - if ( *cp == '\0' ) - lastpath=1; /* this is the last path entry */ - - /* Check lengths so not to overflow res_path */ - if ( strlen(tmppath) + strlen(cmd) + 2 > (size_t)PATH_MAX ) { - toolong++; - continue; - } - - sprintf(res_path, "%s/%s", tmppath, cmd); -#if DEBUG -printf("search_path: res_path = '%s'\n", res_path); -#endif - - - /* if the path is not full at this point, prepend the current - * path to get the full path. - * Note: this could not be wise to do when under a protected - * directory. - */ - - if ( fullpath && res_path[0] != '/' ) { /* not a full path */ - if ( curpath[0] == '\0' ) { - if ( getcwd(curpath, PATH_MAX) == NULL ) { - strcpy(res_path, curpath); - return -1; - } - } - if ( (strlen(curpath) + strlen(res_path) + 2) > (size_t)PATH_MAX ) { - toolong++; - continue; - } - sprintf(tmppath, "%s/%s", curpath, res_path); - strcpy(res_path, tmppath); -#if DEBUG -printf("search_path: full res_path= '%s'\n", res_path); -#endif - - } - - - if ( (ret=access(res_path, access_mode)) == 0 ) { -#if DEBUG -printf("search_path: found res_path = %s\n", res_path); -#endif - return 0; - } - } - - /* return failure */ - if ( toolong ) - sprintf(res_path, - "Unable to find file, %d path/file strings were too long", toolong); - else - strcpy(res_path, "Unable to find file"); - return 1; /* not found */ -} - diff --git a/winsup/testsuite/libltp/lib/str_to_bytes.c b/winsup/testsuite/libltp/lib/str_to_bytes.c deleted file mode 100644 index beecb71b6..000000000 --- a/winsup/testsuite/libltp/lib/str_to_bytes.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#include -#include -#include "str_to_bytes.h" - -/**************************************************************************** - * str_to_bytes(s) - * - * Computes the number of bytes described by string s. s is assumed to be - * a base 10 positive (ie. >= 0) number followed by an optional single - * character multiplier. The following multipliers are supported: - * - * char mult - * ----------------- - * b BSIZE or BBSIZE - * k 1024 bytes - * K 1024 * sizeof(long) - * m 2^20 (1048576) - * M 2^20 (1048576 * sizeof(long) - * g 2^30 (1073741824) - * G 2^30 (1073741824) * sizeof(long) - * - * for instance, "1k" and "1024" would both cause str_to_bytes to return 1024. - * - * Returns -1 if mult is an invalid character, or if the integer portion of - * s is not a positive integer. - * - ****************************************************************************/ - -#if CRAY -#define B_MULT BSIZE /* block size */ -#elif sgi -#define B_MULT BBSIZE /* block size */ -#elif linux -#define B_MULT DEV_BSIZE /* block size */ -#elif __CYGWIN__ -#include -#define B_MULT S_BLKSIZE /* block size */ -#endif - - -#define K_MULT 1024 /* Kilo or 2^10 */ -#define M_MULT 1048576 /* Mega or 2^20 */ -#define G_MULT 1073741824 /* Giga or 2^30 */ -#define T_MULT 1099511627776 /* tera or 2^40 */ - -int -str_to_bytes(s) -char *s; -{ - char mult, junk; - int nconv; - float num; - - nconv = sscanf(s, "%f%c%c", &num, &mult, &junk); - if (nconv == 0 || nconv == 3 ) - return -1; - - if (nconv == 1) - return num; - - switch (mult) { - case 'b': - return (int)(num * (float)B_MULT); - case 'k': - return (int)(num * (float)K_MULT); - case 'K': - return (int)((num * (float)K_MULT) * sizeof(long)); - case 'm': - return (int)(num * (float)M_MULT); - case 'M': - return (int)((num * (float)M_MULT) * sizeof(long)); - case 'g': - return (int)(num * (float)G_MULT); - case 'G': - return (int)((num * (float)G_MULT) * sizeof(long)); - default: - return -1; - } -} - -long -str_to_lbytes(s) -char *s; -{ - char mult, junk; - long nconv; - float num; - - nconv = sscanf(s, "%f%c%c", &num, &mult, &junk); - if (nconv == 0 || nconv == 3 ) - return -1; - - if (nconv == 1) - return (long)num; - - switch (mult) { - case 'b': - return (long)(num * (float)B_MULT); - case 'k': - return (long)(num * (float)K_MULT); - case 'K': - return (long)((num * (float)K_MULT) * sizeof(long)); - case 'm': - return (long)(num * (float)M_MULT); - case 'M': - return (long)((num * (float)M_MULT) * sizeof(long)); - case 'g': - return (long)(num * (float)G_MULT); - case 'G': - return (long)((num * (float)G_MULT) * sizeof(long)); - default: - return -1; - } -} - -/* - * Force 64 bits number when compiled as 32 IRIX binary. - * This allows for a number bigger than 2G. - */ - -long long -str_to_llbytes(s) -char *s; -{ - char mult, junk; - long nconv; - double num; - - nconv = sscanf(s, "%lf%c%c", &num, &mult, &junk); - if (nconv == 0 || nconv == 3 ) - return -1; - - if (nconv == 1) - return (long long)num; - - switch (mult) { - case 'b': - return (long long)(num * (float)B_MULT); - case 'k': - return (long long)(num * (float)K_MULT); - case 'K': - return (long long)((num * (float)K_MULT) * sizeof(long long)); - case 'm': - return (long long)(num * (float)M_MULT); - case 'M': - return (long long)((num * (float)M_MULT) * sizeof(long long)); - case 'g': - return (long long)(num * (float)G_MULT); - case 'G': - return (long long)((num * (float)G_MULT) * sizeof(long long)); - default: - return -1; - } -} - -#ifdef UNIT_TEST - -main(int argc, char **argv) -{ - int ind; - - if (argc == 1 ) { - fprintf(stderr, "missing str_to_bytes() parameteres\n"); - exit(1); - } - - for (ind=1; ind -#include /* for string functions */ -#include "string_to_tokens.h" - -int -string_to_tokens(char *arg_string, char *arg_array[], int array_size, char *separator) -{ - int num_toks = 0; /* number of tokens found */ - char *strtok(); - - if ( arg_array == NULL || array_size <= 1 || separator == NULL ) - return -1; - - /* - * Use strtok() to parse 'arg_string', placing pointers to the - * individual tokens into the elements of 'arg_array'. - */ - if ( (arg_array[num_toks] = strtok(arg_string, separator)) == NULL ) { - return 0; - } - - for (num_toks=1;num_toks -#include /* for varargs stuff */ -#include "test.h" /* for output display mode & result type */ - /* defines */ - -/* - * Define some useful macros. - */ -#define VERBOSE 1 /* flag values for the T_mode variable */ -#define CONDENSE 2 -#define NOPASS 3 -#define DISCARD 4 - -#define MAXMESG 80 /* max length of internal messages */ -#define USERMESG 2048 /* max length of user message */ -#define TRUE 1 -#define FALSE 0 - -/* - * EXPAND_VAR_ARGS - Expand the variable portion (arg_fmt) of a result - * message into the specified string. - */ -#define EXPAND_VAR_ARGS(arg_fmt, str) { \ - va_list ap; /* varargs mechanism */ \ - \ - if ( arg_fmt != NULL ) { \ - if ( Expand_varargs == TRUE ) { \ - va_start(ap, arg_fmt); \ - vsprintf(str, arg_fmt, ap); \ - va_end(ap); \ - Expand_varargs = FALSE; \ - } else { \ - strcpy(str, arg_fmt); \ - } \ - } else { \ - str[0] = '\0'; \ - } \ -} /* EXPAND_VAR_ARGS() */ - -/* - * Define local function prototypes. - */ -static void check_env(); -static void tst_condense(int tnum, int ttype, char *tmesg); -static void tst_print(char *tcid, int tnum, int trange, int ttype, const char *tmesg); -static void cat_file(const char *filename); - - -/* - * Define some static/global variables. - */ -static FILE *T_out = NULL; /* tst_res() output file descriptor */ -static const char *File; /* file whose contents is part of result */ -static int T_exitval = 0; /* exit value used by tst_exit() */ -static int T_mode = VERBOSE; /* flag indicating print mode: VERBOSE, */ - /* CONDENSE, NOPASS, DISCARD */ - -static int Expand_varargs = TRUE; /* if TRUE, expand varargs stuff */ -static char Warn_mesg[MAXMESG]; /* holds warning messages */ - -/* - * These are used for condensing output when NOT in verbose mode. - */ -static int Buffered = FALSE; /* TRUE if condensed output is currently */ - /* buffered (i.e. not yet printed) */ -static char *Last_tcid; /* previous test case id */ -static int Last_num; /* previous test case number */ -static int Last_type; /* previous test result type */ -static char *Last_mesg; /* previous test result message */ - - -/* - * These globals may be externed by the test. - */ -int Tst_count = 0; /* current count of test cases executed; NOTE: */ - /* Tst_count may be externed by other programs */ -int Tst_lptotal = 0; /* tst_brkloop() external */ -int Tst_lpstart = 0; /* tst_brkloop() external */ -int Tst_range = 1; /* for specifying multiple results */ -int Tst_nobuf = 1; /* this is a no-op; buffering is never done, but */ - /* this will stay for compatibility reasons */ - -/* - * These globals must be defined in the test. - */ -extern char *TCID; /* Test case identifier from the test source */ -extern int TST_TOTAL; /* Total number of test cases from the test */ - /* source */ - -/* - * This global is used by the temp. dir. maintenance functions, - * tst_tmpdir()/tst_rmdir(), tst_wildcard()/tst_tr_rmdir(). It is the - * name of the directory created (if any). It is defined here, so that - * it only has to be declared once and can then be referenced from more - * than one module. Also, since the temp. dir. maintenance functions - * rely on the tst_res.c package this seemed like a reasonable place. - */ -char *TESTDIR = NULL; - -/* - * tst_res() - Main result reporting function. Handle test information - * appropriately depending on output display mode. Call - * tst_condense() or tst_print() to actually print results. - * All result functions (tst_resm(), tst_brk(), etc.) - * eventually get here to print the results. - */ -void -tst_res(int ttype, const char *fname, const char *arg_fmt, ...) -{ - int i; - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_res; Tst_count = %d; Tst_range = %d\n", - Tst_count, Tst_range); fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg, if necessary. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Save the test result type by ORing ttype into the current exit - * value (used by tst_exit()). - */ - T_exitval |= ttype; - - /* - * Unless T_out has already been set by tst_environ(), make tst_res() - * output go to standard output. - */ - if ( T_out == NULL ) - T_out = stdout; - - /* - * Check TOUTPUT environment variable (if first time) and set T_mode - * flag. - */ - check_env(); - - /* - * A negative or NULL range is invalid. - */ - if ( Tst_range <= 0 ) { - Tst_range = 1; - tst_print(TCID, 0, 1, TWARN, - "tst_res(): Tst_range must be positive"); - } - - /* - * If a filename was specified, set 'File' if it exists. - */ - if ( fname != NULL && access(fname, F_OK) == 0 ) - File = fname; - - /* - * Set the test case number and print the results, depending on the - * display type. - */ - if ( ttype == TWARN || ttype == TINFO ) { - /* - * Handle WARN and INFO results (test case number is 0). - */ - if ( Tst_range > 1 ) { - tst_print(TCID, 0, 1, TWARN, - "tst_res(): Range not valid for TINFO or TWARN types"); - } - tst_print(TCID, 0, 1, ttype, tmesg); - } else { - /* - * Handle all other types of results other than WARN and INFO. - */ - if ( Tst_count < 0 ) - tst_print(TCID, 0, 1, TWARN, - "tst_res(): Tst_count < 0 is not valid"); - - /* - * Process each display type. - */ - switch ( T_mode ) { - case DISCARD: - /* do not print any results */ - break; - - case NOPASS: /* passing result types are filtered by tst_print() */ - case CONDENSE: - tst_condense(Tst_count + 1, ttype, tmesg); - break; - - default: /* VERBOSE */ - for ( i = 1 ; i <= Tst_range ; i++ ) - tst_print(TCID, Tst_count + i, Tst_range, ttype, tmesg); - break; - } /* end switch() */ - - /* - * Increment Tst_count. - */ - Tst_count += Tst_range; - } /* if ( ttype == TWARN || ttype == TINFO ) */ - - /* - * Reset some values. - */ - Tst_range = 1; - Expand_varargs = TRUE; -} /* tst_res() */ - - -/* - * tst_condense() - Handle test cases in CONDENSE or NOPASS mode (i.e. - * buffer the current result and print the last result - * if different than the current). If a file was - * specified, print the current result and do not - * buffer it. - */ -static void -tst_condense(int tnum, int ttype, char *tmesg) -{ - const char *file; - -#if DEBUG - printf("IN tst_condense: tcid = %s, tnum = %d, ttype = %d, tmesg = %s\n", - TCID, tnum, ttype, tmesg); - fflush(stdout); -#endif - - /* - * If this result is the same as the previous result, return. - */ - if ( Buffered == TRUE ) { - if ( strcmp(Last_tcid, TCID) == 0 && Last_type == ttype && - strcmp(Last_mesg, tmesg) == 0 && File == NULL ) - return; - - /* - * This result is different from the previous result. First, - * print the previous result. - */ - file = File; - File = NULL; - tst_print(Last_tcid, Last_num, tnum - Last_num, Last_type, - Last_mesg); - free(Last_tcid); - free(Last_mesg); - File = file; - } /* if ( Buffered == TRUE ) */ - - /* - * If a file was specified, print the current result since we have no - * way of retaining the file contents for comparing with future - * results. Otherwise, buffer the current result info for next time. - */ - if ( File != NULL ) { - tst_print(TCID, tnum, Tst_range, ttype, tmesg); - Buffered = FALSE; - } else { - Last_tcid = (char *)malloc(strlen(TCID) + 1); - strcpy(Last_tcid, TCID); - Last_num = tnum; - Last_type = ttype; - Last_mesg = (char *)malloc(strlen(tmesg) + 1); - strcpy(Last_mesg, tmesg); - Buffered = TRUE; - } -} /* tst_condense() */ - - -/* - * tst_flush() - Print any messages pending because of CONDENSE mode, - * and flush T_out. - */ -void -tst_flush() -{ -#if DEBUG - printf("IN tst_flush\n"); - fflush(stdout); -#endif - - /* - * Print out last line if in CONDENSE or NOPASS mode. - */ - if ( Buffered == TRUE && (T_mode == CONDENSE || T_mode == NOPASS) ) { - tst_print(Last_tcid, Last_num, Tst_count - Last_num + 1, - Last_type, Last_mesg); - Buffered = FALSE; - } - fflush(T_out); -} /* tst_flush() */ - - -/* - * tst_print() - Actually print a line or range of lines to the output - * stream. - */ -static void -tst_print(char *tcid, int tnum, int trange, int ttype, const char *tmesg) -{ - char type[5]; - -#if DEBUG - printf("IN tst_print: tnum = %d, trange = %d, ttype = %d, tmesg = %s\n", - tnum, trange, ttype, tmesg); - fflush(stdout); -#endif - - /* - * Save the test result type by ORing ttype into the current exit - * value (used by tst_exit()). This is already done in tst_res(), but - * is also done here to catch internal warnings. For internal warnings, - * tst_print() is called directly with a case of TWARN. - */ - T_exitval |= ttype; - - /* - * If output mode is DISCARD, or if the output mode is NOPASS and - * this result is not one of FAIL, BROK, or WARN, just return. This - * check is necessary even though we check for DISCARD mode inside of - * tst_res(), since occasionally we get to this point without going - * through tst_res() (e.g. internal TWARN messages). - */ - if ( T_mode == DISCARD || (T_mode == NOPASS && ttype != TFAIL && - ttype != TBROK && ttype != TWARN) ) - return; - - /* - * Fill in the type string according to ttype. - */ - switch ( ttype ) { - case TPASS: - strcpy(type, "PASS"); - break; - case TFAIL: - strcpy(type, "FAIL"); - break; - case TBROK: - strcpy(type, "BROK"); - break; - case TRETR: - strcpy(type, "RETR"); - break; - case TCONF: - strcpy(type, "CONF"); - break; - case TWARN: - strcpy(type, "WARN"); - break; - case TINFO: - strcpy(type, "INFO"); - break; - default: - strcpy(type, "????"); - break; - } /* switch ( ttype ) */ - - /* - * Build the result line and print it. - */ - if ( T_mode == VERBOSE ) { - fprintf(T_out, "%-8s %4d %s : %s\n", tcid, tnum, type, tmesg); - } else { - /* condense results if a range is specified */ - if ( trange > 1 ) - fprintf(T_out, "%-8s %4d-%-4d %s : %s\n", - tcid, tnum, tnum + trange - 1, type, tmesg); - else - fprintf(T_out, "%-8s %4d %s : %s\n", - tcid, tnum, type, tmesg); - } - - /* - * If tst_res() was called with a file, append file contents to the - * end of last printed result. - */ - if ( File != NULL ) - cat_file(File); - File = NULL; -} /* tst_print() */ - - -/* - * check_env() - Check the value of the environment variable TOUTPUT and - * set the global variable T_mode. The TOUTPUT environment - * variable should be set to "VERBOSE", "CONDENSE", - * "NOPASS", or "DISCARD". If TOUTPUT does not exist or - * is not set to a valid value, the default is "VERBOSE". - */ -static void -check_env() -{ - static int first_time = 1; - char *value; /* value of TOUTPUT environment variable */ - -#if DEBUG - printf("IN check_env\n"); - fflush(stdout); -#endif - - if ( !first_time ) - return; - - first_time = 0; - - if ( (value = getenv(TOUTPUT)) == NULL ) { - /* TOUTPUT not defined, use default */ - T_mode = VERBOSE; - } else if ( strcmp(value, TOUT_CONDENSE_S) == 0 ) { - T_mode = CONDENSE; - } else if ( strcmp(value, TOUT_NOPASS_S) == 0 ) { - T_mode = NOPASS; - } else if ( strcmp(value, TOUT_DISCARD_S) == 0 ) { - T_mode = DISCARD; - } else { - /* default */ - T_mode = VERBOSE; - } - - return; -} /* check_env() */ - - -/* - * tst_exit() - Call exit() with the value T_exitval, set up by - * tst_res(). T_exitval has a bit set for most of the - * result types that were seen (including TPASS, TFAIL, - * TBROK, TWARN, TCONF). Also, print the last result (if - * necessary) before exiting. - */ -void -tst_exit() -{ -#if DEBUG - printf("IN tst_exit\n"); fflush(stdout); - fflush(stdout); -#endif - - /* - * Call tst_flush() flush any ouput in the buffer or the last - * result not printed because of CONDENSE mode. - */ - tst_flush(); - - /* - * Mask out TRETR, TINFO, and TCONF results from the exit status. - */ - exit(T_exitval & ~(TRETR | TINFO | TCONF)); -} /* tst_exit() */ - - -/* - * tst_environ() - Preserve the tst_res() output location, despite any - * changes to stdout. - */ -int -tst_environ() -{ - FILE *fdopen(); - - if ( (T_out = fdopen(dup(fileno(stdout)), "w")) == NULL ) - return(-1); - else - return(0); -} /* tst_environ() */ - - -/* - * tst_brk() - Fail or break current test case, and break the remaining - * tests cases. - */ -void -tst_brk(int ttype, char *fname, void (*func)(), const char *arg_fmt, ...) -{ - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_brk\n"); fflush(stdout); - fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg, if necessary. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Only FAIL, BROK, CONF, and RETR are supported by tst_brk(). - */ - if ( ttype != TFAIL && ttype != TBROK && ttype != TCONF && - ttype != TRETR ) { - sprintf(Warn_mesg, "tst_brk(): Invalid Type: %d. Using TBROK", - ttype); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - ttype = TBROK; - } - - /* - * Print the first result, if necessary. - */ - if ( Tst_count < TST_TOTAL ) - tst_res(ttype, fname, tmesg); - - /* - * Determine the number of results left to report. - */ - Tst_range = TST_TOTAL - Tst_count; - - /* - * Print the rest of the results, if necessary. - */ - if ( Tst_range > 0 ) { - if ( ttype == TCONF ) - tst_res(ttype, NULL, - "Remaining cases not appropriate for configuration"); - else if ( ttype == TRETR ) - tst_res(ttype, NULL, "Remaining cases retired"); - else - tst_res(TBROK, NULL, "Remaining cases broken"); - } else { - Tst_range = 1; - Expand_varargs = TRUE; - } /* if ( Tst_range > 0 ) */ - - /* - * If no cleanup function was specified, just return to the caller. - * Otherwise call the specified function. If specified function - * returns, call tst_exit(). - */ - if ( func != NULL ) { - (*func)(); - tst_exit(); - } - - return; -} /* tst_brk() */ - - -/* - * tst_brkloop() - Fail or break current test case, and break the - * remaining test cases within test case loop. - */ -void -tst_brkloop(int ttype, char *fname, void (*func)(), const char *arg_fmt, ...) -{ - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_brkloop\n"); fflush(stdout); - fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Verify that Tst_lpstart & Tst_lptotal are valid. - */ - if ( Tst_lpstart < 0 || Tst_lptotal < 0 ) { - tst_print(TCID, 0, 1, TWARN, - "tst_brkloop(): Tst_lpstart & Tst_lptotal must both be assigned non-negative values"); - Expand_varargs = TRUE; - return; - } - - /* - * Only FAIL, BROK, CONF, and RETR are supported by tst_brkloop(). - */ - if ( ttype != TFAIL && ttype != TBROK && ttype != TCONF && - ttype != TRETR ) { - sprintf(Warn_mesg, - "tst_brkloop(): Invalid Type: %d. Using TBROK", - ttype); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - ttype = TBROK; - } - - /* - * Print the first result, if necessary. - */ - if ( Tst_count < Tst_lpstart + Tst_lptotal ) - tst_res(ttype, fname, tmesg); - - /* - * Determine the number of results left to report. - */ - Tst_range = Tst_lptotal + Tst_lpstart - Tst_count; - - /* - * Print the rest of the results, if necessary. - */ - if ( Tst_range > 0 ) { - if ( ttype == TCONF ) - tst_res(ttype, NULL, - "Remaining cases in loop not appropriate for configuration"); - else if ( ttype == TRETR ) - tst_res(ttype, NULL, "Remaining cases in loop retired"); - else - tst_res(TBROK, NULL, "Remaining cases in loop broken"); - } else { - Tst_range = 1; - Expand_varargs = TRUE; - } /* if ( Tst_range > 0 ) */ - - /* - * If a cleanup function was specified, call it. - */ - if ( func != NULL ) - (*func)(); -} /* tst_brkloop() */ - - -/* - * tst_resm() - Interface to tst_res(), with no filename. - */ -void -tst_resm(int ttype, const char *arg_fmt, ...) -{ - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_resm\n"); fflush(stdout); - fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Call tst_res with a null filename argument. - */ - tst_res(ttype, NULL, tmesg); -} /* tst_resm() */ - - -/* - * tst_brkm() - Interface to tst_brk(), with no filename. - */ -void -tst_brkm(int ttype, void (*func)(), const char *arg_fmt, ...) -{ - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_brkm\n"); fflush(stdout); - fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Call tst_brk with a null filename argument. - */ - tst_brk(ttype, NULL, func, tmesg); -} /* tst_brkm() */ - - -/* - * tst_brkloopm() - Interface to tst_brkloop(), with no filename. - */ -void -tst_brkloopm(int ttype, void (*func)(), const char *arg_fmt, ...) -{ - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_brkloopm\n"); - fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Call tst_brkloop with a null filename argument. - */ - tst_brkloop(ttype, NULL, func, tmesg); -} /* tst_brkloopm() */ - - -/* - * cat_file() - Print the contents of a file to standard out. - */ -static void -cat_file(const char *filename) -{ - FILE *fp; /* file pointer */ - int b_read; /* number of bytes read with read() */ - int b_written; /* number of bytes written with write() */ - char buffer[BUFSIZ]; /* read/write buffer; BUFSIZ defined in */ - /* stdio.h */ - -#if DEBUG - printf("IN cat_file\n"); fflush(stdout); -#endif - - /* - * Open the file for reading. - */ - if ( (fp = fopen(filename, "r")) == NULL ) { - sprintf(Warn_mesg, - "tst_res(): fopen(%s, \"r\") failed; errno = %d: %s", - filename, errno, strerror(errno)); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - return; - } /* if ( fopen(filename, "r") == -1 ) */ - - /* - * While something to read, continue to read blocks. - * From fread(3) man page: - * If an error occurs, or the end-of-file is reached, the return - * value is zero. - */ - errno = 0; - while ( (b_read = fread((void *)buffer, 1, BUFSIZ, fp)) != (size_t)0 ) { - /* - * Write what was read to the result output stream. - */ - if ( (b_written = fwrite((void *)buffer, 1, b_read, T_out)) != - b_read ) { - sprintf(Warn_mesg, - "tst_res(): While trying to cat \"%s\", fwrite() wrote only %d of %d bytes", - filename, b_written, b_read); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - break; - } /* if ( b_written != b_read ) */ - } /* while ( fread() != 0 ) */ - - /* - * Check for an fread() error. - */ - if ( !feof(fp) ) { - sprintf(Warn_mesg, - "tst_res(): While trying to cat \"%s\", fread() failed, errno = %d: %s", - filename, errno, strerror(errno)); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - } /* if ( !feof() ) */ - - /* - * Close the file. - */ - if ( fclose(fp) == EOF ) { - sprintf(Warn_mesg, - "tst_res(): While trying to cat \"%s\", fclose() failed, errno = %d: %s", - filename, errno, strerror(errno)); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - } /* if ( fclose(fp) == EOF ) */ -} /* cat_file() */ - - - -#ifdef UNIT_TEST -/**************************************************************************** - * Unit test code: Takes input from stdin and can make the following - * calls: tst_res(), tst_resm(), tst_brk(), tst_brkm(), - * tst_flush_buf(), tst_exit(). - ****************************************************************************/ -int TST_TOTAL = 10; -char *TCID = "TESTTCID"; - -#define RES "tst_res.c UNIT TEST message; ttype = %d; contents of \"%s\":" -#define RESM "tst_res.c UNIT TEST message; ttype = %d" - -main() -{ - int ttype; - int range; - char *chrptr; - char chr; - char fname[MAXMESG]; - - printf("UNIT TEST of tst_res.c. Options for ttype:\n\ - -1 : call tst_exit()\n\ - -2 : call tst_flush()\n\ - -3 : call tst_brk()\n\ - -4 : call tst_brkloop()\n\ - -5 : call tst_res() with a range\n\ - 0 : call tst_res(TPASS, ...)\n\ - 1 : call tst_res(TFAIL, ...)\n\ - 2 : call tst_res(TBROK, ...)\n\ - 4 : call tst_res(TWARN, ...)\n\ - 8 : call tst_res(TRETR, ...)\n\ - 16 : call tst_res(TINFO, ...)\n\ - 32 : call tst_res(TCONF, ...)\n\n"); - - while ( 1 ) { - printf("Enter ttype (-5,-4,-3,-2,-1,0,1,2,4,8,16,32): "); - (void) scanf("%d%c", &ttype, &chr); - - - switch ( ttype ) { - case -1: - tst_exit(); - break; - - case -2: - tst_flush(); - break; - - case -3: - printf("Enter the current type (1=FAIL, 2=BROK, 8=RETR, 32=CONF): "); - (void) scanf("%d%c", &ttype, &chr); - printf("Enter file name ( for none): "); - gets(fname); - if ( strcmp(fname, "") == 0 ) - tst_brkm(ttype, tst_exit, RESM, ttype); - else - tst_brk(ttype, fname, tst_exit, RES, ttype, fname); - break; - - case -4: - printf("Enter the size of the loop: "); - (void) scanf("%d%c", &range, &chr); - Tst_lpstart = Tst_count; - Tst_lptotal = range; - printf("Enter the current type (1=FAIL, 2=BROK, 8=RETR, 32=CONF): "); - (void) scanf("%d%c", &ttype, &chr); - printf("Enter file name ( for none): "); - gets(fname); - if ( strcmp(fname, "") == 0 ) - tst_brkloopm(ttype, NULL, RESM, ttype); - else - tst_brkloop(ttype, fname, NULL, RES, ttype, fname); - break; - - case -5: - printf("Enter the size of the range: "); - (void) scanf("%d%c", &Tst_range, &chr); - printf("Enter the current type (0,1,2,4,8,16,32): "); - (void) scanf("%d%c", &ttype, &chr); - /* fall through to tst_res() call */ - - default: - printf("Enter file name ( for none): "); - gets(fname); - if ( strcmp(fname, "") == 0 ) - tst_resm(ttype, RESM, ttype); - else - tst_res(ttype, fname, RES, ttype, fname); - break; - } /* switch() */ - } /* while() */ -} -#endif /* UNIT_TEST */ diff --git a/winsup/testsuite/libltp/lib/tst_sig.c b/winsup/testsuite/libltp/lib/tst_sig.c deleted file mode 100644 index f5b64b666..000000000 --- a/winsup/testsuite/libltp/lib/tst_sig.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -/***************************************************************************** - OS Testing - Silicon Graphics, Inc. - - FUNCTION IDENTIFIER : tst_sig Set up for unexpected signals. - - AUTHOR : David D. Fenner - - CO-PILOT : Bill Roske - - DATE STARTED : 06/06/90 - - This module may be linked with c-modules requiring unexpected - signal handling. The parameters to tst_sig are as follows: - - fork_flag - set to FORK or NOFORK depending upon whether the - calling program executes a fork() system call. It - is normally the case that the calling program treats - SIGCLD as an expected signal if fork() is being used. - - handler - a pointer to the unexpected signal handler to - be executed after an unexpected signal has been - detected. If handler is set to DEF_HANDLER, a - default handler is used. This routine should be - declared as function returning an int. - - cleanup - a pointer to a cleanup routine to be executed - by the unexpected signal handler before tst_exit is - called. This parameter is set to NULL if no cleanup - routine is required. An external variable, T_cleanup - is set so that other user-defined handlers have - access to the cleanup routine. This routine should be - declared as returning type void. - -***************************************************************************/ - -#ifndef CRAY -#define _BSD_SIGNALS 1 /* Specify that we are using BSD signal interface */ -#endif - -#include -#include -#include -#include "test.h" - -#define MAXMESG 150 /* size of mesg string sent to tst_res */ - -void (*T_cleanup)(); /* pointer to cleanup function */ - -extern int errno; -static void def_handler(); /* default signal handler */ - -/**************************************************************************** - * tst_sig() : set-up to catch unexpected signals. fork_flag is set to NOFORK - * if SIGCLD is to be an "unexpected signal", otherwise it is set to - * FORK. cleanup points to a cleanup routine to be executed before - * tst_exit is called (cleanup is set to NULL if no cleanup is desired). - * handler is a pointer to the signal handling routine (if handler is - * set to NULL, a default handler is used). - ***************************************************************************/ - -void -tst_sig(int fork_flag, void (*handler)(), void (*cleanup)()) -{ - char mesg[MAXMESG]; /* message buffer for tst_res */ - int sig; - - /* - * save T_cleanup and handler function pointers - */ - T_cleanup = cleanup; /* used by default handler */ - - if (handler == DEF_HANDLER) { - /* use default handler */ - handler = def_handler; - } - - /* - * now loop through all signals and set the handlers - */ - - for (sig = 1; sig < NSIG; sig++) { - /* - * SIGKILL is never unexpected. - * SIGCLD is only unexpected when - * no forking is being done. - * SIGINFO is used for file quotas and should be expected - */ - - switch (sig) { - case SIGKILL: - case SIGSTOP: - case SIGCONT: -#ifdef CRAY - case SIGINFO: - case SIGRECOVERY: /* allow chkpnt/restart */ -#endif /* CRAY */ - -#ifdef SIGSWAP - case SIGSWAP: -#endif /* SIGSWAP */ - -#ifdef SIGCKPT - case SIGCKPT: -#endif -#ifdef SIGRESTART - case SIGRESTART: -#endif - /* - * pthread-private signals SIGPTINTR and SIGPTRESCHED. - * Setting a handler for these signals is disallowed when - * the binary is linked against libpthread. - */ -#ifdef SIGPTINTR - case SIGPTINTR: -#endif /* SIGPTINTR */ -#ifdef SIGPTRESCHED - case SIGPTRESCHED: -#endif /* SIGPTRESCHED */ -#ifdef __CYGWIN__ - case SIGILL: - case SIGTRAP: - case SIGABRT: - case SIGEMT: - case SIGFPE: - case SIGBUS: -#endif - break; - - case SIGCLD: - if ( fork_flag == FORK ) - continue; - - default: - if (signal(sig, handler) == SIG_ERR) { - (void) sprintf(mesg, - "signal() failed for signal %d. error:%d %s.", - sig, errno, strerror(errno)); - tst_resm(TWARN, mesg); - } - break; - } -#ifdef __sgi - /* On irix (07/96), signal() fails when signo is 33 or higher */ - if ( sig+1 >= 33 ) - break; -#endif /* __sgi */ - - } /* endfor */ -} - - - -/**************************************************************************** - * def_handler() : default signal handler that is invoked when - * an unexpected signal is caught. - ***************************************************************************/ - -static void -def_handler(int sig) -{ - char mesg[MAXMESG]; /* holds tst_res message */ - - /* first reset trap for this signal (except SIGCLD - its weird) */ - if ((sig != SIGCLD) && (sig != SIGSTOP) && (sig != SIGCONT)) { - if (signal(sig, def_handler) == SIG_ERR) { - (void) sprintf(mesg, - "def_handler: signal() failed for signal %d. error:%d %s.", - sig, errno, strerror(errno)); - tst_resm(TWARN, mesg); - } - } - - (void) sprintf(mesg, "Unexpected signal %d received.", sig); - - /* - * Break remaining test cases, do any cleanup, then exit - */ - tst_brkm(TBROK, 0, mesg); - - /* now cleanup and exit */ - if (T_cleanup) { - (*T_cleanup)(); - } - - tst_exit(); -} diff --git a/winsup/testsuite/libltp/lib/tst_tmpdir.c b/winsup/testsuite/libltp/lib/tst_tmpdir.c deleted file mode 100644 index cd9d9c8b8..000000000 --- a/winsup/testsuite/libltp/lib/tst_tmpdir.c +++ /dev/null @@ -1,347 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -/********************************************************** - * - * OS Testing - Silicon Graphics, Inc. - * - * FUNCTION NAME : tst_tmpdir, tst_rmdir - * - * FUNCTION TITLE : Create/remove a testing temp dir - * - * SYNOPSIS: - * void tst_tmpdir(); - * void tst_rmdir(); - * - * AUTHOR : Dave Fenner - * - * INITIAL RELEASE : UNICOS 8.0 - * - * DESCRIPTION - * tst_tmpdir() is used to create a unique, temporary testing - * directory, and make it the current working directory. - * tst_rmdir() is used to remove the directory created by - * tst_tmpdir(). - * - * Setting the env variable "TDIRECTORY" will override the creation - * of a new temp dir. The directory specified by TDIRECTORY will - * be used as the temporary directory, and no removal will be done - * in tst_rmdir(). - * - * RETURN VALUE - * Neither tst_tmpdir() or tst_rmdir() has a return value. - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ -#include -#include /* for mkdir() */ -#include /* for mkdir() */ -#include "test.h" -#include "rmobj.h" - -/* - * Define some useful macros. - */ -#define PREFIX_SIZE 4 -#define STRING_SIZE 256 -#define DIR_MODE 0777 /* mode of tmp dir that will be created */ - -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - -/* - * Define function prototypes. - */ -static void tmpdir_cleanup(); - -/* - * Define global variables. - */ -extern char *TCID; /* defined/initialized in main() */ -extern int TST_TOTAL; /* defined/initialized in main() */ -extern char *TESTDIR; /* the directory created; defined in */ - /* tst_res.c */ - -/* - * tst_tmpdir() - Create a unique temporary directory and chdir() to it. - * It expects the caller to have defined/initialized the - * TCID/TST_TOTAL global variables. The TESTDIR global - * variable will be set to the directory that gets used - * as the testing directory. - * - * NOTE: This function must be called BEFORE any activity - * that would require CLEANUP. If tst_tmpdir() fails, it - * cleans up afer itself and calls tst_exit() (i.e. does - * not return). - */ -#undef FN_NAME -#define FN_NAME "tst_tmpdir()" - -void -tst_tmpdir() -{ - char prefix[PREFIX_SIZE]; /* first three characters from TCID */ - int no_cleanup = 0; /* !0 means TDIRECTORY env var was set */ - - /* - * If the TDIRECTORY env variable is not set, a temp dir will be - * created. - */ - if ( (TESTDIR = getenv(TDIRECTORY)) == NULL ) { - /* - * Create a unique name based on the first three characters of the - * TCID. The last byte in "prefix" is for the null. - */ - strncpy(prefix, TCID, PREFIX_SIZE - 1); - prefix[PREFIX_SIZE-1] = '\0'; - if ( (TESTDIR = tempnam(TEMPDIR, prefix)) == NULL ) - tst_brkm(TBROK, tmpdir_cleanup, "%s: tempnam(%s, %s) failed", - FN_NAME, TEMPDIR, prefix); - - /* - * Create the temporary directory. - */ - if ( mkdir(TESTDIR, DIR_MODE) == -1 ) - tst_brkm(TBROK, tmpdir_cleanup, - "%s: mkdir(%s, %#o) failed; errno = %d: %s", - FN_NAME, TESTDIR, DIR_MODE, errno, strerror(errno)); - - /* - * Change the group on this temporary directory to be that of the - * gid of the person running the tests. - */ - if ( chown(TESTDIR, -1, getgid()) == -1 ) - tst_brkm(TBROK, tmpdir_cleanup, - "chown(%s, -1, %d) failed; errno = %d: %s", - TESTDIR, getgid(), errno, strerror(errno)); - } else { - /* - * The TDIRECTORY env. variable is set, so no temp dir is created. - * Also, no clean up will be done via tst_rmdir(). - */ - no_cleanup++; -#if UNIT_TEST - printf("TDIRECTORY env var is set\n"); -#endif - } - -#if UNIT_TEST - printf("TESTDIR = %s\n", TESTDIR); -#endif - - /* - * Change to the temporary directory. If the chdir() fails, issue - * TBROK messages for all test cases, attempt to remove the - * directory (if it was created), and exit. If the removal also - * fails, also issue a TWARN message. - */ - if ( chdir(TESTDIR) == -1 ) { - tst_brkm(TBROK, NULL, "%s: chdir(%s) failed; errno = %d: %s", - FN_NAME, TESTDIR, errno, strerror(errno) ); - - /* Try to remove the directory */ - if ( !no_cleanup && rmdir(TESTDIR) == -1 ) - tst_resm(TWARN, "%s: rmdir(%s) failed; errno = %d: %s", - FN_NAME, TESTDIR, errno, strerror(errno) ); - - tmpdir_cleanup(); - } - -#if UNIT_TEST - printf("CWD is %s\n", getcwd((char *)NULL, PATH_MAX)); -#endif - - /* - * If we made through all this stuff, return. - */ - return; -} /* tst_tmpdir() */ - - -/* - * - * tst_rmdir() - Recursively remove the temporary directory created by - * tst_tmpdir(). This function is intended ONLY as a - * companion to tst_tmpdir(). If the TDIRECTORY - * environment variable is set, no cleanup will be - * attempted. - */ -#undef FN_NAME -#define FN_NAME "tst_rmdir()" - -void -tst_rmdir() -{ - char *errmsg; - char *tdirectory; - char current_dir[PATH_MAX]; /* current working directory */ - char parent_dir[PATH_MAX]; /* directory above TESTDIR */ - char *basename; /* basename of the TESTDIR */ - - /* - * If the TDIRECTORY env variable is set, this indicates that no - * temp dir was created by tst_tmpdir(). Thus no cleanup will be - * necessary. - */ - if ( (tdirectory = getenv(TDIRECTORY)) != NULL ) { -#if UNIT_TEST - printf("\"TDIRECORY\" env variable is set; no cleanup was performed\n"); -#endif - return; - } - - /* - * Check that TESTDIR is not NULL. - */ - if ( TESTDIR == NULL ) { - tst_resm(TWARN, "%s: TESTDIR was NULL; no removal attempted", - FN_NAME); - return; - } - - /* - * Check that the value of TESTDIR is not "*" or "/". These could - * have disastrous effects in a test run by root. - */ - if ( strcmp(TESTDIR, "/") == 0 ) { - tst_resm(TWARN, - "%s: Recursive remove of root directory not attempted", - FN_NAME); - return; - } - - if ( strchr(TESTDIR, '*') != NULL ) { - tst_resm(TWARN, "%s: Recursive remove of '*' not attempted", - FN_NAME); - return; - } - - /* - * Get the directory name of TESTDIR. If TESTDIR is a relative path, - * get full path. - */ - if ( TESTDIR[0] != '/' ) { - if ( getcwd(current_dir,PATH_MAX) == NULL ) - strcpy(parent_dir, TESTDIR); - else - sprintf(parent_dir, "%s/%s", current_dir, TESTDIR); - } else { - strcpy(parent_dir, TESTDIR); - } - if ( (basename = strrchr(parent_dir, '/')) != NULL ) { - *basename='\0'; /* terminate at end of parent_dir */ - } - - /* - * Change directory to parent_dir (The dir above TESTDIR). - */ - if ( chdir(parent_dir) != 0 ) - tst_resm(TWARN, - "%s: chdir(%s) failed; errno = %d: %s\nAttempting to remove temp dir anyway", - FN_NAME, parent_dir, errno, strerror(errno)); - - /* - * Attempt to remove the "TESTDIR" directory, using rmobj(). - */ - if ( rmobj(TESTDIR, &errmsg) == -1 ) - tst_resm(TWARN, "%s: rmobj(%s) failed: %s", - FN_NAME, TESTDIR, errmsg); - - return; -} /* tst_rmdir() */ - - -/* - * tmpdir_cleanup() - This function is used when tst_tmpdir() - * encounters an error, and must cleanup and exit. - * It prints a warning message via tst_resm(), and - * then calls tst_exit(). - */ -#undef FN_NAME -#define FN_NAME "tst_tmpdir()" - -static void -tmpdir_cleanup() -{ - /* - * Print a warning message and call tst_exit() to exit the test. - */ - tst_resm(TWARN, "%s: No user cleanup function called before exiting", - FN_NAME); - tst_exit(); -} /* tmpdir_cleanup() */ - - -#ifdef UNIT_TEST -/**************************************************************************** - * Unit test code: Takes input from stdin and can make the following - * calls: tst_tmpdir(), tst_rmdir(). - ****************************************************************************/ -int TST_TOTAL = 10; -char *TCID = "TESTTCID"; - -main() -{ - int option; - char *chrptr; - - printf("UNIT TEST of tst_tmpdir.c. Options to try:\n\ - -1 : call tst_exit()\n\ - 0 : call tst_tmpdir()\n\ - 1 : call tst_rmdir()\n\n"); - - while ( 1 ) { - printf("Enter options (-1, 0, 1): "); - (void) scanf("%d%c", &option, &chrptr); - - switch ( option ) { - case -1: - tst_exit(); - break; - - case 0: - tst_tmpdir(); - break; - - case 1: - tst_rmdir(); - break; - } /* switch() */ - } /* while() */ -} -#endif /* UNIT_TEST */ diff --git a/winsup/testsuite/libltp/lib/write_log.c b/winsup/testsuite/libltp/lib/write_log.c deleted file mode 100644 index 316dfe79b..000000000 --- a/winsup/testsuite/libltp/lib/write_log.c +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* - * This module contains code for logging writes to files, and for - * perusing the resultant logfile. The main intent of all this is - * to provide a 'write history' of a file which can be examined to - * judge the state of a file (ie. whether it is corrupted or not) based - * on the write activity. - * - * The main abstractions available to the user are the wlog_file, and - * the wlog_rec. A wlog_file is a handle encapsulating a write logfile. - * It is initialized with the wlog_open() function. This handle is - * then passed to the various wlog_xxx() functions to provide transparent - * access to the write logfile. - * - * The wlog_rec datatype is a structure which contains all the information - * about a file write. Examples include the file name, offset, length, - * pattern, etc. In addition there is a bit which is cleared/set based - * on whether or not the write has been confirmed as complete. This - * allows the write logfile to contain information on writes which have - * been initiated, but not yet completed (as in async io). - * - * There is also a function to scan a write logfile in reverse order. - * - * NOTE: For target file analysis based on a write logfile, the - * assumption is made that the file being written to is - * locked from simultaneous access, so that the order of - * write completion is predictable. This is an issue when - * more than 1 process is trying to write data to the same - * target file simultaneously. - * - * The history file created is a collection of variable length records - * described by scruct wlog_rec_disk in write_log.h. See that module for - * the layout of the data on disk. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "write_log.h" - -#ifndef BSIZE -#ifdef linux -#define BSIZE DEV_BSIZE -#else -#ifdef __CYGWIN__ -#define BSIZE S_BLKSIZE -#else -#define BSIZE BBSIZE -#endif -#endif -#endif - -#ifndef PATH_MAX -#define PATH_MAX 255 -/*#define PATH_MAX pathconf("/", _PC_PATH_MAX)*/ -#endif - -char Wlog_Error_String[256]; - -#if __STDC__ -static int wlog_rec_pack(struct wlog_rec *wrec, char *buf, int flag); -static int wlog_rec_unpack(struct wlog_rec *wrec, char *buf); -#else -static int wlog_rec_pack(); -static int wlog_rec_unpack(); -#endif - -/* - * Initialize a write logfile. wfile is a wlog_file structure that has - * the w_file field filled in. The rest of the information in the - * structure is initialized by the routine. - * - * The trunc flag is used to indicate whether or not the logfile should - * be truncated if it currently exists. If it is non-zero, the file will - * be truncated, otherwise it will be appended to. - * - * The mode argument is the [absolute] mode which the file will be - * given if it does not exist. This mode is not affected by your process - * umask. - */ - -int -wlog_open(wfile, trunc, mode) -struct wlog_file *wfile; -int trunc; -int mode; -{ - int omask, oflags; - - if (trunc) - trunc = O_TRUNC; - - omask = umask(0); - - /* - * Open 1 file descriptor as O_APPEND - */ - - oflags = O_WRONLY | O_APPEND | O_CREAT | trunc; - wfile->w_afd = - open(wfile->w_file, oflags, mode); - umask(omask); - - if (wfile->w_afd == -1) { - sprintf(Wlog_Error_String, - "Could not open write_log - open(%s, %#o, %#o) failed: %s\n", - wfile->w_file, oflags, mode, strerror(errno)); - return -1; - } - - /* - * Open the next fd as a random access descriptor - */ - - oflags = O_RDWR; - if ((wfile->w_rfd = open(wfile->w_file, oflags)) == -1) { - sprintf(Wlog_Error_String, - "Could not open write log - open(%s, %#o) failed: %s\n", - wfile->w_file, oflags, strerror(errno)); - close(wfile->w_afd); - wfile->w_afd = -1; - return -1; - } - - return 0; -} - -/* - * Release all resources associated with a wlog_file structure allocated - * with the wlog_open() call. - */ - -int -wlog_close(wfile) -struct wlog_file *wfile; -{ - close(wfile->w_afd); - close(wfile->w_rfd); - return 0; -} - -/* - * Write a wlog_rec structure to a write logfile. Offset is used to - * control where the record will be written. If offset is < 0, the - * record will be appended to the end of the logfile. Otherwise, the - * record which exists at the indicated offset will be overlayed. This - * is so that we can record writes which are outstanding (with the w_done - * bit in wrec cleared), but not completed, and then later update the - * logfile when the write request completes (as with async io). When - * offset is >= 0, only the fixed length portion of the record is - * rewritten. See text in write_log.h for details on the format of an - * on-disk record. - * - * The return value of the function is the byte offset in the logfile - * where the record begins. - * - * Note: It is the callers responsibility to make sure that the offset - * parameter 'points' to a valid record location when a record is to be - * overlayed. This is guarenteed by saving the return value of a previous - * call to wlog_record_write() which wrote the record to be overlayed. - * - * Note2: The on-disk version of the wlog_rec is MUCH different than - * the user version. Don't expect to od the logfile and see data formatted - * as it is in the wlog_rec structure. Considerable data packing takes - * place before the record is written. - */ - -int -wlog_record_write(wfile, wrec, offset) -struct wlog_file *wfile; -struct wlog_rec *wrec; -long offset; -{ - int reclen; - char wbuf[WLOG_REC_MAX_SIZE + 2]; - - /* - * If offset is -1, we append the record at the end of file - * - * Otherwise, we overlay wrec at the file offset indicated and assume - * that the caller passed us the correct offset. We do not record the - * fname in this case. - */ - - reclen = wlog_rec_pack(wrec, wbuf, (offset < 0)); - - if (offset < 0) { - /* - * Since we're writing a complete new record, we must also tack - * its length onto the end so that wlog_scan_backward() will work. - * Length is asumed to fit into 2 bytes. - */ - - wbuf[reclen] = reclen / 256; - wbuf[reclen+1] = reclen % 256; - reclen += 2; - - write(wfile->w_afd, wbuf, reclen); - offset = lseek(wfile->w_afd, 0, SEEK_CUR) - reclen; - } else { - lseek(wfile->w_rfd, offset, SEEK_SET); - write(wfile->w_rfd, wbuf, reclen); - } - - return offset; -} - -/* - * Function to scan a logfile in reverse order. Wfile is a valid - * wlog_file structure initialized by wlog_open(). nrecs is the number - * of records to scan (all records are scanned if nrecs is 0). func is - * a user-supplied function to call for each record found. The function - * will be passed a single parameter - a wlog_rec structure . - */ - -int -wlog_scan_backward(wfile, nrecs, func, data) -struct wlog_file *wfile; -int nrecs; -int (*func)(); -long data; -{ - int fd, leftover, nbytes, offset, recnum, reclen, rval; - char buf[BSIZE*32], *bufend, *cp, *bufstart; - char albuf[WLOG_REC_MAX_SIZE]; - struct wlog_rec wrec; - - fd = wfile->w_rfd; - - /* - * Move to EOF. offset will always hold the current file offset - */ - - lseek(fd, 0, SEEK_END); - offset = lseek(fd, 0, SEEK_CUR); - - bufend = buf + sizeof(buf); - bufstart = buf; - - recnum = 0; - leftover = 0; - while ((!nrecs || recnum < nrecs) && offset > 0) { - /* - * Check for beginning of file - if there aren't enough bytes - * remaining to fill buf, adjust bufstart. - */ - - if (offset + leftover < sizeof(buf)) { - bufstart = bufend - (offset + leftover); - offset = 0; - } else { - offset -= sizeof(buf) - leftover; - } - - /* - * Move to the proper file offset, and read into buf - */ - - lseek(fd, offset, SEEK_SET); - nbytes = read(fd, bufstart, bufend - bufstart - leftover); - - if (nbytes == -1) { - sprintf(Wlog_Error_String, - "Could not read history file at offset %d - read(%d, %#o, %d) failed: %s\n", - offset, fd, (int)bufstart, - bufend - bufstart - leftover, strerror(errno)); - return -1; - } - - cp = bufend; - leftover = 0; - - while (cp >= bufstart) { - - /* - * If cp-bufstart is not large enough to hold a piece - * of record length information, copy remainder to end - * of buf and continue reading the file. - */ - - if (cp - bufstart < 2) { - leftover = cp - bufstart; - memcpy(bufend - leftover, bufstart, leftover); - break; - } - - /* - * Extract the record length. We must do it this way - * instead of casting cp to an int because cp might - * not be word aligned. - */ - - reclen = (*(cp-2) * 256) + *(cp -1); - - /* - * If cp-bufstart isn't large enough to hold a - * complete record, plus the length information, copy - * the leftover bytes to the end of buf and continue - * reading. - */ - - if (cp - bufstart < reclen + 2) { - leftover = cp - bufstart; - memcpy(bufend - leftover, bufstart, leftover); - break; - } - - /* - * Adjust cp to point at the start of the record. - * Copy the record into wbuf so that it is word - * aligned and pass the record to the user supplied - * function. - */ - - cp -= reclen + 2; - memcpy(albuf, cp, reclen); - - wlog_rec_unpack(&wrec, albuf); - - /* - * Call the user supplied function - - * stop if instructed to. - */ - - if ((rval = (*func)(&wrec, data)) == WLOG_STOP_SCAN) { - break; - } - - recnum++; - - if (nrecs && recnum >= nrecs) - break; - } - } - - return 0; -} - -/* - * The following 2 routines are used to pack and unpack the user - * visible wlog_rec structure to/from a character buffer which is - * stored or read from the write logfile. Any changes to either of - * these routines must be reflected in the other. - */ - -static int -wlog_rec_pack(wrec, buf, flag) -struct wlog_rec *wrec; -char *buf; -int flag; -{ - char *file, *host, *pattern; - struct wlog_rec_disk *wrecd; - - wrecd = (struct wlog_rec_disk *)buf; - - wrecd->w_pid = (uint)wrec->w_pid; - wrecd->w_offset = (uint)wrec->w_offset; - wrecd->w_nbytes = (uint)wrec->w_nbytes; - wrecd->w_oflags = (uint)wrec->w_oflags; - wrecd->w_done = (uint)wrec->w_done; - wrecd->w_async = (uint)wrec->w_async; - - wrecd->w_pathlen = (wrec->w_pathlen > 0) ? (uint)wrec->w_pathlen : 0; - wrecd->w_hostlen = (wrec->w_hostlen > 0) ? (uint)wrec->w_hostlen : 0; - wrecd->w_patternlen = (wrec->w_patternlen > 0) ? (uint)wrec->w_patternlen : 0; - - /* - * If flag is true, we should also pack the variable length parts - * of the wlog_rec. By default, we only pack the fixed length - * parts. - */ - - if (flag) { - file = buf + sizeof(struct wlog_rec_disk); - host = file + wrecd->w_pathlen; - pattern = host + wrecd->w_hostlen; - - if (wrecd->w_pathlen > 0) - memcpy(file, wrec->w_path, wrecd->w_pathlen); - - if (wrecd->w_hostlen > 0) - memcpy(host, wrec->w_host, wrecd->w_hostlen); - - if (wrecd->w_patternlen > 0) - memcpy(pattern, wrec->w_pattern, wrecd->w_patternlen); - - return (sizeof(struct wlog_rec_disk) + - wrecd->w_pathlen + wrecd->w_hostlen + wrecd->w_patternlen); - } else { - return sizeof(struct wlog_rec_disk); - } -} - -static int -wlog_rec_unpack(wrec, buf) -struct wlog_rec *wrec; -char *buf; -{ - char *file, *host, *pattern; - struct wlog_rec_disk *wrecd; - - bzero((char *)wrec, sizeof(struct wlog_rec)); - wrecd = (struct wlog_rec_disk *)buf; - - wrec->w_pid = wrecd->w_pid; - wrec->w_offset = wrecd->w_offset; - wrec->w_nbytes = wrecd->w_nbytes; - wrec->w_oflags = wrecd->w_oflags; - wrec->w_hostlen = wrecd->w_hostlen; - wrec->w_pathlen = wrecd->w_pathlen; - wrec->w_patternlen = wrecd->w_patternlen; - wrec->w_done = wrecd->w_done; - wrec->w_async = wrecd->w_async; - - if (wrec->w_pathlen > 0) { - file = buf + sizeof(struct wlog_rec_disk); - memcpy(wrec->w_path, file, wrec->w_pathlen); - } - - if (wrec->w_hostlen > 0) { - host = buf + sizeof(struct wlog_rec_disk) + wrec->w_pathlen; - memcpy(wrec->w_host, host, wrec->w_hostlen); - } - - if (wrec->w_patternlen > 0) { - pattern = buf + sizeof(struct wlog_rec_disk) + - wrec->w_pathlen + wrec->w_hostlen; - memcpy(wrec->w_pattern, pattern, wrec->w_patternlen); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/checksignal.c b/winsup/testsuite/winsup.api/checksignal.c deleted file mode 100644 index 47dc2f6a0..000000000 --- a/winsup/testsuite/winsup.api/checksignal.c +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID = "checksignal"; /* Test program identifier. */ -int TST_TOTAL = 3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -void -sig_handler (int signo) -{ - errno = EINVAL; -} - -int -main () -{ - int n, ret; - int fds[2]; - char buf[10]; - struct sigaction act; - int i; - - Tst_count = 0; - - /* Reset SA_RESTART flag. */ - while ((ret = sigaction (SIGALRM, NULL, &act)) == EINTR) - ; - if (ret) - tst_brk (TBROK, NULL, NULL, "Get signal action structure"); - act.sa_flags &= ~SA_RESTART; - while ((ret = sigaction (SIGALRM, &act, NULL)) == EINTR) - ; - if (ret) - tst_brk (TBROK, NULL, NULL, "Reset SA_RESTART"); - - for (i = 0; i < 2; i++) - { - if (pipe (fds) < 0) - tst_brk (TBROK, NULL, NULL, "Create pipe"); - /* Set signal handler using signal(2) call... */ - if (signal (SIGALRM, sig_handler) < 0) - tst_brk (TBROK, NULL, NULL, "Call signal() to install signal handler"); - /* ...and check if signal(2) sets SA_RESTART again. */ - while ((ret = sigaction (SIGALRM, NULL, &act)) == EINTR) - ; - if (ret) - tst_brk (TBROK, NULL, NULL, "Get signal action structure"); - tst_resm (act.sa_flags & SA_RESTART ? TPASS : TFAIL, - "signal() sets SA_RESTART"); - - const char *msg1, *msg2; - if (i == 1) - { - siginterrupt (SIGALRM, 1); - msg1 = "Reset SA_RESTART via siginterrupt"; - msg2 = "Set EINTR on interrupted read() call via siginterrupt"; - } - else - { - /* Reset SA_RESTART flag again. */ - act.sa_handler = sig_handler; - act.sa_flags &= ~SA_RESTART; - while ((ret = sigaction (SIGALRM, &act, NULL)) == EINTR) - ; - msg1 = "Reset SA_RESTART via sigaction"; - msg2 = "Set EINTR on interrupted read() call via sigaction"; - } - if (ret) - tst_brk (TBROK, NULL, NULL, msg1); - - /* Start timer to force a SIGALRM. */ - alarm (1); - - /* Call read(2) to check if the EINTR errno is correctly preserved, - even if the signal handler routine changes errno. */ - n = read(fds[0], buf, 10); - tst_resm (n < 0 && errno == EINTR ? TPASS : TFAIL, msg2); - close (fds[0]); - close (fds[1]); - } - - /* Check if another errno is correctly returned (here EBADF). */ - n = read(fds[0], buf, 10); - tst_resm (n < 0 && errno == EBADF ? TPASS : TFAIL, - "Set EBADF on closed file descriptor"); - - tst_exit (); -} diff --git a/winsup/testsuite/winsup.api/crlf.c b/winsup/testsuite/winsup.api/crlf.c deleted file mode 100644 index ea79122f0..000000000 --- a/winsup/testsuite/winsup.api/crlf.c +++ /dev/null @@ -1,527 +0,0 @@ -typedef enum { - Nop=100000, /* ; do nothing */ - New1, /* ; reset and begin new test */ - Open, /* ; open test file */ - Read, /* [askfor] [get] ; read bytes into buffer */ - Write, /* [expect] [bytestream] ; write to file (expect 0 = ignore)*/ - Compare, /* [bytestream] ; compare buffer to given bytes */ - Verify, /* [bytestream] ; compare file to given bytes */ - Seek, /* [offset] [whence] ; seek in file */ - Tell, /* [offset] ; compare file positions */ - BufSize, /* [size] ; change the stdio buffer size */ - Flush, /* ; flush the stdio stream */ - Text, /* ; switch file to text mode */ - Binary, /* ; switch file to binary mode */ - Rep, /* [count] ; repeat 'R' bytes (used in bytestream) */ - Fill, /* [posn] ; fill 'F' until given byte position */ - Start, /* ; for Seek */ - Current, /* ; for Seek */ - End, /* ; for Seek, or end of byte stream */ - Max } Opcode; - -#define New New1,__LINE__ - -/* Byte streams are just inserted into the command stream, and must - end in an End code. */ - -int commands[] = { -#ifndef __DJGPP__ - New, - Write, 1605, Rep, 1600, 'h', 'e', 'l', 'l', 'o', End, - Tell, 1605, - - Open, - BufSize, 16, - Read, 1605, 1605, - Compare, Rep, 1600, 'h', 'e', 'l', 'l', 'o', End, - Tell, 1605, - Flush, - Tell, 1605, - Seek, 1000, Start, - Tell, 1000, - - New, - Text, - Write, 2, 'x', 10, End, - Verify, 'x', 13, 10, End, - - New, - Binary, - Write, 2, 'x', 10, End, - Verify, 'x', 10, End, - - BufSize, 16, - - New, - Binary, - Write, 0, Fill, 15, 13, 10, 'x', End, - Text, Open, - Read, 17, 17, - Compare, Fill, 15, 10, 'x', End, - Tell, 18, - - New, - Binary, - Write, 0, Fill, 14, 13, 10, 'x', End, - Text, Open, - Read, 16, 16, - Compare, Fill, 14, 10, 'x', End, - Tell, 17, - - New, - Binary, - Write, 0, 13, 10, 'a', 'b', End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 3, - - New, - Binary, - Write, 0, 10, 'a', 'b', End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 2, - - New, - Binary, - Write, 0, 13, 'a', 'b', End, - Text, Open, - Read, 2, 2, - Compare, 13, 'a', End, - Tell, 2, - - New, - Binary, - Write, 0, 13, 13, 10, 'a', End, - Text, Open, - Read, 2, 2, - Compare, 13, 10, End, - Tell, 3, - - New, - Binary, - Write, 0, 13, 10, 'a', 13, End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 3, - - New, - Binary, - Write, 0, 13, 10, 'a', 10, End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 3, - - New, - Binary, - Write, 0, 13, 13, 13, 10, 'a', 10, 10, 10, End, - Text, Open, - Read, 4, 4, - Compare, 13, 13, 10, 'a', End, - Tell, 5, -#endif - - New, - Binary, - Write, 0, 13, 13, 13, 10, 'a', 'b', 13, 10, 13, 10, End, - Text, Open, - Read, 4, 4, - Compare, 13, 13, 10, 'a', End, - Tell, 5, - - }; - -/*==========================================================================*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef O_BINARY -#define O_BINARY 0 -#endif -#ifndef O_TEXT -#define O_TEXT 0 -#endif - -int errors = 0; - -#define num_commands (int)(sizeof(commands)/sizeof(commands[0])) - -int pc; -int askfor, get, expect, count, posn, whence, size; - -typedef struct { - unsigned char *bytes; - int max, count; -} Buffer; - -Buffer rw_buf={0,0,0}, cmp_buf={0,0,0}, vfy_buf={0,0,0}; - -void -expand_buf(Buffer *buf, int len) -{ - if (buf->max < len) - { - buf->max = len+20; - if (buf->bytes) - buf->bytes = (unsigned char *)realloc(buf->bytes, buf->max); - else - buf->bytes = (unsigned char *)malloc(buf->max); - } -} - -void -get_bytestream(Buffer *buf) -{ - int tpc; - int len = 0, rep, byte; - unsigned char *bp; - - for (tpc = pc+1; tpc < num_commands && commands[tpc] != End; tpc++) - { - switch (commands[tpc]) - { - case Rep: - len += commands[tpc+1]; - tpc ++; - break; - case Fill: - if (len < commands[tpc+1]) - len = commands[tpc+1]; - tpc ++; - break; - default: - len ++; - break; - } - } - - expand_buf(buf, len); - - len = 0; - bp = buf->bytes; - - for (tpc = pc+1; tpc < num_commands && commands[tpc] != End; tpc++) - { - switch (commands[tpc]) - { - case Rep: - rep = commands[++tpc]; - byte = 'R'; - while (rep--) *bp++ = byte; - break; - case Fill: - rep = commands[++tpc]; - byte = 'F'; - while (bp-buf->bytes < rep) *bp++ = byte; - break; - default: - *bp++ = commands[tpc]; - break; - } - } - buf->count = bp - buf->bytes; - pc = tpc; -} - -char dataname[] = "crlf.dat"; - -int verbose=0; -void -v(char *fmt, ...) -{ - va_list ap; - if (!verbose) return; - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); - printf("\n"); -} - -void -vp(const char *fmt, ...) -{ - va_list ap; - if (!verbose) return; - printf("%08x: ", pc); - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); - printf("\n"); -} - -void -errorq(int use_errno, const char *fmt, ...) -{ - va_list ap; - fprintf(stderr, "crlf: Error at pc=%d: ", pc); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "\n"); - if (use_errno) - perror("The error was"); - errors++; -} - -void -error(int use_errno, const char *fmt, ...) -{ - va_list ap; - fprintf(stderr, "crlf: Error at pc=%d: ", pc); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "\n"); - if (use_errno) - perror("The error was"); - fprintf(stderr, "FAIL\n"); - exit(1); -} - -void -display_buf(const char *which, Buffer *buf, int ofs) -{ - int i; - fprintf(stderr, "%s %04x:", which, ofs); - for (i=0; i<8; i++) - if (i+ofs < buf->count) - { - unsigned char b = buf->bytes[i+ofs]; - fprintf(stderr, " %02x", b); - if (isgraph(b)) - fprintf(stderr, " %c ", b); - else - fprintf(stderr, " . "/*, b*/); - } - fprintf(stderr, "\n"); -} - -void -compare_bufs(const char *name, Buffer *actual, Buffer *expected) -{ - int i, got_one=0; - for (i=0; icount && icount; i++) - if (actual->bytes[i] != expected->bytes[i]) - { - errorq(0, "%s: byte mismatch at offset 0x%x", name, i); - got_one = 1; - break; - } - if (!got_one) - { - if (actual->count < expected->count) - errorq(0, "%s: too few bytes (0x%x vs 0x%x)", name, - actual->count, expected->count); - else if (actual->count > expected->count) - errorq(0, "%s: too many bytes (0x%x vs 0x%x)", name, - actual->count, expected->count); - else - return; - } - - i -= 4; - if (i<0) i = 0; - display_buf("Actual ", actual, i); - display_buf("Expected", expected, i); -} - -int -main(int argc, char **argv) -{ - const char *readmode = "rb"; - const char *writemode = "wb"; - FILE *file = 0; - int i; - struct stat st; - const char *str = ""; - - while (argc > 1 && argv[1][0] == '-') - { - if (strcmp(argv[1], "-v") == 0) - verbose++; - argc--; - argv++; - } - - size = 0; - - for (pc=0; pc - - This software is a copyrighted work licensed under the terms of the - Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. - - Note that dynamically linking to cygwin1.dll automatically places your code - under the GPL unless you purchase a Cygwin Contract with Red Hat, Inc. - See http://www.redhat.com/software/cygwin/ for more information. - - cygload demonstrates how to dynamically load cygwin1.dll. The default - build uses MinGW to compile it; the Makefile also shows how to build - it using the Microsoft compiler. - - By default, the program will silently test basic functionality: - * Making space on the stack for cygtls - * Loading and initializing cygwin1.dll - * Path translation - * Error handling - * Signal handling - - Options for this program: - -v Verbose output. Normal operation is entirely silent, - save for errors. - -testinterrupts Pauses the program for 30 seconds so you can demonstrate - that it handles ^C properly. - -cygwin Name of DLL to load. Defaults to "cygwin1.dll". */ - -#include "cygload.h" -#include -#include -#include -#include // for ENOENT -#include -#include - -using std::cout; -using std::cerr; -using std::endl; -using std::string; - -cygwin::padding *cygwin::padding::_main = NULL; -DWORD cygwin::padding::_mainTID = 0; - -// A few cygwin constants. -static const int SIGHUP = 1; -static const int SIGINT = 2; -static const int SIGTERM = 15; // Cygwin won't deliver this one to us; - // expect unadorned "kill" to just kill - // your process. -static const int SIGSTOP = 17; // Cygwin insists on delivering SIGSTOP to - // the main thread. If your main thread - // is not interruptible, you'll miss the - // signal and ignore the request to suspend. -static const int SIGTSTP = 18; // ^Z on a tty. -static const int SIGCONT = 19; // Resume a stopped process. -static const int SIGUSR1 = 30; -static const int SIGUSR2 = 31; - -// Using *out instead of cout. In verbose mode, out == &cout. -static std::ostream *out = NULL; - -cygwin::padding::padding () -{ - _main = this; - _mainTID = GetCurrentThreadId (); - - _end = _padding + sizeof (_padding); - char *stackbase; -#ifdef __GNUC__ - __asm__ ( - "movl %%fs:4, %0" - :"=r"(stackbase) - ); -#else - __asm - { - mov eax, fs:[4]; - mov stackbase, eax; - } -#endif - _stackbase = stackbase; - - // We've gotten as close as we can to the top of the stack. Even - // subverting the entry point, though, still doesn't get us there-- I'm - // getting 64 bytes in use before the entry point. So we back up the data - // there and restore it when the destructor is called: - if ((_stackbase - _end) != 0) - { - size_t delta = (_stackbase - _end); - - _backup.resize (delta); - - memcpy (&(_backup[0]), _end, delta); - } -} - -cygwin::padding::~padding () -{ - _main = NULL; - - if (_backup.size ()) - { - memcpy (_end, &(_backup[0]), _backup.size ()); - } -} - -void -cygwin::padding::check () -{ - if (_main == NULL) - throw std::runtime_error ("No padding declared!"); - if (_mainTID != GetCurrentThreadId ()) - throw std::runtime_error ("You need to initialize cygwin::connector " - "in the same thread in which you declared the " - "padding."); - - if (_main->_backup.size ()) - *out << "Warning! Stack base is " - << static_cast(_main->_stackbase) - << ". padding ends at " << static_cast(_main->_end) - << ". Delta is " << (_main->_stackbase - _main->_end) - << ". Stack variables could be overwritten!" << endl; -} - -cygwin::connector::connector (const char *dll) -{ - // This will throw if padding is not in place. - padding::check (); - - *out << "Loading " << dll << "..." << endl; - - // This should call init.cc:dll_entry() with DLL_PROCESS_ATTACH, - // which calls dll_crt0_0(). - if ((_library = LoadLibrary (dll)) == NULL) - throw windows_error ("LoadLibrary", dll); - - *out << "Initializing cygwin..." << endl; - - // This calls dcrt0.cc:cygwin_dll_init(), which calls dll_crt0_1(), - // which will, among other things: - // * spawn the cygwin signal handling thread from sigproc_init() - // * initialize the thread-local storage for this thread and overwrite - // the first 4K of the stack - void (*cyginit) (); - get_symbol ("cygwin_dll_init", cyginit); - (*cyginit) (); - - *out << "Loading symbols..." << endl; - - // Pick up the function pointers for the basic infrastructure. - get_symbol ("__errno", _errno); - get_symbol ("strerror", _strerror); - get_symbol ("cygwin_conv_to_full_posix_path", _conv_to_full_posix_path); - get_symbol ("cygwin_conv_to_full_win32_path", _conv_to_full_win32_path); - - // Note that you need to be running an interruptible cygwin function if - // you want to receive signals. You can use the standard signal() - // mechanism if you're willing to have your main thread spend all its time - // in interruptible cygwin functions like sleep(). Christopher Faylor - // cautions that this solution "could be slightly racy": if a second - // signal comes in before the first one is done processing, the thread - // won't be back in sigwait() to catch it. - *out << "Spawning signal handling thread..." << endl; - - _waiting_for_signals = true; - _signal_thread_done = false; - InitializeCriticalSection (&_thread_mutex); - - DWORD tid; - - _signal_thread = CreateThread (NULL, // Default security. - 32768, // Adjust the stack size as - // appropriate for what your signal - // handler needs in order to run, and - // then add 4K for cygtls. - &signal_thread, // Function to call - this, // Context - 0, // Flags - &tid); // Thread ID - - if (_signal_thread == NULL) - throw windows_error ("CreateThread", "signal_thread"); -} - -cygwin::connector::~connector () -{ - try - { - // First, shut down signal handling. - int (*raze) (int); - int (*pthread_join) (void *, void **); - - get_symbol ("raise", raze); - get_symbol ("pthread_join", pthread_join); - - // Tell the listener to shut down... - _waiting_for_signals = false; - int err = 0; - EnterCriticalSection (&_thread_mutex); - if (!_signal_thread_done) - err = raze (SIGUSR2); - LeaveCriticalSection (&_thread_mutex); - if (err) - cerr << error (this, "raise", "SIGUSR2").what () << endl; - // ...and get the thread to join. - if (!CloseHandle (_signal_thread)) - throw windows_error ("CloseHandle", "signal_thread"); - - // This should call init.cc:dll_entry() with DLL_PROCESS_DETACH. - if (!FreeLibrary (_library)) - throw windows_error ("FreeLibrary", "cygwin1.dll"); - } - catch (std::exception &x) - { - cerr << x.what () << endl; - } -} - -DWORD WINAPI -cygwin::connector::signal_thread (void *param) -{ - connector *that = reinterpret_cast < connector * > (param); - - try - { - that->await_signal (); - } - catch (std::exception &x) - { - cerr << "signal_thread caught " << x.what () << endl; - return 0; - } - return 0; -} - -void -cygwin::connector::await_signal () -{ - // Wait for signals. - unsigned long sigset[32]; - int sig; - int (*empty) (void *); - int (*add) (void *, int); - int (*wait) (void *, int *); - - get_symbol ("sigemptyset", empty); - get_symbol ("sigaddset", add); - get_symbol ("sigwait", wait); - - empty (sigset); - add (sigset, SIGHUP); - add (sigset, SIGINT); -// add (sigset, SIGSTOP); -// add (sigset, SIGTSTP); // I can't get this to suspend properly, so - // I'll leave it up to chance that the main - // thread is interruptible. - add (sigset, SIGUSR1); - add (sigset, SIGUSR2); - - while (_waiting_for_signals) - { - int err = wait (sigset, &sig); - if (err) - cerr << error (this, "sigwait").what () << endl; - else - *out << "Received signal " << sig << "." << endl; - switch (sig) - { - case SIGUSR2: - if (!_waiting_for_signals) - { - // SIGUSR2 is how ~connector wakes this thread - goto done; - } - break; - default: - break; - } - handle_signals (sig); - } -done: - EnterCriticalSection (&_thread_mutex); - _signal_thread_done = true; - LeaveCriticalSection (&_thread_mutex); - - *out << "await_signal done." << endl; -} - -cygwin::connector::signal_handler * -cygwin::connector::set_handler (int signal, signal_handler *handler) -{ - signal_handler *retval = _signal_handlers[signal]; - - if (handler == NULL) - _signal_handlers.erase (signal); - else - _signal_handlers[signal] = handler; - - return retval; -} - -void -cygwin::connector::handle_signals (int sig) -{ - callback_list::iterator h = _signal_handlers.find (sig); - - if (h != _signal_handlers.end ()) - { - try - { - signal_handler *handler = h->second; - (*handler) (sig); - return; - } - catch (std::exception &x) - { - cerr << "cygwin::connector::handle_signals caught " - << x.what () << "!" << endl; - return; - } - } - - cerr << "No handler for signal " << sig << "!" << endl; -} - -int -cygwin::connector::err_no () const -{ - int *e = (*_errno) (); - if (e == NULL) - { - return -1; - } - return *e; -} - -string -cygwin::connector::str_error (int err_no) const -{ - string retval; - - const char *s = (*_strerror) (err_no); - if (s != NULL) - { - retval = s; - } - else - { - std::ostringstream o; - o << "Unexpected errno " << err_no; - retval = o.str (); - } - - return retval; -} - -string -cygwin::connector::unix_path (const string &windows) const -{ - char buf[MAX_PATH]; - - _conv_to_full_posix_path (windows.c_str (), buf); - - return string (buf); -} - -string -cygwin::connector::win_path (const string &unix) const -{ - char buf[MAX_PATH]; - - _conv_to_full_win32_path (unix.c_str (), buf); - - return string (buf); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -string -cygwin::error::format (cygwin::connector *c, - int err_no, const char *message, const char *detail) -{ - std::ostringstream ret; - - ret << message; - if (detail) - { - ret << "(" << detail << ")"; - } - ret << ": " << c->str_error (err_no); - - return ret.str (); -} - -string -windows_error::format (DWORD error, const char *message, const char *detail) -{ - std::ostringstream ret; - char buf[512]; - DWORD bytes; - - ret << message; - if (detail) - ret << "(" << detail << ")"; - ret << ": "; - - bytes = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, 0, error, - MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), - buf, sizeof (buf), 0); - - if (bytes == 0) - ret << "Unexpected Windows error " << error; - else - { - // Remove trailing whitespace - char *p = buf + bytes - 1; - while (isspace (*p)) - *p-- = '\0'; - ret << buf << " (" << error << ")"; - } - - return ret.str (); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern "C" int mainCRTStartup (); - -// This just pushes 4K onto the stack, backs up the original stack, and -// jumps into the regular startup code. This avoids having to worry about -// backing up argc and argv. -extern "C" int __stdcall -cygloadCRTStartup () -{ - cygwin::padding padding; - return mainCRTStartup (); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -static void -hangup (int sig) -{ - cout << "Hangup (" << sig << ")." << endl; -} - -static void -interrupt (int sig) -{ - cerr << "Interrupt (" << sig << ")!" << endl; - exit (0); -} - -static int caught = false; - -static void -catch_signal (int) -{ - *out << "Signals are working." << endl; - caught = true; -} - -int -main (int argc, char *argv[]) -{ - // If you do not want to use cygloadCRTStartup() as an entry point, - // uncomment this line, but be sure to have *everything* you want - // from the stack below it backed up before you call the - // constructor for cygwin::connector. - //cygwin::padding padding; - - std::ostringstream output; - bool verbose = false, testinterrupts = false; - const char *dll = "cygwin1.dll"; - - out = &output; - - for (int i = 1; i < argc; ++i) - { - string arg = string (argv[i]); - - if (arg == "-v") - { - verbose = true; - out = &cout; - } - else if (arg == "-testinterrupts") - testinterrupts = true; - else if (arg == "-cygwin") - { - if (i+1 >= argc) - { - cerr << "Need to supply an argument with -cygwin." << endl; - return 255; - } - dll = argv[++i]; - } - } - - - try - { - *out << "Connecting to cygwin..." << endl; - cygwin::connector cygwin (dll); - *out << "Successfully connected." << endl; - - string result = cygwin.str_error (ENOENT); - - if (result != "No such file or directory") - { - cerr << "strerror(ENOENT) returned \"" - << result - << "\" instead of \"No such file or directory\"!" - << endl; - return 1; - } - else if (verbose) - { - *out << "strerror(ENOENT) = " << result << endl; - } - - // Path conversion: from cygwin to Windows... - result = cygwin.win_path ("/usr"); - struct _stat statbuf; - if (::_stat (result.c_str (), &statbuf) < 0) - { - cerr << "stat(\"" << result << "\") failed!" << endl; - return 2; - } - else if (verbose) - { - *out << "/usr == " << result << endl; - } - - // ...and back: - char buf[MAX_PATH], scratch[256]; - GetSystemDirectory (buf, sizeof(buf)); - int (*cygstat) (const char *, void *); - cygwin.get_symbol ("stat", cygstat); - - if (cygstat (buf, scratch) < 0) - { - cerr << "cygwin stat(\"" << buf << "\") failed!" << endl; - return 3; - } - else if (verbose) - { - *out << buf << " == " << cygwin.unix_path(buf) << endl; - } - - // Test error handling. This should output - // "open(/potrzebie/furshlugginer): No such file or directory" - { - int (*cygopen) (const char *, int); - cygwin.get_symbol ("open", cygopen); - - if (cygopen ("/potrzebie/furshlugginer", 0 /* O_RDONLY */ ) < 0) - { - int err = cygwin.err_no (); - if (err != ENOENT) - { - cerr << "cygwin open(\"/potrzebie/furshlugginer\", " - "O_RDONLY): expected to fail with ENOENT, got " - << err << "!" << endl; - return 4; - } - if (verbose) - *out << cygwin::error (&cygwin, "open", - "/potrzebie/furshlugginer").what () - << endl; - } - else - { - cerr << "/potrzebie/furshlugginer should not exist!" - << endl; - return 5; - } - } - - // And signal handling: - std::pointer_to_unary_function < int , void > h1 (&hangup); - std::pointer_to_unary_function < int , void > h2 (&interrupt); - std::pointer_to_unary_function < int , void > h3 (&catch_signal); - cygwin.set_handler (SIGHUP, &h1); - cygwin.set_handler (SIGINT, &h2); - cygwin.set_handler (SIGUSR1, &h3); - - // Make sure the signal handler thread has had time to start... - Sleep (100); - // Send a test signal to set "caught" to true... - int (*raze) (int); - cygwin.get_symbol ("raise", raze); - raze (SIGUSR1); - // And give the thread time to wait for the shutdown signal. - Sleep (100); - - if (testinterrupts) - { - // This is a worst case scenario for testing interrupts: the - // main thread is in a long-duration Windows API call. This - // makes the main thread uninterruptible; cygwin will retry - // 20 times, with a low_priority_sleep(0) between each try. - cout << "Sleeping for 30 seconds, waiting for a signal..." << endl; - Sleep (30000); - cout << "Done waiting." << endl; - } - } - catch (std::exception &x) - { - cerr << x.what () << endl; - return 2; - } - - if (caught) - return 0; - else - { - cerr << "Never received SIGUSR1." << endl; - return 1; - } -} diff --git a/winsup/testsuite/winsup.api/cygload.exp b/winsup/testsuite/winsup.api/cygload.exp deleted file mode 100644 index a07a549f9..000000000 --- a/winsup/testsuite/winsup.api/cygload.exp +++ /dev/null @@ -1,40 +0,0 @@ -source "site.exp" - -if { ! [isnative] } { - verbose "skipping cygload because it's not native \"$target_triplet\" != \"$build_triplet\"" - return -} - -proc ws_spawn {cmd args} { - global rv - verbose "running $cmd\n" - set rv {} - # First item in rv is the return code, second item is the message - lappend rv [catch "exec $cmd" message] $message - verbose send "catchCode = $rv\n" -} - -ws_spawn "gcc -mno-cygwin $srcdir/$subdir/cygload.cc -o mingw-cygload.exe -lstdc++ -Wl,-e,_cygloadCRTStartup@0" - -if { $rv != {0 {}} } { - verbose -log "$rv" - fail "cygload (compile)" -} else { - if { $verbose } { - set redirect_output "./mingw-cygwin.log" - } else { - set redirect_output /dev/null - } - set windows_runtime_root [exec cygpath -m $runtime_root] - ws_spawn "./mingw-cygload.exe -cygwin $windows_runtime_root/cygwin0.dll > $redirect_output" - if { $rv != {0 {}} } { - verbose -log "cygload: $rv" - fail "cygload (execute)" - } else { - pass "cygload" - } - catch { file delete "mingw-cygload.exe" } err - if { $err != "" } { - note "error deleting mingw-cygload.exe: $err" - } -} diff --git a/winsup/testsuite/winsup.api/cygload.h b/winsup/testsuite/winsup.api/cygload.h deleted file mode 100644 index c7c562093..000000000 --- a/winsup/testsuite/winsup.api/cygload.h +++ /dev/null @@ -1,158 +0,0 @@ -// cygload.h -*- C++ -*- -// -// Copyright 2005, Red Hat, Inc. -// -// Written by Max Kaehn -// -// This software is a copyrighted work licensed under the terms of the -// Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. -// -// Note that dynamically linking to cygwin1.dll automatically places your code -// under the GPL unless you purchase a Cygwin Contract with Red Hat, Inc. -// See http://www.redhat.com/software/cygwin/ for more information. - -// This program has large numbers of progress messages so as to provide -// maximum information about crash locations for anyone without access to -// a Microsoft debugger. - - -// This file contains the basic infrastructure for connecting an MSVC -// process to Cygwin. - -#ifndef __CYGLOAD_H__ -#define __CYGLOAD_H__ - -#include // for GetProcAddress() -#include // for pointer_to_unary_function -#include // for runtime_error -#include -#include -#include - -// Convert GetLastError() to a human-readable STL exception. -class windows_error : public std::runtime_error -{ -public: - windows_error (const char *message, const char *detail = NULL) - : runtime_error (format (GetLastError (), message, detail)) { } - windows_error(DWORD error, const char *message, const char *detail = NULL) - : runtime_error (format (error, message, detail)) { } - - static std::string format (DWORD error, const char *message, - const char *detail); -}; - -namespace cygwin -{ - - // Cygwin keeps important thread-local information at the top of the - // stack. Its DllMain-equivalent will do the right thing for any threads - // you spawn, but you need to declare one of these as the very first thing - // in your main() function so horrible things won't happen when cygwin - // overwrites your stack. This will back up the data that will be - // overwritten and restore it when the destructor is called. - class padding { - public: - padding (); - ~padding (); - - // Verifies that padding has been declared. - static void check (); - - private: - std::vector< char > _backup; - char *_stackbase, *_end; - - // gdb reports sizeof(_cygtls) == 3964 at the time of this writing. - // This is at the end of the object so it'll be toward the bottom - // of the stack when it gets declared. - char _padding[32768]; - - static padding *_main; - static DWORD _mainTID; - }; - - // This hooks your application up to cygwin: it loads cygwin1.dll, - // initializes it properly, grabs some important symbols, and - // spawns a thread to let you receive signals from cygwin. - class connector { - public: - connector (const char *dll = "cygwin1.dll"); - ~connector (); - - // A wrapper around GetProcAddress() for fetching symbols from the - // cygwin DLL. Can throw windows_error. - template < class T > void get_symbol (const char *name, T &fn) const; - - // Wrappers for errno() and strerror(). - int err_no () const; - std::string str_error (int) const; - - // Converting between the worlds of Windows and Cygwin. - std::string unix_path (const std::string &windows) const; - std::string win_path (const std::string &unix) const; - - private: - HMODULE _library; - - int *(*_errno) (); - const char *(*_strerror) (int); - void (*_conv_to_full_posix_path) (const char *, char *); - void (*_conv_to_full_win32_path) (const char *, char *); - - public: - // The constructor will automatically hook you up for receiving - // cygwin signals. Just specify a signal and pass in a signal_handler. - typedef std::pointer_to_unary_function signal_handler; - signal_handler *set_handler (int signal, signal_handler *); - - private: - // Cygwin signals can only be received in threads that are calling - // interruptible functions or otherwise ready to intercept signals, so - // we spawn a thread that does nothing but call sigwait(). - - // This is the entry point: - static DWORD WINAPI signal_thread (void *); - // It runs this: - void await_signal (); - // And will execute this on receipt of any signal for which it's - // registered: - void handle_signals (int); - - HANDLE _signal_thread; - bool _waiting_for_signals, _signal_thread_done; - CRITICAL_SECTION _thread_mutex; - - typedef std::map< int, signal_handler * > callback_list; - callback_list _signal_handlers; - }; - - template void connector::get_symbol (const char *name, - T &symbol) const - { - FARPROC retval = NULL; - - retval = GetProcAddress (_library, name); - - if (retval == NULL) - throw windows_error ("GetProcAddress", name); - - symbol = reinterpret_cast < T > (retval); - } - - // cygwin::error converts errno to a human-readable exception. - class error : public std::runtime_error - { - public: - error (connector *c, const char *function, const char *detail = NULL) - : runtime_error (format (c, c->err_no (), function, detail)) { } - error (connector *c, int err_no, const char *function, - const char *detail = NULL) - : runtime_error (format (c, err_no, function, detail)) { } - - static std::string format(connector *c, int err_no, - const char *message, const char *detail); - }; -} - -#endif // __CYGLOAD_H__ diff --git a/winsup/testsuite/winsup.api/devdsp.c b/winsup/testsuite/winsup.api/devdsp.c deleted file mode 100644 index d5ed65365..000000000 --- a/winsup/testsuite/winsup.api/devdsp.c +++ /dev/null @@ -1,783 +0,0 @@ -/* devdsp.c: Device tests for /dev/dsp - - Copyright 2004 Red Hat, Inc - - Written by Gerd Spalink (Gerd.Spalink@t-online.de) - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -/* Conventions used here: - We use the libltp framework - 1. Any unexpected behaviour leads to an exit with nonzero exit status - 2. Unexpected behaviour from /dev/dsp results in an exit status of TFAIL - 3. Unexpected behaviour from OS (malloc, fork, waitpid...) result - in an exit status of TBROK */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "test.h" /* use libltp framework */ - -/* Controls if a child can open the device after the parent */ -#define CHILD_EXPECT 0 /* 0 or 1 */ - -static const char wavfile_okay[] = - { -#include "devdsp_okay.h" /* a sound sample */ - }; - -/* Globals required by libltp */ -const char *TCID = "devdsp"; /* set test case identifier */ -int TST_TOTAL = 37; - -/* Prototypes */ -void sinegen (void *wave, int rate, int bits, int len, int stride); -void sinegenw (int freq, int samprate, short *value, int len, int stride); -void sinegenb (int freq, int samprate, unsigned char *value, int len, - int stride); -void playtest (int fd, int rate, int stereo, int bits); -void rectest (int fd, int rate, int stereo, int bits); -void rwtest (int fd, int rate, int stereo, int bits); -void setpars (int fd, int rate, int stereo, int bits); -void forkplaytest (void); -void forkrectest (void); -void recordingtest (void); -void playbacktest (void); -void monitortest (void); -void ioctltest (void); -void abortplaytest (void); -void playwavtest (void); -void syncwithchild (pid_t pid, int expected_exit_status); -void cleanup (void); -void dup_test (void); - -static int expect_child_failure = 0; - -/* Sampling rates we want to test */ -static const int rates[] = { 44100, 22050, 8000 }; - -/* Combinations of stereo/bits we want to test */ -struct sb -{ - int stereo; - int bits; -}; -static const struct sb sblut[] = { {0, 8}, {0, 16}, {1, 8}, {1, 16} }; - -int -main (int argc, char *argv[]) -{ - /* tst_brkm(TBROK, cleanup, "see if it breaks all right"); */ - ioctltest (); - playbacktest (); - recordingtest (); - monitortest (); - forkplaytest (); - forkrectest (); - abortplaytest (); - playwavtest (); - dup_test (); - tst_exit (); - /* NOTREACHED */ - return 0; -} - -/* test some extra ioctls */ -void -ioctltest (void) -{ - int audio1; - int ioctl_par; - int channels; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio1 = open ("/dev/dsp", O_WRONLY); - if (audio1 < 0) - { - tst_brkm (TFAIL, cleanup, "open W: %s", strerror (errno)); - } - setpars (audio1, 44100, 1, 16); - - channels = ioctl_par = 1; - while (ioctl (audio1, SNDCTL_DSP_CHANNELS, &ioctl_par) == 0) - { - channels++; - ioctl_par = channels; - } - if (channels == ioctl_par) - tst_resm (TFAIL, "Max channels=%d failed", ioctl_par); - else - tst_resm (TPASS, "Max channels=%d failed, OK=%d", channels, ioctl_par); - - /* Note: block size may depend on parameters */ - if (ioctl (audio1, SNDCTL_DSP_GETBLKSIZE, &ioctl_par) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl GETBLKSIZE: %s", strerror (errno)); - } - tst_resm (TPASS, "ioctl get buffer size=%d", ioctl_par); - if (ioctl (audio1, SNDCTL_DSP_GETFMTS, &ioctl_par) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl GETFMTS: %s", strerror (errno)); - } - tst_resm (TPASS, "ioctl get formats=%08x", ioctl_par); - if (ioctl (audio1, SNDCTL_DSP_GETCAPS, &ioctl_par) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl GETCAPS: %s", strerror (errno)); - } - tst_resm (TPASS, "ioctl get caps=%08x", ioctl_par); - if (close (audio1) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } -} - -/* test write / play */ -void -playbacktest (void) -{ - int audio1, audio2; - int rate, k; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio1 = open ("/dev/dsp", O_WRONLY); - if (audio1 < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp W: %s", - strerror (errno)); - } - audio2 = open ("/dev/dsp", O_WRONLY); - if (audio2 >= 0) - { - tst_brkm (TFAIL, cleanup, - "Second open /dev/dsp W succeeded, but is expected to fail"); - } - else if (errno != EBUSY) - { - tst_brkm (TFAIL, cleanup, "Expected EBUSY here, exit: %s", - strerror (errno)); - } - for (rate = 0; rate < sizeof (rates) / sizeof (int); rate++) - for (k = 0; k < sizeof (sblut) / sizeof (struct sb); k++) - { - playtest (audio1, rates[rate], sblut[k].stereo, sblut[k].bits); - tst_resm (TPASS, "Play bits=%2d stereo=%d rate=%5d", - sblut[k].bits, sblut[k].stereo, rates[rate]); - } - if (close (audio1) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } -} - -/* test read / record */ -void -recordingtest (void) -{ - int audio1, audio2; - int rate, k; - - /* test read / record */ - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio1 = open ("/dev/dsp", O_RDONLY); - if (audio1 < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp R: %s", - strerror (errno)); - } - audio2 = open ("/dev/dsp", O_RDONLY); - if (audio2 >= 0) - { - tst_brkm (TFAIL, cleanup, - "Second open /dev/dsp R succeeded, but is expected to fail"); - } - else if (errno != EBUSY) - { - tst_brkm (TFAIL, cleanup, "Expected EBUSY here, exit: %s", - strerror (errno)); - } - for (rate = 0; rate < sizeof (rates) / sizeof (int); rate++) - for (k = 0; k < sizeof (sblut) / sizeof (struct sb); k++) - { - rectest (audio1, rates[rate], sblut[k].stereo, sblut[k].bits); - tst_resm (TPASS, "Record bits=%2d stereo=%d rate=%5d", - sblut[k].bits, sblut[k].stereo, rates[rate]); - } - if (close (audio1) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } -} - -/* simultaneous read/write */ -void -monitortest (void) -{ - int fd; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - fd = open ("/dev/dsp", O_RDWR); - if (fd < 0) - { - tst_brkm (TFAIL, cleanup, "open RW: %s", strerror (errno)); - } - rwtest (fd, 44100, 1, 16); - tst_resm (TPASS, "Record+Play rate=44100, stereo, 16 bits"); - if (close (fd) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } -} - -void -forkrectest (void) -{ - int pid; - int fd; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - fd = open ("/dev/dsp", O_RDONLY); - if (fd < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp R: %s", - strerror (errno)); - } - pid = fork (); - if (pid < 0) - { - tst_brkm (TBROK, cleanup, "Fork failed: %s", strerror (errno)); - } - if (pid) - { - tst_resm (TINFO, "forked, child PID=%d", pid); - syncwithchild (pid, 0); - tst_resm (TINFO, "parent records.."); - rectest (fd, 22050, 1, 16); - tst_resm (TINFO, "parent done"); - } - else - { /* child */ - tst_resm (TINFO, "child records.."); - rectest (fd, 44100, 1, 16); - tst_resm (TINFO, "child done"); - fflush (stdout); - exit (0); /* implicit close */ - } - tst_resm (TPASS, "child records after fork"); - /* fork again, but now we have done a read before, - * so the child is expected to fail - */ - pid = fork (); - if (pid < 0) - { - tst_brkm (TBROK, cleanup, "Fork failed: %s", strerror (errno)); - } - if (pid) - { - tst_resm (TINFO, "forked, child PID=%d", pid); - syncwithchild (pid, CHILD_EXPECT?TFAIL:0); /* expecting error exit */ - tst_resm (TINFO, "parent records again .."); - rectest (fd, 22050, 1, 16); - tst_resm (TINFO, "parent done"); - } - else - { /* child */ - expect_child_failure = CHILD_EXPECT; - tst_resm (TINFO, "child trying to record %s", - CHILD_EXPECT?"(should fail)..":""); - rectest (fd, 44100, 1, 16); - /* NOTREACHED */ - tst_resm (TINFO, "child done"); - fflush (stdout); - exit (0); /* implicit close */ - } - if (close (fd) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "child tries to record while parent is already recording"); -} - -void -forkplaytest (void) -{ - int pid; - int fd; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - fd = open ("/dev/dsp", O_WRONLY); - if (fd < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp R: %s", - strerror (errno)); - } - pid = fork (); - if (pid < 0) - { - tst_brkm (TBROK, cleanup, "Fork failed: %s", strerror (errno)); - } - if (pid) - { - tst_resm (TINFO, "forked, child PID=%d", pid); - syncwithchild (pid, 0); - tst_resm (TINFO, "parent plays.."); - playtest (fd, 22050, 0, 8); - tst_resm (TINFO, "parent done"); - } - else - { /* child */ - tst_resm (TINFO, "child plays.."); - playtest (fd, 44100, 1, 16); - tst_resm (TINFO, "child done"); - fflush (stdout); - exit (0); /* implicit close */ - } - tst_resm (TPASS, "child plays after fork"); - /* fork again, but now we have done a write before, - * so the child is expected to fail - */ - pid = fork (); - if (pid < 0) - { - tst_brkm (TBROK, cleanup, "Fork failed"); - } - if (pid) - { - tst_resm (TINFO, "forked, child PID=%d", pid); - syncwithchild (pid, CHILD_EXPECT?TFAIL:0); /* expected failure */ - tst_resm (TINFO, "parent plays again.."); - playtest (fd, 22050, 0, 8); - tst_resm (TINFO, "parent done"); - } - else - { /* child */ - expect_child_failure = CHILD_EXPECT; - tst_resm (TINFO, "child trying to play %s", - CHILD_EXPECT?"(should fail)..":""); - playtest (fd, 44100, 1, 16); - /* NOTREACHED */ - tst_resm (TINFO, "child done"); - fflush (stdout); - exit (0); /* implicit close */ - } - if (close (fd) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "child tries to play while parent is already playing"); -} - -void -playtest (int fd, int rate, int stereo, int bits) -{ /* Play sine waves, always 0.25 sec */ - void *wave; - int n, c, b; - int size; - if (stereo) - c = 2; - else - c = 1; - if (bits == 8) - b = 1; - else - b = 2; - size = rate / 4 * c * b; - - wave = malloc (size); - if (wave == NULL) - { - tst_brkm (TBROK, cleanup, "Malloc failed, exit"); - } - setpars (fd, rate, stereo, bits); - sinegen (wave, rate, bits, rate / 4, c); - - if ((n = write (fd, wave, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "write: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Wrote %d, expected %d; exit", n, size); - } - free (wave); -} - -void -rectest (int fd, int rate, int stereo, int bits) -{ - void *wave; - int n, c, b; - int size; - if (stereo) - c = 2; - else - c = 1; - if (bits == 8) - b = 1; - else - b = 2; - size = rate / 4 * c * b; - - wave = malloc (size); - if (wave == NULL) - { - tst_brkm (TBROK, cleanup, "Malloc failed, exit"); - } - setpars (fd, rate, stereo, bits); - if ((n = read (fd, wave, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "read: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Read n=%d (%d expected); exit", n, size); - } - if ((n = read (fd, wave, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "read: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Read n=%d (%d expected); exit", n, size); - } - free (wave); -} - -void -rwtest (int fd, int rate, int stereo, int bits) -{ - int pid; - void *wave; - int n, c, b; - int size; - if (stereo) - c = 2; - else - c = 1; - if (bits == 8) - b = 1; - else - b = 2; - size = rate / 4 * c * b; - - wave = malloc (size); - if (wave == NULL) - { - tst_brkm (TBROK, cleanup, "Malloc failed, exit"); - } - setpars (fd, rate, stereo, bits); - pid = fork (); - if (pid < 0) - { - tst_brkm (TBROK, cleanup, "Fork failed: %s", strerror (errno)); - } - if (pid) - { - tst_resm (TINFO, "forked, child PID=%d parent records", pid); - if ((n = read (fd, wave, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "read: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Read n=%d (%d expected)", n, size); - } - free (wave); - syncwithchild (pid, 0); - } - else - { /* child */ - tst_resm (TINFO, "child plays"); - sinegen (wave, rate, bits, rate / 4, c); - if ((n = write (fd, wave, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "child write: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "child write n=%d OK (%d expected)", n, - size); - } - free (wave); - exit (0); - } -} - -void -setpars (int fd, int rate, int stereo, int bits) -{ - int ioctl_par = 0; - - if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &bits) < 0) - { - if (expect_child_failure) - { /* Note: Don't print this to stderr because we expect failures here - * for the some cases after fork() - */ - tst_resm (TINFO, "ioctl SNDCTL_DSP_SAMPLESIZE: %s", - strerror (errno)); - exit (TFAIL); - } - else - { - tst_brkm (TFAIL, cleanup, "ioctl SNDCTL_DSP_SAMPLESIZE: %s", - strerror (errno)); - } - } - if (ioctl (fd, SNDCTL_DSP_STEREO, &stereo) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl SNDCTL_DSP_STEREO: %s", - strerror (errno)); - } - if (ioctl (fd, SNDCTL_DSP_SPEED, &rate) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl SNDCTL_DSP_SPEED: %s", - strerror (errno)); - } - if (ioctl (fd, SNDCTL_DSP_SYNC, &ioctl_par) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl SNDCTL_DSP_SYNC: %s", - strerror (errno)); - } -} - -void -syncwithchild (pid_t pid, int expected_exit_status) -{ - int status; - - if (waitpid (pid, &status, 0) != pid) - { - tst_brkm (TBROK, cleanup, "Wait for child: %s", strerror (errno)); - } - if (!WIFEXITED (status)) - { - tst_brkm (TBROK, cleanup, "Child had abnormal exit"); - } - if (WEXITSTATUS (status) != expected_exit_status) - { - tst_brkm (TFAIL, cleanup, "Child had exit status %d != %d", - WEXITSTATUS (status), expected_exit_status); - } -} - -void -sinegen (void *wave, int rate, int bits, int len, int stride) -{ - if (bits == 8) - { - sinegenb (1000, rate, (unsigned char *) wave, len, stride); - if (stride == 2) - sinegenb (800, rate, (unsigned char *) wave + 1, len, stride); - } - else - { - sinegenw (1000, rate, (short *) wave, len, stride); - if (stride == 2) - sinegenw (800, rate, (short *) wave + 1, len, stride); - } -} - -void -sinegenw (int freq, int samprate, short *value, int len, int stride) -{ - double phase, incr; - - phase = 0.0; - incr = M_PI * 2.0 * (double) freq / (double) samprate; - while (len-- > 0) - { - *value = (short) floor (0.5 + 6553 * sin (phase)); - value += stride; - phase += incr; - } -} - -void -sinegenb (int freq, int samprate, unsigned char *value, int len, int stride) -{ - double phase, incr; - - phase = 0.0; - incr = M_PI * 2.0 * (double) freq / (double) samprate; - while (len-- > 0) - { - *value = (unsigned char) floor (128.5 + 26 * sin (phase)); - value += stride; - phase += incr; - } -} - -void -abortplaytest (void) -{ - int audio; - int size = sizeof (wavfile_okay); - int n; - int ioctl_par = 0; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio = open ("/dev/dsp", O_WRONLY); - if (audio < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp W: %s", - strerror (errno)); - } - if ((n = write (audio, wavfile_okay, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "write: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Wrote %d, expected %d; exit", n, size); - } - if (ioctl (audio, SNDCTL_DSP_RESET, &ioctl_par) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl DSP_RESET: %s", strerror (errno)); - } - if (close (audio) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "Playwav + ioctl DSP_RESET=%d", ioctl_par); -} - -void -playwavtest (void) -{ - int audio; - int size = sizeof (wavfile_okay); - int n; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio = open ("/dev/dsp", O_WRONLY); - if (audio < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp W: %s", - strerror (errno)); - } - if ((n = write (audio, wavfile_okay, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "write: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Wrote %d, expected %d; exit", n, size); - } - if (close (audio) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "Set parameters from wave file header"); -} - -void dup_test (void) -{ - int audio, fd, n; - int bits1, bits2; - int size = sizeof (wavfile_okay); - int header = 44; - const char *okay = wavfile_okay + header; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio = open ("/dev/dsp", O_WRONLY); - if (audio < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp W: %s", - strerror (errno)); - } - /* write header once to set parameters correctly */ - n = write (audio, wavfile_okay, header); - if (n != header) - { - tst_brkm (TFAIL, cleanup, "Wrote %d, expected %d; exit", n, header); - } - size = size - header; - /* dup / close */ - for (fd = audio+1; fd <= audio+5; fd++) - if (dup2 (fd-1, fd) != -1) - { - if (fd-2 >= audio) - if (close (fd-2) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - if ((n = write (fd, okay, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "write: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Wrote %d, expected %d; exit", n, size); - } - } - else - tst_brkm (TFAIL, cleanup, "dup: %s", strerror (errno)); - - for (fd = audio+4; fd <= audio+5; fd++) - if (close (fd) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "Write to duped fd"); - - audio = open ("/dev/dsp", O_WRONLY); - if (audio < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp W: %s", - strerror (errno)); - } - fd = audio + 1; - if (dup2 (audio, fd) == -1) - { - tst_brkm (TFAIL, cleanup, "dup: %s", strerror (errno)); - } - bits1 = AFMT_U8; - if (ioctl (audio, SNDCTL_DSP_SAMPLESIZE, &bits1) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl: %s", strerror (errno)); - } - bits1 = AFMT_S16_LE; - if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &bits1) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl: %s", strerror (errno)); - } - bits1 = AFMT_QUERY; - if (ioctl (audio, SNDCTL_DSP_SAMPLESIZE, &bits1) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl: %s", strerror (errno)); - } - bits2 = AFMT_QUERY; - if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &bits2) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl: %s", strerror (errno)); - } - if (bits1 != AFMT_S16_LE || bits2 != AFMT_S16_LE) - { - tst_brkm (TFAIL, cleanup, "Inconsistent state of duped fd: %d %d %d", - AFMT_S16_LE,bits1,bits2); - } - if (close (audio) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - if (close (fd) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "Parameter change to duped fd"); -} -void -cleanup (void) -{ -} diff --git a/winsup/testsuite/winsup.api/devdsp_okay.h b/winsup/testsuite/winsup.api/devdsp_okay.h deleted file mode 100644 index 0fefa635c..000000000 --- a/winsup/testsuite/winsup.api/devdsp_okay.h +++ /dev/null @@ -1,531 +0,0 @@ -/* This is the decimal representation of a wave file. - It contains the spoken word "okay" sampled at 11025 Hz - and 8 bit resolution. */ - 82, 73, 70, 70, 108, 30, 0, 0, 87, 65, 86, 69, 102, 109, 116, 32, 16, 0, 0, - 0, 1, 0, 1, 0, 17, 43, 0, 0, 17, 43, 0, 0, 1, 0, 8, 0, 100, 97, 116, 97, - 72, 30, 0, 0, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 115, 114, 114, 115, 115, - 115, 117, 117, 117, 116, 115, 115, 115, 115, 116, 116, 116, 118, 116, 115, - 115, 115, 115, 115, 116, 116, 116, 117, 116, 116, 115, 116, 116, 116, 116, - 117, 116, 116, 117, 116, 115, 116, 116, 116, 117, 117, 117, 116, 116, 117, - 116, 116, 116, 117, 117, 117, 117, 116, 116, 116, 118, 117, 117, 117, 117, - 116, 116, 116, 116, 116, 116, 117, 117, 117, 117, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 115, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 115, 115, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 117, 117, 117, 117, 117, 117, 117, 117, 117, 118, 119, 118, 118, 118, - 118, 119, 119, 119, 119, 119, 120, 120, 120, 120, 121, 120, 120, 120, 120, - 121, 121, 120, 119, 118, 116, 115, 114, 115, 114, 113, 112, 112, 111, 112, - 113, 114, 116, 116, 117, 117, 117, 116, 115, 115, 115, 115, 116, 115, 115, - 114, 114, 114, 114, 114, 114, 114, 116, 115, 115, 115, 114, 114, 113, 113, - 114, 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, - 115, 115, 115, 115, 116, 116, 116, 118, 117, 117, 117, 117, 117, 118, 118, - 119, 119, 119, 120, 120, 120, 120, 120, 120, 121, 121, 121, 120, 119, 118, - 117, 117, 117, 116, 117, 116, 116, 115, 115, 115, 115, 115, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 114, 113, 113, 113, 113, - 113, 113, 113, 115, 114, 113, 113, 113, 113, 114, 114, 114, 115, 114, 114, - 114, 114, 114, 114, 114, 115, 116, 115, 115, 115, 115, 114, 114, 115, 115, - 115, 117, 116, 116, 116, 116, 116, 116, 117, 117, 118, 118, 119, 118, 118, - 118, 118, 119, 120, 120, 121, 121, 122, 122, 123, 124, 125, 126, 127, 126, - 126, 126, 126, 127, -127, 124, 114, 102, 94, 89, 94, 102, 109, 115, 120, - 124, 123, 122, 121, 117, 116, 121, 124, 125, 124, 120, 114, 109, 107, 105, - 104, 108, 111, 115, 118, 120, 118, 116, 114, 114, 116, 117, 119, 120, 119, - 118, 116, 113, 112, 111, 113, 117, 120, 122, 122, 121, 118, 115, 114, 113, - 112, 113, 114, 113, 114, 114, 112, 111, 110, 110, 113, 116, 118, 119, 120, - 119, 116, 115, 114, 112, 111, 114, 114, 115, 115, 113, 110, 109, 110, 113, - 115, 118, 120, 120, 119, 119, 116, 114, 112, 112, 113, 114, 115, 115, 114, - 115, 114, 114, 115, 117, 117, 118, 119, 119, 118, 117, 116, 115, 115, 116, - 116, 118, 119, 119, 119, 118, 118, 118, 119, 120, 121, 122, 123, 123, 123, - 122, 122, 124, 122, 121, 119, 118, 117, 115, 115, 115, 115, 116, 117, 118, - 118, 119, 117, 112, 110, 110, 110, 111, 117, 118, 118, 118, 119, 118, 116, - 115, 114, 114, 116, 118, 118, 116, 116, 115, 113, 112, 113, 113, 114, 117, - 117, 117, 117, 115, 113, 112, 111, 108, 108, 110, 111, 113, 115, 116, 115, - 115, 116, 116, 114, 115, 115, 114, 115, 114, 112, 111, 113, 112, 113, 115, - 116, 117, 118, 118, 117, 116, 117, 115, 115, 116, 117, 117, 118, 118, 119, - 119, 119, 120, 122, 122, 124, 125, 126, -128, -127, -126, -124, -121, - -117, -112, -113, -123, 121, 108, 91, 75, 75, 84, 91, 103, 119, 127, -128, - -126, -127, 124, 120, 122, 121, 123, 127, 126, 120, 114, 110, 104, 99, - 101, 104, 107, 114, 120, 123, 123, 122, 119, 116, 116, 117, 116, 117, 118, - 117, 115, 113, 111, 110, 111, 113, 116, 120, 123, 124, 123, 121, 118, 115, - 113, 112, 112, 112, 114, 113, 112, 110, 107, 107, 107, 110, 112, 116, 119, - 120, 119, 118, 115, 113, 110, 110, 111, 112, 113, 114, 114, 116, 115, 114, - 115, 116, 117, 118, 119, 119, 118, 117, 116, 115, 113, 114, 114, 115, 117, - 119, 119, 120, 120, 120, 121, 122, 123, 123, 125, 127, -128, -127, -126, - -126, -124, -121, -120, -119, -123, 124, 113, 101, 90, 81, 81, 87, 96, - 108, 121, 127, -127, -125, -125, 126, 122, 121, 120, 120, 122, 121, 118, - 114, 110, 106, 103, 102, 104, 106, 112, 117, 120, 122, 123, 122, 119, 117, - 117, 116, 115, 116, 116, 115, 115, 114, 113, 113, 113, 115, 117, 119, 120, - 120, 120, 118, 114, 112, 110, 108, 108, 108, 109, 110, 112, 111, 112, 112, - 112, 112, 112, 114, 117, 117, 118, 117, 115, 113, 112, 111, 111, 113, 114, - 116, 118, 119, 119, 118, 118, 118, 117, 117, 117, 118, 117, 118, 118, 118, - 119, 119, 120, 121, 122, 124, 126, 127, -128, -127, -124, -122, -120, - -117, -115, -117, -125, 119, 102, 85, 77, 76, 83, 91, 103, 115, 124, -125, - -122, -126, 124, 121, 119, 119, 121, 122, 121, 118, 117, 114, 109, 106, - 103, 102, 107, 112, 117, 119, 122, 122, 120, 119, 117, 114, 112, 114, 114, - 115, 116, 115, 114, 114, 114, 114, 116, 116, 118, 119, 120, 121, 119, 116, - 113, 109, 108, 107, 107, 109, 111, 112, 113, 114, 115, 113, 112, 112, 112, - 113, 114, 115, 116, 115, 114, 113, 113, 113, 113, 113, 114, 117, 117, 118, - 118, 117, 117, 117, 116, 116, 117, 117, 118, 119, 118, 118, 118, 118, 119, - 120, 121, 122, 124, 126, -128, -127, -125, -124, -123, -120, -117, -114, - -115, -123, 119, 102, 84, 76, 76, 80, 90, 102, 115, 125, -124, -120, -125, - 124, 121, 119, 119, 120, 121, 121, 120, 119, 117, 110, 105, 101, 101, 104, - 110, 114, 118, 121, 123, 122, 120, 118, 115, 113, 114, 116, 116, 117, 117, - 115, 115, 114, 114, 113, 114, 117, 118, 120, 120, 119, 117, 114, 111, 109, - 107, 107, 107, 109, 112, 115, 115, 115, 115, 115, 114, 113, 113, 113, 113, - 114, 114, 114, 114, 113, 113, 113, 114, 116, 117, 118, 119, 119, 120, 118, - 118, 117, 116, 117, 117, 118, 118, 118, 119, 119, 120, 121, 121, 121, 123, - 124, 125, 126, -128, -127, -124, -121, -118, -116, -112, -114, -123, 118, - 99, 81, 75, 77, 82, 92, 104, 114, 125, -123, -122, -128, 123, 120, 118, - 119, 121, 121, 120, 121, 121, 117, 112, 107, 102, 102, 105, 110, 114, 118, - 121, 124, 123, 121, 118, 114, 113, 113, 113, 115, 116, 116, 117, 117, 116, - 115, 115, 115, 115, 116, 118, 119, 118, 118, 115, 112, 110, 107, 106, 107, - 110, 112, 115, 117, 118, 117, 117, 115, 113, 112, 112, 111, 112, 113, 113, - 113, 114, 114, 116, 115, 116, 117, 118, 119, 119, 118, 118, 117, 116, 115, - 116, 116, 117, 118, 119, 121, 120, 120, 121, 121, 121, 121, 121, 122, 123, - 125, 125, 126, -127, -124, -122, -119, -117, -115, -117, -123, 120, 102, - 88, 81, 80, 85, 92, 100, 110, 120, -127, -125, 127, 123, 121, 120, 121, - 122, 121, 121, 123, 122, 119, 114, 109, 104, 103, 104, 107, 110, 114, 117, - 119, 121, 121, 119, 117, 114, 114, 114, 116, 117, 117, 117, 118, 118, 117, - 115, 113, 113, 113, 115, 116, 117, 116, 114, 113, 110, 109, 109, 110, 111, - 113, 116, 117, 117, 116, 115, 112, 111, 110, 109, 112, 113, 115, 117, 118, - 117, 117, 116, 115, 114, 115, 115, 116, 118, 119, 120, 120, 120, 118, 117, - 116, 116, 116, 118, 118, 120, 121, 122, 122, 122, 120, 120, 120, 121, 123, - 125, 127, -126, -123, -121, -120, -119, -118, -120, -128, 115, 101, 91, - 87, 86, 89, 94, 100, 109, 117, 123, 125, 123, 121, 119, 119, 120, 121, - 120, 121, 122, 122, 121, 117, 112, 107, 105, 106, 106, 108, 111, 113, 117, - 119, 119, 118, 117, 114, 113, 114, 115, 116, 117, 118, 119, 120, 118, 117, - 114, 112, 112, 113, 113, 114, 114, 114, 114, 112, 111, 110, 110, 110, 111, - 113, 114, 115, 115, 115, 113, 112, 111, 110, 111, 111, 113, 115, 116, 117, - 117, 117, 116, 115, 115, 113, 114, 115, 116, 118, 119, 120, 120, 119, 118, - 118, 117, 116, 117, 118, 119, 120, 121, 121, 121, 121, 121, 121, 121, 122, - 123, 125, 127, -128, -126, -124, -122, -120, -120, -126, 119, 108, 101, - 93, 91, 93, 93, 97, 105, 112, 117, 120, 120, 118, 117, 118, 118, 117, 118, - 120, 122, 123, 123, 121, 116, 114, 110, 108, 107, 107, 108, 110, 114, 116, - 117, 117, 116, 115, 114, 114, 114, 115, 117, 117, 119, 120, 120, 119, 118, - 116, 115, 114, 113, 113, 112, 112, 112, 111, 111, 111, 111, 112, 112, 113, - 113, 115, 116, 116, 116, 115, 115, 113, 113, 113, 113, 114, 115, 116, 117, - 117, 117, 116, 116, 115, 116, 116, 116, 117, 118, 119, 120, 120, 120, 119, - 119, 118, 118, 117, 117, 118, 119, 119, 120, 121, 121, 122, 123, 121, 121, - 121, 122, 123, 125, 127, -127, -126, -125, -124, -127, 122, 115, 109, 103, - 100, 101, 100, 102, 105, 109, 114, 115, 115, 115, 113, 113, 114, 114, 115, - 117, 120, 121, 122, 123, 121, 118, 116, 113, 112, 111, 111, 111, 112, 114, - 115, 116, 116, 115, 114, 113, 114, 113, 113, 114, 115, 117, 120, 121, 121, - 120, 119, 118, 117, 115, 113, 113, 113, 113, 114, 114, 113, 113, 111, 111, - 111, 111, 112, 112, 114, 116, 116, 117, 116, 116, 115, 115, 114, 114, 114, - 116, 116, 117, 118, 118, 118, 118, 117, 117, 116, 116, 116, 118, 118, 119, - 119, 118, 118, 118, 117, 117, 117, 117, 117, 119, 119, 119, 120, 120, 120, - 120, 120, 119, 119, 119, 119, 120, 120, 120, 121, 120, 120, 120, 120, 120, - 120, 119, 118, 117, 115, 114, 113, 113, 112, 112, 112, 112, 113, 113, 113, - 114, 113, 113, 113, 113, 113, 114, 115, 116, 118, 117, 117, 117, 116, 116, - 116, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 117, 116, 117, 117, 117, 117, 117, 117, 117, 116, 116, 117, 116, 115, 115, - 115, 115, 115, 115, 115, 114, 115, 114, 114, 114, 114, 114, 115, 115, 116, - 117, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, 118, 117, 117, 117, - 116, 116, 116, 116, 116, 117, 117, 118, 118, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 118, 117, 117, 117, 116, 116, 116, 116, 116, 117, 117, - 118, 117, 117, 117, 117, 116, 117, 117, 117, 117, 117, 117, 118, 117, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 115, 115, - 115, 115, 115, 116, 114, 114, 115, 115, 115, 115, 116, 116, 116, 117, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 117, 117, 117, - 118, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 117, 115, 115, - 116, 116, 116, 117, 117, 117, 117, 117, 118, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 117, 117, 116, - 117, 116, 116, 116, 117, 117, 117, 117, 117, 117, 117, 118, 117, 117, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 117, 117, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 118, 117, 117, 117, 116, 116, 116, 116, 116, 115, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, - 115, 115, 116, 116, 117, 117, 117, 117, 117, 118, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 117, 117, - 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 117, 117, 116, 116, 116, 116, 116, 115, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 115, 115, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, 117, 117, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 117, 116, 117, 117, 117, 117, 117, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 117, 117, 116, 116, 116, 117, 116, 116, 116, - 116, 116, 116, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 117, 117, 116, 116, 117, 118, 117, 117, 117, 117, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 117, 117, - 117, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, - 114, 108, 108, 118, 125, -126, 123, 98, 95, 109, 117, 124, 127, 123, 118, - 109, 103, 113, 125, -127, 120, 108, 106, 112, 115, 112, 110, 112, 111, - 112, 112, 116, 120, 120, 118, 114, 113, 120, 122, 119, 116, 115, 115, 117, - 117, 116, 115, 115, 115, 112, 107, 109, 119, 121, 120, 118, 114, 117, 120, - 118, 119, 119, 117, 119, 116, 113, 119, 120, 117, 114, 112, 114, 117, 117, - 116, 113, 114, 118, 117, 117, 119, 121, 118, 113, 114, 116, 116, 118, 116, - 114, 113, 111, 112, 117, 118, 121, 119, 117, 117, 113, 110, 114, 117, 119, - 117, 114, 113, 113, 114, 115, 115, 117, 117, 114, 114, 116, 119, 121, 119, - 115, 116, 117, 117, 120, 122, 121, 115, 109, 112, 117, 117, 116, 115, 116, - 117, 113, 113, 116, 118, 118, 115, 115, 118, 120, 120, 120, 118, 119, 120, - 119, 119, 118, 119, 119, 117, 116, 117, 118, 119, 116, 115, 117, 118, 118, - 118, 118, 118, 119, 119, 120, 120, 121, 120, 118, 118, 119, 119, 119, 118, - 118, 117, 116, 117, 117, 118, 118, 117, 116, 117, 116, 117, 119, 118, 117, - 116, 118, 120, 117, 117, 119, 120, 119, 118, 118, 118, 119, 118, 117, 116, - 119, 118, 117, 116, 117, 118, 118, 117, 116, 117, 118, 117, 116, 116, 117, - 118, 117, 115, 116, 118, 119, 117, 117, 119, 117, 117, 116, 117, 118, 118, - 117, 116, 116, 117, 117, 117, 116, 116, 116, 117, 116, 115, 116, 116, 116, - 118, 117, 116, 116, 117, 117, 117, 117, 117, 116, 115, 116, 116, 117, 118, - 116, 114, 115, 115, 116, 116, 117, 117, 115, 115, 116, 116, 118, 118, 117, - 117, 116, 116, 117, 117, 118, 117, 116, 116, 115, 115, 115, 115, 116, 118, - 116, 115, 115, 116, 116, 116, 116, 117, 117, 117, 118, 117, 117, 117, 117, - 116, 116, 116, 117, 115, 115, 114, 114, 115, 115, 115, 116, 115, 114, 114, - 117, 116, 116, 115, 115, 115, 116, 116, 116, 116, 116, 115, 116, 116, 116, - 116, 115, 115, 115, 116, 115, 115, 115, 116, 116, 116, 116, 115, 115, 116, - 116, 117, 116, 116, 116, 117, 117, 116, 116, 116, 117, 117, 118, 117, 117, - 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, - 118, 118, 117, 118, 117, 117, 117, 117, 117, 118, 117, 117, 116, 115, 117, - 117, 117, 116, 115, 116, 117, 117, 117, 117, 117, 117, 116, 117, 117, 117, - 116, 115, 115, 116, 117, 118, 116, 116, 118, 117, 116, 117, 117, 117, 116, - 116, 116, 117, 116, 117, 115, 115, 116, 117, 117, 116, 115, 115, 117, 118, - 119, 117, 116, 116, 115, 116, 117, 117, 116, 115, 115, 117, 117, 117, 115, - 115, 115, 115, 114, 115, 116, 116, 115, 116, 116, 116, 116, 115, 116, 116, - 116, 116, 115, 116, 116, 116, 116, 115, 116, 117, 116, 117, 118, 116, 116, - 116, 116, 116, 117, 117, 117, 117, 118, 118, 117, 118, 118, 117, 116, 117, - 117, 118, 118, 117, 115, 117, 118, 118, 118, 117, 115, 115, 117, 118, 117, - 116, 116, 114, 115, 117, 117, 117, 116, 115, 116, 116, 116, 117, 116, 116, - 115, 115, 115, 115, 116, 115, 114, 116, 115, 115, 115, 114, 113, 113, 113, - 113, 114, 113, 112, 111, 113, 114, 113, 113, 114, 112, 113, 113, 113, 114, - 113, 113, 113, 114, 114, 114, 114, 114, 114, 115, 115, 116, 117, 116, 116, - 116, 117, 117, 117, 117, 117, 117, 118, 118, 120, 120, 121, 120, 120, 122, - 123, 123, 125, 126, 127, -128, -128, -126, -124, -121, -117, -112, -113, - -127, 106, 94, 105, 117, 114, 106, 94, 85, 89, 105, 116, 121, 118, 109, - 106, 116, 127, -126, 127, 121, 116, 115, 117, 117, 117, 116, 112, 103, 99, - 106, 110, 111, 108, 103, 104, 109, 112, 115, 116, 114, 111, 110, 113, 116, - 118, 116, 112, 110, 111, 112, 112, 114, 115, 113, 111, 111, 113, 116, 118, - 116, 115, 115, 117, 119, 120, 120, 120, 121, 122, 125, -126, -121, -119, - -116, -111, -107, -100, -101, -111, 110, 73, 90, 124, 119, 96, 82, 71, 71, - 95, 119, -127, 126, 114, 103, 115, -117, -108, -116, -126, 123, 119, 116, - 114, 116, 118, 112, 101, 91, 93, 103, 112, 113, 107, 108, 111, 114, 120, - 125, 124, 119, 111, 110, 116, 120, 117, 112, 107, 106, 108, 112, 112, 114, - 114, 110, 107, 110, 115, 118, 117, 114, 111, 110, 112, 114, 116, 116, 114, - 110, 110, 113, 117, 118, 116, 113, 114, 117, 118, 119, 120, 122, 123, 122, - 124, -127, -124, -122, -117, -114, -112, -110, -103, -96, -116, 80, 53, - 97, -125, 112, 89, 77, 65, 73, 107, -121, -114, -123, 113, 104, 127, -104, - -103, -117, -127, 124, 115, 106, 105, 113, 117, 108, 91, 80, 86, 103, 114, - 112, 110, 111, 111, 113, 122, -127, -128, 120, 113, 110, 114, 117, 115, - 112, 109, 106, 105, 105, 109, 116, 116, 109, 105, 108, 115, 119, 120, 117, - 114, 112, 114, 118, 122, 124, 120, 117, 118, 121, 125, -128, -127, -124, - -121, -116, -108, -93, -75, -73, -120, 57, 40, 106, -108, 120, 81, 62, 48, - 59, 104, -106, -99, -123, 106, 100, -128, -96, -92, -107, -120, 127, 108, - 93, 100, 118, 123, 105, 79, 69, 82, 106, 119, 118, 116, 117, 116, 118, - 127, -121, -123, 121, 111, 108, 110, 110, 111, 111, 109, 105, 101, 102, - 112, 121, 122, 112, 105, 111, 120, 123, 120, 115, 112, 108, 110, 114, 115, - 113, 111, 109, 111, 115, 119, 122, 122, 120, 120, 120, 125, -124, -119, - -117, -118, -114, -105, -88, -73, -79, 120, 40, 37, 115, -106, 109, 69, - 57, 51, 67, 119, -95, -97, -125, 108, 110, -118, -92, -93, -109, -122, - 120, 97, 84, 95, 118, 121, 98, 72, 68, 88, 110, 123, 124, 123, 123, 119, - 115, 125, -119, -125, 116, 106, 103, 104, 106, 110, 114, 111, 103, 99, - 105, 120, -127, 123, 111, 105, 111, 118, 120, 118, 114, 109, 106, 110, - 116, 122, 122, 118, 114, 117, 121, 126, -126, -124, -123, -122, -119, - -106, -88, -68, -59, -99, 61, 9, 75, -100, -117, 80, 54, 47, 46, 87, -103, - -78, -104, 115, 104, 124, -100, -85, -95, -114, -127, 105, 76, 77, 110, - -127, 111, 76, 60, 73, 101, 122, -127, -126, -128, 122, 116, 123, -120, - -116, 124, 107, 99, 98, 99, 105, 114, 112, 104, 96, 100, 115, -126, -126, - 118, 108, 107, 116, 122, 121, 117, 111, 103, 103, 110, 116, 119, 117, 113, - 112, 114, 118, 126, -126, 126, 123, 125, -126, -114, -104, -96, -88, -76, - -72, -119, 48, 20, 94, -102, 120, 67, 50, 48, 60, 109, -94, -84, -115, - 114, 111, -122, -94, -87, -104, -120, 120, 94, 71, 81, 115, 126, 100, 64, - 58, 83, 118, -122, -126, 125, 125, 121, 117, 127, -118, -125, 111, 97, 94, - 99, 101, 106, 110, 109, 103, 101, 108, 122, -126, 126, 113, 107, 112, 117, - 117, 115, 114, 112, 108, 106, 112, 121, 123, 118, 115, 117, 120, 124, - -126, -122, -119, -118, -113, -100, -81, -57, -59, -123, 30, 11, 103, -96, - 115, 62, 48, 42, 50, 108, -85, -76, -112, 114, 112, -121, -92, -85, -100, - -117, 119, 85, 63, 80, 117, 126, 99, 66, 60, 82, 115, -121, -120, -121, - -124, 120, 112, 123, -119, -123, 113, 96, 90, 92, 98, 108, 115, 113, 104, - 102, 109, 124, -121, -127, 113, 105, 110, 116, 116, 114, 112, 109, 106, - 107, 114, 121, 123, 119, 116, 116, 119, 124, -125, -122, -124, -123, -118, - -107, -90, -67, -56, -80, 87, 7, 42, -117, -104, 91, 53, 46, 44, 72, -117, - -74, -89, -126, 111, 118, -113, -89, -90, -107, -124, 104, 68, 64, 98, - -127, 118, 84, 59, 68, 102, -124, -119, -121, -121, 126, 113, 114, -127, - -119, 124, 101, 88, 91, 96, 104, 114, 116, 109, 103, 104, 118, -122, -122, - 117, 103, 105, 115, 120, 118, 115, 113, 108, 104, 109, 120, 124, 122, 117, - 114, 117, 124, -124, -121, -118, -117, -113, -103, -83, -60, -52, -107, - 44, 4, 87, -98, 125, 70, 50, 45, 49, 99, -96, -77, -103, 123, 112, 126, - -102, -88, -100, -113, 124, 87, 58, 76, 118, -127, 102, 71, 65, 85, 119, - -121, -121, -118, -121, 120, 111, 119, -123, -126, 110, 92, 88, 92, 98, - 109, 117, 113, 106, 104, 113, -128, -119, -128, 111, 104, 109, 115, 119, - 119, 116, 110, 102, 103, 116, 126, 124, 117, 113, 115, 120, 125, -125, - -120, -120, -119, -115, -103, -81, -59, -57, -105, 50, 7, 84, -101, -126, - 76, 51, 40, 49, 101, -94, -80, -103, 125, 113, 124, -106, -92, -100, -112, - 124, 85, 58, 76, 116, -125, 106, 74, 63, 85, 120, -119, -118, -120, -126, - 118, 112, 120, -125, -128, 109, 91, 87, 93, 99, 110, 117, 113, 106, 104, - 114, -127, -120, 126, 110, 103, 109, 116, 119, 117, 113, 109, 102, 105, - 117, 126, 123, 115, 111, 114, 121, 127, -124, -123, -125, -124, -116, - -104, -88, -70, -55, -77, 91, 9, 45, -118, -108, 94, 59, 43, 42, 77, -116, - -79, -91, -123, 111, 116, -114, -93, -99, -110, -124, 98, 63, 65, 105, - -125, 117, 84, 65, 79, 111, -122, -118, -121, -125, 123, 112, 114, 127, - -126, 114, 94, 88, 90, 97, 105, 114, 115, 110, 105, 110, 124, -121, -125, - 115, 105, 108, 115, 117, 114, 112, 110, 104, 103, 112, 123, 125, 118, 113, - 113, 117, 125, -126, -125, -127, 127, -125, -115, -101, -88, -76, -68, - -80, 107, 24, 42, -128, -109, 97, 59, 47, 48, 79, -122, -89, -97, -124, - 115, 118, -114, -97, -102, -115, -127, 102, 71, 72, 103, 127, 117, 88, 68, - 81, 113, -121, -122, -127, -128, 122, 115, 116, 123, 125, 114, 98, 91, 94, - 100, 106, 111, 111, 108, 105, 113, 125, -125, 126, 114, 108, 111, 117, - 118, 114, 110, 108, 104, 105, 112, 118, 120, 117, 114, 113, 118, 125, - -128, 127, 124, 122, 125, -122, -111, -104, -100, -92, -79, -73, -101, 75, - 26, 82, -115, 122, 74, 55, 51, 67, 108, -110, -100, -111, -128, 117, -126, - -105, -102, -115, -125, 118, 92, 77, 87, 113, 122, 103, 79, 75, 101, -126, - -119, 127, 121, 123, 122, 118, 119, 124, 118, 102, 91, 93, 101, 106, 106, - 107, 109, 111, 114, 121, -128, 127, 119, 111, 111, 115, 116, 112, 109, - 108, 108, 106, 106, 112, 120, 121, 117, 114, 117, 122, 125, 126, 124, 124, - 126, -127, -122, -115, -110, -108, -100, -87, -77, -87, 108, 40, 60, 127, - -123, 89, 65, 60, 65, 92, -127, -107, -105, -121, 116, 119, -117, -106, - -112, -121, 123, 101, 83, 85, 108, 123, 110, 88, 80, 97, 121, -125, 126, - 119, 121, 123, 120, 119, 121, 118, 107, 96, 94, 101, 106, 106, 105, 108, - 111, 114, 120, 123, 125, 123, 116, 111, 111, 114, 113, 109, 108, 106, 105, - 108, 114, 119, 120, 116, 114, 119, 124, 126, 124, 122, 121, 123, 125, - -128, -123, -119, -116, -114, -105, -94, -86, -86, -109, 86, 49, 90, -124, - 117, 83, 64, 60, 76, 111, -118, -110, -118, 121, 114, -127, -108, -107, - -120, 125, 113, 98, 94, 102, 116, 115, 99, 87, 90, 107, 126, -127, 119, - 115, 120, 123, 122, 121, 118, 112, 103, 98, 100, 107, 111, 107, 103, 104, - 110, 119, 124, 123, 119, 116, 111, 111, 115, 117, 112, 108, 106, 106, 108, - 114, 117, 118, 116, 115, 117, 121, 124, 124, 121, 117, 118, 123, 125, 126, - -128, -125, -123, -118, -109, -99, -92, -91, -98, -113, 97, 59, 90, -126, - 118, 82, 61, 63, 84, 116, -122, -121, -127, 117, 115, -123, -106, -108, - -124, 119, 111, 105, 103, 106, 114, 113, 99, 89, 91, 107, 126, -127, 116, - 109, 115, 124, 125, 123, 117, 108, 104, 103, 106, 110, 111, 107, 105, 106, - 108, 113, 119, 121, 118, 113, 109, 112, 118, 120, 117, 109, 105, 108, 112, - 116, 117, 116, 113, 110, 112, 118, 122, 120, 118, 117, 117, 119, 122, 125, - 126, 125, 126, -124, -119, -115, -110, -104, -103, -100, -99, -103, 124, - 76, 74, 109, 118, 96, 77, 69, 76, 100, 121, -127, -123, 127, 116, 123, - -116, -113, -120, 126, 118, 113, 107, 104, 108, 113, 108, 97, 93, 100, - 115, 125, 119, 111, 114, 118, 121, 122, 119, 112, 108, 105, 106, 111, 111, - 108, 107, 107, 109, 113, 118, 117, 116, 115, 113, 112, 116, 117, 114, 111, - 108, 109, 110, 111, 113, 113, 113, 114, 113, 115, 118, 121, 120, 117, 117, - 119, 122, 124, 124, 121, 121, 125, -125, -120, -117, -118, -114, -104, - -98, -100, -103, -110, 117, 80, 80, 110, 113, 95, 79, 68, 78, 102, 121, - -126, -123, 126, 117, 123, -118, -111, -118, 125, 114, 111, 110, 109, 110, - 112, 105, 98, 96, 102, 115, 122, 117, 109, 111, 120, 123, 120, 115, 110, - 110, 109, 110, 112, 111, 107, 107, 111, 113, 116, 116, 115, 113, 113, 113, - 111, 112, 113, 111, 107, 107, 108, 111, 114, 113, 113, 114, 117, 120, 119, - 118, 117, 116, 116, 118, 118, 117, 116, 117, 119, 121, 124, 126, -128, - -124, -122, -122, -119, -111, -102, -102, -106, -110, -114, 125, 91, 82, - 104, 112, 95, 79, 73, 83, 103, 117, 123, 125, 124, 119, 122, -120, -113, - -121, 122, 116, 117, 118, 114, 108, 107, 107, 100, 97, 101, 109, 116, 114, - 107, 110, 119, 125, 124, 119, 115, 113, 113, 114, 114, 115, 112, 108, 107, - 109, 112, 114, 110, 108, 110, 110, 110, 112, 115, 114, 111, 109, 111, 115, - 116, 114, 112, 113, 113, 115, 116, 116, 115, 115, 115, 115, 118, 121, 119, - 118, 117, 118, 120, 123, 125, 125, 125, -128, -124, -119, -115, -111, - -107, -108, -108, -106, -105, -122, 93, 75, 100, 116, 100, 80, 74, 79, 95, - 112, 120, 127, -128, 119, 118, -123, -110, -114, -128, 118, 116, 117, 114, - 108, 108, 107, 103, 97, 99, 107, 116, 116, 110, 110, 119, 125, 125, 122, - 118, 114, 114, 113, 114, 116, 113, 105, 103, 108, 114, 116, 111, 107, 107, - 111, 114, 115, 115, 113, 112, 112, 111, 114, 116, 114, 112, 112, 113, 115, - 116, 117, 116, 116, 115, 114, 116, 118, 118, 117, 117, 116, 119, 122, 123, - 124, 124, 126, -128, -124, -120, -118, -117, -113, -110, -108, -107, -107, - -116, 112, 82, 91, 115, 110, 89, 78, 76, 87, 105, 117, 121, 126, 121, 115, - 125, -115, -113, -124, 122, 116, 118, 120, 116, 111, 109, 104, 99, 99, - 106, 113, 115, 110, 107, 112, 122, 126, 124, 119, 115, 114, 116, 117, 118, - 114, 108, 105, 109, 113, 115, 112, 107, 107, 109, 112, 114, 114, 112, 110, - 110, 113, 116, 118, 116, 112, 111, 113, 117, 118, 116, 115, 112, 112, 114, - 115, 116, 116, 114, 114, 117, 118, 120, 121, 122, 121, 122, 124, -128, - -125, -124, -124, -121, -117, -114, -112, -110, -108, -108, -117, 110, 81, - 92, 117, 112, 89, 79, 76, 87, 106, 117, 122, 124, 118, 111, 124, -112, - -110, -123, 121, 116, 119, 122, 118, 113, 108, 102, 98, 99, 106, 112, 114, - 108, 105, 111, 121, 125, 124, 120, 116, 115, 116, 117, 119, 118, 112, 106, - 107, 109, 111, 112, 111, 109, 109, 109, 110, 113, 116, 114, 113, 112, 113, - 114, 115, 113, 113, 113, 113, 114, 114, 115, 114, 114, 114, 114, 114, 116, - 117, 117, 117, 117, 117, 119, 121, 122, 121, 121, 124, 127, -125, -123, - -123, -120, -115, -112, -111, -109, -108, -112, 119, 87, 90, 116, 116, 94, - 81, 78, 87, 103, 113, 118, 121, 117, 112, 120, -118, -112, -123, 121, 117, - 120, 123, 121, 114, 109, 106, 101, 100, 105, 111, 113, 107, 103, 109, 119, - 124, 122, 119, 116, 116, 119, 120, 120, 118, 113, 108, 109, 113, 114, 113, - 107, 104, 107, 111, 113, 112, 112, 109, 110, 113, 116, 116, 115, 113, 111, - 112, 114, 116, 115, 113, 111, 112, 113, 116, 115, 115, 115, 114, 114, 116, - 118, 119, 119, 119, 119, 122, 123, 125, 127, -126, -124, -122, -120, -115, - -112, -111, -109, -107, -112, 117, 84, 91, 119, 118, 93, 78, 78, 87, 103, - 112, 117, 120, 116, 112, 120, -118, -112, -122, 120, 117, 122, 125, 121, - 114, 110, 107, 103, 102, 104, 110, 112, 107, 104, 110, 119, 123, 121, 118, - 117, 118, 118, 119, 120, 119, 114, 110, 111, 112, 114, 114, 109, 107, 107, - 110, 110, 112, 113, 111, 109, 111, 113, 116, 116, 114, 113, 114, 115, 116, - 116, 114, 113, 113, 113, 114, 114, 114, 114, 114, 114, 116, 120, 120, 119, - 119, 120, 122, 125, 127, -128, -126, -124, -123, -120, -115, -113, -113, - -110, -107, -112, 117, 86, 94, 122, 119, 93, 79, 81, 89, 103, 112, 116, - 118, 115, 110, 119, -117, -111, -123, 120, 117, 123, -128, 124, 115, 110, - 107, 104, 104, 106, 110, 110, 104, 103, 109, 119, 122, 119, 116, 117, 119, - 119, 120, 121, 119, 114, 112, 112, 114, 115, 113, 108, 106, 109, 110, 110, - 110, 110, 109, 110, 113, 114, 115, 115, 114, 114, 115, 116, 116, 116, 115, - 112, 113, 115, 115, 114, 114, 113, 114, 117, 117, 117, 117, 118, 119, 121, - 123, 124, 125, 126, -128, -125, -122, -120, -118, -118, -116, -112, -108, - -108, -128, 95, 88, 115, 125, 103, 84, 81, 86, 99, 111, 114, 117, 115, - 109, 113, -124, -112, -120, 121, 116, 121, -128, 127, 119, 112, 108, 106, - 103, 106, 110, 110, 106, 104, 106, 116, 122, 119, 116, 116, 117, 119, 120, - 122, 119, 115, 112, 111, 114, 116, 114, 108, 105, 106, 111, 113, 111, 109, - 108, 111, 113, 116, 116, 115, 113, 112, 114, 117, 118, 115, 113, 112, 114, - 115, 116, 114, 114, 115, 114, 116, 117, 118, 118, 118, 118, 120, 122, 123, - 124, 125, 126, -127, -124, -122, -119, -117, -116, -114, -111, -109, -121, - 101, 86, 112, 126, 107, 89, 82, 86, 98, 107, 111, 115, 116, 110, 110, 127, - -116, -120, 122, 115, 120, -128, -128, 121, 113, 110, 109, 107, 107, 109, - 111, 107, 103, 106, 115, 120, 117, 113, 115, 117, 119, 120, 119, 119, 116, - 113, 113, 115, 116, 115, 110, 106, 108, 111, 111, 110, 110, 109, 109, 112, - 115, 116, 116, 114, 114, 114, 116, 117, 116, 114, 112, 113, 115, 115, 115, - 114, 114, 114, 115, 117, 117, 118, 118, 119, 120, 122, 121, 122, 125, 126, - 127, -127, -125, -123, -120, -120, -117, -113, -110, -112, 126, 97, 94, - 119, 124, 103, 87, 83, 89, 101, 109, 111, 114, 114, 108, 114, -126, -117, - -124, 120, 116, 123, -127, 126, 118, 113, 111, 108, 108, 109, 109, 109, - 107, 104, 107, 116, 118, 115, 114, 115, 117, 118, 119, 118, 118, 115, 114, - 113, 114, 115, 113, 110, 108, 110, 114, 112, 110, 110, 111, 113, 114, 114, - 115, 114, 114, 114, 115, 116, 116, 115, 114, 114, 117, 117, 115, 114, 114, - 115, 116, 116, 116, 116, 118, 117, 119, 120, 121, 122, 123, 125, 127, - -126, -125, -123, -119, -118, -117, -114, -113, -113, 125, 96, 95, 121, - 123, 101, 88, 86, 92, 104, 109, 111, 114, 113, 108, 115, -126, -118, -126, - 118, 115, 123, -127, 126, 118, 113, 110, 110, 109, 110, 110, 110, 107, - 105, 108, 116, 118, 115, 113, 114, 117, 119, 119, 118, 119, 116, 114, 115, - 116, 117, 115, 111, 109, 113, 114, 112, 110, 108, 109, 111, 113, 114, 113, - 113, 114, 114, 115, 117, 116, 116, 116, 114, 115, 115, 114, 114, 114, 114, - 114, 115, 116, 116, 117, 117, 119, 120, 120, 121, 122, 123, 125, 127, - -127, -126, -124, -122, -122, -119, -116, -115, -116, 125, 100, 98, 119, - 122, 105, 92, 88, 94, 106, 109, 109, 113, 113, 109, 114, 126, -123, -128, - 119, 116, 123, -128, 125, 117, 112, 111, 111, 111, 110, 110, 111, 108, - 105, 109, 116, 117, 115, 113, 114, 116, 118, 117, 116, 117, 115, 113, 113, - 114, 116, 115, 111, 109, 112, 114, 113, 111, 111, 112, 113, 113, 113, 114, - 114, 114, 114, 116, 116, 116, 116, 115, 115, 116, 116, 115, 115, 116, 115, - 115, 115, 116, 117, 118, 119, 120, 120, 121, 122, 124, 125, 127, -128, - -127, -125, -122, -121, -120, -119, -117, -117, 127, 102, 98, 119, 122, - 106, 95, 90, 96, 106, 110, 110, 114, 115, 110, 114, 125, -124, -128, 119, - 115, 120, 126, 124, 118, 114, 112, 112, 111, 111, 112, 112, 109, 107, 110, - 116, 117, 115, 114, 113, 116, 118, 116, 116, 117, 116, 115, 115, 117, 117, - 116, 111, 110, 112, 113, 113, 112, 110, 111, 113, 113, 113, 114, 115, 115, - 116, 115, 116, 116, 116, 115, 115, 116, 116, 115, 116, 115, 115, 116, 116, - 116, 117, 117, 118, 119, 120, 121, 121, 124, 125, 127, -128, -127, -125, - -124, -122, -121, -120, -118, -120, 119, 100, 107, 121, 116, 103, 96, 95, - 100, 109, 110, 111, 115, 113, 111, 116, 126, -127, 124, 117, 114, 121, - 125, 122, 116, 113, 111, 111, 112, 112, 113, 111, 107, 107, 112, 116, 117, - 114, 112, 113, 117, 117, 116, 115, 115, 115, 115, 115, 115, 115, 114, 111, - 111, 114, 115, 113, 111, 111, 112, 113, 113, 113, 114, 115, 114, 114, 115, - 115, 116, 116, 115, 116, 116, 117, 115, 115, 115, 116, 116, 115, 116, 117, - 118, 120, 120, 120, 121, 122, 123, 125, 127, -128, -128, -127, -125, -123, - -123, -124, -125, -126, 118, 105, 108, 118, 114, 105, 102, 99, 105, 112, - 111, 112, 116, 115, 113, 117, 122, 124, 122, 116, 114, 119, 121, 119, 115, - 113, 111, 112, 112, 112, 113, 112, 110, 111, 113, 116, 116, 114, 112, 113, - 116, 116, 115, 114, 114, 114, 115, 114, 113, 115, 114, 114, 113, 114, 114, - 113, 113, 112, 113, 114, 115, 113, 114, 114, 115, 116, 116, 116, 116, 116, - 117, 116, 117, 116, 115, 115, 115, 116, 116, 116, 117, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 127, -127, -126, -127, -127, -127, - -126, 125, 112, 107, 116, 117, 111, 108, 104, 105, 112, 113, 113, 116, - 117, 113, 114, 118, 120, 121, 118, 112, 114, 118, 118, 115, 113, 111, 112, - 114, 113, 114, 115, 113, 111, 113, 115, 115, 115, 113, 110, 113, 114, 113, - 114, 114, 113, 114, 115, 115, 117, 116, 115, 114, 114, 114, 113, 114, 113, - 113, 113, 113, 113, 114, 114, 114, 115, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 115, 116, 118, 117, 117, 117, 118, 118, 119, 120, 121, 122, - 123, 123, 125, 126, 127, 126, 126, 126, 125, 126, 127, 126, 120, 114, 112, - 117, 116, 112, 110, 108, 110, 115, 114, 114, 117, 116, 114, 115, 117, 118, - 118, 116, 113, 114, 116, 115, 115, 112, 112, 114, 115, 115, 114, 114, 113, - 114, 114, 114, 114, 114, 113, 112, 113, 114, 114, 114, 114, 114, 116, 117, - 115, 116, 116, 115, 115, 114, 114, 114, 115, 113, 113, 115, 115, 115, 115, - 115, 115, 116, 117, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 118, - 118, 117, 117, 117, 118, 119, 120, 120, 121, 121, 122, 123, 124, 124, 124, - 124, 123, 123, 123, 124, 124, 122, 119, 118, 117, 116, 117, 115, 113, 113, - 114, 113, 115, 115, 115, 115, 115, 115, 115, 116, 115, 114, 113, 113, 114, - 114, 113, 112, 114, 115, 114, 114, 113, 113, 115, 115, 113, 114, 114, 114, - 113, 113, 114, 114, 115, 114, 115, 116, 116, 115, 115, 115, 115, 115, 115, - 114, 115, 115, 114, 114, 115, 115, 115, 115, 115, 115, 117, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 117, 116, 116, 117, 117, 117, 117, 118, 119, - 119, 119, 120, 120, 122, 121, 121, 121, 121, 121, 121, 120, 121, 122, 121, - 121, 119, 118, 118, 119, 118, 117, 115, 116, 116, 115, 115, 115, 116, 116, - 115, 116, 115, 115, 115, 114, 114, 114, 114, 114, 113, 112, 115, 115, 113, - 114, 113, 114, 115, 115, 114, 114, 114, 113, 113, 114, 114, 114, 115, 114, - 114, 116, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 114, 115, 115, - 115, 116, 116, 116, 116, 115, 115, 116, 116, 116, 116, 116, 116, 117, 117, - 117, 116, 117, 117, 117, 117, 117, 117, 118, 118, 119, 118, 119, 120, 120, - 119, 119, 119, 120, 120, 119, 119, 119, 120, 119, 120, 119, 118, 118, 118, - 117, 117, 117, 117, 116, 116, 115, 117, 116, 115, 115, 115, 115, 115, 115, - 114, 115, 114, 114, 114, 114, 113, 113, 113, 113, 115, 114, 114, 113, 114, - 114, 115, 114, 114, 115, 115, 114, 114, 114, 114, 114, 115, 115, 115, 116, - 115, 115, 115, 115, 116, 115, 115, 115, 115, 116, 115, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 117, 117, 117, 117, 117, 117, - 118, 119, 118, 118, 118, 119, 119, 119, 118, 118, 118, 118, 118, 118, 119, - 119, 118, 118, 118, 119, 119, 119, 118, 117, 117, 117, 117, 117, 117, 116, - 116, 116, 116, 116, 116, 116, 115, 117, 116, 115, 114, 114, 114, 114, 114, - 114, 114, 116, 115, 114, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, - 116, 117, 115, 115, 116, 115, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 117, 117, 117, 117, 118, 117, 117, 117, 117, 117, 117, - 117, 118, 117, 118, 118, 119, 118, 118, 118, 118, 117, 117, 117, 117, 117, - 117, 117, 119, 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 117, 116, - 116, 116, 116, 116, 116, 116, 115, 115, 116, 115, 115, 115, 115, 115, 116, - 116, 116, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 116, 117, 115, - 115, 115, 116, 115, 115, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, - 118, 117, 117, 117, 117, 117, 117, 116, 116, 117, 117, 117, 118, 117, 117, - 117, 118, 117, 117, 117, 117, 117, 117, 118, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 116, 116, 118, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 115, 116, 116, 116, 115, 115, 115, 115, 116, 116, 116, 117, 116, 116, 115, - 115, 116, 115, 115, 115, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 118, 117, 117, 117, 117, 117, 117, - 117, 116, 116, 116, 117, 117, 116, 116, 116, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 117, 118, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 115, 115, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 117, 117, 117, 117, 118, 117, 116, 117, 117, 117, 117, - 116, 116, 116, 116, 117, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 118, 117, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 117, 117, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 118, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 117, 117, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116 - diff --git a/winsup/testsuite/winsup.api/devzero.c b/winsup/testsuite/winsup.api/devzero.c deleted file mode 100644 index 948b0bff5..000000000 --- a/winsup/testsuite/winsup.api/devzero.c +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#include -#include -#include - -int -main(int argc, char **argv) -{ - int fd, r, l; - char buf[1024]; - char *v; - - fd = open("/dev/zero", O_RDONLY); - if (fd < 0) - { - fprintf(stderr, "Unable to open /dev/zero for reading\n"); - perror("The error was"); - exit(1); - } - - l = read(fd, buf, 1024); - if (l != 1024) - { - fprintf(stderr, "Asked to read 1024 bytes, got %d\n", l); - exit(1); - } - - for (r=0; r<1024; r++) - if (buf[r] != 0) - { - fprintf(stderr, "/dev/zero returned a byte of %02x at offset %d\n", - buf[r], r); - exit(1); - } - - l = lseek(fd, 4096, 0); - if (l != 0) - { - fprintf(stderr, "l == %d\n", l); - exit(1); - } - - l = close(fd); - if (l != 0) - { - fprintf(stderr, "close: returned %d\n", l); - perror("The error was"); - exit(1); - } - - fd = open("/dev/zero", O_WRONLY); - if (fd < 0) - { - fprintf(stderr, "Unable to open /dev/zero for writing\n"); - perror("The error was"); - exit(1); - } - - l = write(fd, buf, 1024); - if (l != 1024) - { - fprintf(stderr, "Asked to write 1024 bytes, got %d\n", l); - exit(1); - } - - l = close(fd); - if (l != 0) - { - fprintf(stderr, "close: returned %d\n", l); - perror("The error was"); - exit(1); - } - - fd = open("/dev/zero", O_RDWR); - v = (char *)mmap(0, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); - if (v == (char *)-1) - { - fprintf(stderr, "mmap r/w /dev/zero failed\n"); - perror("The error was"); - exit(1); - } - - for (r=0; r<65536; r++) - if (v[r] != 0) - { - fprintf(stderr, "mmap'd r/w /dev/zero has byte %d at offset %d\n", - v[r], r); - exit(1); - } - munmap(v, 65536); - close(fd); - - fd = open("/dev/zero", O_RDONLY); - v = (char *)mmap(0, 65536, PROT_READ, MAP_SHARED, fd, 0); - if (v == (char *)-1) - { - fprintf(stderr, "mmap /dev/zero r/o failed\n"); - perror("The error was"); - exit(1); - } - - for (r=0; r<65536; r++) - if (v[r] != 0) - { - fprintf(stderr, "mmap'd r/o /dev/zero has byte %d at offset %d\n", - v[r], r); - exit(1); - } - munmap(v, 65536); - close(fd); - - exit(0); -} diff --git a/winsup/testsuite/winsup.api/iospeed.c b/winsup/testsuite/winsup.api/iospeed.c deleted file mode 100644 index 56bf715cf..000000000 --- a/winsup/testsuite/winsup.api/iospeed.c +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -int verbose = 0; - -void -v(char *fmt, ...) -{ - va_list ap; - if (!verbose) return; - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); -} - -#define TSIZE (1024 * 1024 * 16) - -unsigned long start_tic; - -void -start(FILE *f) -{ - fseek(f, 0, SEEK_SET); - start_tic = GetTickCount(); -} - -void -end() -{ - unsigned long end_tic = GetTickCount(); - printf("%6ld", end_tic - start_tic); -} - -void -test(int linesz, int cr) -{ - FILE *f = fopen("iospeed.dat", "wb"); - char buf[65536]; - int i, fd; - - memset(buf, 'x', linesz); - buf[linesz-1] = '\n'; - if (cr) - buf[linesz-2] = '\r'; - for (i=0; i 0); - end(); - - start(f); - while (fgets(buf, 64436, f)); - end(); - - f = fopen("iospeed.dat", "rb"); - fd = fileno(f); - - for (i=0; i 0); - end(); - - start(f); - while (fgets(buf, 64436, f)); - end(); - - printf("\n"); -} - -int -main(int argc, char **argv) -{ - if (argc > 1 && strcmp(argv[1],"-v") == 0) - verbose = 1; - - setbuf(stdout, 0); - - printf(" ----- text ----- ---- binary ----\n"); - printf("linesz cr getc fread fgets getc fread fgets\n"); - - test(4, 0); - test(64, 0); - test(4096, 0); - test(4, 1); - test(64, 1); - test(4096, 1); - - remove ("iospeed.dat"); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/known_bugs.tcl b/winsup/testsuite/winsup.api/known_bugs.tcl deleted file mode 100644 index e063ee6bb..000000000 --- a/winsup/testsuite/winsup.api/known_bugs.tcl +++ /dev/null @@ -1,4 +0,0 @@ -set xfail_list [list dup03 \ - fcntl05 setgroups01 setuid02 \ - ulimit01 unlink08 \ - sample-fail sample-miscompile] diff --git a/winsup/testsuite/winsup.api/ltp/access01.c b/winsup/testsuite/winsup.api/ltp/access01.c deleted file mode 100644 index ae9be948a..000000000 --- a/winsup/testsuite/winsup.api/ltp/access01.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : access01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for access(2) using F_OK, - * R_OK, W_OK and X_OK arguments. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 6 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) access(2) returns 0 for F_OK...(See Description) - * 2.) access(2) returns 0 for R_OK...(See Description) - * 3.) access(2) returns 0 for W_OK...(See Description) - * 4.) access(2) returns 0 for X_OK...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the access(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * access(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create a temp directory and cd to it. - * Creat a temp file wil read, write and execute permissions. - * - * Test: - * Loop if the proper options are given. - * Execute system call with F_OK on tmp file - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * Execute system call with X_OK on tmp file... - * Execute system call with W_OK on tmp file... - * Execute system call with R_OK on tmp file... - * - * Cleanup: - * Print errno log - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="access01"; /* Test program identifier. */ -int TST_TOTAL=4; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - -char Fname[255]; - - -/*********************************************************************** - * Main - ***********************************************************************/ -int main(int ac, char **av) -{ - struct test_case_t { - char *file; - unsigned mode; - const char *string; - int experrno; - } Test_cases[] = { - { Fname, F_OK, "F_OK", 0 }, - { Fname, X_OK, "X_OK", 0 }, - { Fname, W_OK, "W_OK", 0 }, - { Fname, R_OK, "R_OK", 0 }, - }; - - int Ntc = sizeof(Test_cases) / sizeof(struct test_case_t); - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int tc; - - TST_TOTAL=Ntc; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (tc=0; tc -#include -#include - - -#include "test.h" -#include "usctest.h" - - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -char *get_high_address(); - -const char *TCID="access03"; /* Test program identifier. */ -int TST_TOTAL=8; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={EFAULT, 0}; /* List must end with 0 */ - -int main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos. */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * R_OK on low pointer (-1) for path - */ - - - /* Call access(2) */ - TEST(access( (char *)-1,R_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char *)-1,R_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char *)-1,R_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char *)-1,R_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * W_OK on low pointer (-1) for path - */ - - - /* Call access(2) */ - TEST(access( (char *)-1,W_OK)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char *)-1,W_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char *)-1,W_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char *)-1,W_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * X_OK on low pointer (-1) for path - */ - - - /* Call access(2) */ - TEST(access( (char *)-1,X_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char*)-1,X_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char*)-1,X_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char*)-1,X_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * F_OK on low pointer (-1) for path - */ - - - /* Call access(2) */ - TEST(access( (char *)-1,F_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char*)-1,F_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char*)-1,F_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char*)-1,F_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * R_OK on high pointer (sbrk(0)+1) for path - */ - - - /* Call access(2) */ - TEST(access(get_high_address(),R_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char*)sbrk(0)+1,R_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,R_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,R_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * W_OK on high pointer (sbrk(0)+1) for path - */ - - - /* Call access(2) */ - TEST(access(get_high_address(),W_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char*)sbrk(0)+1,W_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,W_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,W_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * X_OK on high pointer (sbrk(0)+1) for path - */ - - - /* Call access(2) */ - TEST(access(get_high_address(),X_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access(high_address,X_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access(high_address,X_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access(high_address,X_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * F_OK on high pointer (sbrk(0)+1) for path - */ - - - /* Call access(2) */ - TEST(access(get_high_address(),F_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char*)sbrk(0)+1,F_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,F_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,F_OK) succeeded unexpectedly."); - - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make and change to a temporary directory */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove the temporary directory and exit with - return code appropriate for results */ - tst_rmdir(); - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/access04.c b/winsup/testsuite/winsup.api/ltp/access04.c deleted file mode 100644 index 069458886..000000000 --- a/winsup/testsuite/winsup.api/ltp/access04.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: access01 - * - * Test Description: - * Verify that access() succeeds to check the existance of a file if - * search access is permitted on the pathname of the specified file. - * - * Expected Result: - * access() should return 0 value and the specified file should exist - * on the file system. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * access01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTDIR "testdir" -#define TESTFILE "testdir/testfile" -#define DIR_MODE S_IRWXU | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="access01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* struct buffer for stat(2) */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call access(2) to check the existence of a - * file under specified path. - */ - TEST(access(TESTFILE, F_OK)); - - /* check return code of access(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, - "access(%s, F_OK) Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Use stat(2) to cross-check the - * existance of testfile under - * specified path. - */ - if (stat(TESTFILE, &stat_buf) < 0) { - tst_resm(TFAIL, "stat() on %s Failed, errno=%d", - TESTFILE, TEST_ERRNO); - } else { - tst_resm(TPASS, "Functionality of access(%s, " - "F_OK) successful", TESTFILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Create a temporary directory and change directory to it. - * Create a test directory and a file under test directory. - * Modify the mode permissions of testfile. - */ -void -setup() -{ - int fd; /* File handle for testfile */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Check that the test process id is not root/super-user */ - if (geteuid() == 0) { - tst_brkm(TBROK, NULL, "Must be non-root/super for this test!"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a test directory under temporary directory */ - if (mkdir(TESTDIR, DIR_MODE) < 0) { - tst_brkm(TBROK, cleanup, - "mkdir(%s, %#o) Failed, errno=%d : %s", - TESTDIR, DIR_MODE, errno, strerror(errno)); - } - - /* Make sure test directory has search permissions set */ - if (chmod(TESTDIR, DIR_MODE) < 0) { - tst_brkm(TBROK, cleanup, - "chmod(%s, %#o) Failed, errno=%d : %s", - TESTDIR, DIR_MODE, errno, strerror(errno)); - } - - /* Creat a test file under above directory created */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - /* Close the testfile created above */ - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Change the mode permissions on the testfile */ - if (chmod(TESTFILE, 0) < 0) { - tst_brkm(TBROK, cleanup, - "chmod(%s, 0) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Delete the test directory/file and temporary directory - * created in the setup. - */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/access05.c b/winsup/testsuite/winsup.api/ltp/access05.c deleted file mode 100644 index 757c64f33..000000000 --- a/winsup/testsuite/winsup.api/ltp/access05.c +++ /dev/null @@ -1,424 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: access03 - * - * Test Description: - * Verify that, - * 1. access() fails with -1 return value and sets errno to EACCES - * if the permission bits of the file mode do not permit the - * requested (Read/Write/Execute) access. - * 2. access() fails with -1 return value and sets errno to EINVAL - * if the specified access mode argument is invalid. - * 3. access() fails with -1 return value and sets errno to EFAULT - * if the pathname points outside allocate address space for the - * process. - * 4. access() fails with -1 return value and sets errno to ENOENT - * if the specified file doesn't exist (or pathname is NULL). - * 5. access() fails with -1 return value and sets errno to ENAMETOOLONG - * if the pathname size is > PATH_MAX characters. - * - * Expected Result: - * access() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * access03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define INV_OK -1 -#define TEST_FILE1 "test_file1" -#define TEST_FILE2 "test_file2" -#define TEST_FILE3 "test_file3" -#define TEST_FILE4 "test_file4" - -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -int no_setup(); -int setup1(); /* setup() to test access() for EACCES */ -int setup2(); /* setup() to test access() for EACCES */ -int setup3(); /* setup() to test access() for EACCES */ -int setup4(); /* setup() to test access() for EINVAL */ -int longpath_setup(); /* setup function to test access() for ENAMETOOLONG */ - -char Longpathname[PATH_MAX+2]; -char High_address_node[64]; - -struct test_case_t { /* test case structure */ - const char *pathname; - int a_mode; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { - { TEST_FILE1, R_OK, "Read Access denied on file", EACCES, setup1 }, - { TEST_FILE2, W_OK, "Write Access denied on file", EACCES, setup2 }, - { TEST_FILE3, X_OK, "Execute Access denied on file", EACCES, setup3 }, - { TEST_FILE4, INV_OK, "Access mode invalid", EINVAL, setup4 }, - { High_address_node, R_OK, "Address beyond address space", EFAULT, no_setup }, - { (char *)-1, R_OK, "Negative address", EFAULT, no_setup }, - { "", W_OK, "Pathname is empty", ENOENT, no_setup }, - { Longpathname, R_OK, "Pathname too long", ENAMETOOLONG, longpath_setup }, - { NULL, 0, NULL, 0, no_setup } -}; - -const char *TCID="access03"; /* Test program identifier. */ -int TST_TOTAL=8; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EACCES, EFAULT, EINVAL, ENOENT, ENAMETOOLONG, 0}; - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ -char *get_high_address (void); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *file_name; /* name of the testfile */ - const char *test_desc; /* test specific message */ - int access_mode; /* specified access mode for testfile */ - int ind; /* counter for testcase looping */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - file_name = Test_cases[ind].pathname; - access_mode = Test_cases[ind].a_mode; - test_desc = Test_cases[ind].desc; - - if (file_name == High_address_node) { - file_name = (char *)get_high_address(); - } - - /* - * Call access(2) to test different test conditions. - * verify that it fails with -1 return value and - * sets appropriate errno. - */ - TEST(access(file_name, access_mode)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "access() returned %d, " - "expected -1, errno:%d", TEST_RETURN, - Test_cases[ind].exp_errno); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - /* - * Call a function to verify whether - * the specified file has specified - * access mode. - */ - if (TEST_ERRNO == Test_cases[ind].exp_errno) { - tst_resm(TPASS, "access() fails, %s, errno:%d", - test_desc, TEST_ERRNO); - } else { - tst_resm(TFAIL, "access() fails, %s, errno:%d, " - "expected errno:%d", test_desc, - TEST_ERRNO, Test_cases[ind].exp_errno); - } - } /* Test Case Looping */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Create a temporary directory and change directory to it. - * Call individual test specific setup functions. - */ -void -setup() -{ - int ind; /* counter for testsetup functions */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Check that the test process id is not root/super-user */ - if (geteuid() == 0) { - tst_brkm(TBROK, NULL, "Must be non-root/super for this test!"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - Test_cases[ind].setupfunc(); - } -} - -/* - * no_setup() - some test conditions do not need any setup. - * Hence, this function simply returns 0. - */ -int -no_setup() -{ - return 0; -} - -/* - * setup1() - Setup function to test access() for return value -1 - * and errno EACCES when read access denied for specified - * testfile. - * - * Creat/open a testfile and close it. - * Deny read access permissions on testfile. - * This function returns 0. - */ -int -setup1() -{ - int fd1; /* file handle for testfile */ - - /* Creat a test file under above directory created */ - if ((fd1 = open(TEST_FILE1, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEST_FILE1, FILE_MODE, errno, strerror(errno)); - } - - /* Close the testfile created above */ - if (close(fd1) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - } - - /* Change mode permissions on testfile */ - if (chmod(TEST_FILE1, 0333) < 0) { - tst_brkm(TBROK, cleanup, "chmod() failed on %s, errno=%d", - TEST_FILE1, errno); - } - - return 0; -} - -/* - * setup2() - Setup function to test access() for return value -1 and - * errno EACCES when write access denied on testfile. - * - * Creat/open a testfile and close it. - * Deny write access permissions on testfile. - * This function returns 0. - */ -int -setup2() -{ - int fd2; /* file handle for testfile */ - - /* Creat a test file under above directory created */ - if ((fd2 = open(TEST_FILE2, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEST_FILE2, FILE_MODE, errno, strerror(errno)); - } - - /* Close the testfile created above */ - if (close(fd2) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - } - - /* Change mode permissions on testfile */ - if (chmod(TEST_FILE2, 0555) < 0) { - tst_brkm(TBROK, cleanup, "chmod() failed on %s, errno=%d", - TEST_FILE2, errno); - } - - return 0; -} - -/* - * setup3() - Setup function to test access() for return value -1 and - * errno EACCES when execute access denied on testfile. - * - * Creat/open a testfile and close it. - * Deny search access permissions on testfile. - * This function returns 0. - */ -int -setup3() -{ - int fd3; /* file handle for testfile */ - - /* Creat a test file under above directory created */ - if ((fd3 = open(TEST_FILE3, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEST_FILE3, FILE_MODE, errno, strerror(errno)); - } - - /* Close the testfile created above */ - if (close(fd3) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - TEST_FILE3, errno, strerror(errno)); - } - - /* Change mode permissions on testfile */ - if (chmod(TEST_FILE3, 0666) < 0) { - tst_brkm(TBROK, cleanup, "chmod() failed on %s, errno=%d", - TEST_FILE3, errno); - } - - return 0; -} - -/* - * setup4() - Setup function to test access() for return value -1 - * and errno EINVAL when specified access mode argument is - * invalid. - * - * Creat/open a testfile and close it. - * This function returns 0. - */ -int -setup4() -{ - int fd4; /* file handle for testfile */ - - /* Creat a test file under above directory created */ - if ((fd4 = open(TEST_FILE4, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEST_FILE4, FILE_MODE, errno, strerror(errno)); - } - - /* Close the testfile created above */ - if (close(fd4) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - TEST_FILE4, errno, strerror(errno)); - } - - return 0; -} - -/* - * longpath_setup() - setup to create a node with a name length exceeding - * the MAX. length of PATH_MAX. - */ -int -longpath_setup() -{ - int ind; - - for (ind = 0; ind <= (PATH_MAX + 1); ind++) { - Longpathname[ind] = 'a'; - } - - return 0; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Delete the test directory/file and temporary directory - * created in the setup. - */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/alarm01.c b/winsup/testsuite/winsup.api/ltp/alarm01.c deleted file mode 100644 index 187e488c9..000000000 --- a/winsup/testsuite/winsup.api/ltp/alarm01.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : alarm01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for alarm(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) alarm(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the alarm(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * alarm(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="alarm01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call alarm(2) - */ - TEST(alarm(1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - tst_resm(TFAIL, "alarm(1) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "alarm(1) returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - signal(SIGALRM, trapper); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -void -trapper(sig) -int sig; -{ - signal(SIGALRM, trapper); -} - diff --git a/winsup/testsuite/winsup.api/ltp/alarm02.c b/winsup/testsuite/winsup.api/ltp/alarm02.c deleted file mode 100644 index 03a41b4f7..000000000 --- a/winsup/testsuite/winsup.api/ltp/alarm02.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : alarm02 - * - * TEST TITLE : Boundary Value Test for alarm(2) - * - * PARENT DOCUMENT : almtds02 - * - * TEST CASE TOTAL : 3 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * BINARY LOCATION : CUTS_BIN/rf_tests/sys - * - * SOURCE LOCATION : CUTS_SRC/src/tests/sys - * - * AUTHOR : Billy Jean Horne - * - * CO-PILOT : Kathy Olmsted - * - * DATE STARTED : 06/01/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * Test Case One - A call to alarm() shall not return an error if - * seconds is a -1. - * Test FAILS if a non-zero value is returned. - * Test Case Two - A call to alarm() shall not return an error if - * seconds is the maximum unsigned integer (2**63). - * Test FAILS if a non-zero value is returned. - * Test Case Three - A call to alarm() shall not return an error if - * seconds is the maximum unsigned integer plus 1 ((2**63)+1). - * Test FAILS if a non-zero value is returned. - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * DETAILED DESCRIPTION - * - * Setup: - * Define a cleanup function. - * - * Test: - * Loop for each test case. - * Execute alarm (0) system call to clear previous alarm. - * Check return code, if system call failed (return=-1) - * Issue a BROK message and exit the test. - * Call alarm() with boundary values for seconds. - * Verify that returned value is as expected. - * Report results. - * - * Cleanup: - * - */ -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" /* required for usctest */ - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void alarm_received(); - - - -const char *TCID="alarm02"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_ * routines */ - -int received_alarm = 0; /* Indicates a SIGALRM was received */ - -/************************************************************ - * Main program - ***********************************************************/ - -int -main(int ac, char **av) -{ - - /* Parameters for usc code */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parameters for alarm test */ - const char *buf[] = { "-1", "ULONG_MAX", "ULONG_MAX+1"}; - unsigned long int sec[] = {-1, ULONG_MAX, ULONG_MAX+1}; - int exp[] = {0,0,0}; - int i; - - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - - setup(); - - /*************************************************************** - * check looping state - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - - Tst_count=0; - - for (i=0;i -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -const char *TCID="alarm03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call alarm(2) - */ - TEST(alarm(100)); - - switch ( fork()) { - case -1: - tst_brkm(TBROK, cleanup, "fork failed, errno:%d %s", - errno, strerror(errno)); - break; - - case 0: - TEST( alarm(0) ); - - if ( TEST_RETURN != 0 ) - tst_resm(TFAIL, - "alarm(100), fork, alarm(0) child's alarm returned %d", - TEST_RETURN); - else if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, - "alarm(100), fork, alarm(0) child's alarm returned %d", - TEST_RETURN); - - exit(0); - break; - - default: - Tst_count++; - TEST( alarm(0) ); - if ( TEST_RETURN <= 0 || TEST_RETURN > 100 ) - tst_resm(TFAIL, - "alarm(100), fork, alarm(0) parent's alarm returned %d", - TEST_RETURN); - - else if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, - "alarm(100), fork, alarm(0) parent's alarm returned %d", - TEST_RETURN); - - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - signal(SIGALRM, trapper); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -void -trapper(sig) -int sig; -{ - signal(SIGALRM, trapper); -} - diff --git a/winsup/testsuite/winsup.api/ltp/alarm07.c b/winsup/testsuite/winsup.api/ltp/alarm07.c deleted file mode 100644 index a9f269522..000000000 --- a/winsup/testsuite/winsup.api/ltp/alarm07.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: alarm03 - * - * Test Description: - * Check the functionality of the alarm() when the time input - * parameter is non-zero and the process does a fork. - * - * Expected Result: - * The alarm request should be cleared in the child process. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * - * Usage: - * alarm03 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID="alarm03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int almreceived = 0; /* flag to indicate SIGALRM received or not */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ -void sigproc(int sig); /* signal catching function */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int time_sec = 3; /* time for which alarm is set */ - int sleep_time = 5; /* waiting time for the SIGALRM signal */ - pid_t cpid; /* child process id */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call First alarm() with non-zero time parameter - * 'time_sec' to send SIGALRM to the process. - */ - TEST(alarm(time_sec)); - - /* Now, fork a child process */ - cpid = fork(); - if (cpid < 0) { - tst_resm(TFAIL, "fork() fails to create child, " - "errno:%d", errno); - } - - /* Wait for signal SIGALRM to be generated */ - sleep(sleep_time); - - if (STD_FUNCTIONAL_TEST) { - if (cpid == 0) { /* Child process */ - /* - * For child process if almreceived is 0 - * means alarm request is cleared. - */ - if (almreceived == 0) { - tst_resm(TPASS, "Functionality of " - "alarm(%u) successful", - time_sec); - } else { - tst_resm(TFAIL, "alarm request not " - "cleared in child, " - "almreceived:%d", almreceived); - } - } else { /* Parent process */ - /* Wait for child to complete execution */ - wait(0); - } - } else { - tst_resm(TPASS, "call returned %d", TEST_RETURN); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Setup signal handler to catch SIGALRM signal. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Set the signal catching function */ - if (signal(SIGALRM, sigproc) == SIG_ERR) { - tst_brkm(TFAIL, cleanup, - "signal() fails to catch SIGALARM, errno=%d", - errno); - } -} - - -/* - * sigproc(int) - This function defines the action that has to be taken - * when the SIGALRM signal is caught. - * It also sets the variable which is used to check whether the - * alarm system call was successful. - */ -void -sigproc(int sig) -{ - almreceived = almreceived + 1; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/asyncio02.c b/winsup/testsuite/winsup.api/ltp/asyncio02.c deleted file mode 100644 index 36c03b449..000000000 --- a/winsup/testsuite/winsup.api/ltp/asyncio02.c +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/************************************************************ - * OS Test - Silicon Graphics, Inc. - * Mendota Heights, Minnesota - * - * TEST IDENTIFIER: aiotcs02: write/close flushes data to the file - * - * PARENT DOCUMENT: aiotds01: kernel i/o - * - * AUTHOR: Barrie Kletscher - * - * CO-PILOT: Dave Baumgartner - * - * TEST ITEMS: - * for each open flags set used: - * 1. Multiple writes to a file work as specified for - * more than BUFSIZ bytes. - * 2. Multiple writes to a file work as specified for - * BUFSIZ bytes. - * 3. Multiple writes to a file work as specified for - * lower than BUFSIZ bytes. - * - * INPUT SPECIFICATIONS: - * Standard parse_opts supported options. - * - * OUTPUT SPECIFICATIONS - * Standard tst_res output format - * - * ENVIRONMENTAL NEEDS: - * This program uses the environment variable TMPDIR for the location - * of the temporary directory. - * - * - * SPECIAL PROCEDURAL REQUIREMENTS: - * The program must be linked with tst_*.o and parse_opts.o. - * - * INTERCASE DEPENDENCIES: - * NONE. - * - * DETAILED DESCRIPTION: - * Attempt to get some memory to work with. - * Call testrun writing (BUFSIZ + 1) bytes - * Call testrun writing BUFSIZ bytes - * Repeated call to testrun() with decreasing write sizes - * less than BUFSIZ - * End - * - * Start testrun() - * Attempt to open a temporary file. - * Write the memory to the file. - * Attempt to close the file which also flushes the buffers. - * Now check to see if the number of bytes written is the - * same as the number of bytes in the file. - * Cleanup - * - * BUGS: - * NONE. - * -************************************************************/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -#define FLAG O_RDWR | O_CREAT | O_TRUNC /* Flags used when opening temp tile */ -#define MODE 0777 /* Mode to open file with */ -#define WRITES 10 /* Number of times buffer is written */ -#define DECR 1000 /* Number of bytes decremented between */ - /* Calls to testrun() */ -#define OK -1 /* Return value from testrun() */ - -#define FNAME1 "aio02.1" -#define FNAME2 "aio02.2" -#define FNAME3 "aio02.3" - -#define ERR_MSG1 "Bytes in file not equal to bytes written." -#define ERR_MSG2 "Bytes in file (%d) not equal to bytes written (%d)." - -char *dp; /* pointer to area of memory */ - -void setup(); -void cleanup(void) __attribute__((noreturn)); -int testrun(int flag, int bytes, int ti); - -const char *TCID="asyncio02"; /* Test program identifier. */ -int TST_TOTAL=6; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* variable used to turn off tst_res buffering */ - -extern int errno; - -int exp_enos[]={0}; /* Array of expected errnos */ -char mesg[150]; -const char *filename; /* name of the temporary file */ - -char *Progname; -int Open_flags; - -int Flags[] = { - O_RDWR | O_CREAT | O_TRUNC, - O_RDWR | O_CREAT | O_TRUNC -}; - -int Num_flags; - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - - int i; /* counter */ - int ret_val; /* return value from testrun call */ - int eok; /* everything is ok flag */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int flag_cnt; - - Tst_nobuf=1; - Num_flags = sizeof(Flags)/sizeof(int); - TST_TOTAL= 3 * Num_flags; - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (flag_cnt=0; flag_cnt= 0; i -= DECR) { - if((ret_val = testrun(Flags[flag_cnt],i,3)) != OK) { - char output[80]; /* local output char string */ - - (void)sprintf(output,ERR_MSG2,ret_val,i*WRITES); - tst_resm(TFAIL,output); - } - } - - if ( eok && STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, - "Less than BUFSIZE bytes multiple synchronous writes to a file checks out ok"); - - } - } - cleanup(); - - return 0; -} /* end main() */ - -/*********************************************************** - * - * This function does the actual running of the tests. - * - ***********************************************************/ -int -testrun(int flag, int bytes, int ti) -{ - - void cleanup(); - - int fildes, /* temporary file's descriptor */ - i; /* counter */ - - int ret; - - struct stat buffer; /* buffer of memory required for stat command */ - - /* - * Attempt to open a temporary file. - */ - - if((fildes = open(filename,flag,MODE)) == -1) { - sprintf(mesg, "open failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - - /* - * Write the memory to the file. - */ - - for(i = 0; i < WRITES; i++) { - TEST( write(fildes,dp,(unsigned)bytes) ); - - if( TEST_RETURN == -1) { - sprintf(mesg, "write failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - } /* end for() */ - - /* - * Attempt to close the file which also flushes the buffers. - */ - - if(close(fildes) == -1) { - sprintf(mesg, "close failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - - ret=OK; - if ( STD_FUNCTIONAL_TEST ) { - - /* - * Now check to see if the number of bytes written is the - * same as the number of bytes in the file. - */ - - if(stat(filename,&buffer) == -1) { - sprintf(mesg, "stat failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - - - if(buffer.st_size != (off_t)(bytes * WRITES)) { - ret=(int)buffer.st_size; - } - } - - if ( unlink(filename) == -1 ) { - sprintf(mesg, "unlink failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - - return ret; - -} /* end testrun() */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - /* Indicate which errnos are expected */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* - * Attempt to get some memory to work with. - */ - - if((dp = (char *)malloc((unsigned)BUFSIZ+1)) == NULL) { - sprintf(mesg, "malloc failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - - -} /* End setup() */ - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/chdir02.c b/winsup/testsuite/winsup.api/ltp/chdir02.c deleted file mode 100644 index 552f912ac..000000000 --- a/winsup/testsuite/winsup.api/ltp/chdir02.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : chdir02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for chdir(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) chdir(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the chdir(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * chdir(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - -const char *TCID="chdir02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -const char *dirs[2] = { "/", "/tmp" }; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call chdir(2) - */ - TEST(chdir(dirs[lc%2])); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "chdir(%s) Failed, errno=%d : %s", dirs[lc%2], - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "chdir(%s) returned %d", dirs[lc%2], TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/chdir04.c b/winsup/testsuite/winsup.api/ltp/chdir04.c deleted file mode 100644 index da2b0ace9..000000000 --- a/winsup/testsuite/winsup.api/ltp/chdir04.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * chdir02.c - * - * DESCRIPTION - * Testcase to test whether chdir(2) sets errno correctly. - * - * ALGORITHM - * 1. Test for ENAMETOOLONG: - * Create a bad directory name with length more than - * - * VFS_MAXNAMELEN (Linux kernel variable), and attempt to - * chdir(2) to it. - * - * 2. Test for ENOENT: - * Attempt to chdir(2) on a non-existent directory - * - * 3. Test for EFAULT: - * Pass an address which lies outside the address space of the - * process, and expect an EFAULT. - * - * USAGE: - * chdir02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * NONE - */ - -#include -#include -#include -#include - -const char *TCID = "chdir02"; -int TST_TOTAL = 3; -extern int Tst_count; - -int exp_enos[] = {ENAMETOOLONG, ENOENT, EFAULT, 0}; - -char bad_dir[] = "abcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyz"; - -char noexist_dir[] = "/tmp/noexistdir"; - -struct test_case_t { - char *dname; - int error; -} TC[] = { - /* - * to test whether chdir() is setting ENAMETOOLONG if the - * directory is more than VFS_MAXNAMELEN - */ - {bad_dir, ENAMETOOLONG}, - - /* - * to test whether chdir() is setting ENOENT if the - * directory is not existing. - */ - {noexist_dir, ENOENT}, - - /* - * to test whether chdir() is setting EFAULT if the - * directory is an invalid address. - */ - {(void *)-1, EFAULT} -}; - -int flag; -#define FAILED 1 - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - int i; - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* set up the expected errnos */ - TEST_EXP_ENOS(exp_enos); - - /* check looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* loop through the test cases */ - for (i=0; i - * chmod01 [-c n] [-e] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define TESTFILE "testfile" - -const char *TCID="chmod01"; /* Test program identifier. */ -int TST_TOTAL=8; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Modes[] = {0, 07, 070, 0700, 0777, 02777, 04777, 06777}; - -void setup(); /* setup function for the test */ -void cleanup() __attribute__ ((noreturn));/* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat(2) struct contents */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int ind; /* counter variable for chmod(2) tests */ - unsigned mode; /* file mode permission */ - - TST_TOTAL = sizeof(Modes) / sizeof(int); - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - for (ind = 0; ind < TST_TOTAL; ind++) { - mode = Modes[ind]; - - /* - * Call chmod(2) with different mode permission - * bits to set it for "testfile". - */ - TEST(chmod(TESTFILE, mode)); - - /* check return code of chmod(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, - "chmod(%s, %#o) Failed, errno=%d : %s", - TESTFILE, mode, TEST_ERRNO, - strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the testfile information using - * stat(2). - */ - if (stat(TESTFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "stat(2) of " - "%s failed, errno:%d", - TESTFILE, TEST_ERRNO); - } - stat_buf.st_mode &= ~S_IFREG; - - /* - * Check for expected mode permissions - * on testfile. - */ - if (stat_buf.st_mode == mode) { - tst_resm(TPASS, "Functionality of " - "chmod(%s, %#o) successful", - TESTFILE, mode); - } else { - tst_resm(TFAIL, "%s: Incorrect " - "modes 0%03o, Expected 0%03o", - TESTFILE, stat_buf.st_mode, - mode); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and close it - */ -void -setup() -{ - int fd; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a test file under temporary directory and close it */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/chmod02.c b/winsup/testsuite/winsup.api/ltp/chmod02.c deleted file mode 100644 index 8026768ae..000000000 --- a/winsup/testsuite/winsup.api/ltp/chmod02.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : chmod02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for chmod(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 8 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) chmod(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the chmod(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * chmod(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="chmod02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char fname[255]; -const char *buf = "file contents\n"; - -int Modes[] = {0, 07, 070, 0700, 0777, 02777, 04777, 06777}; - - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int ind; - int mode; - - TST_TOTAL = sizeof(Modes) / sizeof(int); - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind=0; ind -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="chown01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd, uid, gid; -const char *buf = "davef"; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call chown(2) - */ - TEST(chown(fname, uid,gid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "chown(%s, %d,%d) Failed, errno=%d : %s", fname, uid, gid, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "chown(%s, %d,%d) returned %d", fname, uid, gid, TEST_RETURN); - } - } /* end else */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* create a temp dir and cd to it. */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* set uid and gid */ - uid=geteuid(); - gid=getegid(); - - sprintf(fname,"t_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (write(fd, &buf, strlen(buf)) == -1) { - tst_brkm(TBROK, cleanup, "write(%s, &buf, strlen(buf)) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove temp dir and files */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/close01.c b/winsup/testsuite/winsup.api/ltp/close01.c deleted file mode 100644 index 4d4059823..000000000 --- a/winsup/testsuite/winsup.api/ltp/close01.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * close01.c - * - * DESCRIPTION - * Test that closing a regular file and a pipe works correctly - * - * ALGORITHM - * Creat a file, and dup() a fildes - * Open a pipe - * call close() using the TEST macro - * if the call fails - * issue a FAIL message and continue - * else if STD_FUNCTIONAL_TEST - * attempt to close the file/pipe again - * if there is an error - * issue a PASS message - * else - * issue a FAIL message - * else - * issue a PASS message - * - * - * USAGE: - * close01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "close01()"; -int TST_TOTAL = 2; -extern int Tst_count; - -char fname[40] = ""; - -int fild = -1; -int newfd = -1; -int pipefildes[2]; - -struct test_case_t { - int *fd; - const char *type; -} TC[] = { - /* file descriptor for a regular file */ - {&newfd, "file"}, - - /* file descriptor for a pipe */ - {&pipefildes[0], "pipe"} -}; - -int -main(int ac, char **av) -{ - - int i; - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* set up the file and pipe for the test */ - if ((fild = creat(fname, 0777)) == -1) { - perror (fname); - tst_brkm(TBROK, cleanup, "can't open file %s", fname); - } - - if ((newfd = dup(fild)) == -1) { - tst_brkm(TBROK, cleanup, "can't dup the file des"); - } - - if (pipe(pipefildes) == -1) { - tst_brkm(TBROK, cleanup, "can't open pipe"); - } - - /* loop through the test cases */ - - for (i = 0; i < TST_TOTAL; i++) { - - TEST(close(*TC[i].fd)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "call failed unexpectedly"); - continue; - } - - if (STD_FUNCTIONAL_TEST) { - /* attempt to close the fd again */ - if (close(*TC[i].fd) == -1) { - tst_resm(TPASS, "%s appears closed", - TC[i].type); - } else { - tst_resm(TFAIL, "%s close succeeded on" - "second attempt", TC[i].type); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - int mypid; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - mypid = getpid(); - sprintf(fname, "fname.%d", mypid); -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - if (fild >= 0) - close (fild); - if (newfd >= 0) - close (newfd); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/close02.c b/winsup/testsuite/winsup.api/ltp/close02.c deleted file mode 100644 index 72ecf8181..000000000 --- a/winsup/testsuite/winsup.api/ltp/close02.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * close02.c - * - * DESCRIPTION - * Check that an invalid file descriptor returns EBADF - * - * ALGORITHM - * loop if that option is specified - * call close using the TEST macro and passing in an invalid fd - * if the call succeedes - * issue a FAIL message - * else - * log the errno - * if the errno == EBADF - * issue a PASS message - * else - * issue a FAIL message - * cleanup - * - * USAGE: - * close02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -int exp_enos[] = {EBADF, 0}; - -const char *TCID = "close02()"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup */ - - /* set up expected errnos */ - TEST_EXP_ENOS(exp_enos); - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(close(-1)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "Closed a non existent fildes"); - } else { - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO != EBADF) { - tst_resm(TFAIL, "close() FAILED to set errno " - "to EBADF on an invalid fd, got %d", - errno); - } else { - tst_resm(TPASS, "call returned EBADF"); - } - } - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/close08.c b/winsup/testsuite/winsup.api/ltp/close08.c deleted file mode 100644 index 3fbcc3be8..000000000 --- a/winsup/testsuite/winsup.api/ltp/close08.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : close08 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for close(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) close(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the close(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * close(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="close08"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } - /* - * Call close(2) - */ - TEST(close(fd)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "close(%s) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "close(%s) returned %d", fname, TEST_RETURN); - } - } - - if (unlink(fname) == -1) { - tst_brkm(TBROK, cleanup, "unlink(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/creat01.c b/winsup/testsuite/winsup.api/ltp/creat01.c deleted file mode 100644 index 6f891701e..000000000 --- a/winsup/testsuite/winsup.api/ltp/creat01.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * creat01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the creat(2) system call. - * - * ALGORITHM - * 1. creat() a file using 0444 mode, write to the fildes, write - * should return a positive count. - * - * 2. creat() should truncate a file to 0 bytes if it already - * exists, and should not fail. - * - * USAGE: - * creat01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(void); -void cleanup(void) __attribute__((noreturn)); -void functest1(void); -void functest2(void); - -const char *TCID = "creat01"; -int TST_TOTAL = 2; -extern int Tst_count; - -char filename[40]; - -#define MODE1 0644 -#define MODE2 0444 - -struct test_case_t { - char *fname; - int mode; - void (*functest)(); -} TC[] = { - /* creat() the file and write to it */ - {filename, MODE1, functest1}, - - /* creat() the same file and check that it is now 0 length */ - {filename, MODE2, functest2} -}; - -int -main(int ac, char **av) -{ - int i; - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* set "tstdir", and "testfile" variables */ - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* loop through the test cases */ - - for (i=0; i= 0) { - close(TEST_RETURN); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * functest1() - check the functionality of the first test by making sure - * that a write to the file succeeds - */ -void -functest1() -{ - if (write(TEST_RETURN, "A", 1) != 1) { - tst_resm(TFAIL, "write was unsuccessful"); - } else { - tst_resm(TPASS, "file was created and written to successfully"); - } -} - -/* - * functest2() - check the functionality of the second test by making sure - * that the file is now 0 length - */ -void -functest2() -{ - struct stat buf; - - if (stat(filename, &buf) < 0) { - tst_brkm(TBROK, cleanup, "failed to stat test file"); - /*NOTREACHED*/ - } - if (buf.st_size != 0) { - tst_resm(TFAIL, "creat() FAILED to truncate " - "file to zero bytes"); - } else { - tst_resm(TPASS, "creat() truncated existing file to 0 bytes"); - } -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - if (geteuid() == 0) { - tst_brkm(TBROK, tst_exit, "Must not run this as root"); - /*NOTREACHED*/ - } - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; - - tst_tmpdir(); - - sprintf(filename, "creat01.%d", getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - unlink(filename); - - /* delete the test directory created in setup() */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/creat03.c b/winsup/testsuite/winsup.api/ltp/creat03.c deleted file mode 100644 index 2ca21f1e0..000000000 --- a/winsup/testsuite/winsup.api/ltp/creat03.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * creat03.c - * - * DESCRIPTION - * Testcase to check whether the sticky bit cleared. - * - * ALGORITHM - * Creat a new file, fstat.st_mode should have the 01000 bit off - * - * USAGE: - * creat03 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "creat03"; /* Test program identifier */ -int TST_TOTAL = 1; /* Total number of test cases */ -extern int Tst_count; /* Test case counter */ - -char pfilname[40] = ""; -#define FMODE 0444 - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - struct stat statbuf; - unsigned short filmode; - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(creat(pfilname, FMODE)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "Cannot creat %s", pfilname); - continue; - /*NOTREACHED*/ - } - - if (STD_FUNCTIONAL_TEST) { - if (fstat(TEST_RETURN, &statbuf) == -1) { - tst_brkm(TBROK, cleanup, "fstat() failed"); - } - filmode = statbuf.st_mode; - tst_resm(TINFO, "Created file has mode = 0%o", filmode); - if ((filmode & S_ISVTX) != 0) { - tst_resm(TFAIL, "save text bit not cleared"); - } else { - tst_resm(TPASS, "save text bit cleared"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - if (TEST_RETURN >= 0) { - close(TEST_RETURN); - } - - /* clean up things in case we are looping */ - if (unlink(pfilname) == -1) { - tst_brkm(TBROK, cleanup, "couldn't remove file"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - sprintf(pfilname, "./creat4.%d", getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit - */ -void -cleanup(void) -{ - TEST_CLEANUP; - - /* remove the tmp dir and all its files */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/creat09.c b/winsup/testsuite/winsup.api/ltp/creat09.c deleted file mode 100644 index c3c88a7c6..000000000 --- a/winsup/testsuite/winsup.api/ltp/creat09.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : creat09 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for creat(2) using 0700 argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) creat(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the creat(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * creat(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="creat09"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - ******************************************* - * Call creat(2) with 0700 argument on fname - ******************************************* - */ - TEST(creat(fname, 0700)); - - /* check return code */ - - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "creat(%s, 0700) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "creat(%s, 0700) returned %d", fname, TEST_RETURN); - } - } - - /* close and remove file, possibly for next loop */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } else if (unlink(fname) == -1) { - tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/dup01.c b/winsup/testsuite/winsup.api/ltp/dup01.c deleted file mode 100644 index 521df6a78..000000000 --- a/winsup/testsuite/winsup.api/ltp/dup01.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : dup01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for dup(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) dup(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the dup(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * dup(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - -const char *TCID="dup01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255]; -int Fd; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call dup(2) - */ - TEST( dup(Fd) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "dup(%s) Failed, errno=%d : %s", Fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "dup(%s) returned %d", Fname, TEST_RETURN); - } - - /* close the new file so loops do not open too many files */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* - * Initialize Fd in case we get a quick signal - */ - Fd=-1; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname, "dupfile"); - if ((Fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the open file we've been dup'ing */ - if (Fd != -1) { - if (close(Fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - Fd=-1; - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/dup02.c b/winsup/testsuite/winsup.api/ltp/dup02.c deleted file mode 100644 index ee759b89b..000000000 --- a/winsup/testsuite/winsup.api/ltp/dup02.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : dup02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Negative test for dup(2) with bad fd. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 06/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1-?.) dup(2) returns -1 with errno set to EBADF...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * Standard tst_res formatted output - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Loop through the test cases - * Execute system call - * Check return code, if system call failed (return=-1) - * if doing functional check - * check if errno set correctly, report results - * Otherwise, Issue a FAIL message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - -const char *TCID="dup02"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int Fds[] = { -1, 1500 }; - - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int nfds = sizeof(Fds) / sizeof(int); - int ind; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind=0; ind -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="dup03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - -char Fname[255]; -int *Fd = NULL; -int Nfds=0; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call dup(2) - */ - TEST( dup(Fd[0]) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == EMFILE ) { - tst_resm(TPASS, "dup(%d) Failed, errno=%d : %s", Fd[0], - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, "dup(%d) Failed, errno=%d %s, expected %d (EMFILE)", - Fd[0], TEST_ERRNO, strerror(TEST_ERRNO), EMFILE); - } - } - } else { - tst_resm(TFAIL, "dup(%d) returned %d, expected -1, errno:%d (EMFILE)", - Fd[0], TEST_RETURN, EMFILE); - - /* close the new file so loops do not open too many files */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - long maxfds; - - /* - * Initialize Fd in case we get a quick signal - */ - maxfds = sysconf(_SC_OPEN_MAX); - if (maxfds < 1) { - tst_brkm(TBROK, cleanup, - "sysconf(_SC_OPEN_MAX) Failed, errno=%d : %s", - errno, strerror(errno)); - } - - Fd = (int *)malloc(maxfds*sizeof(int)); - Fd[0]=-1; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* - * open the file as many times as it takes to use up all fds - */ - sprintf(Fname, "dupfile"); - for (Nfds=1; Nfds<=maxfds; Nfds++) { - if ((Fd[Nfds-1] = open(Fname,O_RDWR|O_CREAT,0700)) == -1) { - - Nfds--; /* on a open failure, decrement the counter */ - if ( errno == EMFILE ) { - break; - } - else { /* open failed for some other reason */ - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - } - - /* - * make sure at least one was open and that all fds were opened. - */ - if ( Nfds == 0 ) { - tst_brkm(TBROK, cleanup, "Unable to open at least one file"); - } - if ( Nfds > maxfds ) { - tst_brkm(TBROK, cleanup, - "Unable to open enough files to use all file descriptors, tried %d", - maxfds); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the open file we've been dup'ing */ - if (Fd) { - while (Nfds-- >0) { - if (close(Fd[Nfds]) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - Fd[Nfds]=-1; - } - free(Fd); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/dup04.c b/winsup/testsuite/winsup.api/ltp/dup04.c deleted file mode 100644 index 1c4eaf188..000000000 --- a/winsup/testsuite/winsup.api/ltp/dup04.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : dup04 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for dup(2) of a system pipe descriptor - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 06/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) dup(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the dup(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * dup(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - -const char *TCID="dup04"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int Fd[2]; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call dup(2) for read side - */ - TEST( dup(Fd[0]) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "dup(%d) read side of syspipe Failed, errno=%d : %s", Fd[0], - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "dup(%d) read side of syspipe returned %d", Fd[0], - TEST_RETURN); - - } - else - Tst_count++; - - /* close the new file so loops do not open too many files */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, "close(%d) Failed, errno=%d : %s", - TEST_RETURN, errno, strerror(errno)); - } - } - - /* - * Call dup(2) for write side - */ - TEST( dup(Fd[1]) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "dup(%d) write side of syspipe Failed, errno=%d : %s", Fd[1], - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "dup(%d) write side of syspipe returned %d", Fd[1], - TEST_RETURN); - - } - else - Tst_count++; - - /* close the new file so loops do not open too many files */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, "close(%d) Failed, errno=%d : %s", - TEST_RETURN, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* - * Initialize Fd in case we get a quick signal - */ - Fd[0]=-1; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - if ( pipe(Fd) == -1 ) { - tst_brkm(TBROK, cleanup, "pipe(&Fd) Failed, errno=%d : %s", - errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - int ind; - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the open file we've been dup'ing */ - if (Fd[0] != -1) { - for (ind=0; ind<2; ind++) { - if (close(Fd[ind]) == -1) { - tst_resm(TWARN, "close(%d) Failed, errno=%d : %s", - Fd[ind], errno, strerror(errno)); - } - Fd[ind]=-1; - } - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/dup05.c b/winsup/testsuite/winsup.api/ltp/dup05.c deleted file mode 100644 index 097688353..000000000 --- a/winsup/testsuite/winsup.api/ltp/dup05.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : dup05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for dup(2) of a named pipe descriptor - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 06/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) dup(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the dup(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * dup(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - -const char *TCID="dup05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255]; -int Fd; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call dup(2) - */ - TEST( dup(Fd) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "dup(%s) Failed, errno=%d : %s", Fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "dup(%s) returned %d", Fname, TEST_RETURN); - } - - /* close the new file so loops do not open too many files */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* - * Initialize Fd in case we get a quick signal - */ - Fd=-1; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname, "dupfile"); - if ( mkfifo(Fname, 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "mkfifo(%s, 0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - if ((Fd = open(Fname, O_RDWR, 0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR, 0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the open file we've been dup'ing */ - if (Fd != -1) { - if (close(Fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - Fd=-1; - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execl01.c b/winsup/testsuite/winsup.api/ltp/execl01.c deleted file mode 100644 index f91b0a820..000000000 --- a/winsup/testsuite/winsup.api/ltp/execl01.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execl01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execl(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="execl01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ - - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execl from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execl(2) */ - execl("test", "test", NULL); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execl - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execl.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execle01.c b/winsup/testsuite/winsup.api/ltp/execle01.c deleted file mode 100644 index ca2cdec4e..000000000 --- a/winsup/testsuite/winsup.api/ltp/execle01.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execle01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execle(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execle(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execle(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execle(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="execle01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ -extern char **environ; /* pointer to this processes env, to pass along */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execle from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execle(2) */ - execle("test", "test", NULL, environ); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execle - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execle.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execlp01.c b/winsup/testsuite/winsup.api/ltp/execlp01.c deleted file mode 100644 index c3f8b2147..000000000 --- a/winsup/testsuite/winsup.api/ltp/execlp01.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execlp01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execlp(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execlp(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execlp(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execlp(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="execlp01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execlp from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execlp(2) */ - execlp("/usr/bin/test", "/usr/bin/test", NULL); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execlp - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execlp.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execv01.c b/winsup/testsuite/winsup.api/ltp/execv01.c deleted file mode 100644 index f59f29702..000000000 --- a/winsup/testsuite/winsup.api/ltp/execv01.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execv01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execv(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execv(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execv(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execv(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -void cleanup(); - -const char *TCID="execv01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ -const char * const args[2]={"/usr/bin/test", 0}; /* argument list for execv call */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execv from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execv(2) */ - execv("/usr/bin/test", args); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execv - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execv.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execve01.c b/winsup/testsuite/winsup.api/ltp/execve01.c deleted file mode 100644 index 2584bdf05..000000000 --- a/winsup/testsuite/winsup.api/ltp/execve01.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execve01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execve(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execve(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execve(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execve(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="execve01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ -const char *const args[2]={"/usr/bin/test", 0}; /* argument list for execve call */ -extern char **environ; /* pointer to this processes env, to pass along */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execve from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execve(2) */ - execve("/usr/bin/test", args, environ); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execve - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execve.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execvp01.c b/winsup/testsuite/winsup.api/ltp/execvp01.c deleted file mode 100644 index 8a1726a21..000000000 --- a/winsup/testsuite/winsup.api/ltp/execvp01.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execvp01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execvp(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execvp(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execvp(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execvp(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="execvp01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ -const char *const args[2]={"/usr/bin/test", 0}; /* argument list for execvp call */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execvp from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execvp(2) */ - execvp("/usr/bin/test", args); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execvp - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execvp.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/exit01.c b/winsup/testsuite/winsup.api/ltp/exit01.c deleted file mode 100644 index 74e6c093b..000000000 --- a/winsup/testsuite/winsup.api/ltp/exit01.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * exit01.c - * - * DESCRIPTION - * Check that exit returns the correct values to the waiting parent - * - * ALGORITHM - * Fork a process that immediately calls exit() with a known - * value. Check for that value in the parent. - * - * USAGE - * exit01 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "exit01"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int pid, npid, sig, nsig, exno, nexno, status; - int rval = 0; - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSIkNG ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup for test */ - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count = 0; - - sig = 0; - exno = 1; - - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork failed, errno=%d", - errno, strerror(errno)); - } - - if (pid == 0) { /* parent */ - exit(exno); - } else { - sleep(1); /* let child start */ - npid = wait(&status); - - if (npid != pid) { - tst_resm(TFAIL, "wait error: " - "unexpected pid returned"); - rval = 1; - } - - nsig = status % 256; - - /* - * Check if the core dump bit has been set, bit # 7 - */ - if (nsig >= 128) { - nsig = nsig - 128; - } - - /* - * nsig is the signal number returned by wait - */ - if (nsig != sig) { - tst_resm(TFAIL, "wait error: " - "unexpected signal returned"); - rval = 1; - } - - /* - * nexno is the exit number returned by wait - */ - nexno = status / 256; - if (nexno != exno) { - tst_resm(TFAIL, "wait error: " - "unexpected exit number returned"); - rval = 1; - } - } - - if (rval != 1) { - tst_resm(TPASS, "exit() test PASSED"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/exit02.c b/winsup/testsuite/winsup.api/ltp/exit02.c deleted file mode 100644 index 1503106e9..000000000 --- a/winsup/testsuite/winsup.api/ltp/exit02.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * exit02.c - * - * DESCRIPTION - * Check that exit flushes output file buffers and closes files upon - * exitting - * - * ALGORITHM - * Fork a process that creates a file and writes a few bytes, and - * calls exit WITHOUT calling close(). The parent then reads the - * file. If everything that was written is present in the file, then - * the test passes. - * - * USAGE - * exit02 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "exit02"; -int TST_TOTAL = 1; -extern int Tst_count; - -#define READ 0 -#define WRITE 1 -#define MODE 0666 - -char filen[40]; - -int -main(int ac, char **av) -{ - int pid, npid, sig, nsig, exno, nexno, status; - int filed; - char wbuf[BUFSIZ], rbuf[BUFSIZ]; - int len, rlen; - int rval = 0; - char *strcpy(); - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup for test */ - - /* - * The following loop checks looping state if -i option given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - strcpy(wbuf, "abcd"); - len = strlen(wbuf); - - exno = sig = 0; - - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork failed, error no = %d", - errno, strerror(errno)); - } - - if (pid == 0) { /* child */ - sleep(1); - if ((filed = creat(filen, MODE)) == -1) { - tst_resm(TINFO, "creat error: unable to" - "open output file"); - exit(2); - } - if (write(filed, wbuf, len) != len) { - tst_resm(TINFO, "write error"); - exit(2); - } - close(filed); - exit(exno); - } else { /* parent */ - npid = wait(&status); - - if (npid != pid) { - tst_resm(TFAIL, "wait error: " - "unexpected pid returned"); - rval = 1; - } - - nsig = status % 256; - - /* - * to check if the core dump bit has been - * set, bit # 7 - */ - if (nsig >= 128) - nsig = nsig - 128; - - /* - * nsig is the signal number returned by - * wait - */ - if (nsig != sig) { - tst_resm(TFAIL, "wait error: unexpected " - "signal returned %d", nsig); - rval = 1; - } - - /* - * nexno is the exit number returned by wait - */ - nexno = status / 256; - if (nexno != exno) { - tst_resm(TFAIL, "wait error: unexpected exit " - "number %d", nexno); - rval = 1; - } - - sleep(2); /* let child's exit close opened file */ - - filed = open(filen, O_RDONLY, READ); - if (filed == -1) { - tst_resm(TFAIL, "open error: " - "unable to open input file"); - rval = 1; - } else { - rlen = read(filed, rbuf, len); - if (len != rlen) { - tst_resm(TFAIL, "exit error: file " - "buffer was not flushed"); - rval = 1; - } else if (memcmp(rbuf, wbuf, rlen) != 0) { - tst_resm(TFAIL, "exit error: file " - "buffer was not flushed"); - rval = 1; - } - } - close(filed); - unlink(filen); - } - if (!rval) { - tst_resm(TPASS, "exit() test PASSED"); - } - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - perform all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - sprintf(filen, "tfile_%d",getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* - * Remove tmp dir and all files in it - */ - tst_rmdir(); - - /* - * exit with return code appropriate for results - */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fchdir01.c b/winsup/testsuite/winsup.api/ltp/fchdir01.c deleted file mode 100644 index bd70c01b3..000000000 --- a/winsup/testsuite/winsup.api/ltp/fchdir01.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * fchdir01.c - * - * DESCRIPTION - * fchdir01 - create a directory and cd into it. - * - * ALGORITHM - * create a new directory - * open the directory and get a file descriptor - * loop if that option was specified - * fchdir() into the directory - * check the return code - * if failure, issue a FAIL message. - * otherwise, - * if doing functionality testing, call check_functionality() - * if correct, - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE: - * fchdir01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 03/2001 - Written by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include "test.h" -#include "usctest.h" - -#include -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "fchdir01"; -int TST_TOTAL = 1; -extern int Tst_count; - -int fd = -1; -char temp_dir_buf [PATH_MAX]; -char* temp_dir; -const char *TEST_DIR = "alpha"; - -#define MODES S_IRWXU - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - void check_functionality(void); - int r_val; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* get the name of the test dirctory */ - if ((temp_dir = (getcwd(temp_dir_buf, sizeof (temp_dir_buf)))) == NULL) { - tst_brkm(TBROK, cleanup, "%s - getcwd() in main() " - "failed", TCID); - } - - /* - * create a new directory and open it - */ - - if ((r_val = mkdir(TEST_DIR, MODES)) == -1){ - tst_brkm(TBROK, cleanup, "%s - mkdir() in main() " - "failed", TCID); - } - - if ((fd = open(TEST_DIR, O_RDONLY)) == -1) { - tst_brkm(TBROK, cleanup, "open of directory failed"); - } - - /* - * Use TEST macro to make the call - */ - - TEST(fchdir(fd)); - - if (TEST_RETURN == -1) { - tst_brkm(TFAIL, cleanup, "%s call failed - errno = %d :" - " %s", TCID, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - if (STD_FUNCTIONAL_TEST) { - check_functionality(); - } else { - tst_resm(TPASS, "call succeeded"); - } - } - - /* - * clean up things in case we are looping - */ - - /* - * NOTE: in case of failure here, we need to use "tst_resm()" - * and not "tst_brkm()". This is because if we get to this - * point, we have already set a PASS or FAIL for the test - * and "tst_brkm()" won't report as we might expect. - */ - - /* chdir back to our temporary work directory */ - if ((r_val = chdir("..")) == -1){ - tst_resm(TBROK, "fchdir failed - errno = %d : %s", - errno, strerror(errno)); - } - - if ((r_val = rmdir(TEST_DIR)) == -1){ - tst_resm(TBROK, "rmdir failed - errno = %d : %s", - errno, strerror(errno)); - } - - /* - * clean up things in case we are looping - */ - /* free(temp_dir); */ - temp_dir = NULL; - } - - cleanup(); - - /*NOTREACHED*/ -} - -/* - * check_functionality() - check that we are in the correct directory. - */ -void -check_functionality(void) -{ - char buf [PATH_MAX]; - char *cwd; - char **bufptr = &cwd; - char *dir; - - /* - * Get the current directory path. - */ - if ((cwd = (getcwd(buf, sizeof (buf)))) == NULL) { - tst_brkm(TBROK, cleanup, "%s - getcwd() in " - "check_functionality() failed", TCID); - } - - /* - * strip off all but the last directory name in the - * current working directory. - */ - do { - if ((dir = strsep(bufptr, "/")) == NULL) { - tst_brkm(TBROK, cleanup, "%s - strsep() in " - "check_functionality() failed", TCID); - } - } while(*bufptr != NULL); - - /* - * Make sure we are in the right place. - */ - if (strcmp(TEST_DIR, dir) == 0) { - tst_resm(TPASS, "%s call succeeded", TCID); - } else { - tst_resm(TFAIL, "%s functionality test failed", TCID); - } -} - -/* - * setup() - performs all the ONE TIME setup for this test. - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* create a test directory and cd into it */ - tst_tmpdir(); -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - if (fd >= 0) - close (fd); - - /* remove the test directory */ - tst_rmdir(); - - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/fchdir02.c b/winsup/testsuite/winsup.api/ltp/fchdir02.c deleted file mode 100644 index 4e1d9e74a..000000000 --- a/winsup/testsuite/winsup.api/ltp/fchdir02.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * fchdir02.c - * - * DESCRIPTION - * fchdir02 - try to cd into a bad directory (bad fd). - * - * CALLS - * fchdir() - * - * ALGORITHM - * loop if that option was specified - * call fchdir() with an invalid file descriptor - * check the errno value - * issue a PASS message if we get EBADF - errno 9 - * otherwise, the tests fails - * issue a FAIL message - * break any remaining tests - * call cleanup - * - * USAGE: - * fchdir02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 03/2001 - Written by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include "test.h" -#include "usctest.h" - -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "fchdir02"; -int TST_TOTAL = 1; -extern int Tst_count; - -int exp_enos[] = {9, 0}; /* 0 terminated list of expected errnos */ - -int -main(int ac, char **av) -{ - const int bad_fd = -5; - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* - * Look for a failure by using an invalid number for fd - */ - - TEST(fchdir(bad_fd)); - - if (TEST_RETURN != -1) { - tst_brkm(TFAIL, cleanup, "call succeeded with bad " - "file descriptor"); - } - - TEST_ERROR_LOG(TEST_ERRNO); - - switch(TEST_ERRNO) { - case EBADF: - tst_resm(TPASS, "expected failure - errno = %d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - break; - default: - tst_brkm(TFAIL, cleanup, "call failed with an " - "unexpected error - %d : %s", TEST_ERRNO, - strerror(TEST_ERRNO)); - } - } - - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all the ONE TIME setup for this test. - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* create a test directory and cd into it */ - tst_tmpdir(); - - /* Set up the expected error numbers for -e option */ - TEST_EXP_ENOS(exp_enos); -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* remove the test directory */ - tst_rmdir(); - - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/fchmod01.c b/winsup/testsuite/winsup.api/ltp/fchmod01.c deleted file mode 100644 index e2db7162a..000000000 --- a/winsup/testsuite/winsup.api/ltp/fchmod01.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fchmod01 - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fchmod(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fchmod(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fchmod(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fchmod01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -const char *buf = "davef"; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fchmod(2) - */ - TEST(fchmod(fd, 0700)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fchmod(%s, 0700) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fchmod(%s, 0700) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (write(fd, &buf, strlen(buf)) == -1) { - tst_brkm(TBROK, cleanup, "write(%s, &buf, strlen(buf)) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the open file wev'e been chmoding */ - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/fchown01.c b/winsup/testsuite/winsup.api/ltp/fchown01.c deleted file mode 100644 index d692bfc74..000000000 --- a/winsup/testsuite/winsup.api/ltp/fchown01.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fchown01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fchown(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 02/14/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fchown(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fchown(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fchown(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ -#include -#include -#include - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fchown01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Fd; /* file descriptor for fchown */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* Call fchown(2) just once */ - TEST(fchown(Fd, geteuid(), getegid())); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "fchown(Fd, geteuid(), getegid()) failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* Perform functional verification here */ - tst_resm(TPASS, - "fchown(Fd, geteuid(), getegid()) returned %d", - TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - char fname[1024]; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a tempdir and change to it */ - tst_tmpdir(); - - /* open a file for read/write */ - sprintf(fname, "./tmpfile.%d", getpid()); - if ( (Fd=open(fname, O_RDWR|O_CREAT, 0700)) == -1 ) - tst_brkm(TBROK, cleanup, - "Unable to open %s for read/write. Error:%d, %s", - fname, errno, strerror(errno)); /* this exits */ - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - close(Fd); - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove temp dir and files */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/fcntl02.c b/winsup/testsuite/winsup.api/ltp/fcntl02.c deleted file mode 100644 index cbdd08545..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl02.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_DUPFD argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fcntl(2) with F_DUPFD argument on fname - */ - TEST(fcntl(fd, F_DUPFD, 0)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s, F_DUPFD, 0) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fcntl(%s, F_DUPFD, 0) returned %d", fname, TEST_RETURN); - } - if (close(TEST_RETURN) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we've had open */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl03.c b/winsup/testsuite/winsup.api/ltp/fcntl03.c deleted file mode 100644 index 8199469c3..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl03.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl03 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_GETFD argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fcntl(2) with F_GETFD argument on fname - */ - TEST(fcntl(fd, F_GETFD, 0)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s, F_GETFD, 0) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fcntl(%s, F_GETFD, 0) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl04.c b/winsup/testsuite/winsup.api/ltp/fcntl04.c deleted file mode 100644 index 7af778936..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl04.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl04 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_GETFL argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl04"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fcntl(2) with F_GETFL argument on fname - */ - TEST(fcntl(fd, F_GETFL, 0)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s, F_GETFL, 0) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fcntl(%s, F_GETFL, 0) returned %d", fname, TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl05.c b/winsup/testsuite/winsup.api/ltp/fcntl05.c deleted file mode 100644 index 80cfe8c89..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl05.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_GETLK argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -struct flock flocks; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - flocks.l_type = F_RDLCK; - /* - * Call fcntl(2) with F_GETLK argument on fname - */ - TEST(fcntl(fd, F_GETLK, &flocks)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s, F_GETLK, &flocks) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fcntl(%s, F_GETLK, &flocks) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - /* set needed flags in the flocks structure */ - flocks.l_whence=1; - flocks.l_start=0; - flocks.l_len=0; - flocks.l_pid=getpid(); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the file we have open */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl07.c b/winsup/testsuite/winsup.api/ltp/fcntl07.c deleted file mode 100644 index e0082df45..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl07.c +++ /dev/null @@ -1,423 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl07 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Close-On-Exec functional test - * - * PARENT DOCUMENT : none - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 5 - * - * CPU TYPES : ALL - * - * AUTHOR : Glen Overby - * - * CO-PILOT : William Roske - * - * DATE STARTED : 08/11/93 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) test close-on-exec with a regular file - * 2.) test close-on-exec with a system pipe - * - * INPUT SPECIFICATIONS - * - * Standard arguments accepted by parse_opts(3). - * - * The -t (timing) and -e options apply to the fcntl(.., F_SETFD, ..) - * system call. - * - * -T fd : If this option is given, the program runs as "test_open", - * testing to see if it is open or not and exiting - * accordingly: - * 0 not open (EBADF from fcntl(..., F_GETFD, ...)) - * 3 no error from fcntl - * errno fcntl returned an error other than EBADF - * - * -F name : File to open. Must be an absolute path - * and the file must be writable; - * -n program: path to the 'test_open' program - * - * OUTPUT SPECIFICATIONS - * This test uses the cuts-style test_res format output consisting of: - * - * test-name PASS/FAIL/BROK message - * - * the message will tell what type of test and, if it failed, indicate - * what the failure was. - * - * DURATION - * Terminates - * - * SIGNALS - * None - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * If this test is not called with a full pathname, it must be able - * to find itself on $PATH - * - * INTERCASE DEPENDENCIES - * none - * - * DETAILED DESCRIPTION - * - * Setup: - * Setup signal handling. - * Create and make current a temporary directory. - * Open a regular file for writing - * Create a system pipe - * Create a named pipe and open it for writing - * - * Test: - * Set the file descriptor for close-on-exec - * Fork - * Child execlp's the program "test_open". - * If the exec fails, exit "2" - * Parent waits - * Report results. - * - * Cleanup: - * Close file and pipes - * Remove the temporary directory - * - * BUGS - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" -#include "search_path.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void help(); - -const char *TCID="fcntl07"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - - -/* for parse_opts */ -int fflag, Tflag; /* binary flags: opt or not */ -char *fopt, *Topt; /* option arguments */ - -option_t options[] = { - { "F:", &fflag, &fopt }, /* -F filename */ - { "T:", &Tflag, &Topt }, /* -T exec'ed by test: test FD */ - { NULL, NULL, NULL } -}; - -int stat_loc; /* for waitpid() */ - -int file_fd, pipe_fds[2]; - /* file descriptors for a file and a system pipe */ -#define DEFAULT_FILE "DefaultFileName" -const char *File1 = DEFAULT_FILE; - -#define DEFAULT_SUBPROG "test_open" -const char *openck = DEFAULT_SUBPROG; /* support program name to check for open FD */ -char subprog_path[_POSIX_PATH_MAX]; /* path to exec "openck" with */ -#define STRSIZE 255 - -int *testfds[] = { - &file_fd, &pipe_fds[1], 0 - }; - -const char *testfdtypes[] = { - "regular file", - "write side of system pipe", - }; - -int test_open(const char *arg); -int do_exec(const char *prog, int fd, const char *tcd); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int exec_return; /* return from do_exec */ - int **tcp; /* testcase pointer (pointer to FD) */ - const char **tcd; /* testcase description pointer */ - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - if(fflag) /* -F option */ - File1 = fopt; - - if(Tflag) { /* -T option */ - exit(test_open(Topt)); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(av[0]); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for(tcp = testfds, tcd = testfdtypes; *tcp; tcp++, tcd++) { - - TEST(fcntl(**tcp, F_SETFD, FD_CLOEXEC)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s[%d], F_SETFD, FD_CLOEXEC) Failed, errno=%d : %s", - *tcd, **tcp, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /************************************************************* - * only perform functional verification if flag set - * (-f not given) - *************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - exec_return = do_exec(subprog_path, **tcp, *tcd); - - switch(exec_return) { - case -1: - tst_resm(TBROK, "fork failed. Errno %s [%d]", - strerror(errno), errno); - break; - case 1: - tst_resm(TBROK, "waitpid return was 0%o", stat_loc); - break; - case 2: - tst_resm(TBROK, "exec failed"); /* errno was in child */ - break; - case 0: - tst_resm(TPASS, "%s child exited 0, indicating that the file was closed", - *tcd); - break; - default: - tst_resm(TFAIL, "%s child exited non-zero, %d", *tcd, - exec_return); - break; - } - } - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup(char *path) -{ - search_path(path, subprog_path, X_OK, 1); - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - /* set up a regular file */ - if((file_fd=open(File1, O_CREAT|O_RDWR, 0666)) == -1) { - tst_brkm(TBROK, cleanup, "Open of file %s failed errno %d (%s)\n", File1, errno, strerror(errno)); - } - - /* set up a system pipe (write side gets CLOSE-ON-EXEC) */ - pipe(pipe_fds); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close everything */ - close(file_fd); - close(pipe_fds[0]); - close(pipe_fds[1]); - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -/*************************************************************************** - * issue a help message - ***************************************************************************/ -void -help() -{ - printf("-T fd : If this option is given, the program runs as 'test_open'\n"); - printf(" testing to see if it is open or not and exiting accordingly\n"); - printf("-F name : File to open. Must be an absolute path,\n"); - printf(" and the file must be writable\n"); - printf("-n program: path to the 'test_open' program\n"); -} - -/*---------------------------------------------------------------------------*/ -/* Perform an exec, then wait for the child to terminate. - * The child's termination status determines the success of the test - * - * Return codes: - * -1 BROK fork failed - * 1 BROK waitpid returned != exit status - * ???? exit code from child: - * 2 BROK exec failed - * 0 PASS fd was properly closed - * - */ - -int -do_exec(const char *prog, int fd, const char *tcd) -{ - int pid; - char pidname[STRSIZE]; -#ifdef DEBUG - int rc, status; /* for the fcntl */ -#endif - - /* set up arguments to exec'ed child */ - sprintf(pidname, "%d", fd); - -#ifdef DEBUG - rc = fcntl(fd, F_GETFD, &status); - printf("%s: fd = %d rc = %d status= %d, errno= %d\n", tcd, fd, rc, status, errno); -#endif - - switch(pid=fork()) { - case -1: - return(-1); - case 0: /* child */ - execlp(prog, openck, "-T", pidname, NULL); - - /* the ONLY reason to do this is to get the errno printed out */ - fprintf(stderr, "exec(%s, %s, -T, %s) failed. Errno %s [%d]\n", - prog, openck, pidname, strerror(errno), errno); - exit(2); - default: /* parent */ - waitpid(pid, &stat_loc, 0); - if(WIFEXITED(stat_loc)) { - return(WEXITSTATUS(stat_loc)); - } else { - return(1); - } - } -} - -/* - * PROGRAM TITLE : Test if a named file descriptor is open - * This function is called when fcntcs07 is called with the -T option. - * It tests if a file descriptor is open and exits accordingly. - */ -int -test_open(const char *arg) -{ - int fd, rc; - int status; - - fd = atoi(arg); - - rc = fcntl(fd, F_GETFD, &status); - -#ifdef DEBUG_T - printf("%s: fd = %d rc = %d status= %d, errno= %d\n", openck, fd, rc, - status, errno); -#endif - - if(rc == -1 && errno == EBADF) { - exit(0); - } - - if(rc != -1) - exit(3); - - exit(errno); - return -1; /* to remove compiler warning on IRIX */ -} diff --git a/winsup/testsuite/winsup.api/ltp/fcntl07B.c b/winsup/testsuite/winsup.api/ltp/fcntl07B.c deleted file mode 100644 index 4e94ff267..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl07B.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl07B - * to see if it is open or not and exiting - * accordingly: - * 0 not open (EBADF from fcntl(..., F_GETFD, ...)) - * 3 no error from fcntl - * errno fcntl returned an error other than EBADF - * - * -F name : File to open. Must be an absolute path - * and the file must be writable; - * -n program: path to the 'test_open' program - * - * OUTPUT SPECIFICATIONS - * This test uses the cuts-style test_res format output consisting of: - * - * test-name PASS/FAIL/BROK message - * - * the message will tell what type of test and, if it failed, indicate - * what the failure was. - * - * DURATION - * Terminates - * - * SIGNALS - * None - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * If this test is not called with a full pathname, it must be able - * to find itself on $PATH - * - * INTERCASE DEPENDENCIES - * none - * - * DETAILED DESCRIPTION - * - * Setup: - * Setup signal handling. - * Create and make current a temporary directory. - * Create a named pipe and open it for writing - * - * Test: - * Set the file descriptor for close-on-exec - * Fork - * Child execlp's the program "test_open". - * If the exec fails, exit "2" - * Parent waits - * Report results. - * - * Cleanup: - * Close file and pipes - * Remove the temporary directory - * - * BUGS - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" -#include "search_path.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void help(); - -const char *TCID="fcntl07B"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - -/* for parse_opts */ -int fflag, Tflag; /* binary flags: opt or not */ -char *fopt, *Topt; /* option arguments */ - -option_t options[] = { - { "F:", &fflag, &fopt }, /* -F filename */ - { "T:", &Tflag, &Topt }, /* -T exec'ed by test: test FD */ - { NULL, NULL, NULL } -}; - -int stat_loc; /* for waitpid() */ - -int npipe_fd; - /* file descriptors for a named pipe */ -#define DEFAULT_FILE "DefaultFileName" -const char *File1 = DEFAULT_FILE; - -#define DEFAULT_SUBPROG "test_open" -const char *openck = DEFAULT_SUBPROG; /* support program name to check for open FD */ -const char subprog_path[_POSIX_PATH_MAX];/* path to exec "openck" with */ -#define STRSIZE 255 -#define FIFONAME "FiFo" - -int *testfds[] = { - &npipe_fd, 0 - }; - -const char *testfdtypes[] = { - "named pipe" - }; - -int test_open(char *arg); -int do_exec(const char *prog, int fd, const char *tcd); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int exec_return; /* return from do_exec */ - int **tcp; /* testcase pointer (pointer to FD) */ - const char **tcd; /* testcase description pointer */ - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - if(fflag) /* -F option */ - File1 = fopt; - - if(Tflag) { /* -T option */ - exit(test_open(Topt)); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(av[0]); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for(tcp = testfds, tcd = testfdtypes; *tcp; tcp++, tcd++) { - - TEST(fcntl(**tcp, F_SETFD, FD_CLOEXEC)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s[%d], F_SETFD, FD_CLOEXEC) Failed, errno=%d : %s", - *tcd, **tcp, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /************************************************************* - * only perform functional verification if flag set - * (-f not given) - *************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - exec_return = do_exec(subprog_path, **tcp, *tcd); - - switch(exec_return) { - case -1: - tst_resm(TBROK, "fork failed. Errno %s [%d]", - strerror(errno), errno); - break; - case 1: - tst_resm(TBROK, "waitpid return was 0%o", stat_loc); - break; - case 2: - tst_resm(TBROK, "exec failed"); /* errno was in child */ - break; - case 0: - tst_resm(TPASS, "%s child exited 0, indicating that the file was closed", - *tcd); - break; - default: - tst_resm(TFAIL, "%s child exited non-zero, %d", *tcd, - exec_return); - break; - } - } - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup(char *path) -{ - search_path(path, subprog_path, X_OK, 1); - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - /* set up a named pipe (write side gets CLOSE-ON-EXEC) */ - if(mkfifo(FIFONAME, 0666) == -1) { - tst_brkm(TBROK, cleanup, "mkfifo of named pipe %s failed errno %d (%s)\n", FIFONAME, errno, strerror(errno)); - } - - if((npipe_fd=open(FIFONAME, O_RDWR, 0666)) == -1) { - tst_brkm(TBROK, cleanup, "Open of named pipe %s failed errno %d (%s)\n", File1, errno, strerror(errno)); - } - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close everything */ - close(npipe_fd); - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -/*************************************************************************** - * issue a help message - ***************************************************************************/ -void -help() -{ - printf("-T fd : If this option is given, the program runs as 'test_open'\n"); - printf(" testing to see if it is open or not and exiting accordingly\n"); - printf("-F name : File to open. Must be an absolute path,\n"); - printf(" and the file must be writable\n"); - printf("-n program: path to the 'test_open' program\n"); - -} - -/*---------------------------------------------------------------------------*/ -/* Perform an exec, then wait for the child to terminate. - * The child's termination status determines the success of the test - * - * Return codes: - * -1 BROK fork failed - * 1 BROK waitpid returned != exit status - * ???? exit code from child: - * 2 BROK exec failed - * 0 PASS fd was properly closed - * - */ - -int -do_exec(const char *prog, int fd, const char *tcd) -{ - int pid; - char pidname[STRSIZE]; -#ifdef DEBUG - int rc, status; /* for the fcntl */ -#endif - - /* set up arguments to exec'ed child */ - sprintf(pidname, "%d", fd); - -#ifdef DEBUG - rc = fcntl(fd, F_GETFD, &status); - printf("%s: fd = %d rc = %d status= %d, errno= %d\n", tcd, fd, rc, status, errno); -#endif - - switch(pid=fork()) { - case -1: - return(-1); - case 0: /* child */ - execlp(prog, openck, "-T", pidname, NULL); - - /* the ONLY reason to do this is to get the errno printed out */ - fprintf(stderr, "exec(%s, %s, -T, %s) failed. Errno %s [%d]\n", - prog, openck, pidname, strerror(errno), errno); - exit(2); - default: /* parent */ - waitpid(pid, &stat_loc, 0); - if(WIFEXITED(stat_loc)) { - return(WEXITSTATUS(stat_loc)); - } else { - return(1); - } - } -} - -/* - * PROGRAM TITLE : Test if a named file descriptor is open - * This function is called when fcntcs07 is called with the -T option. - * It tests if a file descriptor is open and exits accordingly. - */ -int -test_open(char *arg) -{ - int fd, rc; - int status; - - fd = atoi(arg); - - rc = fcntl(fd, F_GETFD, &status); - -#ifdef DEBUG_T - printf("%s: fd = %d rc = %d status= %d, errno= %d\n", openck, fd, rc, - status, errno); -#endif - - if(rc == -1 && errno == EBADF) { - exit(0); - } - - if(rc != -1) - exit(3); - - exit(errno); - return -1; /* To remove compiler warning on IRIX */ -} diff --git a/winsup/testsuite/winsup.api/ltp/fcntl08.c b/winsup/testsuite/winsup.api/ltp/fcntl08.c deleted file mode 100644 index eaf22436b..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl08.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl08 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_SETFL argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * close file - * remove temp directory - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -#ifndef O_NDELAY -#define O_NDELAY 0 -#endif - -const char *TCID="fcntl08"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char fname[255]; -int arg, fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fcntl(2) with F_SETFL argument on fname - */ - TEST(fcntl(fd, F_SETFL, arg)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - tst_resm(TFAIL, "fcntl(%s, F_SETFL, %d) Failed, errno=%d : %s", - fname, arg, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fcntl(%s, F_SETFL, %d) returned %d", - fname, arg, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - /* set the flags to be used */ -#ifdef CRAY - arg = (O_NDELAY | O_APPEND | O_RAW | O_NONBLOCK); -#else - arg = (O_NDELAY | O_APPEND | O_NONBLOCK); -#endif /* ! CRAY */ - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl09.c b/winsup/testsuite/winsup.api/ltp/fcntl09.c deleted file mode 100644 index 3a827e149..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl09.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl09 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_SETLK argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl09"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -struct flock flocks; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - -#if 0 - /* Ouch! Either read *or* write lock, but not both! - This code depends on F_RDLCK being 0. */ - flocks.l_type = F_RDLCK | F_WRLCK; -#else - flocks.l_type = F_WRLCK; -#endif - /* - * Call fcntl(2) with F_SETLK argument on fname - */ - TEST(fcntl(fd, F_SETLK, &flocks)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_RDLCK | F_WRLCK Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, - "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_RDLCK | F_WRLCK returned %d", - fname, TEST_RETURN); - } - } - - flocks.l_type = F_UNLCK; - /* - * Call fcntl(2) with F_SETLK argument on fname - */ - TEST(fcntl(fd, F_SETLK, &flocks)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_UNLCK Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, - "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_UNLCK returned %d", - fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"./file_%d",getpid()); - if (creat(fname, 02644) == -1) { - tst_brkm(TBROK, cleanup, "creat(%s, 02644) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if ((fd = open(fname,O_RDWR,0700)) == -1) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - flocks.l_whence=1; - flocks.l_start=0; - flocks.l_len=0; - flocks.l_pid=getpid(); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (unlink(fname) == -1) { - tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - - } - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl10.c b/winsup/testsuite/winsup.api/ltp/fcntl10.c deleted file mode 100644 index e2de44bef..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl10.c +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl10 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_SETLKW argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl10"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -struct flock flocks; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - -#if 0 - /* Ouch! Either read *or* write lock, but not both! - This code depends on F_RDLCK being 0. */ - flocks.l_type = F_RDLCK | F_WRLCK; -#else - flocks.l_type = F_WRLCK; -#endif - /* - * Call fcntl(2) with F_SETLKW flocks.l_type = F_UNLCK argument on fname - */ - TEST(fcntl(fd, F_SETLKW, &flocks)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_RDLCK | F_WRLCK Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, - "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_RDLCK | F_WRLCK returned %d", - fname, TEST_RETURN); - } - } - - flocks.l_type = F_UNLCK; - /* - * Call fcntl(2) with F_SETLKW flocks.l_type = F_UNLCK argument on fname - */ - TEST(fcntl(fd, F_SETLKW, &flocks)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_UNLCK Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, - "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_UNLCK returned %d", - fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = creat(fname, 02644)) == -1) { - tst_brkm(TBROK, cleanup, "creat(%s, 02644) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if ((fd = open(fname,O_RDWR,0700)) == -1) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* set needed fields in the flocks structure */ - flocks.l_whence=1; - flocks.l_start=0; - flocks.l_len=0; - flocks.l_pid=getpid(); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fork01.c b/winsup/testsuite/winsup.api/ltp/fork01.c deleted file mode 100644 index 2aac2d427..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork01.c +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fork01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fork(2) - * - * PARENT DOCUMENT : frktds02 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Kathy Olmsted - * - * CO-PILOT : Steve Shaw - * - * DATE STARTED : 06/17/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fork returns without error - * 2.) fork returns the pid of the child - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * fork() - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * CHILD: - * determine PID - * write to PID to a file and close the file - * exit - * PARENT: - * wait for child to exit - * read child PID from file - * compare child PID to fork() return code and report - * results - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -#define KIDEXIT 42 -extern void setup(); -extern void cleanup(); - -#define LINE_SZ 20 /* size of the line written/read to the file */ -#define FILENAME "childpid" - - - -const char *TCID="fork01"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -/*************************************************************** - * child_pid - the child side of the test - * determine the PID and write to a file - ***************************************************************/ -void child_pid() -{ - - int fildes; - char tmp_line[LINE_SZ]; - - fildes = creat(FILENAME,0700); - sprintf(tmp_line,"%d\n",getpid()); - write(fildes,tmp_line,LINE_SZ); - close(fildes); - -} - -/*************************************************************** - * parent_pid - the parent side of the test - * read the value determined by the child - * compare and report results - ***************************************************************/ -void parent_pid() -{ - - int fildes; - char tmp_line[LINE_SZ]; - pid_t child_id; - - if ((fildes = open(FILENAME,O_RDWR)) == -1) { - tst_brkm(TBROK, cleanup, - "parent open failed. errno: %d (%s)\n", - errno, strerror(errno)); - } - else { - if (read(fildes,tmp_line,LINE_SZ) == 0) { - tst_brkm(TBROK,cleanup, "fork(): parent failed to read PID from file errno: %d (%s)", - errno, strerror(errno)); - } - else { - child_id = atoi(tmp_line); - if (TEST_RETURN != child_id) { - tst_resm(TFAIL,"child reported a pid of %d. parent received %d from fork()", - child_id,TEST_RETURN); - } else { - tst_resm(TPASS,"child pid and fork() return agree: %d",child_id); - } - } - close(fildes); - } -} - -/*************************************************************** - * main() - performs tests - * - ***************************************************************/ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int fails; - int kid_status, wait_status; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - fails = 0; - - /* - * Call fork(2) - */ - TEST(fork()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - if ( STD_FUNCTIONAL_TEST ) { - tst_resm(TFAIL, "fork() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - tst_resm(TBROK,"unable to continue"); - } - } - if (TEST_RETURN == 0) { - /* child */ - if ( STD_FUNCTIONAL_TEST ) { - child_pid(); - } - exit(KIDEXIT); - } else { - /* parent */ - if ( STD_FUNCTIONAL_TEST ) { - tst_resm(TPASS, "fork() returned %d", TEST_RETURN); - } - /* wait for the child to complete */ - wait_status = wait(&kid_status); - if ( STD_FUNCTIONAL_TEST ) { - if (wait_status == TEST_RETURN) { - if (kid_status != KIDEXIT << 8) { - tst_resm(TBROK, - "incorrect child status returned on wait(): %d", - kid_status); - fails++; - } - } - else { - tst_resm(TBROK, - "wait() for child status failed with %d errno: %d : %s", - wait_status,errno,strerror(errno)); - fails++; - } - if (fails == 0 ) { - /* verification tests */ - parent_pid(); - } - } /* STD_FUNCTIONAL_TEST */ - } /* TEST_RETURN */ - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void - setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void - cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_rmdir(); - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fork02.c b/winsup/testsuite/winsup.api/ltp/fork02.c deleted file mode 100644 index eeec828ec..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork02.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * fork02.c - * - * DESCRIPTION - * Test correct operation of fork: - * pid == 0 in child; - * pid > 0 in parent from wait; - * - * ALGORITHM - * Fork one process, check for pid == 0 in child. - * Check for pid > 0 in parent after wait. - * - * USAGE - * fork02 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include "test.h" -#include "usctest.h" - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID = "fork02"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int pid1, pid2, status; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - if ((pid1 = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (pid1 == 0) { - tst_resm(TINFO, "Inside child"); - _exit(0); - } else { - tst_resm(TINFO, "Inside parent"); - pid2 = wait(&status); - tst_resm(TINFO, "exit status of wait %d", status); - - if (pid1 == pid2) { - tst_resm(TPASS, "test 1 PASSED"); - } else { - tst_resm(TFAIL, "test 1 FAILED"); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork03.c b/winsup/testsuite/winsup.api/ltp/fork03.c deleted file mode 100644 index fbc23bb37..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork03.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * fork03.c - * - * DESCRIPTION - * Check that child can use a large text space and do a large - * number of operations. - * - * ALGORITHM - * Fork one process, check for pid == 0 in child. - * Check for pid > 0 in parent after wait. - * - * USAGE - * fork03 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include "test.h" -#include "usctest.h" - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID = "fork03"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - float fl1, fl2; - int i; - int pid1, pid2, status; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - if ((pid1 = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (pid1 == 0) { /* child */ - /* child uses some cpu cycles */ - for (i = 1; i < 32767; i++) { - fl1 = 0.000001; - fl1 = fl2 = 0.000001; - fl1 = fl1 * 10.0; - fl2 = fl1 / 1.232323; - fl1 = fl2 - fl2; - fl1 = fl2; - } - - /* Pid must always be zero in child */ - - if (pid1 != 0) { - exit(1); - } else { - exit(0); - } - } else { /* parent */ - tst_resm(TINFO, "process id in parent of child from " - "fork : %d", pid1); - pid2 = wait(&status); /* wait for child */ - - if (pid1 != pid2) { - tst_resm(TFAIL, "pids don't match : %d vs %d", - pid1, pid2); - continue; - } - - if ((status >> 8) != 0) { - tst_resm(TFAIL, "child exited with failure"); - continue; - } - - tst_resm(TPASS, "test 1 PASSED"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork04.c b/winsup/testsuite/winsup.api/ltp/fork04.c deleted file mode 100644 index 7e8d80f96..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork04.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fork04 - * - * TEST TITLE : Child inheritance of Environment Variables after fork() - * - * PARENT DOCUMENT : frktds01 - * - * TEST CASE TOTAL : 3 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Kathy Olmsted - * - * CO-PILOT : Steve Shaw - * - * DATE STARTED : 06/17/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * Test these environment variables correctly inherited by child: - * 1. TERM - * 2. NoTSetzWq - * 3. TESTPROG - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * DETAILED DESCRIPTION - * - * Setup: - * Setup signal handling. - * Make and change to a temporary directory. - * Pause for SIGUSR1 if option specified. - * Add TESTPROG variable to the environment - * - * Test: - * Loop if the proper options are given. - * fork() - * Check return code, if system call failed (return=-1) - * Log the errno - * CHILD: - * open a temp file - * Determine environment values and write to file - * close file containing test values. - * exit. - * PARENT: - * Wait for child to exit. - * Verify exit status - * Open file containing test values. - * For each test case: - * Read the value from the file. - * Determine and report PASS/FAIL result. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Remove the temporary directory and exit. - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ -#include -#include -#include -#include -#include -#include /*Includes signal information. */ -#include -#include "test.h" -#include "usctest.h" - -const char *TCID="fork04"; /* Test program identifier. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - - -#define KIDEXIT 42 /* Known value for child exit status */ -#define MAX_LINE_LENGTH 256 -#define OUTPUT_FILE "env.out" -#define ENV_NOT_SET "getenv() does not find variable set" - -/* list of environment variables to test */ -const char *environ_list[] = {"TERM","NoTSetzWq","TESTPROG"}; -#define NUMBER_OF_ENVIRON (int)(sizeof(environ_list)/sizeof(char *)) -int TST_TOTAL=NUMBER_OF_ENVIRON; /* Total number of test cases. */ - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove the temporary directory and exit with - return code appropriate for results */ - tst_rmdir(); - tst_exit(); - -} /* End cleanup() */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make and change to a temporary directory */ - tst_tmpdir(); - - /* add a variable to the environment */ - putenv(strdup("TESTPROG=FRKTCS04")); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * child_environment - the child side of the environment tests - * determine values for the variables and write to a file - ***************************************************************/ -void child_environment() -{ - - int fildes; - int index; - char msg[MAX_LINE_LENGTH]; - char *var; - - fildes = creat(OUTPUT_FILE,0700); - - - for (index=0;index: - * - ***********************************************************************/ -int -cmp_env_strings(char *pstring, char *cstring) -{ - char *penv, *cenv, *pvalue, *cvalue; - - /* - * Break pstring into env and value - */ - penv=pstring; - if ( (pvalue=strchr(pstring, ':')) == NULL ) { - tst_resm(TBROK, - "internal error - parent's env string not in correct format:'%s'", - pstring); - return -1; - } else { - *pvalue='\0'; - pvalue++; - if ( *pvalue == '\0' ) { - tst_resm(TBROK, "internal error - missing parent's env value"); - return -1; - } - } - - /* - * Break cstring into env and value - */ - cenv=cstring; - if ( (cvalue=strchr(cstring, ':')) == NULL ) { - tst_resm(TBROK, - "internal error - parent's env string not in correct format:'%s'", - cstring); - return -1; - } else { - *cvalue='\0'; - cvalue++; - if ( *cvalue == '\0' ) { - tst_resm(TBROK, "internal error - missing child's env value"); - return -1; - } - } - - if ( strcmp(penv, cenv) != 0 ) { - tst_resm(TBROK, "internal error - parent(%s) != child (%s) env", - penv, cenv); - return -1; - } - - if ( strcmp(pvalue, cvalue) != 0 ) { - tst_resm(TFAIL, "Env var %s changed after fork(), parent's %s, child's %s", - penv, pvalue, cvalue); - } else { - tst_resm(TPASS, "Env var %s unchanged after fork(): %s", - penv, cvalue); - } - return 0; - -} - -/*************************************************************** - * parent_environment - the parent side of the environment tests - * determine values for the variables - * read the values determined by the child - * compare values - ***************************************************************/ -void parent_environment() -{ - - int fildes; - char tmp_line[MAX_LINE_LENGTH]; - char parent_value[MAX_LINE_LENGTH]; - int index; - int ret; - char *var; - - if ((fildes = open(OUTPUT_FILE,O_RDWR)) == -1) { - tst_brkm(TBROK, cleanup, - "fork() test. Parent open of temporary file failed. errno %d (%s)\n", - errno, strerror(errno)); - } - for (index=0;index -#include "test.h" -#include "usctest.h" - -const char *TCID = "fork06"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -#define NUMFORKS 1000 - -int -main(int ac, char **av) -{ - int i, pid, status, childpid, succeed, fail; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - succeed = 0; - fail = 0; - - for (i = 0; i < NUMFORKS; i++) { - if ((pid = fork()) == -1) { - fail++; - continue; - } - - if (pid == 0) { /* child */ - _exit(0); - } - - /* parent */ - childpid = wait(&status); - if (pid != childpid) { - tst_resm(TFAIL, "pid from wait %d", childpid); - } - succeed++; - } - - tst_resm(TINFO, "tries %d", i); - tst_resm(TINFO, "successes %d", succeed); - tst_resm(TINFO, "failures %d", fail); - - if ((wait(&status)) == -1) { - tst_resm(TINFO, "There were no children to wait for"); - } else { - tst_resm(TINFO, "There were children left"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork07.c b/winsup/testsuite/winsup.api/ltp/fork07.c deleted file mode 100644 index 7e06db7a1..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork07.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * fork07.c - * - * DESCRIPTION - * Check that all children inherit parent's file descriptor - * - * ALGORITHM - * Parent opens a file, writes to it; forks processes until - * -1 is returned. Each child attempts to read the file then returns. - * - * USAGE - * fork07 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "fork07"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -char pbuf[10]; -char fnamebuf[40]; - -int -main(int ac, char **av) -{ - int status, count, forks, pid1; - int ch_r_stat; - FILE *rea = NULL, *writ = NULL; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - if ((writ = fopen(fnamebuf, "w")) == NULL) - tst_resm(TFAIL, "failed to fopen file for write"); - if ((rea = fopen(fnamebuf, "r")) == NULL) - tst_resm(TFAIL, "failed to fopen file for read"); - - fprintf(writ,"abcdefghijklmnopqrstuv") ; - fflush(writ); - sleep(1); - - if ((getc(rea)) != 'a') - tst_resm(TFAIL, "getc from read side was confused"); - - forks = 0; - -forkone: - ++forks; - pid1 = -1; - if ( forks >= 1000 || (pid1 = fork()) != 0) { /* parent */ - if (pid1 > 0) { - goto forkone; - } else if (pid1 < 0) { - tst_resm(TINFO, "last child forked"); - } - } else { /* child */ - ch_r_stat = getc(rea); -#ifdef DEBUG - tst_resm(TINFO, "Child got char: %c", ch_r_stat); - tst_resm(TINFO, "integer value of getc in child " - "expected %d got %d", 'b', ch_r_stat); -#endif - if (ch_r_stat != EOF) { /* for error or EOF */ - tst_resm(TPASS, "test passed in child no %d", - forks); - exit(0); - } else { - tst_resm(TFAIL, "Test failed in child no. %d", - forks); - exit(-1); - } - } - - /* parent */ - --forks; - for (count = 0; count <= forks; count++) { - wait(&status); -#ifdef DEBUG - tst_resm(TINFO, " exit status of wait " - " expected 0 got %d", status); -#endif - if (status == 0) { - tst_resm(TPASS, "parent test passed"); - } else { - tst_resm(TFAIL, "parent test failed"); - } - } - tst_resm(TINFO, "Number of processes forked is %d", forks); - } - fclose (writ); - fclose (rea); - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; - - /* - * make a temp directory and cd to it - */ - tst_tmpdir(); - - strcpy(fnamebuf, "fork07."); - sprintf(pbuf, "%d", getpid()); - strcat(fnamebuf, pbuf); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * remove tmp dir and all files in it - */ - unlink(fnamebuf); - tst_rmdir(); - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork09.c b/winsup/testsuite/winsup.api/ltp/fork09.c deleted file mode 100644 index 233acc76e..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork09.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * fork01.c - * - * DESCRIPTION - * Check that child has access to a full set of files. - * - * ALGORITHM - * Parent opens a maximum number of files - * Child closes one and attempts to open another, it should be - * available - * - * USAGE - * fork01 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include /* for OPEN_MAX */ -#include -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "fork01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -char filname[40], childfile[40]; -int first; -FILE **fildeses; /* file streams */ -int mypid, nfiles; - -int -main(int ac, char **av) -{ - int pid, status, nf; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - fildeses = (FILE**)malloc((OPEN_MAX + 10) * sizeof(FILE *)); - if (fildeses == NULL) { - tst_brkm(TBROK, cleanup, "malloc failed"); - /*NOTREACHED*/ - } - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - mypid = getpid(); - - tst_resm(TINFO, "OPEN_MAX is %d", OPEN_MAX); - - /* establish first free file */ - sprintf(filname, "fork01.%d", mypid); - if ((first = creat(filname, 0660)) == -1) { - tst_brkm(TBROK, cleanup, "Cannot open first file %s, " - "errno = %d", filname, errno); - /*NOTREACHED*/ - } - close(first); - - tst_resm(TINFO, "first file descriptor is %d ", first); - - if (unlink(filname) == -1) { - tst_brkm(TBROK, cleanup, "Cannot unlink file %s, " - "errno = %d", filname, errno); - /*NOTREACHED*/ - } - - /* - * now open all the files for the test - */ - for (nfiles = first; nfiles < OPEN_MAX; nfiles++) { - sprintf(filname, "file%d.%d", nfiles, mypid); - if ((fildeses[nfiles] = fopen(filname, "a")) == NULL) { - tst_brkm(TBROK, cleanup, "Parent: cannot open " - "file %d %s errno = %d", nfiles, - filname, errno); - /*NOTREACHED*/ - } -#ifdef DEBUG - tst_resm(TINFO, "filname: %s", filname); -#endif - } - - tst_resm(TINFO, "Parent reporting %d files open", nfiles - 1); - - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "Fork failed"); - /*NOTREACHED*/ - } - - if (pid == 0) { /* child */ - nfiles--; - if (fclose(fildeses[nfiles]) == -1) { - tst_resm(TINFO, "Child could not close file " - "#%d, errno = %d", nfiles, errno); - exit(1); - /*NOTREACHED*/ - } else { - sprintf(childfile, "cfile.%d", getpid()); - if ((fildeses[nfiles] = - fopen(childfile, "a")) == NULL) { - tst_resm(TINFO, "Child could not open " - "file %s, errno = %d", - childfile, errno); - exit(1); - /*NOTREACHED*/ - } else { - tst_resm(TINFO, "Child opened new " - "file #%d", nfiles); - unlink(childfile); - exit(0); - } - } - } else { /* parent */ - wait(&status); - if (status >> 8 != 0) { - tst_resm(TFAIL, "test 1 FAILED"); - } else { - tst_resm(TPASS, "test 1 PASSED"); - } - } - - /* clean up things in case we are looping */ - for (nf = first; nf < nfiles; nf++) { - fclose(fildeses[nf]); - sprintf(filname, "file%d.%d", nf, mypid); - unlink(filname); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; - - /* - * make a temp directory and cd to it - */ - tst_tmpdir(); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or at premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * remove tmp dir and all files in it - */ - tst_rmdir(); - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork10.c b/winsup/testsuite/winsup.api/ltp/fork10.c deleted file mode 100644 index 9dcbbb3b5..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork10.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * fork04.c - * - * DESCRIPTION - * Check inheritance of file descriptor by children, they - * should all be refering to the same file. - * - * ALGORITHM - * Child reads several chars and exits. - * Parent forks another child, have the child and parent attempt to use - * that location - * - * USAGE - * fork04 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "fork04"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -char pidbuf[10]; -char fnamebuf[40]; - -int -main(int ac, char **av) -{ - int status, pid, fildes; - char parchar[2]; - char chilchar[2]; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - if ((fildes = creat(fnamebuf, 0600)) < 0) { - tst_brkm(TBROK, cleanup, "Parent: cannot open %s for " - "write, errno = %d", fnamebuf, errno); - /*NOTREACHED*/ - } - write(fildes, "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 27); - close(fildes); - - if ((fildes = open(fnamebuf, 0)) == -1) { - tst_brkm(TBROK, cleanup, "Parent: cannot open %s for " - "reading", fnamebuf); - /*NOTREACHED*/ - } - - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() #1 failed"); - /*NOTREACHED*/ - } - - if (pid == 0) { /* child */ - tst_resm(TINFO, "fork child A"); - if (lseek(fildes, 10L, 0) == -1L) { - tst_resm(TFAIL, "bad lseek by child"); - exit(1); - } - exit(0); - } else { /* parent */ - wait(&status); - - /* parent starts second child */ - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() #2 failed"); - /*NOTREACHED*/ - } - - if (pid == 0) { /* child */ - if (read(fildes, chilchar, 1) <= 0) { - tst_resm(TFAIL, "Child can't read " - "file"); - exit(1); - } else { - if (chilchar[0] != 'K') { - chilchar[1] = '\n'; - exit(1); - } else { - exit(0); - } - } - } else { /* parent */ - (void)wait(&status); - if (status >> 8 != 0) { - tst_resm(TFAIL, "Bad return from " - "second child"); - continue; - } - /* parent reads */ - if (read(fildes, parchar, 1) <= 0) { - tst_resm(TFAIL, "Parent cannot read " - "file"); - continue; - } else { - write(fildes, parchar, 1); - if (parchar[0] != 'L') { - parchar[1] = '\n'; - tst_resm(TFAIL, "Test failed"); - continue; - } - } - } - } - tst_resm(TPASS, "test 1 PASSED"); - close (fildes); - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; - - /* - * make a temp directory and cd to it - */ - tst_tmpdir(); - - strcpy(fnamebuf, "fork04."); - sprintf(pidbuf, "%d", getpid()); - strcat(fnamebuf, pidbuf); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * remove tmp dir and all files in it - */ - tst_rmdir(); - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork11.c b/winsup/testsuite/winsup.api/ltp/fork11.c deleted file mode 100644 index 2b1035230..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork11.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * fork05.c - * - * DESCRIPTION - * Test that parent gets a pid from each child when doing wait - * - * ALGORITHM - * Fork NUMFORKS children that do nothing. - * - * USAGE - * fork05 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "fork05"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -#define NUMFORKS 100 - -int -main(int ac, char **av) -{ - int i, pid, cpid, status; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - for (i=0; i 0) { /* parent */ - cpid = wait(&status); - if (cpid == pid) { - tst_resm(TPASS, "fork #%d passed", i+1); - } else { - tst_resm(TFAIL, "fork #%d failed", i+1); - } - } else { - tst_resm(TFAIL, "fork #%d failed", i+1); - break; - } - } - tst_resm(TINFO, "Number of processes forked = %d", i); - tst_resm(TINFO, "Exit test 1"); - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fpathconf01.c b/winsup/testsuite/winsup.api/ltp/fpathconf01.c deleted file mode 100644 index 37fbe9689..000000000 --- a/winsup/testsuite/winsup.api/ltp/fpathconf01.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fpathconf01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fpathconf(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 7 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fpathconf(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fpathconf(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fpathconf(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fpathconf01"; /* Test program identifier. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -#define FILENAME "fpafile01" - -int exp_enos[]={0, 0}; - -int i; - -struct pathconf_args -{ - const char *define_tag; - int value; - int defined; /* Some of these are undefined on regular files. - * Cancer does a slightly better job with these already, - * so this is all I'll do to this test. 11/19/98 roehrich - */ -} args[] = { - {"_PC_MAX_CANON", _PC_MAX_CANON, 0}, - {"_PC_MAX_INPUT", _PC_MAX_INPUT, 0}, - {"_PC_VDISABLE", _PC_VDISABLE, 0}, - {"_PC_LINK_MAX", _PC_LINK_MAX, 1}, - {"_PC_NAME_MAX", _PC_NAME_MAX, 1}, - {"_PC_PATH_MAX", _PC_PATH_MAX, 1}, - {"_PC_PIPE_BUF", _PC_PIPE_BUF, 0} -}; - -int TST_TOTAL=((sizeof(args)/sizeof(args[0]))); -int fd; /* temp file for fpathconf */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (i=0; i -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - -const char *TCID="fstat01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -struct stat statter; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fstat(2) - */ - TEST(fstat(fd, &statter)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fstat(%s, &statter) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fstat(%s, &statter) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fstat02.c b/winsup/testsuite/winsup.api/ltp/fstat02.c deleted file mode 100644 index 224caf0d7..000000000 --- a/winsup/testsuite/winsup.api/ltp/fstat02.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: fstat02 - * - * Test Description: - * Verify that, fstat(2) succeeds to get the status of a file and fills - * the stat structure elements though file pointed to by file descriptor - * not opened for reading. - * - * Expected Result: - * fstat() should return value 0 on success and the stat structure elements - * should be filled with specified 'file' information. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * fstat02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE 0644 -#define TESTFILE "testfile" -#define FILE_SIZE 1024 -#define BUF_SIZE 256 -#define MASK 0777 - -const char *TCID="fstat02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -uid_t User_id; /* user id/group id of test process */ -gid_t Group_id; -int fildes; /* File descriptor of testfile */ - -void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call fstat(2) to get the status of - * specified 'file' pointed to by 'fd' - * into stat structure. - */ - TEST(fstat(fildes, &stat_buf)); - - /* check return code of fstat(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, - "fstat on %s Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Verify the data returned by fstat(2) - * aganist the expected data. - */ - if ((stat_buf.st_uid != User_id) || - (stat_buf.st_gid != Group_id) || - (stat_buf.st_size != FILE_SIZE) || - ((stat_buf.st_mode & MASK) != FILE_MODE)) { - tst_resm(TFAIL, "Functionality of fstat(2) on " - "'%s' Failed", TESTFILE); - } else { - tst_resm(TPASS, "Functionality of fstat(2) on " - "'%s' Succcessful", TESTFILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - Performs setup function for the test. - * Creat a temporary directory and chdir to it. - * Creat a temporary file and write some known data into it. - * Get the effective uid/gid of test process. - */ -void -setup() -{ - int i; - char tst_buff[BUF_SIZE]; - int wbytes; - int write_len = 0; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Check that the test process id is not super/root */ - if (geteuid() == 0) { - tst_brkm(TBROK, NULL, "Must be non-super/root for this test!"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - if ((fildes = open(TESTFILE, O_WRONLY|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } else { - write_len += wbytes; - } - } - - /* Get the uid/gid of the process */ - User_id = getuid(); - Group_id = getgid(); - -} /* End setup() */ - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the test file and remove the test file and temporary directory. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the test file */ - if (close(fildes) == -1) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fstat03.c b/winsup/testsuite/winsup.api/ltp/fstat03.c deleted file mode 100644 index 47982ed47..000000000 --- a/winsup/testsuite/winsup.api/ltp/fstat03.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Test Name: fstat03 - * - * Test Description: - * Verify that, fstat(2) returns -1 and sets errno to EBADF if the file - * pointed to by file descriptor is not valid. - * - * Expected Result: - * fstat() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * fstat03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be executed by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define TEST_FILE "testfile" - -const char *TCID="fstat03"; /* Test program identifier. */ -int TST_TOTAL = 1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EBADF, 0}; -int fildes; /* testfile descriptor */ - -void setup(); /* Main setup function for the tests */ -void cleanup() __attribute__((noreturn));/* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* - * Invoke setup function to create a testfile under temporary - * directory. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - /* - * Call fstat(2) to get the status information - * of a closed testfile pointed to by 'fd'. - * verify that fstat fails with -1 return value and - * sets appropriate errno. - */ - TEST(fstat(fildes, &stat_buf)); - - /* Check return code from fstat(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == EBADF) { - tst_resm(TPASS, "fstat() fails with " - "expected error EBADF"); - } else { - tst_resm(TFAIL, "fstat() fails with " - "wrong errno:%d", TEST_ERRNO); - } - } else { - tst_resm(TFAIL, "fstat() returned %d, " - "expected -1, error EBADF"); - } - } /* End for TEST_LOOPING */ - - /* - * Invoke cleanup() to delete the test directory/file(s) created - * in the setup(). - */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup(void) - performs all ONE TIME setup for this test. - * Exit the test program on receipt of unexpected signals. - * Create a temporary directory and change directory to it. - * Create a testfile under temporary directory. - * Close the testfile. - */ -void -setup() -{ - /* Capture unexpected signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Make a temp dir and cd to it */ - tst_tmpdir(); - - /* Create a testfile under temporary directory */ - if ((fildes = open(TEST_FILE, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE, errno, strerror(errno)); - } - - if (close(fildes) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TEST_FILE, errno, strerror(errno)); - } -} /* End of setup */ - -/* - * void - * cleanup() - Performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Print test timing stats and errno log if test executed with options. - * Close the testfile if still opened. - * Remove temporary directory and sub-directories/files under it - * created during setup(). - * Exit the test program with normal exit code. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove files and temporary directory created */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fstat04.c b/winsup/testsuite/winsup.api/ltp/fstat04.c deleted file mode 100644 index 1de507e62..000000000 --- a/winsup/testsuite/winsup.api/ltp/fstat04.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: fstat01 - * - * Test Description: - * Verify that, fstat(2) succeeds to get the status of a file pointed by - * file descriptor and fills the stat structure elements. - * - * Expected Result: - * fstat() should return value 0 on success and the stat structure should - * be filled with specified 'file' information. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * fstat01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE 0644 -#define TESTFILE "testfile" -#define FILE_SIZE 1024 -#define BUF_SIZE 256 -#define MASK 0777 - -const char *TCID="fstat01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -uid_t User_id; /* user id/group id of test process */ -gid_t Group_id; -int fildes; /* File descriptor of testfile */ - -void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call fstat(2) to get the status of - * specified 'file' pointed to 'fd' - * into stat structure. - */ - TEST(fstat(fildes, &stat_buf)); - - /* check return code of fstat(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, - "fstat on %s Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Verify the data returned by fstat(2) - * aganist the expected data. - */ - if ((stat_buf.st_uid != User_id) || - (stat_buf.st_gid != Group_id) || - (stat_buf.st_size != FILE_SIZE) || - ((stat_buf.st_mode & MASK) != FILE_MODE)) { - tst_resm(TFAIL, "Functionality of fstat(2) on " - "'%s' Failed", TESTFILE); - } else { - tst_resm(TPASS, "Functionality of fstat(2) on " - "'%s' Succcessful", TESTFILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - Performs setup function for the test. - * Creat a temporary directory and chdir to it. - * Creat a test file and write some data into it. - * Get the user/group id info. of test process. - */ -void -setup() -{ - int i; /* counter */ - char tst_buff[BUF_SIZE]; /* data buffer */ - int wbytes; /* no. of bytes written */ - int write_len = 0; /* data length */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Check that the test process id is not super/root */ - if (geteuid() == 0) { - tst_brkm(TBROK, NULL, "Must be non-super/root for this test!"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - if ((fildes = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } else { - write_len += wbytes; - } - } - - /* Get the uid/gid of the process */ - User_id = getuid(); - Group_id = getgid(); - -} /* End setup() */ - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the testfile opened for reading/writing. - * Delete the testfile and temporary directory. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the test file */ - if (close(fildes) == -1) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fsync01.c b/winsup/testsuite/winsup.api/ltp/fsync01.c deleted file mode 100644 index 261ea0dbb..000000000 --- a/winsup/testsuite/winsup.api/ltp/fsync01.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fsync01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fsync(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fsync(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fsync(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fsync(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fsync01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -const char *buf = "davef"; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* write sone data to get fsync'd out */ - if (write(fd, &buf, strlen(buf)) == -1) { - tst_brkm(TBROK, cleanup, - "write(%s, &buf, strlen(buf)) Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } - /* - * Call fsync(2) - */ - TEST(fsync(fd)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fsync(%s) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fsync(%s) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/ftruncate01.c b/winsup/testsuite/winsup.api/ltp/ftruncate01.c deleted file mode 100644 index a45c167aa..000000000 --- a/winsup/testsuite/winsup.api/ltp/ftruncate01.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: ftruncate01 - * - * Test Description: - * Verify that, ftruncate(2) succeeds to truncate a file to a specified - * length if the file indicated by file descriptor opened for writing. - * - * Expected Result: - * ftruncate(2) should return a value 0 and the length of the file after - * truncation should be equal to the length it is truncated to. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * ftruncate01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" /* file under test */ -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define BUF_SIZE 256 /* buffer size */ -#define FILE_SIZE 1024 /* test file size */ -#define TRUNC_LEN 256 /* truncation length */ - -const char *TCID="ftruncate01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fildes; /* file descriptor for test file */ - -void setup(); /* setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat(2) struct contents */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - off_t file_length; /* test file length */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call ftruncate(2) to truncate a test file to a - * specified length. - */ - TEST(ftruncate(fildes, TRUNC_LEN)); - - /* check return code of ftruncate(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, - "ftruncate() of %s Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, - strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the testfile information using - * fstat(2). - */ - if (fstat(fildes, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, - "stat(2) of %s failed, error:%d", - TESTFILE, errno); - } - stat_buf.st_mode &= ~S_IFREG; - file_length = stat_buf.st_size; - - /* - * Check for expected size of testfile after - * truncate(2) on it. - */ - if (file_length != TRUNC_LEN) { - tst_resm(TFAIL, "%s: Incorrect file size %d, " - "Expected %d", TESTFILE, file_length, - TRUNC_LEN); - } else { - tst_resm(TPASS, "Functionality of ftruncate() " - "on %s successful", TESTFILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - */ -void -setup() -{ - int i; /* counter for for loop() */ - int c, c_total = 0; /* bytes to be written to file */ - char tst_buff[BUF_SIZE]; /* buffer to hold data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* open a file for reading/writing */ - if ((fildes = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write to the file 1k data from the buffer */ - while (c_total < FILE_SIZE) { - if ((c = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } else { - c_total += c; - } - } -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the temporary file. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Close the testfile after writing data into it */ - if (close(fildes) == -1) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/ftruncate02.c b/winsup/testsuite/winsup.api/ltp/ftruncate02.c deleted file mode 100644 index 2b4e72326..000000000 --- a/winsup/testsuite/winsup.api/ltp/ftruncate02.c +++ /dev/null @@ -1,313 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: ftruncate02 - * - * Test Description: - * Verify that, ftruncate(2) succeeds to truncate a file to a certain length, - * but the attempt to read past the truncated length will fail. - * - * Expected Result: - * ftruncate(2) should return a value 0 and the attempt to read past the - * truncated length will fail. In case where the file before truncation was - * shorter, the bytes between the old and new should be all zeroes. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * ftruncate02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" /* file under test */ -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define BUF_SIZE 256 /* buffer size */ -#define FILE_SIZE 1024 /* test file size */ -#define TRUNC_LEN1 256 /* truncation length */ -#define TRUNC_LEN2 512 /* truncation length */ - -const char *TCID="ftruncate02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fd; /* file descriptor of testfile */ -char tst_buff[BUF_SIZE]; /* buffer to hold testfile contents */ - -void setup(); /* setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat(2) struct contents */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - off_t file_length2; /* test file length */ - off_t file_length1; /* test file length */ - int rbytes, i; /* bytes read from testfile */ - int read_len = 0; /* total no. of bytes read from testfile */ - int err_flag = 0; /* error indicator flag */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call ftruncate(2) to truncate a test file to a - * specified length (TRUNC_LEN1). - */ - TEST(ftruncate(fd, TRUNC_LEN1)); - - /* check return code of ftruncate(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "ftruncate of %s to size %d Failed, " - "errno=%d : %s", TESTFILE, TRUNC_LEN1, - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the testfile information using - * fstat(2). - */ - if (fstat(fd, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "fstat(2) of %s failed" - " after 1st truncate, error:%d", - TESTFILE, errno); - } - stat_buf.st_mode &= ~S_IFREG; - file_length1 = stat_buf.st_size; - - /* - * Set the file pointer of testfile to the - * beginning of the file. - */ - if (lseek(fd, 0, SEEK_SET) < 0) { - tst_brkm(TFAIL, cleanup, "lseek(2) on %s failed" - " after 1st ftruncate, error:%d", - TESTFILE, errno); - } - - /* Read the testfile from the beginning. */ - while ((rbytes = read(fd, tst_buff, - sizeof(tst_buff))) > 0) { - read_len += rbytes; - } - - /* - * Execute ftruncate(2) again to truncate - * testfile to a size TRUNC_LEN2. - */ - TEST(ftruncate(fd, TRUNC_LEN2)); - - /* check return code of ftruncate(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "ftruncate of %s to size %d " - "Failed, errno=%d : %s", TESTFILE, - TRUNC_LEN2, TEST_ERRNO, - strerror(TEST_ERRNO)); - continue; - } - - /* - * Get the testfile information using - * fstat(2) - */ - if (fstat(fd, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "fstat(2) of %s failed" - " after 2nd truncate, error:%d", - TESTFILE, errno); - } - stat_buf.st_mode &= ~S_IFREG; - file_length2 = stat_buf.st_size; - - /* - * Set the file pointer of testfile to the - * offset TRUNC_LEN1 of testfile. - */ - if (lseek(fd, TRUNC_LEN1, SEEK_SET) < 0) { - tst_brkm(TFAIL, cleanup, "lseek(2) on %s failed" - " after 2nd ftruncate, error:%d", - TESTFILE, errno); - } - - /* Read the testfile contents till EOF */ - while((rbytes = read(fd, tst_buff, - sizeof(tst_buff))) > 0) { - for (i = 0; i < rbytes; i++) { - if (tst_buff[i] != 0) { - err_flag++; - } - } - } - - /* - * Check for expected size of testfile after - * issuing ftruncate(2) on it. - */ - if ((file_length1 != TRUNC_LEN1) || - (file_length2 != TRUNC_LEN2) || - (read_len != TRUNC_LEN1) || - (err_flag != 0)) { - tst_resm(TFAIL, "Functionality of ftruncate(2) " - "on %s Failed", TESTFILE); - } else { - tst_resm(TPASS, "Functionality of ftruncate(2) " - "on %s successful", TESTFILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - */ -void -setup() -{ - int i; /* counter variable */ - int wbytes; /* bytes written to testfile */ - int write_len = 0; /* total no. of bytes written to testfile */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - /* open a file for reading/writing */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fd, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } else { - write_len += wbytes; - } - } -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the testfile. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Close the testfile after writing data into it */ - if (close(fd) == -1) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/ftruncate03.c b/winsup/testsuite/winsup.api/ltp/ftruncate03.c deleted file mode 100644 index 279b4e88f..000000000 --- a/winsup/testsuite/winsup.api/ltp/ftruncate03.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: ftruncate03 - * - * Test Description: - * Verify that, - * 1) ftruncate(2) returns -1 and sets errno to EINVAL if the specified - * truncate length is less than 0. - * 2) ftruncate(2) returns -1 and sets errno to EBADF if the file descriptor - * of the specified file is not valid. - * - * Expected Result: - * ftruncate() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * ftruncate03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be executed by 'non-super-user' only. - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEST_FILE1 "test_file1" /* file under test */ -#define TEST_FILE2 "test_file2" /* file under test */ -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define BUF_SIZE 256 /* buffer size */ -#define FILE_SIZE 1024 /* test file size */ - -int no_setup(); -int setup1(); /* setup function to test chmod for EBADF */ -int setup2(); /* setup function to test chmod for EINVAL */ - -int fd1; /* File descriptor for testfile1 */ -int fd2; /* File descriptor for testfile2 */ - -struct test_case_t { /* test case struct. to hold ref. test cond's*/ - int fd; - const char *desc; - int exp_errno; - int len; - int (*setupfunc)(); -} Test_cases[] = { - { 1, "Length argument is -ve", EINVAL, -1, setup1 }, - { 2, "File descriptor is not valid", EBADF, 256, setup2 }, - { 0, NULL, 0, 0, no_setup } -}; - -const char *TCID="ftruncate03"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EINVAL, EBADF, 0}; - -void setup(); /* Main setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* Main cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *test_desc; /* test specific error message */ - int fildes; /* File descriptor of testfile */ - off_t trunc_len; /* truncate length */ - int ind; - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* - * Perform global setup for test to call individual test specific - * setup functions. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - fildes = Test_cases[ind].fd; - test_desc = Test_cases[ind].desc; - trunc_len = Test_cases[ind].len; - - if (fildes == 1) { - fildes = fd1; - } else { - fildes = fd2; - } - - /* - * Call ftruncate(2) to test different test conditions. - * verify that it fails with return code -1 and sets - * appropriate errno. - */ - TEST(ftruncate(fildes, trunc_len)); - - /* check return code of ftruncate(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == Test_cases[ind].exp_errno) { - tst_resm(TPASS, "ftruncate() fails, %s," - " errno=%d", test_desc, - TEST_ERRNO); - } else { - tst_resm(TFAIL, "ftruncate() fails, %s," - " errno=%d, expected errno:%d", - test_desc, TEST_ERRNO, - Test_cases[ind].exp_errno); - } - } else { - tst_resm(TFAIL, "ftruncate() returned %d, " - "expected -1, errno:%d", TEST_RETURN, - Test_cases[ind].exp_errno); - } - } /* End of TEST CASE LOOPING. */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Fill the test buffer with some date used to fill test file(s). - * Call individual test specific setup functions. - */ -void -setup() -{ - int ind; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Check that the test process id is not root/super-user */ - if (geteuid() == 0) { - tst_brkm(TBROK, NULL, "Must be non-root/super for this test!"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - Test_cases[ind].setupfunc(); - } -} /* End of setup */ - -/* - * int - * setup1() - setup function for a test condition for which ftruncate(2) - * returns -1 and sets errno to EINVAL. - * Create a test file and open it for writing only. - */ -int -setup1() -{ - /* Open the testfile in write-only mode */ - if ((fd1 = open(TEST_FILE1, O_WRONLY|O_CREAT, 0644)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_WRONLY) Failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - } - return 0; -} /* End setup1() */ - -/* - * int - * setup2() - setup function for a test condition for which ftruncate(2) - * returns -1 and sets errno to EBADF. - * Create a test file and open it for reading/writing, and fill the - * testfile with the contents of test buffer. - * Close the test file. - * - */ -int -setup2() -{ - int c, i, c_total = 0; - char tst_buff[BUF_SIZE]; /* buffer to hold testfile contents */ - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* open a testfile for reading/writing */ - if ((fd2 = open(TEST_FILE2, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TEST_FILE2, FILE_MODE, errno, strerror(errno)); - } - - /* Write to the file 1k data from the buffer */ - while (c_total < FILE_SIZE) { - if ((c = write(fd2, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - } else { - c_total += c; - } - } - - /* Close the testfile after writing data into it */ - if (close(fd2) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - } - return 0; -} /* End of setup2 */ - -/* - * int - * no_setup() - This function just returns 0. - */ -int -no_setup() -{ - return 0; -} - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the temporary file. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Close the testfile after opening it read-only in setup1 */ - if (close(fd1) == -1) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getegid01.c b/winsup/testsuite/winsup.api/ltp/getegid01.c deleted file mode 100644 index 942201067..000000000 --- a/winsup/testsuite/winsup.api/ltp/getegid01.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getegid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getegid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getegid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getegid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getegid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getegid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0}; /* must be a 0 terminated list */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - ; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Get effective group id. - */ - ; - - /* Call getegid(2) */ - TEST(getegid( )); - - /* check return code */ - if ( TEST_RETURN < 0 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getegid - Get effective group id. failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; /* next loop for MTKERNEL */ - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getegid - Get effective group id. returned %d", TEST_RETURN); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/geteuid01.c b/winsup/testsuite/winsup.api/ltp/geteuid01.c deleted file mode 100644 index 82a681ec5..000000000 --- a/winsup/testsuite/winsup.api/ltp/geteuid01.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : geteuid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for geteuid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) geteuid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the geteuid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * geteuid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="geteuid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0}; /* must be a 0 terminated list */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - ; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Get effective user id. - */ - ; - - /* Call geteuid(2) */ - TEST(geteuid( )); - - /* check return code */ - if ( TEST_RETURN < 0 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "geteuid - Get effective user id. failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; /* next loop for MTKERNEL */ - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "geteuid - Get effective user id. returned %d", TEST_RETURN); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/getgid01.c b/winsup/testsuite/winsup.api/ltp/getgid01.c deleted file mode 100644 index e5b138c8a..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgid01.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getgid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getgid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getgid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getgid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getgid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getgid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getgid(2) - */ - TEST(getgid()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getgid() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getgid() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getgid02.c b/winsup/testsuite/winsup.api/ltp/getgid02.c deleted file mode 100644 index 5efbda521..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgid02.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * getgid02.c - * - * DESCRIPTION - * Testcase to check the basic functionality of getegid(). - * - * ALGORITHM - * call setup - * loop if that option was specified - * Execute getegid() call using TEST macro - * if not expected value - * break remaining tests and cleanup - * if STD_FUNCTIONAL_TEST - * Execute geteuid() call - * Execute getpwduid() call - * if the passwd entry is NULL - * break the remaining tests and cleanup - * else if pwent->pw_gid != TEST_RETURN - * print failure message - * else - * print pass message - * else - * print pass message - * call cleanup - * - * USAGE: - * getgid02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include -#include - -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "getgid02"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int euid; - struct passwd *pwent; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(getegid()); - - if (TEST_RETURN < 0) { - tst_brkm(TBROK, cleanup, "This should never happen"); - } - - if (STD_FUNCTIONAL_TEST) { - euid = geteuid(); - - pwent = getpwuid(euid); - - if (pwent == NULL) { - tst_brkm(TBROK, cleanup, "geteuid() returned " - "unexpected value %d", euid); - } else { - if (pwent->pw_gid != TEST_RETURN) { - tst_resm(TFAIL, "getegid() return value" - " %d unexpected - expected %d", - TEST_RETURN, pwent->pw_gid); - } else { - tst_resm(TPASS, "effective group id %d " - "is correct", TEST_RETURN); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup() -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/getgid03.c b/winsup/testsuite/winsup.api/ltp/getgid03.c deleted file mode 100644 index ef0eaea14..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgid03.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * getgid01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of getgid(). - * - * ALGORITHM - * call setup - * loop if that option was specified - * Execute getgid() call using TEST macro - * if not expected value - * break remaining tests and cleanup - * if STD_FUNCTIONAL_TEST - * Execute getuid() call - * Execute getpwduid() call - * if the passwd entry is NULL - * break the remaining tests and cleanup - * else if pwent->pw_gid != TEST_RETURN - * print failure message - * else - * print pass message - * else - * print pass message - * call cleanup - * - * USAGE: - * getgid01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include -#include - -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "getgid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int uid; - struct passwd *pwent; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(getgid()); - - if (TEST_RETURN < 0) { - tst_brkm(TBROK, cleanup, "This should never happen"); - } - - if (STD_FUNCTIONAL_TEST) { - uid = getuid(); - pwent = getpwuid(uid); - - if (pwent == NULL) { - tst_brkm(TBROK, cleanup, "getuid() returned " - "unexpected value %d", uid); - } else { - if (pwent->pw_gid != TEST_RETURN) { - tst_resm(TFAIL, "getgid() return value " - "%d unexpected - expected %d", - TEST_RETURN, pwent->pw_gid); - } else { - tst_resm(TPASS, "group id %d returned " - "correctly", TEST_RETURN); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup() -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/getgroups01.c b/winsup/testsuite/winsup.api/ltp/getgroups01.c deleted file mode 100644 index db9f942f6..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgroups01.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/*********************************************************************** -TEST IDENTIFIER: getgroups01 : Getgroups system call critical test - -PARENT DOCUMENT: ggrtds01: Getgroups system call test design spec - -AUTHOR: Barrie Kletscher - Rewrote : 11-92 by Richard Logan - -CO-PILOT: Dave Baumgartner - -TEST ITEMS: - 1. Check to see if getgroups(-1, gidset) fails and sets errno to EINVAL - 2. Check to see if getgroups(0, gidset) does not return -1 and gidset is - not modified. - 3. Check to see if getgroups(x, gigset) fails and sets errno to EINVAL, - where x is one less then what is returned by getgroups(0, gidset). - 4. Check to see if getgroups() succeeds and gidset contains - group id returned from getgid(). - -INPUT SPECIFICATIONS: - NONE - -OUTPUT SPECIFICATIONS: - Standard tst_res output format - -ENVIRONMENTAL NEEDS: - NONE. - -SPECIAL PROCEDURAL REQUIREMENTS: - None - -INTERCASE DEPENDENCIES: - Test case #3 depends on test case #2. - -DETAILED DESCRIPTION: - Set up the signal handling capabilities. - execute tests - exit - -BUGS: - None known. - -************************************************************/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="getgroups01"; /* Test program identifier. */ -int TST_TOTAL=4; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *ptr; /* message returned from parse_opts */ - - int i, /* counter */ - group, /* return value from Getgid() call */ - entries; /* number of group entries */ - - gid_t gidset[NGROUPS]; /* storage for all group ids */ - gid_t cmpset[NGROUPS]; - int ret; - int ret2; - int errors = 0; - char msg[500]; - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (ptr=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", ptr); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * Check to see if getgroups() fails on erraneous condition. - */ - TEST( getgroups(-1,gidset) ); - - if((ret=TEST_RETURN) != -1) { - sprintf(msg, - "getgroups(-1,gidset) returned %d, expected -1 and errno = EINVAL", - ret); - tst_resm(TFAIL,msg); - errors++; - } - else if ( STD_FUNCTIONAL_TEST ) { - if(errno != EINVAL) { - sprintf(msg, - "getgroups(-1,gidset) returned %d, errno = %d, expected errno %d (EINVAL)", - ret, errno, EINVAL); - tst_resm(TFAIL,msg); - errors++; - } - else { - sprintf(msg, - "getgroups(-1,gidset) returned %d and error = %d (EINVAL) as expected", - ret, errno); - tst_resm(TPASS, msg); - } - } - - /* - * Check that if ngrps is zero that the number of groups is return and - * the the gidset array is not modified. - * This is a POSIX special case. - */ - - memset(gidset, 052, NGROUPS); - memset(cmpset, 052, NGROUPS); - - TEST( getgroups(0,gidset) ); - if((ret=TEST_RETURN) < 0) { - sprintf(msg, - "getgroups(0,gidset) returned %d with errno = %d, expected num gids with no change to gidset", - ret, errno); - tst_resm(TFAIL,msg); - errors++; - } - else if ( STD_FUNCTIONAL_TEST ) { - /* - * check that gidset was unchanged - */ - if ( memcmp(cmpset, gidset, NGROUPS) != 0 ) { - sprintf(msg, - "getgroups(0,gidset) returned %d, the gidset array was modified", - ret); - tst_resm(TFAIL,msg); - errors++; - } - else { - sprintf(msg, - "getgroups(0,gidset) returned %d, the gidset array not was modified", - ret); - tst_resm(TPASS, msg); - } - } - - /* - * Check to see that is -1 is returned and errno is set to EINVAL when - * ngroups is not big enough to hold all groups. - */ - - if ( ret <= 1 ) { - sprintf(msg, "getgroups(0,gidset) returned %d, Unable to test that\nusing ngrps >=1 but less than number of grps", ret); - tst_resm(TCONF, msg); - errors++; - } - else { - TEST( getgroups(ret-1, gidset) ); - if ((ret2 = TEST_RETURN) == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( errno != EINVAL ) { - sprintf(msg, - "getgroups(%d, gidset) returned -1, but not errno %d (EINVAL) but %d", - ret-1, EINVAL, errno); - tst_resm(TFAIL, msg); - errors++; - } - else { - sprintf(msg, - "getgroups(%d, gidset) returned -1, and errno %d (EINVAL) when %d grps", - ret-1, errno, ret); - tst_resm(TPASS, msg); - } - } - } - else { - sprintf(msg, - "getgroups(%d, gidset) returned %d, expected -1 and errno EINVAL.", - ret-1, ret2); - tst_resm(TFAIL, msg); - errors++; - } - } - - /* - * Check to see if getgroups() succeeds and contains getgid's gid. - */ - - TEST( getgroups(NGROUPS,gidset) ); - if((entries = TEST_RETURN) == -1) { - sprintf(msg, "getgroups(NGROUPS,gidset) returned -1 and errno = %d", errno); - tst_resm(TFAIL, msg); - errors++; - } - else if ( STD_FUNCTIONAL_TEST ) { - - /* - * Check to see if getgroups() contains getgid(). - */ - - group = getgid(); - - for(i = 0; i < entries; i++) - { - if(gidset[i] == group) - { - sprintf(msg, - "getgroups(NGROUPS,gidset) ret %d contains gid %d (from getgid)", - entries, group); - tst_resm(TPASS, msg); - break; - } - } - - if( i == entries ) { - sprintf(msg, - "getgroups(NGROUPS,gidset) ret %d, does not contain gid %d (from getgid)", - entries, group); - tst_resm(TFAIL,msg); - errors++; - } - } - - } - cleanup(); - - return 0; -} /* end main() */ - - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - diff --git a/winsup/testsuite/winsup.api/ltp/getgroups02.c b/winsup/testsuite/winsup.api/ltp/getgroups02.c deleted file mode 100644 index e05258935..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgroups02.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getgroups02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getgroups(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getgroups(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getgroups(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getgroups(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getgroups02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -/* define array size for gids */ -#define GID_ARRAY_SIZE 100 - -gid_t gidset[GID_ARRAY_SIZE]; /* array of gids */ - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getgroups(2) - */ - TEST(getgroups(GID_ARRAY_SIZE, gidset)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getgroups() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getgroups() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/gethostid01.c b/winsup/testsuite/winsup.api/ltp/gethostid01.c deleted file mode 100644 index ebb6d1724..000000000 --- a/winsup/testsuite/winsup.api/ltp/gethostid01.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : gethostid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for gethostid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) gethostid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the gethostid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * gethostid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="gethostid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0}; /* must be a 0 terminated list */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - ; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Get host name - */ - ; - - /* Call gethostid(2) */ - TEST(gethostid( )); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "gethostid - Get host name failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; /* next loop for MTKERNEL */ - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "gethostid - Get host name returned %d", TEST_RETURN); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/gethostname01.c b/winsup/testsuite/winsup.api/ltp/gethostname01.c deleted file mode 100644 index 0e765bfad..000000000 --- a/winsup/testsuite/winsup.api/ltp/gethostname01.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : gethostname01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for gethostname(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) gethostname(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the gethostname(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * gethostname(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - - - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="gethostname01";/* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0}; /* must be a 0 terminated list */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - char hname[100]; /* host name */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Get host name - */ - ; - - /* Call gethostname(2) */ - TEST(gethostname(hname, sizeof(hname) )); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "gethostname - Get host name failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; /* next loop for MTKERNEL */ - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "gethostname - Get host name returned %d", TEST_RETURN); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/getpgid01.c b/winsup/testsuite/winsup.api/ltp/getpgid01.c deleted file mode 100644 index 88907f413..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpgid01.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * getpgid01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of getpgid(). - * - * ALGORITHM - * block1: Does getpgid(0), and checks for error. - * block2: Does getpgid(getpid()) and checks for error. - * block3: Does getpgid(getppid()) and checks for error. - * block4: Verifies that getpgid(getpgid(0)) == getpgid(0). - * block5: Does getpgid(1) and checks for error. - * - * USAGE - * getpgid01 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * Expects that there are no EPERM limitations on getting the - * process group ID from proc 1 (init). - */ - -#include -#include -#include -#include -#include - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID = "getpgid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned by parse_opts */ - - register int pgid_0, pgid_1; - register int my_pid, my_ppid; - int ex_stat, fail = 0; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - if ((pgid_0 = fork()) < 0) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - if (pgid_0 > 0) { /* parent */ - /* - * parent process waits for child to exit, and then - * exits itself. - */ - while ((pgid_0 = wait(&ex_stat)) > 0); - - if (WEXITSTATUS(ex_stat) == 0) { - tst_resm(TINFO, "%s PASSED", TCID); - } else { - tst_resm(TINFO, "%s FAILED", TCID); - } - - /* let the child carry on */ - exit(0); - } - - /* child */ - tst_resm(TINFO, "Enter block 1"); - fail = 0; - if ((pgid_0 = getpgid(0)) < 0) { - perror("getpgid"); - tst_resm(TFAIL, "getpgid(0) failed"); - fail = 1; - } - - if (fail) { - tst_resm(TINFO, "Test block 1: getpgid(0) FAILED"); - } else { - tst_resm(TPASS, "Test block 1: getpgid(0) PASSED"); - } - tst_resm(TINFO, "Exit block 1"); - - tst_resm(TINFO, "Enter block 2"); - fail = 0; - - my_pid = getpid(); - if ((pgid_1 = getpgid(my_pid)) < 0) { - perror("getpgid"); - tst_resm(TFAIL, "getpgid(my_pid=%d) failed", my_pid); - tst_exit(); - } - if (pgid_0 != pgid_1) { - tst_resm(TFAIL, "getpgid(my_pid=%d) != getpgid(0) " - "[%d != %d]", my_pid, pgid_1, pgid_0); - fail = 1; - } - if (fail) { - tst_resm(TINFO, "Test block 2: getpgid(getpid()) " - "FAILED"); - } else { - tst_resm(TPASS, "Test blcok 2: getpgid(getpid()) " - "PASSED"); - } - tst_resm(TINFO, "Exit block 2"); - - tst_resm(TINFO, "Enter block 3"); - fail = 0; - - my_ppid = getppid(); - if ((pgid_1 = getpgid(my_ppid)) < 0) { - perror("getpgid"); - tst_resm(TFAIL, "getpgid(my_ppid=%d) failed", - my_ppid); - tst_exit(); - } - if (pgid_0 != pgid_1) { - tst_resm(TFAIL, "getpgid(my_ppid=%d) != getpgid(0) " - "[%d != %d]", my_ppid, pgid_1, pgid_0); - fail = 1; - } - - if (fail) { - tst_resm(TINFO, "Test block 3: getpgid(getppid()) " - "FAILED"); - } else { - tst_resm(TPASS, "Test block 3: getpgid(getppid()) " - "PASSED"); - } - tst_resm(TINFO, "Exit block 3"); - - tst_resm(TINFO, "Enter block 4"); - fail = 0; - - if ((pgid_1 = getpgid(pgid_0)) < 0) { - perror("getpgid"); - tst_resm(TFAIL, "getpgid(my_pgid=%d) failed", pgid_0); - tst_exit(); - } - if (pgid_0 != pgid_1) { - tst_resm(TFAIL, "getpgid(my_pgid=%d) != getpgid(0) " - "[%d != %d]", pgid_0, pgid_1, pgid_0); - fail = 1; - } - - if (fail) { - tst_resm(TINFO, "Test block 4: getpgid(1) FAILED"); - } else { - tst_resm(TPASS, "Test block 4: getpgid(1) PASSED"); - } - tst_resm(TINFO, "Exit block 4"); -#ifndef __CYGWIN__ -block5: - tst_resm(TINFO, "Enter block 5"); - fail = 0; - - if (getpgid(1) < 0) { - perror("getpgid"); - tst_resm(TFAIL, "getpgid(1) failed"); - fail = 1; - } - - if (fail) { - tst_resm(TINFO, "Test block 5: getpgid(1) FAILED"); - } else { - tst_resm(TPASS, "Test block 5: getpgid(1) PASSED"); - } - tst_resm(TINFO, "Exit block 5"); -#endif - } - cleanup(); -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/getpgid02.c b/winsup/testsuite/winsup.api/ltp/getpgid02.c deleted file mode 100644 index f6eaec6f6..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpgid02.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * getpgid02.c - * - * DESCRIPTION - * Testcase to check the basic functionality of getpgid(). - * - * ALGORITHM - * test 1: Does getpgid(-99) and expects ESRCH. - * test 2: Searches an unused pid and expects ESRCH. - * - * USAGE: - * getpgid02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include -#include -#include -#include -#include - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID = "getpgid01"; -int TST_TOTAL = 2; -extern int Tst_count; - -int pgid_0, pgid_1; -#define BADPID -99 - -int exp_enos[]={ESRCH, 0}; - -struct test_case_t { - int *id; - int error; -} TC[] = { - /* The pid value is negative */ - {&pgid_0, ESRCH}, - - /* The pid value does not match any process */ - {&pgid_1, ESRCH} -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - int i; - const char *msg; /* message returned by parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* set up the expected errnos */ - TEST_EXP_ENOS(exp_enos); - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - - /* loop through the test cases */ - for (i = 0; i < TST_TOTAL; i++) { - - TEST(getpgid(*TC[i].id)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "call succeeded unexpectedly"); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO == TC[i].error) { - tst_resm(TPASS, "expected failure - " - "errno = %d : %s", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "unexpected error - %d : %s - " - "expected %d", TEST_ERRNO, - strerror(TEST_ERRNO), TC[i].error); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - pgid_0 = BADPID; - - /* - * Find a pid that isn't currently being used. Start - * at 'our pid - 1' and go backwards until we find one. - * In this way, we can be reasonably sure that the pid - * we find won't be reused for a while as new pids are - * allocated counting up to PID_MAX. - */ - for (pgid_1 = getpid() - 1; --pgid_1 > 0; ) { - if (kill(pgid_1, 0) < 0 && errno == ESRCH) { - break; - } - } -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/getpgrp01.c b/winsup/testsuite/winsup.api/ltp/getpgrp01.c deleted file mode 100644 index 6997be264..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpgrp01.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getpgrp01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getpgrp(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getpgrp(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getpgrp(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getpgrp(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getpgrp01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getpgrp(2) - */ - TEST(getpgrp()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getpgrp() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getpgrp() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getpid01.c b/winsup/testsuite/winsup.api/ltp/getpid01.c deleted file mode 100644 index df8197d28..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpid01.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getpid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getpid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getpid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getpid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getpid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getpid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getpid(2) - */ - TEST(getpid()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getpid() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getpid() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getpid02.c b/winsup/testsuite/winsup.api/ltp/getpid02.c deleted file mode 100644 index 06d80b38d..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpid02.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: getpid01 - * - * Test Description: - * Verify that getpid() system call gets the process ID of the of the - * calling process. - * - * Expected Result: - * getpid() should return pid of the process on success. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * - * Usage: - * getpid01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -const char *TCID="getpid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t proc_id; /* process id of the test process */ - pid_t pid; /* process id of the child process */ - pid_t pproc_id; /* parent process id */ - int status; /* exit status of child process */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Invoke getpid() to get the process id of - * the test process. - */ - TEST(getpid()); - - /* Save the process id returned by getpid() */ - proc_id = TEST_RETURN; - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* Fork a child now */ - if ((pid = fork()) < 0) { - tst_resm(TFAIL, "fork() failed to create child," - " error=%d", TEST_ERRNO); - } else if (pid == 0) { /* Child process */ - /* Get the parent process id */ - pproc_id = getppid(); - - /* Verify if the two process IDs match */ - if (pproc_id != proc_id) { - exit(1); - } - exit(0); - } else { /* parent process */ - wait(&status); - - /* Check exit status of child */ - if (WEXITSTATUS(status) != 0) { - tst_resm(TFAIL, "getpid() returned " - "invalid pid %d", proc_id); - } else { - tst_resm(TPASS, "Functionality of " - "getpid() successful"); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Setup signal catching function. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/getppid01.c b/winsup/testsuite/winsup.api/ltp/getppid01.c deleted file mode 100644 index d0e6032c0..000000000 --- a/winsup/testsuite/winsup.api/ltp/getppid01.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getppid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getppid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getppid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getppid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getppid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getppid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getppid(2) - */ - TEST(getppid()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getppid() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getppid() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getppid02.c b/winsup/testsuite/winsup.api/ltp/getppid02.c deleted file mode 100644 index 50a72e470..000000000 --- a/winsup/testsuite/winsup.api/ltp/getppid02.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * getppid01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the getppid() syscall. - * - * USAGE: - * getppid01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include - -const char *TCID = "getppid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int pid, ppid; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - ppid = getpid(); - pid = fork(); - if (pid < 0) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (pid == 0) { /* child */ - TEST(getppid()); - - if (TEST_RETURN < 0) { - tst_resm(TFAIL, "something is really broken"); - continue; - } - - if (STD_FUNCTIONAL_TEST) { - if (TEST_RETURN != ppid) { - tst_resm(TFAIL, "getppid() failed"); - } else { - tst_resm(TPASS, "return value = " - "parent's pid value"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - } else { - wait(NULL); - - /* let the child carry on */ - exit(0); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/getuid01.c b/winsup/testsuite/winsup.api/ltp/getuid01.c deleted file mode 100644 index cd3dff769..000000000 --- a/winsup/testsuite/winsup.api/ltp/getuid01.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getuid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getuid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getuid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getuid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getuid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getuid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getuid(2) - */ - TEST(getuid()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getuid() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getuid() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getuid02.c b/winsup/testsuite/winsup.api/ltp/getuid02.c deleted file mode 100644 index 966b55290..000000000 --- a/winsup/testsuite/winsup.api/ltp/getuid02.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * getuid02.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the geteuid() system call. - * - * USAGE: - * getuid02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include - -const char *TCID = "getuid02"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned by parse_opts */ - - struct passwd *pwent; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* check looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(geteuid()); - - if (TEST_RETURN < 0) { - tst_brkm(TBROK, cleanup, "This should never happen"); - } - - if (STD_FUNCTIONAL_TEST) { - - pwent = getpwuid(TEST_RETURN); - if (pwent == NULL) { - tst_resm(TFAIL, "geteuid() returned unexpected " - "value %d", TEST_RETURN); - } else { - if (pwent->pw_uid != TEST_RETURN) { - tst_resm(TFAIL, "getpwuid() value, %d, " - "does not match geteuid() " - "value, %d", pwent->pw_uid, - TEST_RETURN); - } else { - tst_resm(TPASS, "values from geteuid()" - " and getpwuid() match"); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/getuid03.c b/winsup/testsuite/winsup.api/ltp/getuid03.c deleted file mode 100644 index e18c366f4..000000000 --- a/winsup/testsuite/winsup.api/ltp/getuid03.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * getuid01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the getuid() system call. - * - * USAGE: - * getuid01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include - -const char *TCID = "getuid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned by parse_opts */ - - struct passwd *pwent; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* check looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(getuid()); - - if (TEST_RETURN < 0) { - tst_brkm(TBROK, cleanup, "This should never happen"); - } - - if (STD_FUNCTIONAL_TEST) { - - pwent = getpwuid(TEST_RETURN); - if (pwent == NULL) { - tst_resm(TFAIL, "getuid() returned unexpected " - "value %d", TEST_RETURN); - } else { - if (pwent->pw_uid != TEST_RETURN) { - tst_resm(TFAIL, "getpwuid() value, %d, " - "does not match getuid() " - "value, %d", pwent->pw_uid, - TEST_RETURN); - } else { - tst_resm(TPASS, "values from getuid()" - " and getpwuid() match"); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/kill01.c b/winsup/testsuite/winsup.api/ltp/kill01.c deleted file mode 100644 index 042899173..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill01.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * kill01.c - * - * DESCRIPTION - * Test case to check the basic functionality of kill(). - * - * ALGORITHM - * call setup - * loop if the -i option was given - * fork a child - * execute the kill system call - * check the return value - * if return value is -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * if the process was terminated with the expected signal. - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE - * kill01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * This test should be ran as a non-root user. - */ - -#include "test.h" -#include "usctest.h" - -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "kill01()"; -int TST_TOTAL = 1; - -extern int Tst_count; - -#define TEST_SIG SIGKILL - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t pid; - int exno, status, nsig; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - status = 1; - exno = 1; - pid = fork(); - if (pid < 0) { - tst_brkm(TBROK, cleanup, "Fork of child failed"); - } else if (pid == 0) { - pause(); - /*NOTREACHED*/ - exit(exno); - } else { - TEST(kill(pid, TEST_SIG)); - waitpid(pid, &status, 0); - } - - if (TEST_RETURN == -1) { - tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s", - TCID, TEST_ERRNO, strerror(TEST_ERRNO)); - /*NOTREACHED*/ - } - - if (STD_FUNCTIONAL_TEST) { - /* - * Check to see if the process was terminated with the - * expected signal. - */ - nsig = WTERMSIG(status); - if (nsig == TEST_SIG) { - tst_resm(TPASS, "received expected signal %d", - nsig); - } else { - tst_resm(TFAIL, "expected signal %d received %d" ,TEST_SIG,nsig); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/kill02.c b/winsup/testsuite/winsup.api/ltp/kill02.c deleted file mode 100644 index eba47cc6a..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill02.c +++ /dev/null @@ -1,857 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/*********************************************************************************** - - OS Test - Silicon Graphics, Inc. - - TEST IDENTIFIER : kill02 Sending a signal to processes with the same process group ID. - - PARENT DOCUMENT : kiltds01 Kill System Call. - - AUTHOR : Dave Baumgartner - - CO-PILOT : Barrie Kletscher - - DATE STARTED : 12/30/85 - - TEST ITEMS - - 1. Sending a signal to pid of zero sends to all processes whose process - group ID is equal to the process group ID as the sender. - - 2. Sending a signal to pid of zero does not send to processes in another process group. - - - OUTPUT SPECIFICATIONS - - PASS : - kiltcs02 1 PASS The signal was sent to all processes in the process group. - kiltcs02 2 PASS The signal was not sent to selective processes that were not in the process group. - - FAIL : - kiltcs02 1 FAIL The signal was not sent to all processes in the process group. - kiltcs02 2 FAIL The signal was sent to a process that was not in the process group. - - BROK : - kiltcs02 # BROK System call XXX failed. Errno:X, Error message:XXX. - kiltcs02 # BROK Setting to catch unexpected signal %d failed. Errno: %d, Error message %s. - kiltcs02 # BROK Setting to ignore signal %d failed. Errno: %d, Error message %s. - - WARN : - kiltcs02 0 WARN Unexpected signal X was caught. - - SPECIAL PROCEDURAL REQUIREMENTS - - The program must be linked with tst_res.o. - - DETAILED DESCRIPTION - - **Setup** - Set up unexpected signal handling. - Set up one pipe for each process to be created with no blocking for read. - - **MAIN** - If setup fails exit. - Fork 2 children(1 & 2). - Wait for set up complete messages from the 1st and 2nd child. - Send the signal SIGUSR1 with pid equal to zero. - Sleep a reasonable amount of time so that each child has been swapped in - to process the signal. - Now decide the outcome of the test items by reading from each pipe to find - out if the child was interrupted by the signal and wrote to it. - Remove the second child. - Tell the first child it is time to remove it's child B because the decisions have been made. - Exit. - - **First Child** - Set to catch SIGUSR1 with an int_rout1. - Set up to handle the message from the parent to remove child B. - Fork two children(A & B). - Wait for set up complete messages from child A & child B. - Send a set up complete message to the parent. - Pause until the signal SIGUSR1 comes in from the parent. - Pause until the parent says it is time to remove the child. - Exit. - - **Second Child** - Set to catch SIGUSR1 with an int_rout2. - Set the process group to be something different than the parents. - Send a set up complete message to the parent. - Pause until killed by parent because this child shouldn't receive signal SIGUSR1. - - **Child A** - Set to catch SIGUSR1 with an int_routA. - Send a set up complete message to the parent(First Child). - Pause until the signal SIGUSR1 comes in from the parent. - Exit. - - **Child B** - Set to catch SIGUSR1 with an int_routB. - Set the process group to be something different than the parents(First Child's). - Send a set up complete message to the parent. - Pause until killed by parent because this child shouldn't receive signal SIGUSR1. - - **usr1_rout-Used by all children** - Write to the appropriate pipe that the signal SIGUSR1 was caught. - - **usr2_rout** - Remove child B. - -******************************************************************************/ -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -#define MAXMESG 150 /*The maximum message that can be created. */ -#define CHAR_SET_FAILED "0" /*Set up failing status transferred through the pipe. */ -#define CHAR_SET_PASSED "1" /*Set up passing status transferred through the pipe. */ -#define SIG_CAUGHT "2" /*Indicates that the signal SIGUSR1 was caught. */ -#define SIG_RECEIVED 1 /*Integer value that indicates that the signal SIGUSR1 */ - /*was caught. */ -#define SIG_NOT_RECD 0 /*Integer value that indicates that the signal SIGUSR1 */ - /*was caught. */ -#define INT_SET_FAILED 0 /*Set up failing status transferred through the pipe. */ -#define INT_SET_PASSED 1 /*Set up passing status transferred through the pipe. */ -#define SLEEP_TIME 10 /*Amount of time the children get to catch the signal */ -#define TRUE 40 /*Child exits with this if execution was as */ - /*expected. */ -#define FALSE 50 /*Child exits with this if it timed out waiting for the */ - /*parents signal. */ -#define TIMEOUT 60 /*Amount of time given in alarm calls. */ -#define CHILD_EXIT(VAR) ((VAR >> 8) & 0377) /*Exit value from the child. */ -#define CHILD_SIG(VAR) (VAR & 0377) /*Signal value from the termination of child. */ - /*from the parent. */ -#define SYS_FAIL "The system call %s failed. Errno: %d, Error message: %s." - -int pid1; /*Return value from 1st fork. Global so that it can be */ - /*used in interrupt handling routines. */ -int pid2; /*Return value from 2nd fork. Global so that it can be */ - /*used in interrupt handling routines. */ -int pidA; /*Return value from 1st fork in child 1. Global so that it */ - /*can be used in interrupt handling routines. */ -int pidB; /*Return value from 2nd fork in child 1. Global so that it */ - /*can be used in interrupt handling routines. */ -extern int errno; /*Error number returned by a system call. */ -int pipe1_fd[2]; /*Pipe file descriptors used for communication */ - /*between child 1 and the 1st parent. */ -int pipe2_fd[2]; /*Pipe file descriptors used for communication */ - /*between child 2 and the 1st parent. */ -int pipeA_fd[2]; /*Pipe file descriptors used for communication */ - /*between child A and the 1st parent. */ -int pipeB_fd[2]; /*Pipe file descriptors used for communication */ - /*between child B and the 1st parent. */ -char pipe_buf[10]; /*Pipe buffer. */ -char buf_tmp1[2],buf_tmp2[2]; /*Temp hold for info read into pipe_buf. */ -int read1_stat = 0; /*Number of characters read from pipe 1. */ -int read2_stat = 0; /*Number of characters read from pipe 2. */ -int readA_stat = 0; /*Number of characters read from pipe A. */ -int readB_stat = 0; /*Number of characters read from pipe B. */ -int alarm_flag = FALSE; /*This flag indicates an alarm time out. */ -char who_am_i = '0'; /*This indicates which process is which when using */ - /*interrupt routine usr1_rout. */ - -void notify_timeout(); /*Signal handler that the parent enters if it times out */ - /*waiting for the child to indicate its set up status. */ -void parent_rout(); /*This is the parents routine. */ -void child1_rout(); /*This is child 1's routine. */ -void child2_rout(); /*This is child 2's routine. */ -void childA_rout(); /*This is child A's routine. */ -void childB_rout(); /*This is child B's routine. */ -void usr1_rout(); /*This routine is used by all children to indicate that */ - /*they have caught signal SIGUSR1. */ -void par_kill(); /*This routine is called by the original parent to */ - /*remove child 2 and to indicate to child 1 to */ - /*remove its children. */ -void chld1_kill(); /*This routine is used by child 1 to remove itself and */ - /*its children A and B. */ - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="kill02"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* var. used to turn off tst_res buffering */ - -int exp_enos[]={0}; /* Array of expected errnos */ - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - char mesg[MAXMESG]; /* Holds messages to pass to tst_res. */ - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; - - /*************************************************************** - * parse standard options, and exit if there is an error - * the -t and -f options not support yet. - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if ((pid1 = fork()) > 0) - { - /* - * This is the parent, fork again to create child 2. - */ - if ((pid2 = fork()) > 0) { - /* - * This is the parent. - */ - (void) parent_rout(); - } - else if (pid2 == 0) { - /* - * This is child 2. - */ - (void) child2_rout(); - } - else { - /* - * The second fork failed kill the first child. - */ - if (kill(pid1,SIGKILL) == -1 && errno != ESRCH) { - tst_resm(TWARN,"Child process may not have been killed."); - } - (void) sprintf(mesg,SYS_FAIL,"fork",errno,strerror(errno)); - tst_brkm(TBROK,cleanup,mesg); - } - - } - else if (pid1 == 0) { - /* - * This is child 1. - */ - (void) child1_rout(); - } - else { - /* - * Fork failed. - */ - (void) sprintf(mesg,SYS_FAIL,"fork",errno,strerror(errno)); - tst_brkm(TBROK,cleanup,mesg); - } - } - - cleanup(); - - return 0; -} /* END OF MAIN.*/ - -/****************************************************************************** - * This is the parents routine. The parent waits for the children 1 and 2 to - * get set up. Then sends the signal and checks the outcome. - *********************************************************************************/ -void parent_rout() -{ - char mesg[MAXMESG]; /*Used to buffer messages for tst_resm. */ - - /* - * Set to catch the alarm signal SIGALRM. - */ - if (signal(SIGALRM,notify_timeout) == SIG_ERR) { - (void) par_kill(); - tst_brkm(TBROK, NULL, - "Could not set to catch the parents time out alarm."); - tst_exit(); - } - - /* - * Setting to catch the timeout alarm worked now let the children start up. - * Set an alarm which causes a time out on the read pipe loop. - * The children will notify the parent that set up is complete - * and the pass/fail status of set up. - */ - (void) alarm(TIMEOUT); - - while ((read(pipe1_fd[0],pipe_buf,1) != 1) && (alarm_flag == FALSE)) - /*EMPTY*/; - strncpy(buf_tmp1,pipe_buf,1); - (void) alarm(TIMEOUT); - - while ((read(pipe2_fd[0],pipe_buf,1) != 1) && (alarm_flag == FALSE)) - /*EMPTY*/; - (void) alarm(0); /*Reset the alarm clock.*/ - strncpy(buf_tmp2,pipe_buf,1); - - /* - * Check the alarm flag. - */ - if (alarm_flag == TRUE) { - tst_brkm(TBROK,NULL,"The set up of the children failed by timing out."); - (void) par_kill(); - cleanup(); - } - - /* - * Check to see if either child failed in the set up. - */ - if ( (strncmp(buf_tmp1,CHAR_SET_FAILED,1) == 0) || - (strncmp(buf_tmp2,CHAR_SET_FAILED,1) == 0)) { - /* - * Problems were encountered in the set up of one of the children. - * The error message has been displayed by the child. - */ - (void) par_kill(); - cleanup(); - } - - /* - * Setup passed, now send SIGUSR1 to process id of zero. - */ - TEST( kill(0,SIGUSR1) ); - - if ( TEST_RETURN == -1) - { - (void) sprintf(mesg,SYS_FAIL,"kill",errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - (void) par_kill(); - cleanup(); - } - - /* - * Sleep for a while to allow the children to get a chance to - * catch the signal. - */ - (void) sleep(SLEEP_TIME); - - /* - * The signal was sent above and time has run out for child response, - * check the outcomes. - */ - read1_stat = read(pipe1_fd[0],pipe_buf,1); - if (read1_stat == -1 && errno == EAGAIN) read1_stat = 0; - read2_stat = read(pipe2_fd[0],pipe_buf,1); - if (read2_stat == -1 && errno == EAGAIN) read2_stat = 0; - readA_stat = read(pipeA_fd[0],pipe_buf,1); - if (readA_stat == -1 && errno == EAGAIN) readA_stat = 0; - readB_stat = read(pipeB_fd[0],pipe_buf,1); - if (readB_stat == -1 && errno == EAGAIN) readB_stat = 0; - - if (read1_stat == -1 || read2_stat == -1 || - readA_stat == -1 || readB_stat == -1) { - /* - * The read system call failed. - */ - (void) sprintf(mesg,SYS_FAIL,"read",errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - (void) par_kill(); - cleanup(); - } - - /* - * Check the processes that were supposed to get the signal. - */ - if (read1_stat == SIG_RECEIVED) { - if (readA_stat == SIG_RECEIVED) { - /* - * Both processes, 1 and A, that were supposed to receive - * the signal did receive the signal. - */ - if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, - "The signal was sent to all processes in the process group."); - else - Tst_count++; - } - else { /*Process A didn't receive the signal.*/ - tst_resm(TFAIL,"Process A did not receive the signal."); - } - - } - else { /*Process 1 didn't receive the signal.*/ - tst_resm(TFAIL,"Process 1 did not receive the signal."); - } - - /* - * Check the processes that were not supposed to get the signal. - */ - if (read2_stat == SIG_NOT_RECD) { - if (readB_stat == SIG_NOT_RECD) { - /* - * Both processes, 2 and B did not receive the signal. - */ - if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, - "The signal was not sent to selective processes that were not in the process group."); - else - Tst_count++; - } - else { /*Process B received the signal.*/ - tst_resm(TFAIL,"Process B received the signal."); - } - - } - - else /*Process 2 received the signal.*/ - { - tst_resm(TFAIL,"Process 2 received the signal."); - } - - (void) par_kill(); - return; -} /*End of parent_rout*/ - -/******************************************************************************* - * This is child 1's routine. It creates children A & B, checks their set up, - * reports to the parent set up pass/fail info., then waits for - * the parents signal. - ******************************************************************************/ -void child1_rout() -{ - char mesg[MAXMESG]; /*Used to buffer messages for tst_resm. */ - who_am_i = '1'; - - /* - * Set to catch the SIGUSR1 with int1_rout. - */ - if (signal(SIGUSR1,usr1_rout) == SIG_ERR) - { - tst_brkm(TBROK,NULL,"Could not set to catch the childrens signal."); - (void) write(pipe1_fd[1],CHAR_SET_FAILED,1); - exit(0); - } - - /* - * Create children A & B. - */ - if ((pidA = fork()) > 0) { - /* - * This is the parent(child1), fork again to create child B. - */ - if ((pidB = fork()) == 0) { - /* This is child B. */ - (void) childB_rout(); - } - - else if (pidB == -1) { - /* - * The fork of child B failed kill child A. - */ - if (kill(pidA,SIGKILL) == -1) - tst_resm(TWARN,"Child process may not have been killed."); - (void) sprintf(mesg,SYS_FAIL,"fork",errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - (void) write(pipe2_fd[1],CHAR_SET_FAILED,1); - exit(0); - } - } - - else if (pidA == 0) { - /* This is child A. */ - (void) childA_rout(); - - } - - else if (pidA == -1) { - /* - * The fork of child A failed. - */ - (void) sprintf(mesg,SYS_FAIL,"fork",errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - (void) write(pipe1_fd[1],CHAR_SET_FAILED,1); - exit(0); - } - - /* - * Set to catch the SIGUSR2 with chld1_kill. - */ - if (signal(SIGUSR2,chld1_kill) == SIG_ERR) { - tst_brkm(TBROK,NULL,"Could not set to catch the parents signal."); - (void) write(pipe1_fd[1],CHAR_SET_FAILED,1); - (void) chld1_kill(); - exit(0); - } - - /* - * Set to catch the alarm signal SIGALRM. - */ - if (signal(SIGALRM,notify_timeout) == SIG_ERR) { - tst_brkm(TBROK,NULL,"Could not set to catch the childs time out alarm."); - (void) write(pipe1_fd[1],CHAR_SET_FAILED,1); - (void) chld1_kill(); - exit(0); - } - - /* - * Setting to catch the signals worked now let the children start up. - * Set an alarm which causes a time out on the pipe read loop. - * The children A & B will notify the parent(child1) that set up is complete - * and the pass/fail status of set up. - */ - (void) alarm(TIMEOUT-40); - - while ((read(pipeA_fd[0],pipe_buf,1) != 1) && (alarm_flag == FALSE)) - /*EMPTY*/; - (void) alarm(TIMEOUT-40); - - while ((read(pipeB_fd[0],pipe_buf,1) != 1) && (alarm_flag == FALSE)) - /*EMPTY*/; - (void) alarm(0); /*Reset the alarm clock.*/ - - /* - * Check the alarm flag. - */ - if (alarm_flag == TRUE) { - tst_brkm(TBROK,NULL,"The set up of the children failed by timing out."); - (void) chld1_kill(); - (void) write(pipe1_fd[1],CHAR_SET_FAILED,1); - exit(0); - } - - /* - * Send a set up complete message to the parent. - */ - (void) write(pipe1_fd[1],CHAR_SET_PASSED,1); - - /* - * Pause until the signal SIGUSR1 or SIGUSR2 is sent from the parent. - */ - (void) pause(); - - /* - * Pause until signal SIGUSR2 is sent from the parent. - * This pause will only be executed if SIGUSR2 has not been received yet. - */ - while (1) { - sleep(1); - } - -} /*End of child1_rout*/ - -/******************************************************************************* - * This is the routine for child 2, which should not receive the parents signal. - ******************************************************************************/ -void child2_rout() -{ - who_am_i = '2'; - - /* - * Set the process group of this process to be different - * than the other processes. - */ - (void) setpgrp(); - - /* - * Set to catch the SIGUSR1 with usr1_rout. - */ - if (signal(SIGUSR1,usr1_rout) == SIG_ERR) { - tst_brkm(TBROK,cleanup,"Could not set to catch the parents signal."); - (void) write(pipe2_fd[1],CHAR_SET_FAILED,1); - exit(0); - } - - /* Send a set up complete message to parent.*/ - (void) write(pipe2_fd[1],CHAR_SET_PASSED,1); - - /* - * Pause until killed by the parent or SIGUSR1 is received. - */ - (void) pause(); -} - - -/******************************************************************************* - * This is the routine for child A, which should receive the parents signal. - ******************************************************************************/ -void childA_rout() -{ - who_am_i = 'A'; - - /* Send a set up complete message to parent.*/ - write(pipeA_fd[1],CHAR_SET_PASSED,1); - - /* - * Pause until killed by the parent or SIGUSR1 is received. - */ - (void) pause(); - - exit(0); -} /*End of childA_rout*/ - -/******************************************************************************* - * This is the routine for child B, which should not receive the parents signal. - ******************************************************************************/ -void childB_rout() -{ - who_am_i = 'B'; - - /* - * Set the process group of this process to be different - * than the other processes. - */ - (void) setpgrp(); - - /* Send a set up complete message to parent(child 1).*/ - write(pipeB_fd[1],CHAR_SET_PASSED,1); - - /* - * Pause until killed by the parent(child 1) or SIGUSR1 is received. - */ - (void) pause(); - - exit(0); -} - -/******************************************************************************* - * This routine sets up the interprocess communication pipes, signal handling, - * and process group information. - ******************************************************************************/ -void -setup() -{ - int errno_buf = 0; /*indicates the errno if pipe set up fails. */ - int err_flag = FALSE; /*Indicates if an error has occurred in pipe set up. */ - char mesg[MAXMESG]; /*Used to buffer messages for tst_res. */ - - /* - * Set the process group ID to be equal between the parent and children. - */ - (void) setpgrp(); - - /* - * Set to catch unexpected signals. - * SIGCLD is set to be ignored because we do not wait for termination status. - * SIGUSR1 is set to be ignored because this is the signal we are using for - * the test and we are not concerned with the parent getting it. - */ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - if (signal(SIGUSR1,SIG_IGN) == SIG_ERR) { - (void) sprintf(mesg, - "Setting to ignore signal SIGCLD failed. Errno: %d, Error message %s.", - errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - tst_exit(); - } - - if (signal(SIGCLD,SIG_IGN) == SIG_ERR) { - (void) sprintf(mesg, - "Setting to ignore signal SIGCLD failed. Errno: %d, Error message %s.", - errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - tst_exit(); - } - - /* Indicate which errnos are expected */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified */ - TEST_PAUSE; - - - /* - * Set up pipe1, pipe2, pipeA, and pipeB. - */ - if ((pipe(pipe1_fd) == -1) || (fcntl(pipe1_fd[0],F_SETFL,O_NDELAY) == -1)) - { - errno_buf = errno; - err_flag = TRUE; - } - - if ((pipe(pipe2_fd) == -1) || (fcntl(pipe2_fd[0],F_SETFL,O_NDELAY) == -1)) - { - errno_buf = errno; - err_flag = TRUE; - } - - if ((pipe(pipeA_fd) == -1) || (fcntl(pipeA_fd[0],F_SETFL,O_NDELAY) == -1)) - { - errno_buf = errno; - err_flag = TRUE; - } - - if ((pipe(pipeB_fd) == -1) || (fcntl(pipeB_fd[0],F_SETFL,O_NDELAY) == -1)) - { - errno_buf = errno; - err_flag = TRUE; - } - - /* - * Check for errors. - */ - if (err_flag == TRUE) - { - (void) sprintf(mesg,SYS_FAIL,"pipe",errno_buf,strerror(errno_buf)); - tst_brkm(TBROK, NULL, mesg); - tst_exit(); - } - return; - -} - -/*********************************************************** - * This routine indicates that the process caught SIGUSR1. - **********************************************************/ -void usr1_rout() -{ - char mesg[MAXMESG]; /*Used to buffer messages for tst_res. */ - - switch (who_am_i) - { - case '1': if (write(pipe1_fd[1],SIG_CAUGHT,1) == -1) - tst_resm(TWARN,"Writing signal catching status failed in child 1."); - break; - case '2': if (write(pipe2_fd[1],SIG_CAUGHT,1) == -1) - tst_resm(TWARN,"Writing signal catching status failed in child 2."); - break; - case 'A': if (write(pipeA_fd[1],SIG_CAUGHT,1) == -1) - tst_resm(TWARN,"Writing signal catching status failed in child A."); - break; - case 'B': if (write(pipeB_fd[1],SIG_CAUGHT,1) == -1) - tst_resm(TWARN,"Writing signal catching status failed in child B."); - break; - default: - sprintf(mesg,"Unexpected value %d for who_am_i in usr1_rout().",who_am_i); - tst_resm(TWARN,mesg); - break; - } - -} /*End of usr1_rout*/ - - -/*********************************************************** - * This routine handles the timeout alarm in the parent, - * which occurs when the child fails to notify the parent - * the status of set up. - **********************************************************/ -void notify_timeout() -{ - alarm_flag = TRUE; - -} /*End of notify_timeout*/ - -/*********************************************************** - * This routine handles the procedure for removing the - * children forked off during this test. - **********************************************************/ -void par_kill() -{ - char mesg[MAXMESG]; /*Used to buffer messages for tst_res. */ - /* - * Indicate to child1 that it can remove it's children and itself now. - */ - if (kill(pid1,SIGUSR2) == -1 && errno != ESRCH) - { - (void) sprintf(mesg,SYS_FAIL,"kill",errno,strerror(errno)); - tst_resm(TWARN,mesg); - tst_resm(TWARN,"Child 1 and it's children may still be alive."); - } - - /* - * Remove child 2. - */ - if (kill(pid2,SIGKILL) == -1 && errno != ESRCH) - tst_resm(TWARN,"Child2 may still be alive."); - - return; - -} /*End of par_kill*/ - - -/********************************************************************* - * This routine is executed by child 1 when the parent tells it to - * remove it's children and itself. - ********************************************************************/ -void chld1_kill() -{ - char mesg[MAXMESG]; /*Used to buffer messages for tst_resm. */ - - /* - * Remove children A & B. - */ - if (kill(pidA,SIGKILL) == -1 && errno != ESRCH) - { - (void) sprintf(mesg, - "The system call kill failed. Child 1's(A) child may still be alive. Errno: %d, Error message %s.", - errno,strerror(errno)); - tst_resm(TWARN,mesg); - } - if (kill(pidB,SIGKILL) == -1 && errno != ESRCH) - { - (void) sprintf(mesg, - "The system call kill failed. Child 1's(B) child may still be alive. Errno: %d, Error message %s.", - errno,strerror(errno)); - tst_resm(TWARN,mesg); - } - - exit(0); - -} /*End of chld1_kill*/ - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/kill03.c b/winsup/testsuite/winsup.api/ltp/kill03.c deleted file mode 100644 index 1de727fd7..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill03.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * kill03.c - * - * DESCRIPTION - * Test case to check that kill fails when given an invalid signal. - * - * ALGORITHM - * call setup - * loop if the -i option was given - * fork a child - * execute the kill system call with an invalid signal - * check the return value - * if return value is not -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * if the errno was set to 22 (invalid argument). - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE - * kill03 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include "test.h" -#include "usctest.h" - -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "kill03()"; -int TST_TOTAL = 1; - -extern int Tst_count; - -int exp_enos[] = {EINVAL, 0}; - -#define TEST_SIG 2000 - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t pid; - int exno, status; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - TEST_EXP_ENOS(exp_enos); - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - status = 1; - exno = 1; - pid = fork(); - if (pid < 0) { - tst_brkm(TBROK, cleanup, "Fork of child failed"); - } else if (pid == 0) { - pause(); - /*NOTREACHED*/ - exit(exno); - } else { - TEST(kill(pid, TEST_SIG)); - kill(pid, SIGKILL); - waitpid(pid, &status, 0); - } - - if (TEST_RETURN != -1) { - tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s " - "Expected a return value of -1 got %d", - TCID, TEST_ERRNO, strerror(TEST_ERRNO)), - TEST_RETURN; - /*NOTREACHED*/ - } - - if (STD_FUNCTIONAL_TEST) { - /* - * Check to see if the errno was set to the expected - * value of 22 : EINVAL. - */ - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == EINVAL) { - tst_resm(TPASS, "errno set to %d : %s, as " - "expected", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "errno set to %d : %s expected " - "%d : %s", TEST_ERRNO, - strerror(TEST_ERRNO), 22, strerror(22)); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/kill04.c b/winsup/testsuite/winsup.api/ltp/kill04.c deleted file mode 100644 index a7b3274c3..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill04.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * kill04.c - * - * DESCRIPTION - * Test case to check that kill() fails when passed a non-existant pid. - * - * ALGORITHM - * call setup - * loop if the -i option was given - * fork a child - * execute the kill system call with a non-existant PID - * check the return value - * if return value is not -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * if the errno was set to 3 (No such proccess) - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE - * kill04 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * This test should be run by a non-root user - */ - -#include "test.h" -#include "usctest.h" - -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "kill04()"; -int TST_TOTAL = 1; - -extern int Tst_count; - -int exp_enos[] = {ESRCH, 0}; - -#define TEST_SIG SIGKILL - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t pid, fake_pid; - int exno, status, fake_status, nsig; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - TEST_EXP_ENOS(exp_enos); - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - status = 1; - exno = 1; - pid = fork(); - if (pid < 0) { - tst_brkm(TBROK, cleanup, "Fork failed"); - } else if (pid == 0) { - pause(); - /*NOTREACHED*/ - exit(exno); - } else { - fake_pid = fork(); - if (fake_pid < 0) { - tst_brkm(TBROK, cleanup, "Second fork failed"); - } else if (fake_pid == 0) { - pause(); - /*NOTREACHED*/ - exit(exno); - } - kill(fake_pid, TEST_SIG); - waitpid(fake_pid, &fake_status, 0); - TEST(kill(fake_pid, TEST_SIG)); - kill(pid, TEST_SIG); - waitpid(pid, &status, 0); - } - - if (TEST_RETURN != -1) { - tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s " - "Expected a return value of -1 got %d", - TCID, TEST_ERRNO, strerror(TEST_ERRNO)), - TEST_RETURN; - /*NOTREACHED*/ - } - - if (STD_FUNCTIONAL_TEST) { - /* - * Check to see if the errno was set to the expected - * value of 3 : ESRCH - */ - nsig = WTERMSIG(status); - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == ESRCH) { - tst_resm(TPASS, "errno set to %d : %s, as " - "expected", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "errno set to %d : %s expected " - "%d : %s", TEST_ERRNO, - strerror(TEST_ERRNO), 3, strerror(3)); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/kill09.c b/winsup/testsuite/winsup.api/ltp/kill09.c deleted file mode 100644 index 3b4c24fb5..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill09.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : kill09 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for kill(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) kill(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the kill(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * kill(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void alarm_handler(int sig); - - - - -const char *TCID="kill09"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int fork_pid; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int status; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* make a child process so we can kill it */ - /* If we cannot fork => we cannot test kill, so break and exit */ - if ((fork_pid=fork()) == -1) { - tst_brkm(TBROK, cleanup, - "fork() Failure. errno=%d : %s", - errno, strerror(errno)); - } - - if (fork_pid == 0) { - /* CHILD */ - /* - * Setup alarm signal if we don't get the signal to prevent this process - * from hanging around forever. - */ - signal(SIGALRM, alarm_handler); - alarm(20); - pause(); - exit(1); - } - - /* PARENT */ - /* - * Call kill(2) - */ - TEST(kill(fork_pid, SIGKILL)); - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "kill(%d, SIGKILL) Failed, errno=%d : %s", fork_pid, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "kill(%d, SIGKILL) returned %d", fork_pid, TEST_RETURN); - } - } - - /* - * wait for process to cleanup zombies. - * - */ - waitpid(0, &status, WNOHANG); - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - (void) signal(SIGCHLD, SIG_IGN); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -void -alarm_handler(int sig) -{ - exit(8); -} diff --git a/winsup/testsuite/winsup.api/ltp/link02.c b/winsup/testsuite/winsup.api/ltp/link02.c deleted file mode 100644 index 84c53c23c..000000000 --- a/winsup/testsuite/winsup.api/ltp/link02.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : link02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for link(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) link(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the link(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * link(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="link02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255], Lname[255]; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct stat fbuf, lbuf; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call link(2) - */ - TEST(link(Fname, Lname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "link(%s, %s) Failed, errno=%d : %s", - Fname, Lname, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - stat(Fname, &fbuf); - stat(Lname, &lbuf); - if ( fbuf.st_nlink > 1 && lbuf.st_nlink > 1 && - fbuf.st_nlink == lbuf.st_nlink ) - - tst_resm(TPASS, "link(%s, %s) returned %d and link cnts match", - Fname, Lname, TEST_RETURN); - else { - tst_resm(TFAIL, - "link(%s, %s) returned %d, stat link cnts do not match %d %d", - Fname, Lname, TEST_RETURN, fbuf.st_nlink, - lbuf.st_nlink); - } - } - if (unlink(Lname) == -1) { - tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int fd; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - strcpy(Fname, "tfile"); - if ((fd = open(Fname, O_RDWR|O_CREAT, 0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - strcpy(Lname, "lfile"); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/link03.c b/winsup/testsuite/winsup.api/ltp/link03.c deleted file mode 100644 index 38c16af72..000000000 --- a/winsup/testsuite/winsup.api/ltp/link03.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : link03 - * - * EXECUTED BY : anyone - * - * TEST TITLE : multi links tests - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/31/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) link(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * -N #links : Use #links links every iteration - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the link(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * link(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void help(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="link03"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; - -int exp_enos[]={0, 0}; - -#define BASENAME "lkfile" - -char Basename[255]; -char Fname[255]; -int Nlinks=0; -char *Nlinkarg; - -int Nflag=0; - - -/* for test specific parse_opts options */ -option_t options[] = { - { "N:", &Nflag, &Nlinkarg }, /* -N #links */ - { NULL, NULL, NULL } -}; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct stat fbuf, lbuf; - int cnt; - int nlinks; - char lname[255]; - - Tst_nobuf=1; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - if ( Nflag ) { - if (sscanf(Nlinkarg, "%i", &Nlinks) != 1 ) { - tst_brkm(TBROK, NULL, "--N option arg is not a number"); - tst_exit(); - } - if ( Nlinks > 1000 ) { - tst_resm(TWARN, "--N option arg > 1000 - may get errno:%d (EMLINK)", - EMLINK); - } - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if ( Nlinks ) - nlinks = Nlinks; - else - /* min of 10 links and max of a 100 links */ - nlinks = (lc%90)+10; - - for(cnt=1; cnt < nlinks; cnt++) { - - sprintf(lname, "%s%d", Basename, cnt); - /* - * Call link(2) - */ - TEST(link(Fname, lname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_brkm(TFAIL, cleanup, "link(%s, %s) Failed, errno=%d : %s", - Fname, lname, TEST_ERRNO, strerror(TEST_ERRNO)); - } - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - stat(Fname, &fbuf); - - for(cnt=1; cnt < nlinks; cnt++) { - sprintf(lname, "%s%d", Basename, cnt); - - stat(lname, &lbuf); - if ( fbuf.st_nlink <= 1 || lbuf.st_nlink <= 1 || - (fbuf.st_nlink != lbuf.st_nlink) ) { - - tst_resm(TFAIL, - "link(%s, %s[1-%d]) ret %d for %d files, stat values do not match %d %d", - Fname, Basename, nlinks, TEST_RETURN, nlinks, - fbuf.st_nlink, lbuf.st_nlink); - break; - } - } - if ( cnt >= nlinks ) { - tst_resm(TPASS, - "link(%s, %s[1-%d]) ret %d for %d files, stat linkcounts match %d", - Fname, Basename, nlinks, TEST_RETURN, nlinks, - fbuf.st_nlink); - } - } - else - Tst_count++; - - for(cnt=1; cnt < nlinks; cnt++) { - - sprintf(lname, "%s%d", Basename, cnt); - - if (unlink(lname) == -1) { - tst_res(TWARN, "unlink(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * help - ***************************************************************/ -void -help() -{ - printf(" -N #links : create #links hard links every iteration\n"); -} - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int fd; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname,"%s_%d", BASENAME, getpid()); - if ((fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_res(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - sprintf(Basename, "%s_%d.", BASENAME, getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/link04.c b/winsup/testsuite/winsup.api/ltp/link04.c deleted file mode 100644 index b3453b5d0..000000000 --- a/winsup/testsuite/winsup.api/ltp/link04.c +++ /dev/null @@ -1,426 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : link04 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Negative test cases for link(2). - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 14 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/30/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1-14.) link(2) returns...(See Test_cases structure below) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * Standard tst_res output formt. - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the link(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * link(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include /* for PATH_MAX */ -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -extern char *get_high_address(); - -const char *TCID="link04"; /* Test program identifier. */ -int TST_TOTAL=14; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int longpath_setup(); -int no_setup(); -int filepath_setup(); -int filepath2_setup(); -char Longpathname[PATH_MAX+2]; -char High_address[64]; -int dir_setup(); - -struct test_case_t { - const char *file1; - const char *desc1; - const char *file2; - const char *desc2; - int exp_errno; - int (*setupfunc1)(); - int (*setupfunc2)(); -} Test_cases[] = { - /* This test program should contain test cases where link */ - /* will fail regardless of who executed it (i.e. joe-user or root) */ - - /* first path is invalid */ - - { "nonexistfile", "non-existent file", "nefile", "nefile", - ENOENT, no_setup, no_setup}, - - { "", "path is empty string", "nefile", "nefile", - ENOENT, no_setup, no_setup}, - - { "neefile/file", "path contains a non-existent file", "nefile", "nefile", - ENOENT, no_setup, no_setup }, - -#ifndef __CYGWIN__ - { "regfile/file", "path contains a regular file", "nefile", "nefile", - ENOTDIR, filepath_setup, no_setup }, -#endif - - { Longpathname, "pathname too long", "nefile", "nefile", - ENAMETOOLONG, longpath_setup, no_setup }, - - { High_address, "address beyond address space", "nefile", "nefile", - EFAULT, no_setup, no_setup }, - - { (char *)-1, "negative address", "nefile", "nefile", - EFAULT, no_setup, no_setup }, - - /* second path is invalid */ - - { "regfile", "regfile", "", "empty string", - ENOENT, no_setup, no_setup}, - - { "regfile", "regfile", "neefile/file", "path contains a non-existent file", - ENOENT, filepath_setup, no_setup}, - - { "regfile", "regfile", "file/file", "path contains a regular file", - ENOENT, filepath_setup, no_setup}, - - { "regfile", "regfile", Longpathname, "pathname too long", - ENAMETOOLONG, no_setup, longpath_setup }, - - { "regfile", "regfile", High_address, "address beyond address space", - EFAULT, no_setup, no_setup }, - - { "regfile", "regfile", (char *)-1, "negative address", - EFAULT, no_setup, no_setup}, - - /* two existing files */ - - { "regfile", "regfile", "regfile2", "regfile2", - EEXIST, filepath_setup, filepath2_setup }, - - { NULL, NULL, NULL, NULL, 0, no_setup, no_setup } -}; - - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *fname1, *fname2; - const char *desc1, *desc2; - int ind; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind=0; Test_cases[ind].desc1 != NULL; ind++ ) { - - fname1 = Test_cases[ind].file1; - desc1 = Test_cases[ind].desc1; - fname2 = Test_cases[ind].file2; - desc2 = Test_cases[ind].desc2; - - if ( fname1 == High_address ) - fname1 = get_high_address(); - - if ( fname2 == High_address ) - fname2 = get_high_address(); - - /* - * Call link(2) - */ - TEST(link(fname1, fname2)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == Test_cases[ind].exp_errno ) - tst_resm(TPASS, "link(<%s>, <%s>) Failed, errno=%d", - desc1, desc2, TEST_ERRNO); - else - tst_resm(TFAIL, - "link(<%s>, <%s>) Failed, errno=%d, expected errno:%d", - desc1, desc2, TEST_ERRNO, Test_cases[ind].exp_errno); - } - else - Tst_count++; - } else { - tst_resm(TFAIL, - "link(<%s>, <%s>) returned %d, expected -1, errno:%d", - desc1, desc2, TEST_RETURN, Test_cases[ind].exp_errno); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int ind; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - for (ind=0; Test_cases[ind].desc1 != NULL; ind++ ) { - Test_cases[ind].setupfunc1(); - Test_cases[ind].setupfunc2(); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -/****************************************************************** - * - ******************************************************************/ -int -no_setup() -{ - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -longpath_setup() -{ - int ind; - - static int alreadycalled = 0; - - if ( alreadycalled ) - return 0; - alreadycalled++; - - for(ind=0; ind<= PATH_MAX+1; ind++) { - Longpathname[ind] = 'a'; - } - return 0; - -} - -/****************************************************************** - * - ******************************************************************/ -int -filepath2_setup() -{ - int fd; - static int alreadycalled = 0; - - if ( alreadycalled ) - return 0; - alreadycalled++; - - if ( (fd=creat("regfile2", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, "creat(regfile2, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - return 0; -} -/****************************************************************** - * - ******************************************************************/ -int -filepath_setup() -{ - int fd; - static int alreadycalled = 0; - - if ( alreadycalled ) - return 0; - alreadycalled++; - - if ( (fd=creat("regfile", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, "creat(regfile, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -dir_setup() -{ - static int alreadycalled = 0; - - if ( alreadycalled ) - return 0; - alreadycalled++; - - if ( mkdir("dir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "mkdir(dir, 0700) Failed, errno=%d : %s", - errno, strerror(errno)); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/ltp/link05.c b/winsup/testsuite/winsup.api/ltp/link05.c deleted file mode 100644 index 9387c25a8..000000000 --- a/winsup/testsuite/winsup.api/ltp/link05.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : link05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : multi links (EMLINK) negative test - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 3 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/31/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) link(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the link(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * link(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void help(); - - - -const char *TCID="link05"; /* Test program identifier. */ -#ifdef CRAY -int TST_TOTAL=2; /* Total number of test cases. */ -#else -int TST_TOTAL=1; /* Total number of test cases. */ -#endif -extern int Tst_count; /* Test Case counter for tst_* routines */ - -#define BASENAME "lkfile" - -char Basename[255]; -char Fname[255]; - -int Nflag=0; -char *Noptlinks; - -/* for test specific parse_opts options */ -option_t options[] = { - { "N:", &Nflag, &Noptlinks }, /* -N option */ - { NULL, NULL, NULL } -}; - -int nlinks = 1000; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct stat fbuf, lbuf; - int cnt; - char lname[255]; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - if ( Nflag ) { - if ( sscanf(Noptlinks, "%i", &nlinks) != 1 ) { - tst_brkm(TBROK, cleanup, "-N option invalid, must be numeric"); - } - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for(cnt=1; cnt < nlinks; cnt++) { - - sprintf(lname, "%s%d", Basename, cnt); - /* - * Call link(2) - */ - TEST(link(Fname, lname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - tst_resm(TFAIL, "link(%s, %s) Failed, errno=%d : %s", - Fname, lname, TEST_ERRNO, strerror(TEST_ERRNO)); - } - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - stat(Fname, &fbuf); - - for(cnt=1; cnt < nlinks; cnt++) { - sprintf(lname, "%s%d", Basename, cnt); - - stat(lname, &lbuf); - if ( fbuf.st_nlink <= 1 || lbuf.st_nlink <= 1 || - (fbuf.st_nlink != lbuf.st_nlink) ) { - - tst_resm(TFAIL, - "link(%s, %s[1-%d]) ret %d for %d files, stat values do not match %d %d", - Fname, Basename, nlinks, TEST_RETURN, nlinks, - fbuf.st_nlink, lbuf.st_nlink); - break; - } - } - if ( cnt >= nlinks ) { - tst_resm(TPASS, - "link(%s, %s[1-%d]) ret %d for %d files, stat linkcounts match %d", - Fname, Basename, nlinks, TEST_RETURN, nlinks, - fbuf.st_nlink); - } - } - else - Tst_count++; - -#ifdef CRAY -/* - * IRIX (xfs) systems do not have the 1000 link limit. - * I tried 100000 links on 2/97 without error on IRIX 6.4. - */ - /* - * Now check that one more link will put you over the top - */ - sprintf(lname, "%s%d", Basename, cnt); - - /* - * Call link(2) - */ - TEST(link(Fname, lname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == EMLINK ) { - tst_resm(TPASS, - "link(%s, %s) ret %d on %d link, errno:%d", - Fname, lname, TEST_RETURN, nlinks+1, EMLINK); - } - else { - tst_resm(TFAIL, - "link(%s, %s) ret %d on %d link, errno:%d, expected -1, errno:%d", - Fname, lname, TEST_RETURN, nlinks+1, - TEST_ERRNO, EMLINK); - } - } - else - Tst_count++; - } - else { - tst_resm(TFAIL, "link(%s, %s) ret %d on %d link, expected -1, errno:%d", - Fname, lname, TEST_RETURN, nlinks+1, EMLINK); - } -#endif /* CRAY */ - - for(cnt=1; cnt < nlinks; cnt++) { - - sprintf(lname, "%s%d", Basename, cnt); - - if (unlink(lname) == -1) { - tst_res(TWARN, "unlink(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * help - ***************************************************************/ -void -help() -{ - printf(" -N #links : create #links hard links every iteration\n"); -} - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int fd; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname,"%s_%d", BASENAME, getpid()); - if ((fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_res(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - sprintf(Basename, "%s_%d.", BASENAME, getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/lseek01.c b/winsup/testsuite/winsup.api/ltp/lseek01.c deleted file mode 100644 index 22d0c6c39..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek01.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : lseek01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for lseek(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 3 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) lseek(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the lseek(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * lseek(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="lseek01"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255]; -int Fd; - -int Whence[] = {SEEK_SET, SEEK_CUR, SEEK_END, -1}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int ind; - int offset; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - offset=(lc%100)*4096; /* max size is 100 blocks */ - - for (ind=0; Whence[ind] >= 0; ind++) { - - /* - * Call lseek(2) - */ - TEST(lseek(Fd, (long)offset, Whence[ind])); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "lseek(%s, %ld, 0) Failed, errno=%d : %s", - Fname, offset, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "lseek(%s, %ld, %d) returned %d", Fname, - offset, Whence[ind], TEST_RETURN); - } - else - Tst_count++; - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname, "tfile_%d",getpid()); - if ((Fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(Fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", Fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/lseek02.c b/winsup/testsuite/winsup.api/ltp/lseek02.c deleted file mode 100644 index 04fa3f10f..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek02.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : lseek02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Negative test for lseek(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 04/25/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) lseek(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the lseek(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * lseek(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="lseek02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int Whence[] = {SEEK_SET, SEEK_CUR, SEEK_END, -1}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call lseek(2) - */ - TEST( lseek(-1, (long)1, SEEK_SET) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_ERRNO == EBADF ) - - tst_resm(TPASS, - "lseek(-1, 1, SEEK_SET) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - else - tst_resm(TFAIL, - "lseek(-1, 1, SEEK_SET) Failed, errno=%d : %s, expected %d(EBADF)", - TEST_ERRNO, strerror(TEST_ERRNO), EBADF); - - } - else - Tst_count++; - - } else { - - tst_resm(TFAIL, "lseek(-1, 1, SEEK_SET) returned %d", - TEST_RETURN); - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/lseek03.c b/winsup/testsuite/winsup.api/ltp/lseek03.c deleted file mode 100644 index 51c303d85..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek03.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : lseek03 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Negative test for lseek(2) whence - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 04/25/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) lseek(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the lseek(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * lseek(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void rec_sigsys(int); - -const char *TCID="lseek03"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char fname[255]; -int fd; -int Rec_sigsys = 0; - -int Whences[] = { 4, -1, 7 }; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - unsigned ind; - int whence; - - TST_TOTAL=sizeof(Whences)/sizeof(int); - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - - signal(SIGSYS, rec_sigsys); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind=0; ind -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="lseek04"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255]; -int Fd; - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call lseek(2) - */ - TEST(lseek(Fd, (long)1, SEEK_SET)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_ERRNO == ESPIPE ) - tst_resm(TPASS, - "lseek(fifofd, 1, SEEK_SET) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - else - tst_resm(TFAIL, - "lseek(fifofd, 1, SEEK_SET) Failed, errno=%d %s, expected %d(ESPIPE)", - TEST_ERRNO, strerror(TEST_ERRNO), - EINVAL); - } - else - Tst_count++; - } else { - - tst_resm(TFAIL, "lseek(fifofd, 1, SEEK_SET) returned %d", - TEST_RETURN); - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname,"tfile_%d",getpid()); - if ( mkfifo(Fname,0700) == -1) { - tst_brkm(TBROK, cleanup, - "mkfifo(%s, 0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - - if ( (Fd=open(Fname, O_RDWR, 0777)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR, 0777) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(Fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", Fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/lseek05.c b/winsup/testsuite/winsup.api/ltp/lseek05.c deleted file mode 100644 index 8867086bd..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek05.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : lseek05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Negative test for lseek(2) of a pipe - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 04/25/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) lseek(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the lseek(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * lseek(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="lseek05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int Fd; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call lseek(2) - */ - TEST(lseek(Fd, (long)1, SEEK_SET)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_ERRNO == ESPIPE ) - tst_resm(TPASS, - "lseek(pipefd, 1, SEEK_SET) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - else - tst_resm(TFAIL, - "lseek(pipefd, 1, SEEK_SET) Failed, errno=%d %s, expected %d(ESPIPE)", - TEST_ERRNO, strerror(TEST_ERRNO), - EINVAL); - } - else - Tst_count++; - } else { - - tst_resm(TFAIL, "lseek(pipefd, 1, SEEK_SET) returned %d", - TEST_RETURN); - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int fds[2]; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - if ( pipe(fds) == -1) { - tst_brkm(TBROK, cleanup, - "pipe(&fds) Failed, errno=%d : %s", errno, strerror(errno)); - } - Fd = fds[0]; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(Fd) == -1) { - tst_resm(TWARN, "close(%d) Failed, errno=%d : %s", Fd, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/lseek06.c b/winsup/testsuite/winsup.api/ltp/lseek06.c deleted file mode 100644 index f62c3422c..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek06.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: lseek01 - * - * Test Description: - * Verify that, lseek() call succeeds to set the file pointer position - * to less than or equal to the file size, when a file is opened for - * read or write. - * - * Expected Result: - * lseek() should return the offset from the beginning of the file measured - * in bytes. Also check if able to read valid data from this location. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * lseek01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define OFFSET 4 -#define TEMP_FILE "tmp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="lseek01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fildes; /* file handle for temp file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char read_buf[1]; /* data read from temp. file */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Invoke lseek(2) to move the read/write file - * pointer/handle by OFFSET bytes. - */ - TEST(lseek(fildes, OFFSET, SEEK_SET)); - - /* check return code of lseek(2) */ - if (TEST_RETURN == (off_t)-1) { - tst_resm(TFAIL, "lseek on (%s) Failed, errno=%d : %s", - TEMP_FILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check if the return value from lseek(2) - * is equal to the specified OFFSET value. - */ - if (TEST_RETURN != OFFSET) { - tst_resm(TFAIL, "lseek() returned incorrect " - "value %d, expected %d", - TEST_RETURN, OFFSET); - continue; - } - /* - * The return value is good, now check data. - * Read the data byte from this location. - */ - if (read(fildes, &read_buf, sizeof(read_buf)) < 0) { - tst_brkm(TFAIL, cleanup, "read() failed " - "on %s, error=%d", TEMP_FILE, errno); - } else { - /* - * Check if read byte is the expected character. - * For pos 4 ---> 'e' - */ - if (read_buf[0] != 'e') { - tst_resm(TFAIL, "Incorrect data read " - "from file %s", TEMP_FILE); - } else { - tst_resm(TPASS, "Functionality " - "of lseek() on %s " - "successful", TEMP_FILE); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - */ -void -setup() -{ - char write_buf[BUFSIZ]; /* buffer to hold data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Get the data to be written to temporary file */ - strcpy(write_buf, "abcdefg"); - - /* Creat/open a temporary file under above directory */ - if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write data into temporary file */ - if(write(fildes, write_buf, strlen(write_buf)) != (int)strlen(write_buf)) { - tst_brkm(TBROK, cleanup, "write(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file created */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s:", - TEMP_FILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/lseek07.c b/winsup/testsuite/winsup.api/ltp/lseek07.c deleted file mode 100644 index c5a27b5b3..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek07.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: lseek02 - * - * Test Description: - * Verify that, lseek() call succeeds to set the file pointer position - * to more than the file size, when a file is opened for reading/writing. - * - * Expected Result: - * lseek() should return n+1, where n is the size of the file. - * Also when some data is written into this file it should start - * from that offset. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * lseek02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "tmp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="lseek02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fildes; /* file handle for temp file */ -size_t file_size; /* size of temporary file */ -char write_buf1[BUFSIZ]; /* buffer to hold data */ -char write_buf2[BUFSIZ]; /* buffer to hold data */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char read_buf[BUFSIZ]; /* data read from temp. file */ - off_t offset; /* byte position in temporary file */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* Set the offset position */ - offset = file_size + (lc * strlen(write_buf2)); - - /* - * Invoke lseek(2) to move the write file - * pointer/handle by the specified offset value. - */ - TEST(lseek(fildes, offset, SEEK_SET)); - - /* check return code of lseek(2) */ - if (TEST_RETURN == (off_t)-1) { - tst_resm(TFAIL, "lseek on (%s) Failed, errno=%d : %s", - TEMP_FILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check if the return value from lseek(2) - * is equal to the specified offset value. - */ - if (TEST_RETURN != offset) { - tst_resm(TFAIL, "lseek() returned " - "incorrect value %d, expected " - "%d", TEST_RETURN, offset); - continue; - } - /* - * The return value is okay, now write some data at - * the current offset position. - */ - if (write(fildes, write_buf2, strlen(write_buf2)) != - (int)strlen(write_buf2)) { - tst_brkm(TFAIL, cleanup, "write() failed to " - "write additional data, error = %d", - errno); - } - - /* - * Now close the file and open it again - * and read all of the data. - */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() on %s Failed," - " errno = %d", TEMP_FILE, errno); - } - - /* Open the file again in read/write mode */ - if ((fildes = open(TEMP_FILE, O_RDWR)) < 0) { - tst_brkm(TFAIL, cleanup, "Could not open the " - "%s readonly, error = %d", - TEMP_FILE, errno); - } - - /* - * Now read all of the data. The size should be the - * offset + strlen(write_buf2). - */ - if (read(fildes, &read_buf, (offset + - strlen(write_buf2))) < 0) { - tst_brkm(TFAIL, cleanup, "read() failed on %s, " - "error=%d", TEMP_FILE, errno); - } else { - /* - * Check data read is the complete data and not - * the only portion written. - */ - if ((strncmp(read_buf, write_buf1, - strlen(write_buf1))) != 0) { - tst_brkm(TFAIL, cleanup, - "Incorrect data read #1 from " - "file %s", TEMP_FILE); - } - if ((strncmp(&read_buf[offset], write_buf2, - strlen(write_buf2))) != 0) { - tst_brkm(TFAIL, cleanup, - "Incorrect data read #2 from " - "file %s", TEMP_FILE); - } - tst_resm(TPASS, "Functionality of " - "lseek() on %s successful", TEMP_FILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - * Get the size of the file using fstat(). - */ -void -setup() -{ - struct stat stat_buf; /* struct buffer for stat(2) */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Get the data to be written to temporary file */ - strcpy(write_buf1, "abcdefg"); - strcpy(write_buf2, "ijk"); - - /* Creat/open a temporary file for writing under above directory */ - if ((fildes = open(TEMP_FILE, O_WRONLY | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_WRONLY|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write data into temporary file */ - if(write(fildes, write_buf1, strlen(write_buf1)) != - (int)strlen(write_buf1)) { - tst_brkm(TBROK, cleanup, "write(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - /* Get the size of the temporary file after writing data */ - if (fstat(fildes, &stat_buf) < 0) { - tst_brkm(TBROK, cleanup, "fstat() on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - file_size = stat_buf.st_size; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file created */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s:", - TEMP_FILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/lseek08.c b/winsup/testsuite/winsup.api/ltp/lseek08.c deleted file mode 100644 index 32fdcc0e4..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek08.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: lseek03 - * - * Test Description: - * Verify that, lseek() call succeeds to set the file pointer position - * to the end of the file when 'whence' value set to SEEK_END and any - * attempts to read from that position should fail. - * - * Expected Result: - * lseek() should return the offset which is set to the file size measured - * in bytes. read() attempt should fail with -1 return value. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * lseek03 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "tmp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="lseek03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fildes; /* file handle for temp file */ -ssize_t file_size; /* size of the temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char read_buf[1]; /* data read from temp. file */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Invoke lseek(2) to move the read/write file - * pointer/handle to the END of the file. - */ - TEST(lseek(fildes, 0, SEEK_END)); - - /* check return code of lseek(2) */ - if (TEST_RETURN == (off_t)-1) { - tst_resm(TFAIL, "lseek on (%s) Failed, errno=%d : %s", - TEMP_FILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check if the return value from lseek(2) - * is equal to the file_size. - */ - if (TEST_RETURN != file_size) { - tst_resm(TFAIL, "lseek() returned incorrect " - "value %d, expected %d", - TEST_RETURN, file_size); - continue; - } - /* - * The return value is okay, now attempt to read data - * from the file. This should fail as the file pointer - * should be pointing to END OF FILE. - */ - read_buf[0] = '\0'; - if (read(fildes, &read_buf, sizeof(read_buf)) > 0) { - tst_resm(TFAIL, "read() successful on %s", - TEMP_FILE); - } else { - tst_resm(TPASS, "Functionality of lseek() on " - "%s successful", TEMP_FILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /* NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - * Get the size of the file using fstat(). - */ -void -setup() -{ - struct stat stat_buf; /* struct. buffer for stat(2) */ - char write_buf[BUFSIZ]; /* buffer to hold data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Get the data to be written to temporary file */ - strcpy(write_buf, "abcdefg\n"); - - /* Creat/open a temporary file under above directory */ - if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write data into temporary file */ - if(write(fildes, write_buf, strlen(write_buf)) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - /* Get the size of the file using fstat */ - if (fstat(fildes, &stat_buf) < 0) { - tst_brkm(TBROK, cleanup, - "fstat(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - file_size = stat_buf.st_size; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file created */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s:", - TEMP_FILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/lseek09.c b/winsup/testsuite/winsup.api/ltp/lseek09.c deleted file mode 100644 index 36688c656..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek09.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: lseek04 - * - * Test Description: - * Verify that, lseek() call succeeds to set the file pointer position - * to the current specified location, when 'whence' value is set to - * SEEK_CUR and the data read from the specified location should match - * the expected data. - * - * Expected Result: - * lseek() should return the specified offset from the beginning of the file - * measured in bytes. The data read from this location should match the - * expected data. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * lseek04 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "tmp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="lseek04"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fildes; /* file handle for temp file */ -size_t file_size; /* total size of file after data write */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char read_buf[BUFSIZ]; /* data read from temp. file */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Invoke lseek(2) to set the file - * pointer/handle from the current location - * of the file descriptor + specified offset. - */ - TEST(lseek(fildes, 1, SEEK_CUR)); - - /* check return code of lseek(2) */ - if (TEST_RETURN == (off_t)-1) { - tst_resm(TFAIL, "lseek on (%s) Failed, errno=%d : %s", - TEMP_FILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check if the return value from lseek(2) is equal - * to the 3 positions from the beginning of the file. - * ie, 2 positions from lseek() in the setup + - * 1 position from above above. - */ - if (TEST_RETURN != 3) { - tst_resm(TFAIL, "lseek() returned incorrect " - "value %d, expected 4", TEST_RETURN); - continue; - } - /* - * Read the data byte from this location. - */ - read_buf[0] = '\0'; - if (read(fildes, &read_buf, (file_size - 3)) < 0) { - tst_brkm(TFAIL, cleanup, - "read() failed on %s, error=%d", - TEMP_FILE, errno); - } else { - /* - * Check if read data contains - * expected characters - * From pos 4 ---> 'defg'. - */ - if (memcmp(read_buf, "defg", 4)) { - tst_resm(TFAIL, "Incorrect data read " - "from file %s", TEMP_FILE); - } else { - tst_resm(TPASS, "Functionality of " - "lseek() on %s successful", - TEMP_FILE); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* reset file pointer in case we are looping */ - if (lseek(fildes, 2, SEEK_SET) == -1) { - tst_brkm(TBROK, cleanup, "lseek failed - could not " - "reset file pointer"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - * Get the size of the file using fstat(). - */ -void -setup() -{ - struct stat stat_buf; /* buffer to hold stat info. */ - char write_buf[BUFSIZ]; /* buffer to hold data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Get the data to be written to temporary file */ - strcpy(write_buf, "abcdefg"); - - /* Creat/open a temporary file under above directory */ - if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write data into temporary file */ - if(write(fildes, write_buf, strlen(write_buf)) <= 0) { - tst_brkm(TBROK, cleanup, "write(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - /* Get the temporary file information */ - if (fstat(fildes, &stat_buf) < 0) { - tst_brkm(TBROK, cleanup, "fstat(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - file_size = stat_buf.st_size; - - /* - * Reset the file pointer position to the specified offset - * from the beginning of the file. - */ - if (lseek(fildes, 2, SEEK_SET) != 2) { - tst_brkm(TBROK, cleanup, - "lseek() fails to set file ptr. to specified offset"); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file created */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s:", - TEMP_FILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/lseek10.c b/winsup/testsuite/winsup.api/ltp/lseek10.c deleted file mode 100644 index ab3cc6ba3..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek10.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: lseek05 - * - * Test Description: - * Verify that, - * 1. lseek() returns -1 and sets errno to ESPIPE, if the file handle of - * the specified file is associated with a pipe, socket, or FIFO. - * 2. lseek() returns -1 and sets errno to EINVAL, if the 'Whence' argument - * is not a proper value. - * 3. lseek() returns -1 and sets errno to EBADF, if the file handle of - * the specified file is not valid. - * - * Expected Result: - * lseek() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * lseek05 [-c n] [-e] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE1 "tmp_file1" -#define TEMP_FILE2 "tmp_file2" -#define TEMP_FILE3 "tmp_file3" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define PIPE_MODE S_IFIFO | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define SEEK_TOP 10 - -const char *TCID="lseek05"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={ESPIPE, EINVAL, EBADF, 0}; - -int no_setup(); -int setup1(); /* setup function to test lseek() for ESPIPE */ -int setup2(); /* setup function to test lseek() for EINVAL */ -int setup3(); /* setup function to test lseek() for EBADF */ - -int fd1; /* file handle for testfile1 */ -int fd2; /* file handle for testfile2 */ -int fd3; /* file handle for testfile3 */ - -struct test_case_t { /* test case struct. to hold ref. test cond's*/ - int fd; - int Whence; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { - { 1, SEEK_SET, "'fd' associated with a pipe/fifo", ESPIPE, setup1 }, - { 2, SEEK_TOP, "'whence' argument is not valid", EINVAL, setup2 }, - { 3, SEEK_SET, "'fd' is not an open file descriptor", EBADF, setup3 }, - { 0, 0, NULL, 0, no_setup } -}; - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int fildes; /* file handle for testfile */ - int whence; /* position of file handle in the file */ - const char *test_desc; /* test specific error message */ - int ind; /* counter to test different test conditions */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - fildes = Test_cases[ind].fd; - test_desc = Test_cases[ind].desc; - whence = Test_cases[ind].Whence; - - /* Assign the 'fd' values appropriatly */ - if (fildes == 1) { - fildes = fd1; - } else if (fildes == 2) { - fildes = fd2; - } else { - fildes = fd3; - } - /* - * Invoke lseek(2) to test different test conditions. - * Verify that it fails with -1 return value and - * sets appropriate errno. - */ - TEST(lseek(fildes, 0, whence)); - - /* check return code of lseek(2) */ - if (TEST_RETURN != (off_t)-1) { - tst_resm(TFAIL, "lseek() returned %d, expected " - "-1, errno:%d", TEST_RETURN, - Test_cases[ind].exp_errno); - continue; - } - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == Test_cases[ind].exp_errno) { - tst_resm(TPASS, "lseek() fails, %s, errno:%d", - test_desc, TEST_ERRNO); - } else { - tst_resm(TFAIL, "lseek() fails, %s, errno:%d, " - "expected errno:%d", test_desc, - TEST_ERRNO, Test_cases[ind].exp_errno); - } - } - } - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Invoke individual test setup functions according to the order - * set in test struct. definition. - */ -void -setup() -{ - int ind; /* counter for test setup function */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - Test_cases[ind].setupfunc(); - } -} - -/* - * no_setup() - This is a dummy function which simply returns 0. - */ -int -no_setup() -{ - return 0; -} - -/* - * setup1() - setup function for a test condition for which lseek(2) - * returns -1 and sets errno to ESPIPE. - * Creat a named pipe/fifo using mknod() and open it for - * reading/writing. - * This function returns 0 on success. - */ -int -setup1() -{ - /* Creat a named pipe/fifo using mknod() */ - if (mknod(TEMP_FILE1, PIPE_MODE, 0) < 0) { - tst_brkm(TBROK, cleanup, - "mknod(%s, %#o, 0) Failed, errno=%d :%s", - TEMP_FILE1, FILE_MODE, errno, strerror(errno)); - } - - /* Open the named pipe/fifo for reading/writing */ - if ((fd1 = open(TEMP_FILE1, O_RDWR)) < 0) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR) Failed, errno=%d, :%s", - TEMP_FILE1, errno, strerror(errno)); - } - - return 0; -} - -/* - * setup2() - setup function for a test condition for which lseek(2) - * returns -1 and sets errno to EINVAL. - * Creat a temporary file for reading/writing and write some data - * into it. - * This function returns 0 on success. - */ -int -setup2() -{ - char write_buff[BUFSIZ]; /* buffer to hold data */ - - /* Get the data to be written to temporary file */ - strcpy(write_buff, "abcdefg"); - - /* Creat/open a temporary file under above directory */ - if ((fd2 = open(TEMP_FILE2, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE2, FILE_MODE, errno, strerror(errno)); - } - - /* Write data into temporary file */ - if(write(fd2, write_buff, sizeof(write_buff)) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TEMP_FILE2, errno, strerror(errno)); - } - - return 0; -} - -/* - * setup3() - setup function for a test condition for which lseek(2) - * returns -1 and sets errno to EBADF. - * Creat a temporary file for reading/writing and close it. - * This function returns 0 on success. - */ -int -setup3() -{ - /* Creat/open a temporary file under above directory */ - if ((fd3 = open(TEMP_FILE3, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE3, FILE_MODE, errno, strerror(errno)); - } - - /* Close the temporary file created above */ - if (close(fd3) < 0) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s:", - TEMP_FILE3, errno, strerror(errno)); - } - - return 0; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile(s) created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file(s) created in setup1/setup2*/ - if (close(fd1) < 0) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s:", - TEMP_FILE1, errno, strerror(errno)); - } - if (close(fd2) < 0) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s:", - TEMP_FILE2, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/lstat02.c b/winsup/testsuite/winsup.api/ltp/lstat02.c deleted file mode 100644 index eed8f78c7..000000000 --- a/winsup/testsuite/winsup.api/ltp/lstat02.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : lstat02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for lstat(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) lstat(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the lstat(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * lstat(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="lstat02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255], lname[255], symlnk[255], buf[255]; -int fd; -struct stat statter; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call lstat(2) - */ - TEST(lstat(symlnk, &statter)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "lstat(%s, &statter) Failed, errno=%d : %s", symlnk, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "lstat(%s, &statter) returned %d", symlnk, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - sprintf(symlnk,"lnfile_%d",getpid()); - if (symlink(fname, symlnk) == -1) { - tst_resm(TWARN, "symlink(%s, %s) Failed, errno=%d : %s", - fname, symlnk, errno, strerror(errno)); - } else if (readlink(symlnk, buf, 255) == -1) { - tst_resm(TWARN, "readlink(%s, buf, 255) Failed, errno=%d : %s", - symlnk, errno, strerror(errno)); - } else if (strcmp(buf, fname) != 0) { - tst_resm(TWARN, - "Setup Failure : Expected symbolic link contents of %s : Actual is %s", - fname, buf); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/mkdir01.c b/winsup/testsuite/winsup.api/ltp/mkdir01.c deleted file mode 100644 index 5772f0683..000000000 --- a/winsup/testsuite/winsup.api/ltp/mkdir01.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : mkdir01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic errno test for mkdir(2) - * - * PARENT DOCUMENT : mkstds02 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Bill Branum - * - * CO-PILOT : Kathy Olmsted - * - * DATE STARTED : 4/15/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * mkdir(2) test for errno(s) EFAULT. - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * DETAILED DESCRIPTION - * This test will verify that mkdir(2) returns a value of - * -1 and sets errno to EFAULT when the path argument points - * outside (above/below) the allocated address space of the - * process. - * - * Setup: - * Setup signal handling. - * Create and make current a temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno. - * If doing functional test - * check the errno returned and print result message - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Remove the temporary directory. - * Exit. - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -char *get_high_address(); - -const char *TCID="mkdir01"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={EFAULT, 0}; /* List must end with 0 */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * TEST CASE: 1 - * mkdir() call with pointer below allocated address space. - */ - - /* Call mkdir(2) */ - TEST(mkdir((char *)-1,0777)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, "mkdir - path argument pointing below allocated address space failed as expected with errno %d : %s", TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, "mkdir - path argument pointing below allocated address space failed with errno %d : %s but expected %d (EFAULT)", TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, "mkdir - path argument pointing below allocated address space succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: 2 - * mkdir() call with pointer above allocated address space. - */ - - /* Call mkdir(2) */ - TEST(mkdir(get_high_address(),0777)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, "mkdir - path argument pointing above allocated address space failed as expected with errno %d : %s", TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, "mkdir - path argument pointing above allocated address space failed with errno %d : %s but expected %d (EFAULT)", TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, "mkdir - path argument pointing above allocated address space succeeded unexpectedly."); - - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Create a temporary directory and make it current. */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Remove the temporary directory. - */ - tst_rmdir(); - - /* - * Exit with return code appropriate for results. - */ - tst_exit(); - -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/mkdir08.c b/winsup/testsuite/winsup.api/ltp/mkdir08.c deleted file mode 100644 index d1cc19344..000000000 --- a/winsup/testsuite/winsup.api/ltp/mkdir08.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : mkdir08 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for mkdir(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) mkdir(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the mkdir(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * mkdir(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="mkdir08"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mkdir(2) - */ - TEST(mkdir(fname, 0777)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "mkdir(%s) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "mkdir(%s) returned %d", fname, TEST_RETURN); - } - if(rmdir(fname) == -1) { - tst_brkm(TBROK, cleanup, "rmdir(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname, "./dir_%d", getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/mknod01.c b/winsup/testsuite/winsup.api/ltp/mknod01.c deleted file mode 100644 index e25194e0c..000000000 --- a/winsup/testsuite/winsup.api/ltp/mknod01.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : mknod01 - * - * EXECUTED BY : root - * - * TEST TITLE : Basic test for mknod(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 4 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 05/13/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) mknod(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the mknod(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * mknod(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="mknod01"; /* Test program identifier. */ -int TST_TOTAL; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char Path[1024]; /* path to create */ -int i; /* counter for test case loop */ -int tcases[] = { /* modes to give nodes created (1 per text case) */ - S_IFREG|0777, /* ordinary file with mode 0777 */ - S_IFIFO|0777, /* fifo special with mode 0777 */ - S_IFCHR|0777, /* character special with mode 0777 */ - S_IFBLK|0777, /* block special with mode 0777 */ - - S_IFREG|04700, /* ordinary file with mode 04700 (suid) */ - S_IFREG|02700, /* ordinary file with mode 02700 (sgid) */ - S_IFREG|06700, /* ordinary file with mode 06700 (sgid & suid) */ - -#ifdef CRAY - S_IFDIR|0777, /* Direcory */ - S_IRESTART|0400, /* restartbit */ -#ifdef S_IFOFD - S_IFOFD|0777, /* off line, with data */ -#endif -#ifdef S_IFOFL - S_IFOFL|0777, /* off line, with no data */ -#endif -#endif /* CRAY */ - -}; - - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - TST_TOTAL=(sizeof(tcases)/sizeof(tcases[0])); - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASES: - * Make nodes in tcases array - */ - for(i=0; i - * Aaron Laffin - * - * 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. - */ -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID="mmap001"; -int TST_TOTAL=5; -extern int Tst_count; -static char *filename=NULL; -static int m_opt = 0; -static char *m_copt; - -void cleanup() -{ - /* - * remove the tmp directory and exit - */ - - if ( filename ) - free(filename); - - TEST_CLEANUP; - - tst_rmdir(); - - tst_exit(); -} - -void setup() -{ - char buf[1024]; - /* - * setup a default signal hander and a - * temporary working directory. - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - tst_tmpdir(); - - TEST_PAUSE; - - snprintf(buf,1024,"testfile.%d",getpid()); - - filename = strdup(buf); -} - -void help() -{ - printf(" -m x size of mmap in pages (default 1000)\n"); -} - -/* - * add the -m option whose parameter is the - * pages that should be mapped. - */ -option_t options[] = -{ - { "m:", &m_opt, &m_copt }, - { NULL, NULL, NULL } -}; - -int main(int argc, char * argv[]) -{ - char *array; - const char *msg; - int i,lc; - int fd; - int pages,memsize; - - if ( (msg=parse_opts(argc, argv, options, help)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - if ( m_opt ) - { - memsize = pages = atoi( m_copt ); - - if (memsize < 1) - { - tst_brkm(TBROK, cleanup, "Invalid arg for -m: %s",m_copt); - } - - memsize *= getpagesize(); /* N PAGES */ - - } - else - { - /* - * default size 1000 pages; - */ - memsize = pages = 1000; - memsize *= getpagesize(); - } - - tst_resm(TINFO,"mmap()ing file of %u pages or %u bytes", pages,memsize); - - setup(); - - for (lc=0; TEST_LOOPING(lc); lc++) - { - Tst_count=0; - - fd = open(filename, O_RDWR | O_CREAT, 0666); - if ((fd == -1)) - tst_brkm(TBROK, cleanup, "Problems opening files"); - - if (lseek(fd, memsize, SEEK_SET) != memsize) - { - close(fd); - tst_brkm(TBROK, cleanup, "Problems doing the lseek: %d: %s", - errno,strerror(errno)); - } - - if (write(fd,"\0",1) !=1) - { - close(fd); - tst_brkm(TBROK, cleanup, "Problems writing: %d: %s", - errno,strerror(errno)); - } - - array = mmap(0, memsize, PROT_WRITE, MAP_SHARED,fd,0); - if (array == (char *)MAP_FAILED) - { - tst_resm(TFAIL, "mmap() failed: %d: %s", - errno,strerror(errno)); - tst_exit(); - } - else - { - tst_resm(TPASS, "mmap() completed successfully."); - } - - if ( STD_FUNCTIONAL_TEST ) - { - tst_resm(TINFO,"touching mmaped memory"); - - for(i = 0; i < memsize; i++) - { - array[i] = (char) i; - } - - /* - * seems that if the map area was bad, we'd get SEGV, hence we can - * indicate a PASS. - */ - tst_resm(TPASS, "we're still here, mmaped area must be good"); - - TEST( msync(array, memsize, MS_SYNC) ); - - if ( TEST_RETURN == -1 ) - { - tst_resm(TFAIL, "msync() failed: errno: %d: %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else - { - tst_resm(TPASS, "msync() was successful"); - } - - } /* STD_FUNCTIONAL_TEST */ - - TEST( munmap(array, memsize) ); - - if ( TEST_RETURN == -1 ) - { - tst_resm(TFAIL, "munmap() failed: errno: %d: %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else - { - tst_resm(TPASS, "munmap() was successful"); - } - - close(fd); - unlink(filename); - } - cleanup(); - return 0; -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap02.c b/winsup/testsuite/winsup.api/ltp/mmap02.c deleted file mode 100644 index 33a12738c..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap02.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: mmap02 - * - * Test Description: - * Call mmap() with prot parameter set to PROT_READ and with the file - * descriptor being open for read, to map a file creating mapped memory - * with read access. The minimum file permissions should be 0444. - * - * The call should succeed to create the mapped region with required - * attributes. - * - * Expected Result: - * mmap() should succeed returning the address of the mapped region, - * the mapped region should contain the contents of the mapped file. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * mmap02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -char *addr; /* addr of memory mapped region */ -char *dummy; /* dummy string */ -size_t page_sz; /* system page size */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with read access. - */ - TEST(mmap(0, page_sz, PROT_READ, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN == (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* Get the mmap return value */ - addr = (char *)TEST_RETURN; - - /* - * Read the file contents into the dummy - * string. - */ - if (read(fildes, dummy, page_sz) < 0) { - tst_brkm(TFAIL, cleanup, "read() on %s Failed, " - "error:%d", TEMPFILE, errno); - } - - /* - * Check whether mapped memory region has - * the file contents. - */ - if (memcmp(dummy, addr, page_sz)) { - tst_resm(TFAIL, "mapped memory area contains " - "invalid data"); - } else { - tst_resm(TPASS, - "Functionality of mmap() successful"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* Clean up things in case we are looping */ - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TFAIL, NULL, "munmap() fails to unmap the " - "memory, errno=%d", errno); - } - - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Get system page size, allocate and initialize the string dummy. - * Initialize addr such that it is more than one page below the break - * address of the process, and initialize one page region from addr - * with char 'A'. - * Create a temporary directory a file under it. - * Write some known data into file and close it. - * Change mode permissions on file to 0444. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* Allocate space for the test buffer */ - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, sizeof(tst_buff)) < (int)sizeof(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); - - /* Close the temporary file */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Change Mode permissions on Temporary file */ - if (chmod(TEMPFILE, 0444) < 0) { - tst_brkm(TFAIL, cleanup, "chmod(%s, 0444) Failed, errno=%d : " - "%s", TEMPFILE, errno, strerror(errno)); - } - - /* Open the temporary file again, - Readonly mode */ - if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { - tst_brkm(TFAIL, cleanup, "open(%s, O_RDONLY) Failed, errno=%d " - ": %s", TEMPFILE, errno, strerror(errno)); - } - - - /* Allocate and initialize dummy string of system page size bytes */ - if ((dummy = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, "calloc() failed to allocate space"); - tst_exit(); - } - -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Free the memory allocated to dummy variable. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Free the memory allocated for dummy string */ - if (dummy) { - free(dummy); - } - - if (fildes >= 0) - close (fildes); - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap03.c b/winsup/testsuite/winsup.api/ltp/mmap03.c deleted file mode 100644 index 9302d335d..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap03.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: mmap03 - * - * Test Description: - * Call mmap() to map a file creating a mapped region with execute access - * under the following conditions - - * - The prot parameter is set to PROT_EXE - * - The file descriptor is open for read - * - The file being mapped has execute permission bit set. - * - The minimum file permissions should be 0555. - * - * The call should succeed to map the file creating mapped memory with the - * required attributes. - * - * Expected Result: - * mmap() should succeed returning the address of the mapped region, - * and the mapped region should contain the contents of the mapped file. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * mmap03 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -char *dummy; /* dummy variable to hold temp file contents */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with execute access. - */ - TEST(mmap(0, page_sz, PROT_EXEC, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN == (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* Get the mmap return value */ - addr = (char *)TEST_RETURN; - - /* - * Read the file contents into the dummy - * variable. - */ - if (read(fildes, dummy, page_sz) < 0) { - tst_brkm(TFAIL, cleanup, "read() on %s Failed, " - "error:%d", TEMPFILE, errno); - } - - /* - * Check whether the mapped memory region - * has the file contents. - */ - if (memcmp(dummy, addr, page_sz)) { - tst_resm(TFAIL, "mapped memory region contains " - "invalid data"); - } else { - tst_resm(TPASS, - "Functionality of mmap() successful"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* Clean up things in case we are looping */ - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TFAIL, NULL, "munmap() fails to unmap the " - "memory, errno=%d", errno); - } - - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file and close it. - * Change the mode permissions on file to 0555. - * Re-open the file for reading. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* Allocate space for the test buffer */ - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); - - /* Make sure proper permissions set on file */ - if (chmod(TEMPFILE, 0555) < 0) { - tst_brkm(TFAIL, cleanup, "chmod() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Close the temporary file opened for write */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Allocate and initialize dummy string of system page size bytes */ - if ((dummy = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, cleanup, - "calloc() failed to allocate memory for dummy"); - } - - /* Open the temporary file again for reading */ - if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { - tst_brkm(TFAIL, cleanup, "open(%s) with read-only Failed, " - "errno:%d", TEMPFILE, errno); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - Free the memory allocated to dummy variable. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Free the memory space allocated for dummy variable */ - if (dummy) { - free(dummy); - } - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap04.c b/winsup/testsuite/winsup.api/ltp/mmap04.c deleted file mode 100644 index 64d3a8ebe..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap04.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: mmap04 - * - * Test Description: - * Call mmap() to map a file creating a mapped region with read/exec access - * under the following conditions - - * - The prot parameter is set to PROT_READ|PROT_EXEC - * - The file descriptor is open for read - * - The file being mapped has read and execute permission bit set. - * - The minimum file permissions should be 0555. - * - * The call should succeed to map the file creating mapped memory with the - * required attributes. - * - * Expected Result: - * mmap() should succeed returning the address of the mapped region, - * and the mapped region should contain the contents of the mapped file. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * mmap04 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap04"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -char *dummy; /* dummy variable to hold temp file contents */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with read and execute access. - */ - TEST(mmap(0, page_sz, PROT_READ|PROT_EXEC, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN == (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - continue; - } - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* Get the mmap return value */ - addr = (char *)TEST_RETURN; - - /* - * Read the file contents into the dummy - * variable. - */ - if (read(fildes, dummy, page_sz) < 0) { - tst_brkm(TFAIL, cleanup, "read() on %s Failed, " - "error:%d", TEMPFILE, errno); - } - - /* - * Check whether the mapped memory region - * has the file contents. - */ - if (memcmp(dummy, addr, page_sz)) { - tst_resm(TFAIL, "mapped memory region contains " - "invalid data"); - } else { - tst_resm(TPASS, - "Functionality of mmap() successful"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - /* Clean up things in case we are looping. */ - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TFAIL, NULL, "munmap() fails to unmap the " - "memory, errno=%d", errno); - } - - - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file and close it. - * Change the mode permissions on file to 0555. - * Re-open the file for reading. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); - - /* Make sure proper permissions set on file */ - if (chmod(TEMPFILE, 0555) < 0) { - tst_brkm(TFAIL, cleanup, "chmod() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Close the temporary file opened for write */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Allocate and initialize dummy string of system page size bytes */ - if ((dummy = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, cleanup, - "calloc() failed to allocate memory for dummy"); - } - - /* Open the temporary file again for reading */ - if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { - tst_brkm(TFAIL, cleanup, "open(%s) with read-only Failed, " - "errno:%d", TEMPFILE, errno); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Free the memeory allocated to dummy variable. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Free the memory space allocated for dummy variable */ - if (dummy) { - free(dummy); - } - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap05.c b/winsup/testsuite/winsup.api/ltp/mmap05.c deleted file mode 100644 index bcdfd0cd8..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap05.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: mmap05 - * - * Test Description: - * Call mmap() to map a file creating mapped memory with no access under - * the following conditions - - * - The prot parameter is set to PROT_NONE - * - The file descriptor is open for read(any mode other than write) - * - The minimum file permissions should be 0444. - * - * The call should succeed to map the file creating mapped memory with the - * required attributes. - * - * Expected Result: - * mmap() should succeed returning the address of the mapped region, - * and an attempt to access the contents of the mapped region should give - * rise to the signal SIGSEGV. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * mmap05 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -int fildes = -1; /* file descriptor for temporary file */ -int pass=0; /* pass flag perhaps set to 1 in sig_handler */ -sigjmp_buf env; /* environment for sigsetjmp/siglongjmp */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ -void sig_handler(); /* signal handler to catch SIGSEGV */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - volatile char file_content; /* tempfile content */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with no access. - */ - - TEST(mmap(0, page_sz, PROT_NONE, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN == (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - continue; - } - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - - /* - * Try to access the mapped region. This should - * generate a SIGSEGV which will be caught below. - * - * This is wrapped by the sigsetjmp() call that will - * take care of restoring the program's context in an - * elegant way in conjunction with the call to - * siglongjmp() in the signal handler. - */ - if (sigsetjmp(env, 1) == 0) { - file_content = addr[0]; - } - - if (pass) { - tst_resm(TPASS, "Got SIGSEGV as expected"); - } else { - tst_resm(TFAIL, "Mapped memory region with NO " - "access is accessible"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* Unmap mapped memory and reset pass in case we are looping */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TFAIL, cleanup, "munmap() fails to unmap the " - "memory, errno=%d", errno); - } - pass = 0; - - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file and close it. - * Change the mode permissions on file to 0444 - * Re-open the file for reading. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, sig_handler, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* Allocate space for the test buffer */ - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) - != (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); - - /* Close the temporary file opened for write */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Make sure proper permissions set on file */ - if (chmod(TEMPFILE, 0444) < 0) { - tst_brkm(TFAIL, cleanup, "chmod() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Open the temporary file again for reading */ - if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { - tst_brkm(TFAIL, cleanup, "open(%s) with read-only Failed, " - "errno:%d", TEMPFILE, errno); - } -} - -/* - * sig_handler() - Signal Cathing function. - * This function gets executed when the test process receives - * the signal SIGSEGV while trying to access the contents of memory which - * is not accessible. - */ -void -sig_handler(sig) -{ - if (sig == SIGSEGV) { - /* set the global variable and jump back */ - pass = 1; - siglongjmp(env, 1); - } else { - tst_brkm(TBROK, cleanup, "received an unexpected signal"); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap06.c b/winsup/testsuite/winsup.api/ltp/mmap06.c deleted file mode 100644 index ec113c077..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap06.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: mmap06 - * - * Test Description: - * Call mmap() to map a file creating a mapped region with read access - * under the following conditions - - * - The prot parameter is set to PROT_READ - * - The file descriptor is open for writing. - * - * The call should fail to map the file. - * - * Expected Result: - * mmap() should fail returning -1 and errno should get set to EACCES. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * mmap06 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap06"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EACCES, 0}; - -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with read access. - */ - TEST(mmap(0, page_sz, PROT_READ, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN != (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() returned invalid value, " - "expected: -1"); - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TBROK, cleanup, "munmap() failed"); - } - continue; - } - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == EACCES) { - tst_resm(TPASS, "mmap() fails, 'fd' doesn't allow " - "desired access, errno:%d", errno); - } else { - tst_resm(TFAIL, "mmap() fails, 'fd' doesn't allow " - "desired access, invalid errno:%d", errno); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* Allocate space for the test buffer */ - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, - "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, - "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap07.c b/winsup/testsuite/winsup.api/ltp/mmap07.c deleted file mode 100644 index ab989f443..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap07.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: mmap07 - * - * Test Description: - * Call mmap() to map a file creating a mapped region with read access - * under the following conditions - - * - The prot parameter is set to PROT_WRITE - * - The file descriptor is open for writing. - * - The flags parameter has MAP_PRIVATE set. - * - * The call should fail to map the file. - * - * Expected Result: - * mmap() should fail returning -1 and errno should get set to EACCES. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * mmap07 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap07"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EACCES, 0}; - -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with write access. - */ - TEST(mmap(0, page_sz, PROT_WRITE, - MAP_FILE|MAP_PRIVATE, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN != (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() returned invalid value, " - "expected: -1"); - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TBROK, cleanup, "munmap() failed"); - } - continue; - } - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == EACCES) { - tst_resm(TPASS, "mmap() fails, 'fd' doesn't allow " - "desired access, errno:%d", errno); - } else { - tst_resm(TFAIL, "mmap() fails, 'fd' doesn't allow " - "desired access, invalid errno:%d", errno); - } - - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* Allocate space for the test buffer */ - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap08.c b/winsup/testsuite/winsup.api/ltp/mmap08.c deleted file mode 100644 index 543c5397b..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap08.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: mmap08 - * - * Test Description: - * Verify that mmap() fails to map a file creating a mapped region - * when the file specified by file descriptor is not valid. - * - * Expected Result: - * mmap() should fail returning -1 and errno should get set to EBADF. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * mmap08 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap08"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EBADF, 0}; - -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * which is already closed. so, fildes is not valid. - */ - TEST(mmap(0, page_sz, PROT_WRITE, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN != (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() returned invalid value, " - "expected: -1"); - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TBROK, cleanup, "munmap() failed"); - } - continue; - } - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == EBADF) { - tst_resm(TPASS, "mmap() fails, 'fd' is not valid, " - "errno:%d", errno); - } else { - tst_resm(TFAIL, "mmap() fails, 'fd' is not valid, " - "invalid errno:%d", errno); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file and close it. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) - != (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); - - /* Close the temporary file opened for writing */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/munmap01.c b/winsup/testsuite/winsup.api/ltp/munmap01.c deleted file mode 100644 index 0527201be..000000000 --- a/winsup/testsuite/winsup.api/ltp/munmap01.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: munmap01 - * - * Test Description: - * Verify that, munmap call will succeed to unmap a mapped file or - * anonymous shared memory region from the calling process's address space - * and after successful completion of munmap, the unmapped region is no - * longer accessible. - * - * Expected Result: - * munmap call should succeed to unmap a mapped file or anonymous shared - * memory region from the process's address space and it returns with a - * value 0, further reference to the unmapped region should result in a - * segmentation fault (SIGSEGV). - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * munmap01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="munmap01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char *addr; /* addr of memory mapped region */ -int fildes; /* file descriptor for tempfile */ -unsigned int map_len; /* length of the region to be mapped */ - -void setup(); /* Main setup function of test */ -void cleanup(void); /* cleanup function for the test */ -void sig_handler(); /* signal catching function */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* Perform global setup for test */ - setup(); - - /* - * Call munmap to unmap the mapped region of the - * temporary file from the calling process's address space. - */ - TEST(munmap(addr, map_len)); - - /* Check for the return value of munmap() */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "munmap() fails, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check whether further reference is possible - * to the unmapped memory region by writing - * to the first byte of region with - * some arbitrary number. - */ - *addr = 50; - - /* This message is printed if no SIGSEGV */ - tst_resm(TFAIL, "process succeeds to refer unmapped " - "memory region"); - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - } /* End for TEST_LOOPING */ - - /* exit with return code appropriate for results */ - tst_exit(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Set up signal handler to catch SIGSEGV. - * Get system page size, create a temporary file for reading/writing, - * write one byte data into it, map the open file for the specified - * map length. - */ -void -setup() -{ - size_t page_sz; /* system page size */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* call signal function to trap the signal generated */ - if (signal(SIGSEGV, sig_handler) == SIG_ERR) { - tst_brkm(TBROK, cleanup, "signal fails to catch signal"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TBROK, cleanup, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* - * Get the length of the open file to be mapped into process - * address space. - */ - map_len = 3 * page_sz; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) { - tst_brkm(TBROK, cleanup, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* - * move the file pointer to maplength position from the beginning - * of the file. - */ - if (lseek(fildes, map_len, SEEK_SET) == -1) { - tst_brkm(TBROK, cleanup, "lseek() fails on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* Write one byte into temporary file */ - if (write(fildes, "a", 1) != 1) { - tst_brkm(TBROK, cleanup, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* - * map the open file 'TEMPFILE' from its beginning up to the maplength - * into the calling process's address space at the system choosen - * with read/write permissions to the the mapped region. - */ - addr = mmap(0, map_len, PROT_READ | PROT_WRITE, \ - MAP_FILE | MAP_SHARED, fildes, 0); - - /* check for the return value of mmap system call */ - if (addr == (char *)MAP_FAILED) { - tst_brkm(TBROK, cleanup, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } -} - -/* - * sig_handler() - signal catching function. - * This function is used to trap the signal generated when tried to read or - * write to the memory mapped region which is already detached from the - * calling process address space. - * this function is invoked when SIGSEGV generated and it calls test - * cleanup function and exit the program. - */ -void -sig_handler() -{ - tst_resm(TPASS, "Functionality of munmap() successful"); - - /* Invoke test cleanup function and exit */ - cleanup(); - - /* exit with return code appropriate for results */ - tst_exit(); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the temporary file. - * Remove the temporary directory. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, NULL, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Remove the temporary directory and all files in it */ - tst_rmdir(); -} diff --git a/winsup/testsuite/winsup.api/ltp/munmap02.c b/winsup/testsuite/winsup.api/ltp/munmap02.c deleted file mode 100644 index 7345e73e0..000000000 --- a/winsup/testsuite/winsup.api/ltp/munmap02.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: munmap02 - * - * Test Description: - * Verify that, munmap call will succeed to unmap a mapped file or - * anonymous shared memory region from the calling process's address space - * if the region specified by the address and the length is part or all of - * the mapped region. - * - * Expected Result: - * munmap call should succeed to unmap a part or all of mapped region of a - * file or anonymous shared memory from the process's address space and it - * returns with a value 0, - * further reference to the unmapped region should result in a segmentation - * fault (SIGSEGV). - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * munmap01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="munmap02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -int fildes; /* file descriptor for tempfile */ -unsigned int map_len; /* length of the region to be mapped */ - -void setup(); /* Main setup function of test */ -void cleanup(void); /* cleanup function for the test */ -void sig_handler(); /* signal catching function */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* Perform global setup for test */ - setup(); - - /* - * Call munmap to unmap the part of the mapped region of the - * temporary file from the address and length that is part of - * the mapped region. - */ - TEST(munmap(addr, map_len)); - - /* Check for the return value of munmap() */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "munmap() fails, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check whether further reference is possible - * to the unmapped memory region by writing - * to the first byte of region with - * some arbitrary number. - */ - *addr = 50; - - /* This message is printed if no SIGSEGV */ - tst_resm(TFAIL, "process succeeds to refer unmapped " - "memory region"); - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - } /* End for TEST_LOOPING */ - - /* exit with return code appropriate for results */ - tst_exit(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Setup signal handler to catch SIGSEGV. - * Get system page size, create a temporary file for reading/writing, - * write one byte data into it, map the open file for the specified - * map length. - */ -void -setup() -{ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* call signal function to trap the signal generated */ - if (signal(SIGSEGV, sig_handler) == SIG_ERR) { - tst_brkm(TBROK, cleanup, "signal fails to catch signal"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TBROK, cleanup, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* - * Get the length of the open file to be mapped into process - * address space. - */ - map_len = 3 * page_sz; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) { - tst_brkm(TBROK, cleanup, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* - * move the file pointer to maplength position from the beginning - * of the file. - */ - if (lseek(fildes, map_len, SEEK_SET) == -1) { - tst_brkm(TBROK, cleanup, "lseek() fails on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* Write one byte into temporary file */ - if (write(fildes, "a", 1) != 1) { - tst_brkm(TBROK, cleanup, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* - * map the open file 'TEMPFILE' from its beginning up to the maplength - * into the calling process's address space at the system choosen - * with read/write permissions to the the mapped region. - */ - addr = mmap(0, map_len, PROT_READ | PROT_WRITE, - MAP_FILE | MAP_SHARED, fildes, 0); - - /* check for the return value of mmap system call */ - if (addr == (char *)MAP_FAILED) { - tst_brkm(TBROK, cleanup, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* - * increment the start address of the region at which the file is - * mapped to a maplength of 3 times the system page size by the value - * of system page size and decrement the maplength value by the value - * of system page size. - */ - addr = (char *)((long)addr + page_sz); - map_len = map_len - page_sz; -} - -/* - * void - * sig_handler() - signal catching function. - * This function is used to trap the signal generated when tried to read or - * write to the memory mapped region which is already detached from the - * calling process address space. - * this function is invoked when SIGSEGV generated and it calls test - * cleanup function and exit the program. - */ -void -sig_handler() -{ - tst_resm(TPASS, "Functionality of munmap() successful"); - - /* Invoke test cleanup function and exit */ - cleanup(); - - /* exit with return code appropriate for results */ - tst_exit(); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Unmap the portion of the region of the file left unmapped. - * Close the temporary file. - * Remove the temporary directory. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * get the start address and length of the portion of - * the mapped region of the file. - */ - addr = (char *)((long)addr - page_sz); - map_len = map_len - page_sz; - - /* unmap the portion of the region of the file left unmapped */ - if (munmap(addr, map_len) < 0) { - tst_brkm(TBROK, NULL, - "munmap() fails to unmap portion of mapped region"); - } - - /* Close the temporary file */ - if (close(fildes) < 0) { - tst_brkm(TBROK, NULL, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Remove the temporary directory and all files in it */ - tst_rmdir(); -} diff --git a/winsup/testsuite/winsup.api/ltp/nice05.c b/winsup/testsuite/winsup.api/ltp/nice05.c deleted file mode 100644 index 1246e7fbd..000000000 --- a/winsup/testsuite/winsup.api/ltp/nice05.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : nice05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for nice(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) nice(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the nice(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * nice(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="nice05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int val; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - val = lc % 39; - /* - * Call nice(2) - */ - TEST(nice(val)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "nice(%d) Failed, errno=%d : %s", val, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "nice(%d) returned %d", val, TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/open02.c b/winsup/testsuite/winsup.api/ltp/open02.c deleted file mode 100644 index 594ab5b1c..000000000 --- a/winsup/testsuite/winsup.api/ltp/open02.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * open02.c - * - * DESCRIPTION - * Test if open without O_CREAT returns -1 if a file does not exist. - * - * ALGORITHM - * 1. open a new file without O_CREAT, test for return value of -1 - * - * USAGE: - * open02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include -#include -#include -#include - -const char *TCID = "open02"; -int TST_TOTAL = 1; -extern int Tst_count; - -char pfilname[40] = ""; - -int exp_enos[] = {ENOENT, 0}; - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard command line options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup for test */ - - TEST_EXP_ENOS(exp_enos); - - /* - * check looping state if -i option given on the command line - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - Tst_count = 0; /* reset Tst_count while looping. */ - - TEST(open(pfilname, O_RDWR, 0444)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "opened non-existent file"); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO != ENOENT) { - tst_resm(TFAIL, "open(2) set invalid errno: " - "expected ENOENT, got %d", TEST_ERRNO); - } else { - tst_resm(TPASS, "open returned ENOENT"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - umask(0); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that options was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - sprintf(pfilname, "./open3.%d", getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/open03.c b/winsup/testsuite/winsup.api/ltp/open03.c deleted file mode 100644 index 6a699bad1..000000000 --- a/winsup/testsuite/winsup.api/ltp/open03.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : open03 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for open(2) - * - * PARENT DOCUMENT : xxxtds01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) open(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the open(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * open(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="open03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call open(2) - */ - TEST(open(fname,O_RDWR|O_CREAT,0700)); - - fd=TEST_RETURN; - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "open(%s,O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "open(%s, O_RDWR|O_CREAT,0700) returned %d", - fname, TEST_RETURN); - } - - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } else if (unlink(fname) == -1) { - tst_brkm(TBROK, cleanup, - "unlink(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/pathconf01.c b/winsup/testsuite/winsup.api/ltp/pathconf01.c deleted file mode 100644 index 466875f21..000000000 --- a/winsup/testsuite/winsup.api/ltp/pathconf01.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : pathconf01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for pathconf(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 6 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) pathconf(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the pathconf(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * pathconf(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="pathconf01"; /* Test program identifier. */ -int TST_TOTAL; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int i; -const char *path = "/tmp"; - -struct pathconf_args -{ - const char *define_tag; - int value; -} args[] = { - {"_PC_LINK_MAX", _PC_LINK_MAX}, - {"_PC_NAME_MAX", _PC_NAME_MAX}, - {"_PC_PATH_MAX", _PC_PATH_MAX}, - {"_PC_PIPE_BUF", _PC_PIPE_BUF}, - {"_PC_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED}, - {"_PC_NO_TRUNC", _PC_NO_TRUNC}, - {NULL, 0} -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - TST_TOTAL=(sizeof(args)/sizeof(args[0]))-1; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (i=0; i -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="pause01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={EINTR, 0}; -void go(); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - (void) signal(SIGALRM, go); - alarm(1); - /* - * Call pause(2) - */ - TEST(pause()); - - /* check return code. Pause returns -1 and EINTR errno */ - if (TEST_RETURN != -1) { - tst_resm(TFAIL, - "pause() returned WITHOUT an error return code : %d", - TEST_ERRNO); - } else { - /* log the errno */ - TEST_ERROR_LOG(TEST_ERRNO); - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* check the errno */ - if (TEST_ERRNO == EINTR) - tst_resm(TPASS, "pause() returned %d", TEST_RETURN); - else - tst_resm(TFAIL, "pause() returned %d. Expected %d (EINTR)", - TEST_RETURN, EINTR); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -/* routine to catch the alarm signal */ -void -go() -{ -} diff --git a/winsup/testsuite/winsup.api/ltp/pipe01.c b/winsup/testsuite/winsup.api/ltp/pipe01.c deleted file mode 100644 index cc01cc988..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe01.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * pipe01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the pipe(2) syscall: - * Check that both ends of the pipe (both file descriptors) are - * available to a process opening the pipe. - * - * ALGORITHM - * Write a string of characters down a pipe; read the string from the - * other file descriptor. Test passes if both can be done, as reported - * by the number of characters written and read. - * - * USAGE: - * pipe01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * RESTRICITONS - * NONE - */ -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "pipe01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int fildes[2]; /* fds for pipe read and write */ - char wrbuf[BUFSIZ], rebuf[BUFSIZ]; - int red, written; /* no. of chars read/written to pipe */ - int greater, length; - char *strcpy(); - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(pipe(fildes)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "pipe() failed unexpectedly - errno %d", - TEST_ERRNO); - continue; - } - - if (STD_FUNCTIONAL_TEST) { - - strcpy(wrbuf, "abcdefghijklmnopqrstuvwxyz"); - length = strlen(wrbuf); - - if ((written = write(fildes[1], wrbuf, length)) == -1) { - tst_brkm(TBROK, cleanup, "write() failed"); - } - - if ((written < 0) || (written > 26)) { - tst_resm(TFAIL, "Condition #1 test failed"); - continue; - } - - if ((red = read(fildes[0], rebuf, written)) == -1) { - tst_brkm(TBROK, cleanup, "read() failed"); - } - - if ((red < 0) || (red > written)) { - tst_resm(TFAIL, "Condition #2 test failed"); - continue; - } - - /* are the strings written and read equal */ - if ((greater = memcmp(rebuf, wrbuf, red)) != 0) { - tst_resm(TFAIL, "Condition #3 test failed"); - continue; - } - tst_resm(TPASS, "pipe() functionality is correct"); - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/pipe08.c b/winsup/testsuite/winsup.api/ltp/pipe08.c deleted file mode 100644 index 70d61dab8..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe08.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * pipe08.c - * - * DESCRIPTION - * Check that a SIGPIPE signal is generated when a write is - * attempted on an empty pipe. - * - * ALGORITHM - * 1. Write to a pipe after closing the read side. - * 2. Check for the signal SIGPIPE to be received. - * - * USAGE: - * pipe08 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * USAGE - * pipe08 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "pipe08"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); -void sighandler(int); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int pipefd[2]; /* fds for pipe read/write */ - char wrbuf[BUFSIZ]; - int written, length; - int close_stat; /* exit status of close(read fd) */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - if (!STD_FUNCTIONAL_TEST) { - tst_resm(TWARN, "-f option should not be used"); - } - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(pipe(pipefd)); - - if (TEST_RETURN != 0) { - tst_resm(TFAIL, "call failed unexpectedly"); - continue; - } - - if ((close_stat = close(pipefd[0])) == -1) { - tst_brkm(TBROK, cleanup, "close of read side failed"); - } - - strcpy(wrbuf, "abcdefghijklmnopqrstuvwxyz\0"); - length = strlen(wrbuf); - - /* - * the SIGPIPE signal will be caught here or else - * the program will dump core when the signal is - * sent - */ - written = write(pipefd[1], wrbuf, length); - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * sighandler - catch signals and look for SIGPIPE - */ -void -sighandler(int sig) -{ - if (sig != SIGPIPE) { - tst_resm(TFAIL, "expected SIGPIPE, got %d", sig); - } else { - tst_resm(TPASS, "got expected SIGPIPE signal"); - } -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, sighandler, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/pipe09.c b/winsup/testsuite/winsup.api/ltp/pipe09.c deleted file mode 100644 index eb21bb601..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe09.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * pipe09.c - * - * DESCRIPTION - * Check that two processes can use the same pipe at the same time. - * - * ALGORITHM - * 1. Open a pipe - * 2. Fork a child which writes to the pipe - * 3. Fork another child which writes a different character to the pipe - * 4. Have the parent read from the pipe - * 5. It should get the characters from both children. - * - * USAGE: - * pipe09 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include -#include "test.h" -#include "usctest.h" - -#define PIPEWRTCNT 100 /* must be an even number */ - -const char *TCID = "pipe09"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int i, red, wtstatus; - int pipefd[2]; /* fds for pipe read/write */ - char rebuf[BUFSIZ]; - int Acnt = 0, Bcnt = 0; /* count 'A' and 'B' */ - int fork_1, fork_2; /* ret values in parent */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(pipe(pipefd)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "pipe() call failed"); - continue; - } - - if (!STD_FUNCTIONAL_TEST) { - tst_resm(TWARN, "-f option should not be used"); - tst_resm(TPASS, "call succeeded"); - continue; - } - - if ((fork_1 = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() #1 failed"); - /*NOTREACHED*/ - } - - if (fork_1 == 0) { /* 1st child */ - if (close(pipefd[0]) != 0) { - tst_resm(TWARN, "pipefd[0] close failed, " - "errno = %d", errno); - exit(1); - } - - for (i = 0; i < PIPEWRTCNT / 2; ++i) { - if (write(pipefd[1], "A", 1) != 1) { - tst_resm(TWARN, "write to pipe failed"); - exit(1); - } - } - exit(0); - } - - /* parent */ - - waitpid(fork_1, &wtstatus, 0); - if (WEXITSTATUS(wtstatus) != 0) { - tst_brkm(TBROK, cleanup, "problem detected in child, " - "wait status %d, errno = %d", wtstatus, errno); - } - - if ((fork_2 = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() #2 failed"); - /*NOTREACHED*/ - } - - if (fork_2 == 0) { /* 2nd child */ - if (close(pipefd[0]) != 0) { - tst_resm(TWARN, "pipefd[0] close " - "failed, errno = %d", errno); - exit(1); - } - - for (i = 0; i < PIPEWRTCNT / 2; ++i) { - if (write(pipefd[1], "B", 1) != 1) { - tst_resm(TWARN, "write to pipe failed"); - exit(1); - } - } - exit(0); - } - - /* parent */ - - waitpid(fork_2, &wtstatus, 0); - if (WEXITSTATUS(wtstatus) != 0) { - tst_brkm(TBROK, cleanup, "problem detected in child, " - "wait status %d, errno = %d", wtstatus, errno); - } - - if (close(pipefd[1]) != 0) { - tst_brkm(TBROK, cleanup, "pipefd[1] close failed, " - "errno = %d", errno); - /*NOTREACHED*/ - } - - while ((red = read(pipefd[0], rebuf, 100)) > 0) { - for (i = 0; i < red; i++) { - if (rebuf[i] == 'A') { - Acnt++; - continue; - } - if (rebuf[i] == 'B') { - Bcnt++; - continue; - } - tst_resm(TFAIL, "got bogus '%c' character", - rebuf[i]); - break; - } - } - - if (red == -1) { - tst_brkm(TBROK, cleanup, "Failure reading pipefd pipe, " - "errno = %d", errno); - } - - if (Bcnt == Acnt && Bcnt == (PIPEWRTCNT / 2)) { - tst_resm(TPASS, "functionality appears to be correct"); - } else { - tst_resm(TFAIL, "functionality is not correct - Acnt " - "= %d, Bcnt = %d", Acnt, Bcnt); - } - - /* clean up things in case we are looping */ - Acnt = Bcnt = 0; - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/pipe10.c b/winsup/testsuite/winsup.api/ltp/pipe10.c deleted file mode 100644 index 52ac5d94e..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe10.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * pipe10.c - * - * DESCRIPTION - * Check that parent can open a pipe and have a child read from it - * - * ALGORITHM - * Parent opens pipe, child reads. Passes if child can read all the - * characters written by the parent. - * - * USAGE: - * pipe10 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include -#include - -const char *TCID = "pipe10"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int fd[2]; /* fds for pipe read/write */ - char wrbuf[BUFSIZ], rebuf[BUFSIZ]; - int red, written; /* no of chars read and */ - /* written to pipe */ - int length, greater, forkstat; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(pipe(fd)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "pipe creation failed"); - continue; - } - - if (!STD_FUNCTIONAL_TEST) { - tst_resm(TPASS, "call succeeded"); - continue; - } - - strcpy(wrbuf, "abcdefghijklmnopqrstuvwxyz\0"); - length = strlen(wrbuf); - - written = write(fd[1], wrbuf, length); - - /* did write write at least some chars */ - if ((written < 0) || (written > length)) { - tst_brkm(TBROK, cleanup, "write to pipe failed"); - } - - forkstat = fork(); - - if (forkstat == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - /*NOTREACHED*/ - } - - if (forkstat == 0) { /* child */ - red = read(fd[0], rebuf, written); - - /* did read , get at least some chars */ - if ((red < 0) || (red > written)) { - tst_brkm(TBROK, cleanup, "read pipe failed"); - } - - greater = memcmp(rebuf, wrbuf, red); - - /* are the strings written and read equal */ - if (greater == 0) { - tst_resm(TPASS, "functionality is correct"); - } else { - tst_resm(TFAIL, "read & write strings do " - "not match"); - } - } else { /* parent */ - /* let the child carry on */ - exit(0); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/pipe11.c b/winsup/testsuite/winsup.api/ltp/pipe11.c deleted file mode 100644 index 558e70a96..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe11.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * pipe11.c - * - * DESCRIPTION - * Check if many children can read what is written to a pipe by the - * parent. - * - * ALGORITHM - * 1. Open a pipe and write to it - * 2. Fork a large number of children - * 3. Have the children read the pipe and check how many characters - * each got - * - * USAGE: - * pipe11 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "pipe11"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -#define NUMCHILD 50 -#define NCPERCHILD 50 -char rawchars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; -int kidid; -int numchild; /* no of children to fork */ -int ncperchild; /* no of chars child should read */ -int szcharbuf; /* size of char buf */ -int pipewrcnt; /* chars written to pipe */ -char *wrbuf, *rdbuf; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int fd[2]; /* fds for pipe read/write */ - int i; - int fork_ret, status; - int nread, written; /* no of chars read and written */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(pipe(fd)); - - if (TEST_RETURN != 0) { - tst_resm(TFAIL, "pipe creation failed"); - continue; - } - - if (!STD_FUNCTIONAL_TEST) { - tst_resm(TPASS, "call succeeded"); - continue; - } - - written = write(fd[1], wrbuf, szcharbuf); - if (written != szcharbuf) { - tst_brkm(TBROK, cleanup, "write to pipe failed"); - } - -refork: - ++kidid; - fork_ret = fork(); - - if (fork_ret < 0) { - tst_brkm(TBROK, cleanup, "fork() failed"); - /*NOTREACHED*/ - } - - if ((fork_ret != 0) && (fork_ret != -1) && (kidid < numchild)) { - goto refork; - } - - if (fork_ret == 0) { /* child */ - if (close(fd[1])) { - tst_resm(TINFO, "child %d " "could not close " - "pipe", kidid); - exit(0); - } - nread = read(fd[0], rdbuf, ncperchild); - if (nread == ncperchild) { - tst_resm(TINFO, "child %d " "got %d chars", - kidid, nread); - exit(0); - } else { - tst_resm(TFAIL, "child %d did not receive " - "expected no of characters, got %d " - "characters", kidid, nread); - exit(1); - } - } - - /* parent */ - sleep(5); - tst_resm(TINFO, "There are %d children to wait for", kidid); - for (i = 1; i <= kidid; ++i) { - wait(&status); - if (status == 0) { - tst_resm(TPASS, "child %d exitted successfully", - i); - } else { - tst_resm(TFAIL, "child %d exitted with bad " - "status", i); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - int i, j; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - numchild = NUMCHILD; - ncperchild = NCPERCHILD; - - kidid = 0; - - /* allocate read and write buffers */ - szcharbuf = numchild * ncperchild; - - /* make sure pipe write doesn't block */ - if (szcharbuf == PIPE_BUF) { - /* adjust number of characters per child */ - ncperchild = szcharbuf / numchild; - } - - if ((wrbuf = (char *)malloc(szcharbuf)) == (char *)0) { - tst_brkm(TBROK, cleanup, "malloc failed"); - /*NOTREACHED*/ - } - - if ((rdbuf = (char *)malloc(szcharbuf)) == (char *)0) { - tst_brkm(TBROK, cleanup, "malloc of rdbuf failed"); - /*NOTREACHED*/ - } - - /* initialize wrbuf */ - j = 0; - for (i = 0; i < szcharbuf; ) { - wrbuf[i++] = rawchars[j++]; - if (j >= (int)sizeof(rawchars)) { - j = 0; - } - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/poll01.c b/winsup/testsuite/winsup.api/ltp/poll01.c deleted file mode 100644 index 704b738a2..000000000 --- a/winsup/testsuite/winsup.api/ltp/poll01.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: poll01 - * - * Test Description: - * Verify that valid open file descriptor must be provided to poll() to - * succeed. - * - * Expected Result: - * poll should return the correct values when an valid file descriptor is - * provided. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * - * Usage: - * poll01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define BUF_SIZE 512 - -const char *TCID="poll01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int fildes[2]; /* file descriptors of the pipe. */ -struct pollfd fds[1]; /* struct. for poll() */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t cpid; /* child process id */ - char write_buf[] = "Testing\0"; /* buffer string for write */ - char read_buf[BUF_SIZE]; /* buffer for read-end of pipe */ - int status; /* exit status of child process */ - int rval; - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call poll() with the TEST macro. - */ - TEST(poll(fds, 1, -1)); - - /* check return code of poll() */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "poll() failed on write, errno=%d" - " : %s", TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - - /* write the message to the pipe */ - if (write(fildes[1], write_buf, strlen(write_buf)) - < (int)strlen(write_buf)) { - tst_brkm(TBROK, cleanup, "write() failed on write " - "to pipe, error:%d", errno); - } - - /* Fork child process */ - if ((cpid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (cpid == 0) { /* Child process */ - /* - * close writing end of pipe and read from - * the pipe - */ - if (close(fildes[1]) == -1) { - tst_brkm(TFAIL, NULL, "close() failed on write " - "endof pipe, errno:%d", errno); - exit(1); - } - - /* - * Set poll() data structures to check - * if data is present on read - */ - fds[0].fd = fildes[0]; - fds[0].events = POLLIN; - - /* - * If data are present, then read the data. If poll() - * and read() return expected values, then the - * functionality of poll() is correct. - */ - rval = (poll(fds, 1, -1)); - - if (rval == -1) { - tst_resm(TFAIL, "poll() failed on read - " - "errno=%d : %s", - TEST_ERRNO, strerror(errno)); - exit(1); - } - - /* Read data from read end of pipe */ - if (read(fildes[0], read_buf, sizeof(read_buf)) != - (int)strlen(write_buf)) { - tst_brkm(TFAIL, NULL, "read() failed - " - "error:%d", errno); - exit(1); - } - - /* Now, do the actual comparision */ - if (memcmp(read_buf, write_buf, strlen(write_buf))) { - tst_resm(TFAIL, "Data from reading pipe " - "are different"); - exit(1); - } - - /* Everything is fine, exit normally */ - exit(0); - } else { /* Parent process */ - /* Wait for child to complete execution */ - wait(&status); - - if (WEXITSTATUS(status) == 1) { - tst_resm(TFAIL, "child exited abnormally"); - } else { - tst_resm(TPASS, - "Functionality of poll() successful"); - } - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Creat read/write pipe using pipe(). - * Set poll data structures to check writing to the pipe. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Creat read/write pipe */ - if (pipe(fildes) < 0) { - tst_brkm(TBROK, tst_exit, - "pipe() failed to create interprocess channel"); - } - - /* Set poll data structures */ - fds[0].fd = fildes[1]; - fds[0].events = POLLOUT; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * close read end of pipe if still open. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close read end of pipe if still open */ - if (close(fildes[0]) < 0) { - tst_brkm(TFAIL, NULL, "close() failed on read-end of pipe, " - "errno:%d", errno); - } - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/read01.c b/winsup/testsuite/winsup.api/ltp/read01.c deleted file mode 100644 index 332b939a7..000000000 --- a/winsup/testsuite/winsup.api/ltp/read01.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : read01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for read(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) read(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the read(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * read(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -/* - * Set READ_BLOCK_SIZE to the block size of the system. - */ -#ifdef linux -#define READ_BLOCK_SIZE DEV_BSIZE -#else -#ifdef __CYGWIN__ -#define READ_BLOCK_SIZE S_BLKSIZE -#else -#define READ_BLOCK_SIZE BSIZE -#endif -#endif - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="read01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -char fname[255]; -int fd, i; -int offset=0; -char *s; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if (write(fd, s, READ_BLOCK_SIZE) == -1) { - tst_brkm(TBROK, cleanup, - "write(%s, %s, %d) Failed, errno=%d : %s", - fname, s, READ_BLOCK_SIZE, errno, strerror(errno)); - } - offset+=READ_BLOCK_SIZE; - if (lseek(fd, (long)(offset-READ_BLOCK_SIZE), 0) == -1) { - tst_brkm(TBROK, cleanup, - "lseek(%s, %ld, 0) Failed, errno=%d : %s", - fname, (long)(offset-READ_BLOCK_SIZE), errno, strerror(errno)); - } - /* - * Call read(2) - */ - TEST(read(fd, s, READ_BLOCK_SIZE)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "read(fd, s, READ_BLOCK_SIZE) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "read(pfds) returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - if ((s = malloc(READ_BLOCK_SIZE)) == NULL) { - tst_brkm(TBROK, cleanup, - "malloc(%d) Failed, errno=%d : %s", - READ_BLOCK_SIZE, errno, strerror(errno)); - } - (void) memset(s, '*', READ_BLOCK_SIZE); - for (i=0; i < READ_BLOCK_SIZE; i++) { - if ( s[i] != '*' ) { - tst_brkm(TBROK, cleanup, - "File Data pattern not setup correctly : expected * at s[%d] : found %c", - i, s[i]); - } - } - sprintf(fname,"./tfile_%d",getpid()); - if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1 ) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/read04.c b/winsup/testsuite/winsup.api/ltp/read04.c deleted file mode 100644 index c976cd6a4..000000000 --- a/winsup/testsuite/winsup.api/ltp/read04.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * read01.c - * - * DESCRIPTION - * Testcase to check if read returns the number of bytes read correctly. - * - * ALGORITHM - * Create a file and write some bytes out to it. - * Attempt to read more than written. - * Check the return count, and the read buffer. The read buffer should be - * same as the write buffer. - * - * USAGE: - * read01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "read01"; -int TST_TOTAL = 1; -extern int Tst_count; - -#define TST_SIZE 26 /* could also do strlen(palfa) */ -char fname[255]; -char palfa[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; -int fild; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int rfild; - char prbuf[BUFSIZ]; - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup for test */ - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - Tst_count = 0; /* reset Tst_count while looping */ - - if ((rfild = open(fname, O_RDONLY)) == -1) { - tst_brkm(TBROK, cleanup, "can't open for reading"); - /*NOTREACHED*/ - } - TEST(read(rfild, prbuf, BUFSIZ)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "call failed unexpectedly"); - continue; - } - - if (STD_FUNCTIONAL_TEST) { - if (TEST_RETURN != TST_SIZE) { - tst_resm(TFAIL, "Bad read count - got %d - " - "expected %d", TEST_RETURN, TST_SIZE); - continue; - } - if (memcmp(palfa, prbuf, TST_SIZE) != 0) { - tst_resm(TFAIL, "read buffer not equal " - "to write buffer"); - continue; - } - tst_resm(TPASS, "functionality of read() is correct"); - } else { - tst_resm(TPASS, "call succeeded"); - } - if (close(rfild) == -1) { - tst_brkm(TBROK, cleanup, "close() failed"); - /*NOTREACHED*/ - } - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - sprintf(fname,"tfile_%d",getpid()); - - if ((fild = creat(fname, 0777)) == -1) { - tst_brkm(TBROK, cleanup, "creat(%s, 0777) Failed, errno = %d" - " : %s", fname, errno, strerror(errno)); - /*NOTREACHED*/ - } - if (write(fild, palfa, TST_SIZE) != TST_SIZE) { - tst_brkm(TBROK, cleanup, "can't write to Xread"); - /*NOTREACHED*/ - } - close (fild); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - unlink(fname); - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/readdir01.c b/winsup/testsuite/winsup.api/ltp/readdir01.c deleted file mode 100644 index c77e90680..000000000 --- a/winsup/testsuite/winsup.api/ltp/readdir01.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : readdir01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : write multiple files and try to find them with readdir - * - * TEST CASE TOTAL : - * - * WALL CLOCK TIME : - * - * CPU TYPES : ALL - * - * AUTHOR : Nate Straz - * - * CO-PILOT : - * - * DATE STARTED : 02/16/2001 - * - * INITIAL RELEASE : Linux 2.4.x - * - * TEST CASES - * - * 1.) Create n files and check that readdir() finds n files - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the readdir(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * readdir(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include - /* test.h and usctest.h are the two header files that are required by the - * quickhit package. They contain function and macro declarations which you - * can use in your test programs - */ -#include "test.h" -#include "usctest.h" - - /* The setup and cleanup functions are basic parts of a test case. These - * steps are usually put in separate functions for clarity. The help function - * is only needed when you are adding new command line options. - */ -void setup(); -void help(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="readdir01"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; - -int exp_enos[]={0, 0}; - -#define BASENAME "readdirfile" - -char Basename[255]; -char Fname[255]; -int Nfiles=0; - -/* To add command line options you need to declare a structure to pass to - * parse_opts(). options is the structure used in this example. The format is - * the string that should be added to optstring in getopt(3), an integer that - * will be used as a flag if the option is given, and a pointer to a string that - * should receive the optarg parameter from getopt(3). Here we add a -N - * option. Long options are not supported at this time. - */ -char *Nfilearg; -int Nflag=0; - -/* for test specific parse_opts options */ -option_t options[] = { - { "N:", &Nflag, &Nfilearg }, /* -N #files */ - { NULL, NULL, NULL } -}; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int cnt; - int nfiles, fd; - char fname[255]; - DIR *test_dir; - struct dirent *dptr; - - Tst_nobuf=1; - - /*************************************************************** - * parse standard options - ***************************************************************/ - /* start off by parsing the command line options. We provide a function - * that understands many common options to control looping. If you are not - * adding any new options, pass NULL in place of options and &help. - */ - if ( (msg=parse_opts(ac, av, options, &help)) ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - if ( Nflag ) { - if (sscanf(Nfilearg, "%i", &Nfiles) != 1 ) { - tst_brkm(TBROK, NULL, "--N option arg is not a number"); - tst_exit(); - } - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - /* Next you should run a setup routine to make sure your environment is - * sane. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state - ***************************************************************/ - /* TEST_LOOPING() is a macro that will make sure the test continues - * looping according to the standard command line args. - */ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if ( Nfiles ) - nfiles = Nfiles; - else - /* min of 10 links and max of a 100 links */ - nfiles = (lc%90)+10; - - /* create a bunch of files to look at */ - for(cnt=0; cnt < nfiles; cnt++) { - - sprintf(fname, "%s%d", Basename, cnt); - if ((fd = open(fname, O_RDWR|O_CREAT, 0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (write(fd, "hello\n", 6) < 0) { - tst_brkm(TBROK, cleanup, - "write(%s, \"hello\\n\", 6) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (close(fd) < 0) { - tst_res(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - } - - if ((test_dir = opendir(".")) == NULL) { - tst_resm(TFAIL, "opendir(\".\") Failed, errno=%d : %s", - errno, strerror(errno)); - } else { - /* count the entries we find to see if any are missing */ - cnt = 0; - errno = 0; - while ( (dptr = readdir(test_dir)) ) { - if (strcmp(dptr->d_name, ".") && strcmp(dptr->d_name, "..")) - cnt++; - } - - if (errno != 0) { - tst_resm(TFAIL, "readir(test_dir) Failed on try %d, errno=%d : %s", - cnt, errno, strerror(errno)); - } - if (cnt == nfiles) { - tst_resm(TPASS, "found all %d that were created", nfiles); - } else if (cnt > nfiles) { - tst_resm(TFAIL, "found more files than were created"); - tst_resm(TINFO, "created: %d, found: %d", nfiles, cnt); - } else { - tst_resm(TFAIL, "found less files than were created"); - tst_resm(TINFO, "created: %d, found: %d", nfiles, cnt); - } - } - - /* Here we clean up after the test case so we can do another iteration. - */ - for(cnt=0; cnt < nfiles; cnt++) { - - sprintf(fname, "%s%d", Basename, cnt); - - if (unlink(fname) == -1) { - tst_res(TWARN, "unlink(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * help - ***************************************************************/ -/* The custom help() function is really simple. Just write your help message to - * standard out. Your help function will be called after the standard options - * have been printed - */ -void -help() -{ - printf(" -N #files : create #files files every iteration\n"); -} - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* You will want to enable some signal handling so you can capture - * unexpected signals like SIGSEGV. - */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - /* One cavet that hasn't been fixed yet. TEST_PAUSE contains the code to - * fork the test with the -c option. You want to make sure you do this - * before you create your temporary directory. - */ - TEST_PAUSE; - - /* If you are doing any file work, you should use a temporary directory. We - * provide tst_tmpdir() which will create a uniquely named temporary - * directory and cd into it. You can now create files in the current - * directory without worrying. - */ - tst_tmpdir(); - - sprintf(Basename, "%s_%d.", BASENAME, getpid()); -} - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* If you use a temporary directory, you need to be sure you remove it. Use - * tst_rmdir() to do it automatically. - */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/readlink01.c b/winsup/testsuite/winsup.api/ltp/readlink01.c deleted file mode 100644 index 744fff02a..000000000 --- a/winsup/testsuite/winsup.api/ltp/readlink01.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name : readlink01 - * - * Test Description : - * Verify that, readlink will succeed to read the contents of the symbolic - * link created the process. - * - * Expected Result: - * readlink() should return the contents of symbolic link path in the buffer - * on success. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * readlink01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" -#define SYMFILE "slink_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define MAX_SIZE 256 - -const char *TCID="readlink01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_val; /* strlen of testfile */ - -void setup(); /* Setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - char buffer[MAX_SIZE]; /* temporary buffer to hold symlink contents*/ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call readlink(2) to read the contents of - * symlink into a buffer. - */ - TEST(readlink(SYMFILE, buffer, sizeof(buffer))); - - /* Check return code of readlink(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "readlink() on %s failed, errno=%d : %s" - , SYMFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Compare the return value of readlink() - * with the expected value which is the - * strlen() of testfile. - */ - if (TEST_RETURN == exp_val) { - /* Check for the contents of buffer */ - if (memcmp(buffer, TESTFILE, exp_val) != 0) { - tst_resm(TFAIL, "Pathname %s and buffer" - " contents %s differ", - TESTFILE, buffer); - } else { - tst_resm(TPASS, "readlink() " - "functionality on '%s' is " - "correct", SYMFILE); - } - } else { - tst_resm(TFAIL, "readlink() return value %d " - "does't match, Expected %d", - TEST_RETURN, exp_val); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and close it - * Create a symbolic link of testfile. - */ -void -setup() -{ - int fd; /* file handle for testfile */ - - /* make sure test is not being run as root */ - if (0 == geteuid()) { - tst_brkm(TBROK, tst_exit, "Must not run test as root"); - } - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Create a symlink of testfile under temporary directory */ - if (symlink(TESTFILE, SYMFILE) < 0) { - tst_brkm(TBROK, cleanup, - "symlink(%s, %s) failed, errno=%d : %s", - TESTFILE, SYMFILE, errno, strerror(errno)); - } - - /* Get the strlen of testfile */ - exp_val = strlen(TESTFILE); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/readlink02.c b/winsup/testsuite/winsup.api/ltp/readlink02.c deleted file mode 100644 index 4ef6ffa11..000000000 --- a/winsup/testsuite/winsup.api/ltp/readlink02.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : readlink02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for readlink(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) readlink(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the readlink(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * readlink(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="readlink02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -char fname[255], buf[255], symlnk[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call readlink(2) - */ - TEST(readlink(symlnk, buf, 255)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "readlink(%s, buf, 255) Failed, errno=%d : %s", symlnk, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "readlink(%s, buf, 255) returned %d", symlnk, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"./tfile_%d",getpid()); - if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - if (close(fd) == -1 ) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - sprintf(symlnk,"./sl_%d",getpid()); - if (symlink(fname, symlnk) == -1) { - tst_resm(TWARN, "symlnk(%s, %s) Failed, errno=%d : %s", - fname, symlnk, errno, strerror(errno)); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/readlink03.c b/winsup/testsuite/winsup.api/ltp/readlink03.c deleted file mode 100644 index 41cf4bbe9..000000000 --- a/winsup/testsuite/winsup.api/ltp/readlink03.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name : readlink03 - * - * Test Description : - * Verify that, - * 1) readlink(2) returns -1 and sets errno to EACCES if search/write - * permission is denied in the directory where the symbolic link - * resides. - * 2) readlink(2) returns -1 and sets errno to EINVAL if the buffer size - * is not positive. - * 3) readlink(2) returns -1 and sets errno to EINVAL if the specified - * file is not a symbolic link file. - * 4) readlink(2) returns -1 and sets errno to ENAMETOOLONG if the - * pathname component of symbolic link is too long (ie, > PATH_MAX). - * 5) readlink(2) returns -1 and sets errno to ENOENT if the component of - * symbolic link points to an empty string. - * - * Expected Result: - * readlink() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * readlink03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be executed by 'non-super-user' only. - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define MODE_RWX S_IRWXU | S_IRWXG | S_IRWXO -#define FILE_MODE S_IRUSR | S_IRGRP | S_IROTH -#define DIR_TEMP "testdir_1" -#define TESTFILE "testfile" -#define TEST_FILE1 "testdir_1/tfile_1" -#define SYM_FILE1 "testdir_1/sfile_1" -#define TEST_FILE2 "tfile_2" -#define SYM_FILE2 "sfile_2" -#define MAX_SIZE 256 - -const char *TCID="readlink03"; /* Test program identifier. */ -int TST_TOTAL=5; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EACCES, EINVAL, ENAMETOOLONG, ENOENT, 0}; - -int no_setup(); -int setup1(); /* setup function to test symlink for EACCES */ -int setup2(); /* setup function to test symlink for EEXIST */ -int lpath_setup(); /* setup function to test chmod for ENAMETOOLONG */ - -char Longpathname[PATH_MAX+2]; - -struct test_case_t { /* test case struct. to hold ref. test cond's*/ - const char *link; - const char *desc; - int exp_errno; - size_t buf_siz; - int (*setupfunc)(); -} Test_cases[] = { -#ifndef __CYGWIN__ - { SYM_FILE1, "No Search permissions to process", EACCES, 1, setup1 }, - { SYM_FILE2, "Buffer size is not positive", EINVAL, -1, setup2 }, - { TEST_FILE2, "File is not symbolic link", EINVAL, 1, no_setup }, -#else - { TEST_FILE2, "File is not symbolic link", EINVAL, 1, setup2 }, -#endif - { Longpathname, "Symlink path too long", ENAMETOOLONG, 1, lpath_setup }, - { "", "Symlink Pathname is empty", ENOENT, 1, no_setup }, - { NULL, NULL, 0, 0, no_setup } -}; - -extern void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - char buffer[MAX_SIZE]; /* temporary buffer to hold symlink contents*/ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *sym_file; /* symbolic link file name */ - const char *test_desc; /* test specific error message */ - int i; /* counter to test different test conditions */ - size_t buf_size; /* size of buffer for readlink */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* - * Invoke setup function to call individual test setup functions - * to simulate test conditions. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - for (i = 0; Test_cases[i].desc != NULL; i++) { - sym_file = Test_cases[i].link; - test_desc = Test_cases[i].desc; - buf_size = Test_cases[i].buf_siz; - - if (buf_size == 1) { - buf_size = sizeof(buffer); - } - - /* - * Call readlink(2) to test different test conditions. - * verify that it fails with -1 return value and sets - * appropriate errno. - */ - TEST(readlink(sym_file, buffer, buf_size)); - - /* Check return code of readlink(2) */ - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "readlink() returned %d, " - "expected -1, errno:%d", TEST_RETURN, - Test_cases[i].exp_errno); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO == Test_cases[i].exp_errno) { - tst_resm(TPASS, "readlink(), %s, returned " - "errno %d", test_desc, TEST_ERRNO); - tst_resm(TPASS, "readlink(), %s, returned " - "errno %d", test_desc, TEST_ERRNO); - } else { - tst_resm(TFAIL, "readlink() failed, %s, " - "errno=%d, expected errno=%d", - test_desc, TEST_ERRNO, - Test_cases[i].exp_errno); - } - } /* End of TEST CASE LOOPING. */ - } /* End for TEST_LOOPING */ - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Create a temporary directory and change directory to it. - * Call test specific setup functions. - */ -void -setup() -{ - int i; - - /* make sure test is not being run as root */ - if (0 == geteuid()) { - tst_brkm(TBROK, tst_exit, "Must not run test as root"); - } - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (i = 0; Test_cases[i].desc != NULL; i++) { - Test_cases[i].setupfunc(); - } -} - -/* - * no_setup() - Some test conditions for readlink(2) do not any setup. - */ -int -no_setup() -{ - return 0; -} - -/* - * setup1() - setup function for a test condition for which readlink(2) - * returns -1 and sets errno to EACCES. - * - * Create a test directory under temporary directory and create a test file - * under this directory with mode "0666" permissions. - * Create a symlink of testfile under test directory. - * Modify the mode permissions on test directory such that process will not - * have search permissions on test directory. - */ -int -setup1() -{ - int fd; /* file handle for testfile */ - - if (mkdir(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TBROK, cleanup, "mkdir(2) of %s failed", DIR_TEMP); - } - - if ((fd = open(TEST_FILE1, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - } - - /* Creat a symbolic link of testfile under test directory */ - if (symlink(TEST_FILE1, SYM_FILE1) < 0) { - tst_brkm(TBROK, cleanup, "symlink of %s failed", TEST_FILE1); - } - - /* Modify mode permissions on test directory */ - if (chmod(DIR_TEMP, FILE_MODE) < 0) { - tst_brkm(TBROK, cleanup, "chmod(2) of %s failed", DIR_TEMP); - } - return 0; -} - -/* - * setup2() - setup function for a test condition for which readlink(2) - * returns -1 and sets errno to EINVAL. - * - * Create a testfile under temporary directory and create a symlink - * file of it. - */ -int -setup2() -{ - int fd; /* file handle for testfile */ - - /* Creat a testfile and close it */ - if ((fd = open(TEST_FILE2, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - } - - /* Creat a symlink of testfile created above */ - if (symlink(TEST_FILE2, SYM_FILE2) < 0) { - tst_brkm(TBROK, cleanup, "symlink() failed to create %s in " - "setup2, error=%d", SYM_FILE2, errno); - } - return 0; -} - -/* - * lpath_setup() - setup to create a node with a name length exceeding - * the MAX. length of PATH_MAX. - */ -int -lpath_setup() -{ - int i; /* counter variable */ - - for (i = 0; i <= (PATH_MAX + 1); i++) { - Longpathname[i] = 'a'; - } - return 0; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * - * Restore the mode permissions on test directory. - * Remove the temporary directory created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Restore mode permissions on test directory created in setup2() */ - if (chmod(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TBROK, NULL, "chmod(2) of %s failed", DIR_TEMP); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/rename01.c b/winsup/testsuite/winsup.api/ltp/rename01.c deleted file mode 100644 index 14ae1f245..000000000 --- a/winsup/testsuite/winsup.api/ltp/rename01.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * rename01 - * - * DESCRIPTION - * This test will verify the rename(2) syscall basic functionality. - * Verify rename() works when the "new" file or directory does not exist. - * - * ALGORITHM - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * 1. "old" is plain file, new does not exists - * create the "old" file, make sure the "new" file - * dose not exist - * rename the "old" to the "new" file - * verify the "new" file points to the "old" file - * verify the "old" file does not exist - * - * 2. "old" is a directory,"new" does not exists - * create the "old" directory, make sure "new" - * dose not exist - * rename the "old" to the "new" - * verify the "new" points to the "old" - * verify the "old" does not exist - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * USAGE - * rename01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None. - */ -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -extern void do_file_setup(char *); - -const char *TCID="rename01"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char fname[255], mname[255]; -char fdir[255], mdir[255]; -struct stat buf1; -dev_t f_olddev, d_olddev; -ino_t f_oldino, d_oldino; - -struct test_case_t { - const char *name1; - const char *name2; - const char *desc; - dev_t *olddev; - ino_t *oldino; -} TC[] = { - /* comment goes here */ - {fname, mname, "file", &f_olddev, &f_oldino}, - - /* comment goes here */ - {fdir, mdir, "directory", &d_olddev, &d_oldino} -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int i; - - /* - * parse standard options - */ - if ((msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* - * perform global setup for test - */ - setup(); - - /* - * check looping state if -i option given - */ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* loop through the test cases */ - for (i=0; i -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); -void do_file_setup(); - - - -const char *TCID="rename02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -int fd; -char fname[255], mname[255]; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call rename(2) - */ - TEST(rename(fname, mname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "rename(%s, %s) Failed, errno=%d : %s", fname, mname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "rename(%s, %s) returned %d", fname, mname, TEST_RETURN); - } - if (unlink(mname) == -1) { - tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s", mname, errno, strerror(errno)); - } - do_file_setup(); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"./tfile_%d",getpid()); - sprintf(mname,"./rnfile_%d",getpid()); - do_file_setup(); - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - -void -do_file_setup() -{ - if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - if (close(fd) == -1 ) - tst_resm(TWARN, "close(%s) Failed on file create, errno=%d : %s", - fname, errno, strerror(errno)); - -} diff --git a/winsup/testsuite/winsup.api/ltp/rename08.c b/winsup/testsuite/winsup.api/ltp/rename08.c deleted file mode 100644 index 0788ddc98..000000000 --- a/winsup/testsuite/winsup.api/ltp/rename08.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * rename08 - * - * DESCRIPTION - * This test will verify that rename(2) syscall failed in EFAULT - * - * ALGORITHM - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * Create a valid file to use in the rename() call. - * - * Test: - * Loop if the proper options are given. - * 1. "old" is a valid file, newpath points to address - * outside allocated address space - * rename the "old" to the "new" file - * verify rename() failed with error EFAULT - * - * 2. "old" points to address outside allocated address space - * ,"new" is a valid file - * rename the "old" to the "new" - * verify rename() failed with error EFAULT - * - * 3. oldpath and newpath are all NULL - * try to rename NULL to NULL - * verify rename() failed with error EFAULT - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created.* - * USAGE - * rename08 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None. - */ -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -extern void do_file_setup(char *); - -const char *TCID="rename08"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={EFAULT, 0}; /* List must end with 0 */ - -int fd; -char fname[255]; - -struct test_case_t { - char *fd; - char *fd2; - int error; -} TC[] = { - /* "new" file is invalid - EFAULT */ - {fname, (char *)-1, EFAULT}, - - /* "old" file is invalid - EFAULT */ - {(char *)-1, fname, EFAULT}, - - /* both files are NULL - EFAULT */ - {NULL, NULL, EFAULT} -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int i; - - /* - * parse standard options - */ - if ((msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* - * perform global setup for test - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* - * check looping state if -i option given - */ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* loop through the test cases */ - for (i = 0; i < TST_TOTAL; i++) { - - TEST(rename(TC[i].fd, TC[i].fd2)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "call succeeded unexpectedly"); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO == TC[i].error) { - tst_resm(TPASS, "expected failure - " - "errno = %d : %s", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "unexpected error - %d : %s - " - "expected %d", TEST_ERRNO, - strerror(TEST_ERRNO), TC[i].error); - } - } - } /* End for TEST_LOOPING */ - - /* - * cleanup and exit - */ - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Create a temporary directory and make it current. */ - tst_tmpdir(); - - sprintf(fname,"./tfile_%d",getpid()); - - do_file_setup(fname); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Remove the temporary directory. - */ - tst_rmdir(); - - /* - * Exit with return code appropriate for results. - */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/rename10.c b/winsup/testsuite/winsup.api/ltp/rename10.c deleted file mode 100644 index 438ef3725..000000000 --- a/winsup/testsuite/winsup.api/ltp/rename10.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * rename10 - * - * DESCRIPTION - * This test will verify that rename(2) syscall fails with ENAMETOOLONG - * and ENOENT - * - * ALGORITHM - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * create the "old" file - * - * Test: - * Loop if the proper options are given. - * 1. rename the "old" to the "new" file - * verify rename() failed with error ENAMETOOLONG - * - * 2. "new" path contains a directory that does not exist - * rename the "old" to the "new" - * verify rename() failed with error ENOENT - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created.* - * - * USAGE - * rename10 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None. - */ -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -extern void do_file_setup(char *); - -const char *TCID="rename10"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char badmname[] = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyz"; - -int exp_enos[]={ENAMETOOLONG, ENOENT, 0}; /* List must end with 0 */ - -int fd; -char fname[255], mname[255]; -char mdir[255]; - -struct test_case_t { - char *fd1; - char *fd2; - int error; -} TC[] = { - /* badmname is too long for a file name - ENAMETOOLONG */ - {fname, badmname, ENAMETOOLONG}, - - /* mname contains a directory component which does not exist - ENOENT */ - {fname, mname, ENOENT} -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int i; - - /* - * parse standard options - */ - if ((msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* - * perform global setup for test - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* - * check looping state if -i option given - */ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* loop through the test cases */ - for (i=0; i < TST_TOTAL; i++) { - - TEST(rename(TC[i].fd1, TC[i].fd2)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "call succeeded unexpectedly"); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO == TC[i].error) { - tst_resm(TPASS, "expected failure - " - "errno = %d : %s", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "unexpected error - %d : %s - " - "expected %d", TEST_ERRNO, - strerror(TEST_ERRNO), TC[i].error); - } - } - } /* End for TEST_LOOPING */ - - /* - * cleanup and exit - */ - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Create a temporary directory and make it current. */ - tst_tmpdir(); - - sprintf(fname,"./tfile_%d",getpid()); - sprintf(mdir,"./rndir_%d",getpid()); - sprintf(mname,"%s/rnfile_%d",mdir,getpid()); - - do_file_setup(fname); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Remove the temporary directory. - */ - tst_rmdir(); - - /* - * Exit with return code appropriate for results. - */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/rmdir01.c b/winsup/testsuite/winsup.api/ltp/rmdir01.c deleted file mode 100644 index 1d41f1c13..000000000 --- a/winsup/testsuite/winsup.api/ltp/rmdir01.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * rmdir01 - * - * DESCRIPTION - * This test will verify that rmdir(2) syscall basic functionality. - * verify rmdir(2) returns a value of 0 and the directory being - * removed - * - * ALGORITHM - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * make a directory tstdir - * call rmdir(tstdir), check the return value - * verify the directory tstdir does not exists. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created.* - * USAGE - * rmdir01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None. - */ -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup() __attribute__((noreturn)); - -#define PERMS 0777 - -const char *TCID="rmdir01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char tstdir [100]; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct stat buf; - - /* - * parse standard options - */ - if ((msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* - * perform global setup for test - */ - setup(); - - /* - * check looping state if -i option given - */ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * TEST rmdir() base functionality - */ - - /* Initialize the test directory name */ - - /* create a directory */ - if ( mkdir(tstdir, PERMS) == -1 ) { - tst_brkm(TBROK, cleanup, "mkdir(%s, %#o) Failed", - tstdir, PERMS); - /*NOTREACHED*/ - } - /* call rmdir using TEST macro */ - - TEST(rmdir(tstdir)); - - if (TEST_RETURN == -1 ) { - tst_resm(TFAIL, "rmdir(%s) Failed", tstdir); - continue; - } - - if (STD_FUNCTIONAL_TEST) { - /* check whether tstdir been removed */ - if (stat(tstdir, &buf) != -1) { - tst_resm(TFAIL, "directory %s still exists", - tstdir); - continue; - } else { - tst_resm(TPASS, "directory has been removed"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - } /* End for TEST_LOOPING */ - - /* - * cleanup and exit - */ - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Create a temporary directory and make it current. */ - tst_tmpdir(); - - sprintf(tstdir,"./tstdir_%d",getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Remove the temporary directory. - */ - tst_rmdir(); - - /* - * Exit with return code appropriate for results. - */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/rmdir04.c b/winsup/testsuite/winsup.api/ltp/rmdir04.c deleted file mode 100644 index ece6a9ff4..000000000 --- a/winsup/testsuite/winsup.api/ltp/rmdir04.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : rmdir04 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for rmdir(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) rmdir(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the rmdir(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * rmdir(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="rmdir04"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -char *cwd; -char fname[255]; - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if (mkdir(fname, 0777) == -1) { - tst_brkm(TBROK, cleanup, - "mkdir(%s) Failure. errno=%d : %s", fname, errno, strerror(errno)); - } - /* - * Call rmdir(2) - */ - TEST(rmdir(fname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "rmdir(%s) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "rmdir(%s) returned %d", fname, TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname, "./dir_%d", getpid()); - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/rmdir05.c b/winsup/testsuite/winsup.api/ltp/rmdir05.c deleted file mode 100644 index ff19b3a81..000000000 --- a/winsup/testsuite/winsup.api/ltp/rmdir05.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : rmdir05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Functionality Tests for rmdir(2) - * - * PARENT DOCUMENT : rmstds02 - * - * TEST CASE TOTAL : 6 - * - * WALL CLOCK TIME : 2 - * - * CPU TYPES : ALL - * - * AUTHOR : Bill Branum - * - * CO-PILOT : Steve Shaw - * - * DATE STARTED : 4/23/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * rmdir(2) test for errno(s) EINVAL, EMLINK, EFAULT - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * DETAILED DESCRIPTION - * Verify that rmdir(2) returns a value of -1 and sets errno - * to indicate the error. - * - * Setup: - * Setup signal handling. - * Create a temporary directory and make it current. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno. - * If doing functional test - * check the errno returned and print result message - * - * Cleanup: - * Print errno log and/or timing stats if options given. - * Remove the temporary directory. - * Exit. - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -extern char *get_high_address(); - -const char *TCID="rmdir05"; /* Test program identifier. */ -int TST_TOTAL=6; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines. */ -struct stat stat_buf; /* Stat buffer used for verification. */ -char dir_name[256]; /* Array to hold directory name. */ - - -int -main(int argc, char **argv) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(argc, argv, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * TEST CASE: 1 - * path points to the current directory - */ - - /* Call rmdir(2) */ - TEST(rmdir(".")); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_RETURN == -1 ) { -#if defined(sgi) - if (TEST_ERRNO == EINVAL) { -#elif defined(linux) || defined (__CYGWIN__) - if (TEST_ERRNO & (EBUSY | ENOTEMPTY)) { -#endif - - /* For functionality tests, verify that the - * directory wasn't removed. - */ - if (stat(".",&stat_buf) == -1){ - tst_resm(TFAIL,"rmdir(\".\") removed the current working directory when it should have failed."); - } else { - tst_resm(TPASS,"rmdir(\".\") failed to remove the current working directory. Returned %d : %s",TEST_ERRNO,strerror(TEST_ERRNO)); - } - } else { -#if defined(sgi) - tst_resm(TFAIL,"rmdir(\".\") failed with errno %d : %s but expected %d (EINVAL)",TEST_ERRNO,strerror(TEST_ERRNO),EINVAL); -#elif defined(linux) || defined (__CYGWIN__) - tst_resm(TFAIL,"rmdir(\".\") failed with errno %d : %s but expected %d (EBUSY)",TEST_ERRNO,strerror(TEST_ERRNO),EBUSY); -#endif - } - } else { - tst_resm(TFAIL,"rmdir(\".\") succeeded unexpectedly."); - } - } - - - /* - * TEST CASE: 2 - * path points to the "." (dot) entry of a directory - */ -#if defined(linux) || defined (__CYGWIN__) - tst_resm(TCONF, "rmdir on \"dir/.\" supported on Linux"); -#elif defined(sgi) - /* Call rmdir(2) */ - TEST(rmdir("dir1/.")); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EINVAL) { - - /* For functionality tests, verify that the - * directory wasn't removed. - */ - if (stat("dir1/.",&stat_buf) == -1){ - tst_resm(TFAIL,"rmdir(\"dir1/.\") removed the \".\" entry of a directory when it should have failed."); - } else { - tst_resm(TPASS,"rmdir(\"dir1/.\") failed to remove the \".\" entry of a directory. Returned %d : %s",TEST_ERRNO,strerror(TEST_ERRNO)); - } - } else { - tst_resm(TFAIL,"rmdir(\"dir1/.\") failed with errno %d : %s but expected %d (EINVAL)",TEST_ERRNO,strerror(TEST_ERRNO),EINVAL); - } - } else { - tst_resm(TFAIL,"rmdir(\"dir1/.\") - path points to the \".\" entry of a directory succeeded unexpectedly."); - } - } -#endif - -#if defined(sgi) - /* - * TEST CASE: 3 - * the directory has been linked - */ - tst_resm(TCONF, "linked directories not valid on IRIX"); -#elif defined(linux) - tst_resm(TCONF, "linked directories test not implemented on Linux"); -#elif defined(CRAY) - - - /* Call rmdir(2) */ - TEST(rmdir("dir2")); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EMLINK) { - /* For functionality tests, verify that the directory wasn't - * removed. - */ - if (stat("dir2",&stat_buf) == -1){ - tst_resm(TFAIL,"rmdir(\"dir2\") removed a directory with multiple links when it should have failed."); - } else { - tst_resm(TPASS,"rmdir(\"dir2\") failed to remove a directory with multiple links. Returned %d : %s",TEST_ERRNO,strerror(TEST_ERRNO)); - } - } else { - tst_resm(TFAIL,"rmdir(\"dir2\") failed with errno %d : %s but expected %d (EMLINK)",TEST_ERRNO,strerror(TEST_ERRNO),EMLINK); - } - } else { - tst_resm(TFAIL,"rmdir(\"dir2\") - the directory has been linked succeeded unexpectedly."); - } - } -#endif /* linux */ - - - /* - * TEST CASE: 4 - * path argument points below the minimum allocated address space - */ - - - /* Call rmdir(2) */ - TEST(rmdir((char *)-1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS,"rmdir() - path argument points below the minimum allocated address space failed as expected with errno %d : %s",TEST_ERRNO,strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL,"rmdir() - path argument points below the minimum allocated address space failed with errno %d : %s but expected %d (EFAULT)",TEST_ERRNO,strerror(TEST_ERRNO),EFAULT); - } - } else { - tst_resm(TFAIL,"rmdir() - path argument points below the minimum allocated address space succeeded unexpectedly."); - } - } - - /* - * TEST CASE: 5 - * path argument points above the maximum allocated address space - */ - - - /* Call rmdir(2) */ - TEST(rmdir( get_high_address())); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS,"rmdir() - path argument points above the maximum allocated address space failed as expected with errno %d : %s",TEST_ERRNO,strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL,"rmdir() - path argument points above the maximum allocated address space failed with errno %d : %s but expected %d (EFAULT)",TEST_ERRNO,strerror(TEST_ERRNO),EFAULT); - } - } else { - tst_resm(TFAIL,"rmdir() - path argument points above the maximum allocated address space succeeded unexpectedly."); - } - } - - /* - * TEST CASE: 6 - * able to remove a directory - */ - - /* Create a directory. */ - if (mkdir(dir_name,0777) != 0){ - tst_brkm(TBROK,cleanup,"mkdir(\"%s\") failed with errno %d : %s",dir_name,errno,strerror(errno)); - } - - /* Call rmdir(2) */ - TEST(rmdir(dir_name)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL,"rmdir(\"%s\") failed when it should have passed. Returned %d : %s",dir_name,TEST_ERRNO,strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - /* Verify the directory was removed. */ - if (stat(dir_name,&stat_buf) != 0){ - tst_resm(TPASS,"rmdir(\"%s\") removed the directory as expected.",dir_name); - } else { - tst_resm(TFAIL,"rmdir(\"%s\") returned a zero exit status but failed to remove the directory.",dir_name); - } - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Create a temporary directory and make it current. */ - tst_tmpdir(); - - /* Create a directory. */ - if (mkdir("dir1",0777) == -1){ - tst_brkm(TBROK,cleanup,"mkdir() failed to create dir1."); - } - -#if defined(CRAY) - /* NOTE: linking directories is NOT valid on IRIX */ - - /* Create a directory that has multiple links to it. */ - if (mkdir("dir2",0777) == -1){ - tst_brkm(TBROK,cleanup,"mkdir() failed to create dir2."); - } else { - if (system("runcmd `get_attrib -A link` dir2 mlink_dir > link.out 2>&1") != 0){ - tst_brk(TBROK,"link.out",cleanup,"link failed to link dir2 and mlink_dir."); - } - } - -#endif - - /* Create a unique directory name. */ - sprintf(dir_name,"./dir_%d",getpid()); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - -#if defined(CRAY) - /* NOTE: setup was not done on IRIX */ - /* Unlink the directory. */ - if (system("runcmd `get_attrib -A unlink` dir2 > unlink.out 2>&1") != 0){ - tst_res(TWARN,"unlink.out","unlink failed to unlink dir2."); - } -#endif - - /* - * Remove the temporary directory. - */ - tst_rmdir(); - - /* - * Exit with a return value appropriate for the results. - */ - tst_exit(); - -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/sbrk01.c b/winsup/testsuite/winsup.api/ltp/sbrk01.c deleted file mode 100644 index 700fb6b17..000000000 --- a/winsup/testsuite/winsup.api/ltp/sbrk01.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : sbrk01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for sbrk(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/05/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) sbrk(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the sbrk(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * sbrk(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="sbrk01"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Increment; /* Amount to make change size by */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - long tret; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(0); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - -#ifdef __CYGWIN__ - /* we need to initialize output buffer before first sbrk. - otherwise, when memory is freed bu second sbrk, fwrite will - fail */ - tst_resm(TINFO, "Entering test"); -#endif - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Increase by 8192 bytes - */ - Increment = 8192; - - /* Call sbrk(2) */ -#if defined(sgi) - tret=(long)sbrk(Increment); /* Remove -64 IRIX compiler warning */ - TEST_ERRNO=errno; -#else - TEST(sbrk(Increment)); - tret=TEST_RETURN; -#endif - - /* check return code */ - if ( tret == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "sbrk - Increase by 8192 bytes failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "sbrk - Increase by 8192 bytes returned %d", - tret); - } - } - - - /* - * TEST CASE: - * Decrease to original size - */ - Increment=(Increment * -1); - - /* Call sbrk(2) */ -#ifdef CRAY - TEST(sbrk(Increment)); - tret=TEST_RETURN; -#else - tret=(long)sbrk(Increment); - TEST_ERRNO=errno; -#endif - - /* check return code */ - if ( tret == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "sbrk - Decrease to original size failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "sbrk - Decrease to original size returned %d", tret); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/select01.c b/winsup/testsuite/winsup.api/ltp/select01.c deleted file mode 100644 index 3b81f93db..000000000 --- a/winsup/testsuite/winsup.api/ltp/select01.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : select01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : select to a file - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 3 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 02/24/93 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) select(2) to a fd of regular file with no I/O and small timeout - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the select(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * join(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include /* For open system call parameters. */ -#include -#include -#include -#include - -#ifdef __CYGWIN__ -/* - FIXME: workaround for bug in newlib -- FD_ZERO is defined via bzero and - if we don't include strings.h compiler warns about implicit declaration -*/ -#include -#endif - -#include "test.h" -#include "usctest.h" - -#define FILENAME "select01" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="select01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Fd; -fd_set Readfds; - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct timeval timeout; - long test_time = 0; /* in usecs */ - - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Assigning the specified seconds within the timeval structure. - */ - test_time = ((lc%2000)*100000); /* 100 milli-seconds */ - - /* - * Bound the time to a value less than 60 seconds - */ - - if ( test_time > 1000000 * 60 ) - test_time = test_time % (1000000 * 60); - - timeout.tv_sec = test_time / 1000000; - timeout.tv_usec = test_time - (timeout.tv_sec * 1000000); - - - /* Call the system call being tested. */ - TEST(select(4, &Readfds, 0, 0, &timeout)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "%d select(4, &Readfds, 0, 0, &timeout), timeout = %ld usecs, errno=%d", - lc, test_time, errno); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* Perform functional verification here */ - tst_resm(TPASS, - "select(4, &Readfds, 0, 0, &timeout) timeout = %ld usecs", - test_time); - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - if ((Fd=open(FILENAME, O_CREAT | O_RDWR)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_CREAT | O_RDWR) failed: errno:%d\n", - errno); - } - - /* - * Initializing and assigning the standard output file descriptor to - * fd_set for select. - */ - - FD_ZERO(&Readfds); - FD_SET(Fd, &Readfds); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - close(Fd); - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/select02.c b/winsup/testsuite/winsup.api/ltp/select02.c deleted file mode 100644 index 935f4b273..000000000 --- a/winsup/testsuite/winsup.api/ltp/select02.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : select02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : select of system pipe fds - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : Glen Overby - * - * DATE STARTED : 02/24/93 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) select(2) to fd of system pipe with no I/O and small timeout - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the select(2) system call. It is intended - * to provide a limited exposure of the system call, for now. - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include /* For open system call parameters. */ -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="select02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Fd[2]; -fd_set saved_Readfds, saved_Writefds; -fd_set Readfds, Writefds; - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct timeval timeout; - long test_time = 0; /* in usecs */ - - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Assigning the specified seconds within the timeval structure. - */ - - test_time = ((lc%2000)*100000); /* 100 milli-seconds */ - - /* - * Bound the time to a value less than 60 seconds - */ - - if ( test_time > 1000000 * 60 ) - test_time = test_time % (1000000 * 60); - - timeout.tv_sec = test_time / 1000000; - timeout.tv_usec = test_time - (timeout.tv_sec * 1000000); - - Readfds = saved_Readfds; - Writefds = saved_Writefds; - - /* Call the system call being tested. */ - - TEST(select(5, &Readfds, &Writefds, 0, &timeout)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "%d select(5, &Readfds, &Writefds, 0, &timeout) failed, errno=%d\n", - lc, errno); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* Perform functional verification here */ - tst_resm(TPASS, - "select(5, &Readfds, &Writefds, 0, &timeout) timeout = %ld usecs", - test_time); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - if (pipe(Fd) == -1 ) { - tst_brkm(TBROK, cleanup, "pipe(&Fd) failed, errno=%d", errno); - } - - /* - * Initializing and assigning the standard output file descriptor to - * fd_set for select. - */ - - FD_ZERO(&saved_Readfds); - FD_ZERO(&saved_Writefds); - FD_SET(Fd[0], &saved_Readfds); - FD_SET(Fd[1], &saved_Writefds); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/select03.c b/winsup/testsuite/winsup.api/ltp/select03.c deleted file mode 100644 index 225ef19a7..000000000 --- a/winsup/testsuite/winsup.api/ltp/select03.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : select03 - * - * EXECUTED BY : anyone - * - * TEST TITLE : select of fd of a named-pipe (FIFO) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : Glen Overby - * - * DATE STARTED : 02/24/93 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) select(2) of fd of a named-pipe (FIFO) with no I/O and small timeout value - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the select(2) system call. It is intended - * to provide a limited exposure of the system call, for now. - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include /* For open system call parameters. */ -#include -#include -#include -#include -#include - - -#include "test.h" -#include "usctest.h" - -#define FILENAME "select03" - -extern void setup(); -extern void cleanup(); - -const char *TCID="select03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Fd; -fd_set saved_Readfds, saved_Writefds; -fd_set Readfds, Writefds; - - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct timeval timeout; - long test_time = 0; /* in usecs */ - - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Assigning the specified seconds within the timeval structure. - */ - - test_time = ((lc%2000)*100000); /* 100 milli-seconds */ - - /* - * Bound the time to a value less than 60 seconds - */ - - if ( test_time > 1000000 * 60 ) - test_time = test_time % (1000000 * 60); - - timeout.tv_sec = test_time / 1000000; - timeout.tv_usec = test_time - (timeout.tv_sec * 1000000); - - Readfds = saved_Readfds; - Writefds = saved_Writefds; - - /* Call the system call being tested. */ - - TEST(select(5, &Readfds, &Writefds, 0, &timeout)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "%d select(5, &Readfds, &Writefds, 0, &timeout) failed errno=%d\n", - lc, errno); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* Perform functional verification here */ - tst_resm(TPASS, - "select(5, &Readfds, &Writefds, 0, &timeout) timeout = %ld usecs", - test_time); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - - /* make and open FIFO */ - if ( mkfifo(FILENAME, 0777) == -1 ) { - tst_brkm(TBROK, cleanup, "mkfifo(%s, 0777) failed, errno=%d", - FILENAME, errno); - } - - if ((Fd=open(FILENAME, O_RDWR)) == -1 ) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR) failed, errno=%d", - FILENAME, errno); - } - - /* - * Initializing and assigning the standard output file descriptor to - * fd_set for select. - */ - - FD_ZERO(&saved_Readfds); - FD_ZERO(&saved_Writefds); - FD_SET(Fd, &saved_Readfds); - FD_SET(Fd, &saved_Writefds); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/setgid01.c b/winsup/testsuite/winsup.api/ltp/setgid01.c deleted file mode 100644 index a75e88a1d..000000000 --- a/winsup/testsuite/winsup.api/ltp/setgid01.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setgid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for setgid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setgid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setgid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setgid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="setgid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -int gid; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call setgid(2) - */ - TEST(setgid(gid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setgid(%d) Failed, errno=%d : %s", gid, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setgid(%d) returned %d", gid, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - gid = getgid(); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/setgroups01.c b/winsup/testsuite/winsup.api/ltp/setgroups01.c deleted file mode 100644 index ee1c54b63..000000000 --- a/winsup/testsuite/winsup.api/ltp/setgroups01.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setgroups01 - * - * EXECUTED BY : root - * - * TEST TITLE : Basic test for setgroups(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setgroups(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setgroups(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setgroups(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="setgroups01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int len = NGROUPS; -gid_t list[NGROUPS]; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call setgroups(2) - */ - TEST(setgroups(len, list)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setgroups(%d, list) Failed, errno=%d : %s", len, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setgroups(%d, list) returned %d", len, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - if ( geteuid() != 0 ) - tst_brkm(TBROK, cleanup, "Must be ROOT to run this test."); - - /* Pause if that option was specified */ - TEST_PAUSE; - - if (getgroups(len, list) == -1) { - tst_brkm(TBROK, cleanup, - "getgroups(%d, list) Failure. errno=%d : %s", - len, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/setpgid01.c b/winsup/testsuite/winsup.api/ltp/setpgid01.c deleted file mode 100644 index 0835c66a3..000000000 --- a/winsup/testsuite/winsup.api/ltp/setpgid01.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setpgid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for setpgid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setpgid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setpgid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setpgid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup() __attribute__ ((noreturn)); - -const char *TCID="setpgid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -int pgid, pid; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call setpgid(2) - */ - TEST(setpgid(pid, pgid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setpgid(%d, %d) Failed, errno=%d : %s", pid, pgid, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setpgid(%d, %d) returned %d", pid, pgid, TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int status; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* - * Make sure current process is NOT a session or pgrp leader - */ - - pgid=getpgrp(); - pid=getpid(); - - if (pgid == pid) { - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() in setup() failed - errno %d", - errno); - } - - if (pid != 0) { /* parent - sits and waits */ - wait(&status); - exit(WEXITSTATUS(status)); - } else { /* child - continues with test */ - pid = getpid(); - } - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/setregid01.c b/winsup/testsuite/winsup.api/ltp/setregid01.c deleted file mode 100644 index e4251f04e..000000000 --- a/winsup/testsuite/winsup.api/ltp/setregid01.c +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setregid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for setregid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 5 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 05/13/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setregid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setregid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setregid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="setregid01"; /* Test program identifier. */ -int TST_TOTAL=5; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int gid, egid; /* current real and effective group id */ - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Dont change either real or effective gid - */ - gid=getgid(); - egid=getegid(); - - - /* Call setregid(2) */ - TEST(setregid(-1, -1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setregid - Dont change either real or effective gid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setregid - Dont change either real or effective gid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change effective to effective gid - */ - - - /* Call setregid(2) */ - TEST(setregid(-1, egid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setregid - change effective to effective gid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setregid - change effective to effective gid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change real to real gid - */ - - - /* Call setregid(2) */ - TEST(setregid(gid, -1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setregid - change real to real gid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setregid - change real to real gid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change effective to real gid - */ - - - /* Call setregid(2) */ - TEST(setregid(-1, gid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setregid - change effective to real gid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setregid - change effective to real gid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * try to change real to current real - */ - - - /* Call setregid(2) */ - TEST(setregid(gid, gid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setregid - try to change real to current real failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setregid - try to change real to current real returned %d", TEST_RETURN); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/setreuid01.c b/winsup/testsuite/winsup.api/ltp/setreuid01.c deleted file mode 100644 index 05467c80f..000000000 --- a/winsup/testsuite/winsup.api/ltp/setreuid01.c +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setreuid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for setreuid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 5 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 05/14/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setreuid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setreuid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setreuid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="setreuid01"; /* Test program identifier. */ -int TST_TOTAL=5; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int ruid, euid; /* real and effective user ids */ - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Don't change either real or effective uid - */ - ruid=getuid(); /* get real uid */ - euid=geteuid(); /* get effective uid */ - - - /* Call setreuid(2) */ - TEST(setreuid(-1, -1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setreuid - Don't change either real or effective uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setreuid - Don't change either real or effective uid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change effective to effective uid - */ - - - /* Call setreuid(2) */ - TEST(setreuid(-1, euid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setreuid - change effective to effective uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setreuid - change effective to effective uid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change real to real uid - */ - - - /* Call setreuid(2) */ - TEST(setreuid(ruid, -1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setreuid - change real to real uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setreuid - change real to real uid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change effective to real uid - */ - - - /* Call setreuid(2) */ - TEST(setreuid(-1, ruid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setreuid - change effective to real uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setreuid - change effective to real uid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * try to change real to current real - */ - - - /* Call setreuid(2) */ - TEST(setreuid(ruid, ruid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setreuid - try to change real to current real failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setreuid - try to change real to current real returned %d", TEST_RETURN); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/setuid01.c b/winsup/testsuite/winsup.api/ltp/setuid01.c deleted file mode 100644 index 37e18fd51..000000000 --- a/winsup/testsuite/winsup.api/ltp/setuid01.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setuid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for setuid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 05/14/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setuid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setuid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setuid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="setuid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int uid; /* current user id */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * TEST CASE: - * Set the effective user ID to the current real uid - */ - uid=getuid(); - - /* Call setuid(2) */ - TEST(setuid(uid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setuid - Set the effective user ID to the current real uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setuid - Set the effective user ID to the current real uid returned %d", TEST_RETURN); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/setuid02.c b/winsup/testsuite/winsup.api/ltp/setuid02.c deleted file mode 100644 index ee55ae19b..000000000 --- a/winsup/testsuite/winsup.api/ltp/setuid02.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setuid02 - * - * EXECUTED BY : root - * - * TEST TITLE : Basic test for setuid(2) as root - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 05/14/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setuid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setuid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setuid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="setuid02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int uid; /* current user id */ - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - uid=getuid(); - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Set the effective user ID to the current real uid - */ - - /* Call setuid(2) */ - TEST(setuid(uid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setuid - Set the effective user ID to the current real uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setuid - Set the effective user ID to the current real uid returned %d", TEST_RETURN); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* must be root */ - if ( geteuid() != 0 ) - tst_brkm(TBROK, cleanup, "Must be root for this test!"); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/signal03.c b/winsup/testsuite/winsup.api/ltp/signal03.c deleted file mode 100644 index 2a0923ca2..000000000 --- a/winsup/testsuite/winsup.api/ltp/signal03.c +++ /dev/null @@ -1,663 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/*********************************************************************************** - * - * OS Test - Silicon Graphics, Inc. Eagan, Minnesota - * - * TEST IDENTIFIER : signal03 Boundary value and other invalid value checking - * of signal setup and signal sending. - * - * PARENT DOCUMENT : sgntds01 Signal System Call - * - * AUTHOR : Dave Baumgartner - * : Rewrote 12/92 by Richard Logan - * - * CO-PILOT : Barrie Kletscher - * - * DATE STARTED : 10/17/85 - * - * TEST ITEMS - * - * 1. SIGKILL can not be set to be caught, errno:EINVAL (POSIX). - * 2. SIGKILL can not be caught. - * 3. SIGKILL can not be set to be ignored, errno:EINVAL (POSIX). - * 4. SIGKILL can not be ignored. - * 5. SIGKILL can not be reset to default, errno:EINVAL (POSIX. - * - * ENVIRONMENTAL NEEDS - * - * NONE - * - * SPECIAL PROCEDURAL REQUIREMENTS - * - * None - * - * INTERCASE DEPENDENCIES - * - * 2 depends on 1 and 4 on 3. - * - * DETAILED DESCRIPTION - * - * main() - * Call catch_test to test setup and catching of SIGKILL. - * - * - * Call ignore_test to test setup and ignoring of SIGKILL. - * - * - * Call sigdfl_test to test setting SIGKILL to default. - * - * * END OF MAIN * - * - * - * catch_test() - * - * fork a child - * if this is the parent - * sleep to let child start. - * send sig to child. - * wait for the child to terminate. - * - * if the termination status of the child equals the signal sent to it - * Test item 1 PASSED the child was killed. - * else if status equals the exit value of SIG_CAUGHT - * Test item 2 FAILED sig was caught. - * else - * Test item 2 FAILED because the child was not killed - * but sig was not caught either. - * - * else this the child - * set exit_val to SIG_NOT_CAUGHT. - * set to catch sig, where the interrupt routine just sets - * exit_val to SIG_CAUGHT. - * - * If the return value and errno, after trying to set to catch sig, - * do not indicate that an error has occurred. - * Test item 1 FAILED bad return, return value:X, errno:X. - * else - * Test item 1 PASSED sig was not set to be caught. - * - * pause until the parent sends a signal. - * The child should be killed by the signal but if not exit - * with exit_val. - * - * * End of catch_test. * - * - * - * ignore_test() - * - * fork a child - * if this is the parent - * sleep to let child start. - * send SIGKILL to child. - * wait for the child to terminate. - * - * if the termination status of the child equals SIGKILL - * Test item 4 PASSED the child was killed. - * else if the status equals the exit value of SIG_IGNORED - * Test item 4 FAILED SIGKILL was ignored. - * - * else this the child - * - * If the return value and errno, after trying to set to ignore SIGKILL, - * do not indicate that an error has occurred. - * Test item 3 FAILED bad return, return value:X, errno:X. - * else - * Test item 3 PASSED SIGKILL was not set to be ignored. - * - * pause until the parent sends SIGKILL. - * The child should be killed by the signal but if not exit - * with SIG_IGNORED. - * - * * End of ignore_test. * - * - * - * sigdfl_test() - * - * If the return value and errno, after trying to set to SIGKILL to default, - * do not indicate that an error has occurred. - * Test item 5 FAILED bad return, return value:X, errno:X. - * else - * Test item 5 PASSED SIGKILL was not set to default. - * - * * End of sigdfl_test. * - * - * BUGS/NOTES - * Since the system call under test is executed in the child, no - * timings on this system call will be reported. - * -***********************************************************************************/ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void do_test(); -void sigdfl_test(); -void update_timings(); - -#if defined(linux) -# define SIG_PF sig_t /* This might need to be sighandler_t on some systems */ -#elif defined(__CYGWIN__) -typedef void (*sighandler_t) (int); -#define SIG_PF sighandler_t -#endif - -#define SIG_CAUGHT 1 -#define SIG_NOT_CAUGHT 0 -#define SIG_IGNORED 5 -#define TIMED_OUT 99 - -#define TIMEOUT 20 - -#define GO_FLAG 1 -#define ERROR_FLAG 2 -#define PASS_FLAG 3 -#define FAIL_FLAG 4 - -#define IGNORE_TEST 1 -#define CATCH_TEST 2 - -#define MAXMESG 150 /* The Maximum message that can be created. */ - -int exit_val; /* Global variable, used to tell whether the */ - /* child exited instead of being killed. */ -extern int errno; /* errno holds the error value returned by */ - /* a system call. */ -char mesg[MAXMESG]; /* Holds messages to pass to tst_res. */ - -struct ipc_t { - int status; - char mesg[MAXMESG]; - struct tblock timings; -} Ipc_info; - -const char *TCID = "signal03"; -int TST_TOTAL = 5; -extern int Tst_count; /* count of test items completed */ - -int Pid; /* Return value from fork. */ - -long Tret; - -/*********************************************************************** - * M A I N - ***********************************************************************/ -int -main(argc, argv) -int argc; -char **argv; -{ - int lc; - const char *msg; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(argc, argv, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - errno=-4; - - /* - * Call catch_test to test setup and catching of SIGKILL. - */ - (void) do_test(CATCH_TEST, Tst_count); - - /* - * Call ignore_test to test setup and ignoring of SIGKILL. - */ - (void) do_test(IGNORE_TEST, Tst_count); - - /* - * Call sigdfl_test to test setting SIGKILL to default. - */ - (void) sigdfl_test(); - - } - - cleanup(); - - return 0; -} /*End of main*/ - -/*********************************************************************** - * - ***********************************************************************/ -void -do_test(test_case, tst_count) -int test_case; -int tst_count; -{ - int term_stat; /* Termination status of the child returned to */ - /* the parent. */ - char string[30]; - int fd1[2]; /* ipc */ - int rd_sz; /* size of read */ - void p_timeout_handler(); - void c_timeout_handler(); - void catchsig(); - - Tst_count = tst_count; - - /* - * Create a pipe of ipc - */ - if ( pipe(fd1) == -1 ) { - sprintf(mesg, - "pipe system call failed, Errno: %d, Error message: %s", - errno,strerror(errno)); - tst_resm(TBROK,mesg); - tst_resm(TBROK,mesg); - return; - } - - /* - * Cause the read to return 0 once EOF is encountered and the - * read to return -1 if pipe is empty. - */ - - if ( fcntl(fd1[0], F_SETFL, O_NONBLOCK) == -1 ) { - sprintf(mesg, "fcntl(fd1[0], F_SETFL, O_NONBLOCK) failed: errno=%d", - errno); - tst_resm(TBROK,mesg); - tst_resm(TBROK,mesg); - close(fd1[0]); - close(fd1[1]); - return; - } - - if ((Pid = fork()) > 0) { /* parent */ - - signal(SIGALRM, p_timeout_handler); - - alarm(TIMEOUT); - - close(fd1[1]); /* close write side */ - - /* - * Deal with child's messages. - * Only the GO_FLAG status will allow parent to - * go on. All pipe io will be in the ipc_t structure sizes - * to avoid reading part of next message. - */ - while ( 1 ) { - - while ( (rd_sz=read(fd1[0], (char *)&Ipc_info, sizeof(Ipc_info))) != 0 ) { - if ( rd_sz > 0 ) - break; /* read something */ - } - - if ( rd_sz == 0 ) { /* if EOF encountered */ - sprintf(mesg, "child's pipe is closed before 'go' message received"); - tst_resm(TBROK, Ipc_info.mesg); - tst_resm(TBROK, Ipc_info.mesg); - close(fd1[0]); - return; - } - - else if ( Ipc_info.status == GO_FLAG ) { - break; /* go on */ - } - else if ( Ipc_info.status == ERROR_FLAG ) { - tst_resm(TBROK, "From child: %s", Ipc_info.mesg); - tst_resm(TBROK, "From child: %s", Ipc_info.mesg); - close(fd1[0]); - return; - } - else if ( Ipc_info.status == PASS_FLAG ) { - - if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, "From child: %s", Ipc_info.mesg); - else - Tst_count++; - update_timings(Ipc_info.timings); - } - else if ( Ipc_info.status == FAIL_FLAG ) { - tst_resm(TFAIL, "From child: %s", Ipc_info.mesg); - update_timings(Ipc_info.timings); - } - else { - tst_resm(TINFO, "Unknown message from child: %s", mesg); - } - } - - /* - * Send the signal SIGKILL to the child. - */ - if (kill(Pid,SIGKILL) == -1) - { - /* - * The kill system call failed. - */ - sprintf(mesg, - "kill(Pid,SIGKILL) failed, Errno: %d, Error message: %s", - errno,strerror(errno)); - tst_resm(TBROK,mesg); - tst_resm(TBROK,mesg); - close(fd1[0]); - return; - } - - /* - * Wait for the child to terminate and check the termination status. - */ - if (wait(&term_stat) == -1) { - /* - * The wait system call failed. - */ - sprintf(mesg, - "Wait system call failed. Errno: %d, Error message: %s", - errno,strerror(errno)); - tst_resm(TBROK,mesg); - tst_resm(TBROK,mesg); - close(fd1[0]); - return; - } - else if ( STD_FUNCTIONAL_TEST ) { - if ((term_stat & 0377) == SIGKILL) { - /* - * The child was killed by the signal sent, - * which is correct. - */ - tst_resm(TPASS,"The child was killed by SIGKILL."); - } - else if ( (term_stat >> 8) == TIMED_OUT ) { - sprintf(mesg, "child exited with a timed out exit status"); - tst_resm(TBROK,mesg); - } - else { - if ((term_stat >> 8) == SIG_IGNORED && test_case == IGNORE_TEST ) { - sprintf(mesg, - "SIGKILL was ignored by child after sent by parent."); - } - else if ((term_stat >> 8) == SIG_CAUGHT && test_case == CATCH_TEST ) { - sprintf(mesg, - "SIGKILL was caught by child after sent by parent."); - } - else { - sprintf(mesg, - "Child's termination status is unexpected. Status: %d (%#o).", - term_stat, term_stat); - } - tst_resm(TFAIL, mesg); - } - } - else { - Tst_count++; /* increment test counter */ - } - close(fd1[0]); - - } /* End of parent. */ - else if (Pid == 0) { - /* - * This is the child. - * Set up to ignore/catch SIGKILL and check the return values. - */ - errno=0; - if ( test_case == IGNORE_TEST ) { - exit_val = SIG_IGNORED; - strcpy(string, "signal(SIGKILL, SIG_IGN)"); - - Tret=(long)signal(SIGKILL, SIG_IGN); - TEST_ERRNO=errno; - } - else { - exit_val = SIG_NOT_CAUGHT; - strcpy(string, "signal(SIGKILL, catchsig)"); - Tret=(long)signal(SIGKILL, catchsig); - TEST_ERRNO=errno; - } - Ipc_info.timings=tblock; - - if ( (SIG_PF)Tret == SIG_ERR ) { - if ( TEST_ERRNO == EINVAL ) { - sprintf(Ipc_info.mesg, "%s ret:%ld SIG_ERR (%ld) as expected", - string, Tret, (long)SIG_ERR); - Ipc_info.status = PASS_FLAG; - } - else { - sprintf(Ipc_info.mesg, - "%s ret:%ld, errno:%d expected ret:%ld, errno:%d", - string, Tret, TEST_ERRNO, (long)SIG_ERR, EINVAL); - Ipc_info.status = FAIL_FLAG; - } - - write(fd1[1], (char *)&Ipc_info, sizeof(Ipc_info)); - } - else { - /* - * The child was not allowed to set the signal to - * be ignored and errno was correct. - */ - sprintf(Ipc_info.mesg, - "%s ret:%ld, errno:%d expected ret:%ld, errno:%d", - string, Tret, TEST_ERRNO, (long)SIG_ERR, EINVAL); - Ipc_info.status = FAIL_FLAG; - write(fd1[1], (char *)&Ipc_info, sizeof(Ipc_info)); - } - - /* - * tell parent we are ready - setup by child is done - */ - Ipc_info.status = GO_FLAG; - write(fd1[1], (char *)&Ipc_info, sizeof(Ipc_info)); - - /* - * Set the alarm to wake up from the pause below if - * the parents signal is ignored. - */ - signal(SIGALRM, p_timeout_handler); - alarm(TIMEOUT); - - /* - * Pause until the parent sends a signal or until alarm is received. - */ - pause(); - - exit(exit_val); - - - } /* End of child. */ - else { - /* - * The fork system call failed. - */ - sprintf(mesg, - "Fork system call failed. Errno: %d, Error message: %s", - errno,strerror(errno)); - tst_resm(TBROK,mesg); - tst_resm(TBROK,mesg); - close(fd1[0]); - close(fd1[1]); - return; - } - -} /* End of do_test. */ - -/*********************************************************************** - * sigdfl_test - test for attempt to set SIGKILL to default - ***********************************************************************/ -void -sigdfl_test() -{ - /* - * Try to set SIGKILL to default and check the return values. - */ - errno=-4; - - Tret=(long)signal(SIGKILL,SIG_DFL); - TEST_RETURN=Tret; - TEST_ERRNO=errno; - - - if ( (SIG_PF)TEST_RETURN == SIG_ERR ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO != EINVAL ) { - sprintf(mesg, - "signal(SIGKILL,SIG_DFL) ret:%d, errno:%d expected ret:-1, errno:%d", - TEST_RETURN, TEST_ERRNO, EINVAL); - tst_resm(TFAIL, mesg); - } - else { - sprintf(mesg, - "signal(SIGKILL,SIG_DFL) ret:%d, errno:%d as expected.", - TEST_RETURN, TEST_ERRNO); - tst_resm(TPASS, mesg); - } - } - else - Tst_count++; - } - else { - sprintf(mesg, - "signal(SIGKILL,SIG_DFL) ret:%d, errno:%d expected ret:-1, errno:%d", - TEST_RETURN, TEST_ERRNO, EINVAL); - tst_resm(TFAIL, mesg); - } - -} /* End of sigdfl_test. */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make and change to a temporary directory */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - - TEST_CLEANUP; - - /* - * remove the temporary directory and exit with - * return code appropriate for results - */ - - tst_rmdir(); - - tst_exit(); - -} /* End cleanup() */ - -/*********************************************************************** - * Signal handler routine that used by the parent to handler - * a time out situation. It will attempt to kill the child and - * call cleanup. - ***********************************************************************/ -void -p_timeout_handler() -{ - kill(Pid, SIGKILL); - cleanup(); -} - -/*********************************************************************** - * Signal handler routine that used by the child to handle - * a time out situation. It will set a global varaible and return - * if called. - ***********************************************************************/ -void -c_timeout_handler() -{ - exit_val = TIMED_OUT; - return; -} - -/*********************************************************************** - * This signal handling routine will set a global variable and return - * if called. - ***********************************************************************/ -void -catchsig() -{ - exit_val = SIG_CAUGHT; - return; -} - -/*********************************************************************** - * Update timing information - ***********************************************************************/ -void -update_timings(atblock) -struct tblock atblock; -{ - tblock.tb_max += atblock.tb_max; - tblock.tb_min += atblock.tb_min; - tblock.tb_total += atblock.tb_total; - tblock.tb_count += atblock.tb_count; -} diff --git a/winsup/testsuite/winsup.api/ltp/stat01.c b/winsup/testsuite/winsup.api/ltp/stat01.c deleted file mode 100644 index da3596e17..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat01.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: stat01 - * - * Test Description: - * Verify that, stat(2) succeeds to get the status of a file and fills the - * stat structure elements. - * - * Expected Result: - * stat() should return value 0 on success and fills the stat structure - * elements with the specified 'file' information. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * stat01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * - */ -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE 0644 -#define TESTFILE "testfile" -#define FILE_SIZE 1024 -#define BUF_SIZE 256 -#define MASK 0777 - -const char *TCID="stat01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; -uid_t User_id; /* Owner id of the test file */ -gid_t Group_id; /* Group id of the test file */ -char nobody_uid[] = "nobody"; -struct passwd *ltpuser; - -void setup(); /* Setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - /*NOTREACHED*/ - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call stat(2) to get the status of - * specified 'file' into stat structure. - */ - TEST(stat(TESTFILE, &stat_buf)); - - /* check return code of stat(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, \ - "stat(%s, &stat_buf) Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - stat_buf.st_mode &= ~S_IFREG; - /* - * Verify the data returned by stat(2) - * aganist the expected data. - */ - if ((stat_buf.st_uid != User_id) || \ - (stat_buf.st_gid != Group_id) || \ - (stat_buf.st_size != FILE_SIZE) || \ - ((stat_buf.st_mode & MASK) != FILE_MODE)) { - tst_resm(TFAIL, "Functionality of " - "stat(2) on '%s' Failed", - TESTFILE); - } else { - tst_resm(TPASS, "Functionality of " - "stat(2) on '%s' Succcessful", - TESTFILE); - } - } else { - tst_resm(TINFO, "Call succeeded"); - } - } - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - Performs setup function for the test. - * Creat a temporary directory and change directory to it. - * Creat a testfile and write some known data into it. - * Get the effective uid/gid of test process. - */ -void -setup() -{ - int i, fd; - char tst_buff[BUF_SIZE]; - int wbytes; - int write_len = 0; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); -#if 0 - /* Switch to nobody user for correct error code collection */ - if (geteuid() != 0) { - tst_brkm(TBROK, tst_exit, "Test must be run as root"); - } - ltpuser = getpwnam(nobody_uid); - if (setuid(ltpuser->pw_uid) == -1) { - tst_resm(TINFO, "setuid failed to " - "to set the effective uid to %d", - ltpuser->pw_uid); - perror("setuid"); - } -#endif - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fd, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } else { - write_len += wbytes; - } - } - - /* Close the testfile created */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Get the uid/gid of the process */ - User_id = getuid(); - Group_id = getgid(); - -} /* End setup() */ - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test file and temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/stat02.c b/winsup/testsuite/winsup.api/ltp/stat02.c deleted file mode 100644 index 745476fa0..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat02.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: stat02 - * - * Test Description: - * Verify that, stat(2) succeeds to get the status of a file and fills the - * stat structure elements though process doesn't have read access to the - * file. - * - * Expected Result: - * stat() should return value 0 on success and the stat structure elements - * should be filled with specified 'file' information. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * stat02 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * - */ -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define TESTFILE "testfile" -#define FILE_SIZE 1024 -#define BUF_SIZE 256 -#define NEW_MODE 0222 -#define MASK 0777 - -const char *TCID="stat02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; -uid_t User_id; /* eff. user id/group id of test process */ -gid_t Group_id; -char nobody_uid[] = "nobody"; -struct passwd *ltpuser; - -void setup(); /* Setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call stat(2) to get the status of - * specified 'file' into stat structure. - */ - TEST(stat(TESTFILE, &stat_buf)); - - /* check return code of stat(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "stat(%s, &stat_buf) Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - stat_buf.st_mode &= ~S_IFREG; - /* - * Verify the data returned by stat(2) - * aganist the expected data. - */ - if ((stat_buf.st_uid != User_id) || \ - (stat_buf.st_gid != Group_id) || \ - (stat_buf.st_size != FILE_SIZE) || \ - ((stat_buf.st_mode & MASK) != NEW_MODE)) { - tst_resm(TFAIL, "Functionality of " - "stat(2) on '%s' Failed", - TESTFILE); - } else { - tst_resm(TPASS, "Functionality of " - "stat(2) on '%s' Succcessful", - TESTFILE); - } - } else { - tst_resm(TPASS, "Call succeeded"); - } - } - Tst_count++; /* incr TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - Performs setup function for the test. - * Creat a temporary directory and change directory to it. - * Creat a testfile and write some data into it. - * Modify the mode permissions of testfile such that test process - * has read-only access to testfile. - */ -void -setup() -{ - int i, fd; /* counter, file handle for file */ - char tst_buff[BUF_SIZE]; /* data buffer for file */ - int wbytes; /* no. of bytes written to file */ - int write_len = 0; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); -#if 0 - /* Switch to nobody user for correct error code collection */ - if (geteuid() != 0) { - tst_brkm(TBROK, tst_exit, "Test must be run as root"); - } - ltpuser = getpwnam(nobody_uid); - if (setuid(ltpuser->pw_uid) == -1) { - tst_resm(TINFO, "setuid failed to " - "to set the effective uid to %d", - ltpuser->pw_uid); - perror("setuid"); - } -#endif - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fd, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } else { - write_len += wbytes; - } - } - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Modify mode permissions on the testfile */ - if (chmod(TESTFILE, NEW_MODE) < 0) { - tst_brkm(TBROK, cleanup, - "chmod(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Get the uid/gid of the process */ - User_id = getuid(); - Group_id = getgid(); - -} /* End setup() */ - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory and file created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/stat03.c b/winsup/testsuite/winsup.api/ltp/stat03.c deleted file mode 100644 index dcddfd2a0..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat03.c +++ /dev/null @@ -1,391 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: stat03 - * - * Test Description: - * Verify that, - * 1) stat(2) returns -1 and sets errno to EACCES if search permission is - * denied on a component of the path prefix. - * 2) stat(2) returns -1 and sets errno to ENOENT if the specified file - * does not exists or empty string. - * 3) stat(2) returns -1 and sets errno to EFAULT if pathname points - * outside user's accessible address space. - * 4) stat(2) returns -1 and sets errno to ENAMETOOLONG if the pathname - * component is too long. - * 5) stat(2) returns -1 and sets errno to ENOTDIR if the directory - * component in pathname is not a directory. - * - * Expected Result: - * stat() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * stat03 [-c n] [-e] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define MODE_RWX S_IRWXU | S_IRWXG | S_IRWXO -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define DIR_TEMP "testdir_1" -#define TEST_FILE1 "testdir_1/tfile_1" -#define TEST_FILE2 "t_file/tfile_2" - -int no_setup(); -int setup1(); /* setup function to test chmod for EACCES */ -int setup2(); /* setup function to test chmod for ENOTDIR */ -int longpath_setup(); /* setup function to test chmod for ENAMETOOLONG */ -char nobody_uid[] = "nobody"; -struct passwd *ltpuser; - - -char Longpathname[PATH_MAX+2]; -char High_address_node[64]; - -struct test_case_t { /* test case struct. to hold ref. test cond's*/ - const char *pathname; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { -#ifndef __CYGWIN__ - { TEST_FILE1, "No Search permissions to process", EACCES, setup1 }, -#endif - { High_address_node, "Address beyond address space", EFAULT, no_setup }, - { (char *)-1, "Negative address", EFAULT, no_setup }, - { Longpathname, "Pathname too long", ENAMETOOLONG, longpath_setup }, - { "", "Pathname is empty", ENOENT, no_setup }, -#ifndef __CYGWIN__ - { TEST_FILE2, "Path contains regular file", ENOTDIR, setup2 }, -#endif - { NULL, NULL, 0, no_setup } -}; - -const char *TCID="stat03"; /* Test program identifier. */ -int TST_TOTAL = 6; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EACCES, EFAULT, ENAMETOOLONG, ENOENT, ENOTDIR, 0}; - -void setup(); /* Main setup function for the tests */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ -char *get_high_address(void); - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *file_name; /* ptr. for file name whose mode is modified*/ - const char *test_desc; /* test specific error message */ - int ind; /* counter to test different test conditions */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - /*NOTREACHED*/ - } - - /* - * Invoke setup function to call individual test setup functions - * to simulate test conditions. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - file_name = Test_cases[ind].pathname; - test_desc = Test_cases[ind].desc; - - if (file_name == High_address_node) { - file_name = (char *)get_high_address(); - } - - /* - * Call stat(2) to test different test conditions. - * verify that it fails with -1 return value and - * sets appropriate errno. - */ - TEST(stat(file_name, &stat_buf)); - - /* Check return code from stat(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == Test_cases[ind].exp_errno) { - tst_resm(TPASS, - "stat() fails, %s, errno:%d", - test_desc, TEST_ERRNO); - } else { - tst_resm(TFAIL, "stat() fails, %s," - " errno:%d, expected errno:%d", - test_desc, TEST_ERRNO, - Test_cases[ind].exp_errno); - } - } else { - tst_resm(TFAIL, "stat(2) returned %d," - " expected -1, errno:%d", TEST_RETURN, - Test_cases[ind].exp_errno); - } - } /* End of TEST CASE LOOPING. */ - Tst_count++; /* incr TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* - * Invoke cleanup() to delete the test directory/file(s) created - * in the setup(). - */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup(void) - performs all ONE TIME setup for this test. - * Exit the test program on receipt of unexpected signals. - * Create a temporary directory and change directory to it. - * Invoke individual test setup functions according to the order - * set in struct. definition. - */ -void -setup() -{ - int ind; /* counter for setup functions */ - - /* Capture unexpected signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); -#if 0 - /* Switch to nobody user for correct error code collection */ - if (geteuid() != 0) { - tst_brkm(TBROK, tst_exit, "Test must be run as root"); - } - ltpuser = getpwnam(nobody_uid); - if (setuid(ltpuser->pw_uid) == -1) { - tst_resm(TINFO, "setuid failed to " - "to set the effective uid to %d", - ltpuser->pw_uid); - perror("setuid"); - } -#endif - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* Make a temp dir and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - Test_cases[ind].setupfunc(); - } -} /* End setup() */ - -/* - * int - * no_setup() - Some test conditions for stat(2) do not any setup. - * Hence, this function just returns 0. - * This function simply returns 0. - */ -int -no_setup() -{ - return 0; -} - - -/* - * int - * setup1() - setup function for a test condition for which stat(2) - * returns -1 and sets errno to EACCES. - * Create a test directory under temporary directory and create a test file - * under this directory with mode "0666" permissions. - * Modify the mode permissions on test directory such that process will not - * have search permissions on test directory. - * - * The function returns 0. - */ -int -setup1() -{ - int fd; /* file handle for testfile */ - - /* Creat a test directory */ - if (mkdir(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TBROK, cleanup, "mkdir(2) of %s failed", DIR_TEMP); - /*NOTREACHED*/ - } - - /* Creat a test file under above test directory */ - if ((fd = open(TEST_FILE1, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - /*NOTREACHED*/ - } - /* Close the test file */ - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Modify mode permissions on test directory */ - if (chmod(DIR_TEMP, FILE_MODE) < 0) { - tst_brkm(TBROK, cleanup, "chmod(2) of %s failed", DIR_TEMP); - /*NOTREACHED*/ - } - return 0; -} - -/* - * int - * setup2() - setup function for a test condition for which stat(2) - * returns -1 and sets errno to ENOTDIR. - * - * Create a test file under temporary directory so that test tries to - * change mode of a testfile "tfile_2" under "t_file" which happens to be - * another regular file. - */ -int -setup2() -{ - int fd; /* File handle for test file */ - - /* Creat a test file under temporary directory */ - if ((fd = open("t_file", O_RDWR|O_CREAT, MODE_RWX)) == -1) { - tst_brkm(TBROK, cleanup, - "open(2) on t_file failed, errno=%d : %s", - errno, strerror(errno)); - /*NOTREACHED*/ - } - /* Close the test file created above */ - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(t_file) Failed, errno=%d : %s", - errno, strerror(errno)); - /*NOTREACHED*/ - } - return 0; -} - -/* - * int - * longpath_setup() - setup to create a node with a name length exceeding - * the MAX. length of PATH_MAX. - * This function retruns 0. - */ -int -longpath_setup() -{ - int ind; /* counter variable */ - - for (ind = 0; ind <= (PATH_MAX + 1); ind++) { - Longpathname[ind] = 'a'; - } - return 0; -} - -/* - * void - * cleanup() - Performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Print test timing stats and errno log if test executed with options. - * Remove temporary directory and sub-directories/files under it - * created during setup(). - * Exit the test program with normal exit code. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - -#ifndef __CYGWIN__ - /* Restore mode permissions on test directory created in setup2() */ - if (chmod(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TFAIL, NULL, "chmod(2) of %s failed", DIR_TEMP); - } -#endif - - /* Remove files and temporary directory created */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/stat05.c b/winsup/testsuite/winsup.api/ltp/stat05.c deleted file mode 100644 index 5c0964a93..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat05.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : stat05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for stat(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) stat(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the stat(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * stat(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="stat05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -struct stat statter; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call stat(2) with F_CLRALF argument on fname - */ - TEST(stat(fname, &statter)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "stat(%s, &statter) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "stat(%s, &statter) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/stat06.c b/winsup/testsuite/winsup.api/ltp/stat06.c deleted file mode 100644 index c5fae6fe5..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat06.c +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : stat06 - * - * EXECUTED BY : anyone - * - * TEST TITLE : stat(2) negative path testcases - * - * PARENT DOCUMENT : None - * - * TEST CASE TOTAL : 7 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/30/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1-7) See Testcases structure below. - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * -h : print help and exit - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the stat(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * stat(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="stat06"; /* Test program identifier. */ -int TST_TOTAL=8; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -extern char *get_high_address(); - -int exp_enos[]={0, 0}; - -int high_address_setup(); -int longpath_setup(); -int no_setup(); -int filepath_setup(); -char Longpathname[PATH_MAX+2]; -char High_address[64]; -struct stat statbuf; -jmp_buf sig11_recover; -void sig11_handler(int sig); - -struct test_case_t { - const char *pathname; - struct stat *stbuf; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { - { "nonexistfile", &statbuf, "non-existent file", ENOENT, no_setup}, - { "", &statbuf, "path is empty string", ENOENT, no_setup}, - { "nefile/file", &statbuf, "path contains a non-existent file", - ENOENT, no_setup }, -#ifndef __CYGWIN__ - { "file/file", &statbuf, "path contains a regular file", - ENOTDIR, filepath_setup }, -#endif - { Longpathname, &statbuf, "pathname too long", ENAMETOOLONG, longpath_setup }, - { High_address, &statbuf, "address beyond address space", EFAULT, high_address_setup }, - { (char *)-1, &statbuf, "negative address", EFAULT, no_setup }, - { "file", (struct stat *)-1, "invalid struct stat address", EFAULT, filepath_setup }, - { NULL, NULL, NULL, 0, no_setup } -}; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *fname; - const char *desc; - int ind; - struct stat *stbuf; - struct sigaction sa, osa; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - - fname = Test_cases[ind].pathname; - desc = Test_cases[ind].desc; - stbuf = Test_cases[ind].stbuf; - - if (stbuf == (struct stat *)-1) { - /* special sig11 case */ - sa.sa_handler = &sig11_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - - sigaction(SIGSEGV, NULL, &osa); - sigaction(SIGSEGV, &sa, NULL); - - if (setjmp(sig11_recover)) { - TEST_RETURN = -1; - TEST_ERRNO = EFAULT; - } else { - TEST(stat(fname, stbuf)); - } - sigaction(SIGSEGV, &osa, NULL); - } else { - /* - * Call stat(2) - */ - - TEST(stat(fname, stbuf)); - } - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == Test_cases[ind].exp_errno ) - tst_resm(TPASS, "stat(<%s>, &stbuf) Failed, errno=%d", - desc, TEST_ERRNO); - else - tst_resm(TFAIL, - "stat(<%s>, &stbuf) Failed, errno=%d, expected errno:%d", - desc, TEST_ERRNO, Test_cases[ind].exp_errno); - } - else - Tst_count++; - } else { - tst_resm(TFAIL, - "stat(<%s>, &stbuf) returned %d, expected -1, errno:%d", - desc, TEST_RETURN, Test_cases[ind].exp_errno); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int ind; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - Test_cases[ind].setupfunc(); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - -/****************************************************************** - * no_setup() - does nothing - ******************************************************************/ -int -no_setup() -{ - return 0; -} - -/****************************************************************** - * high_address_setup() - generates an address that should cause a segfault - ******************************************************************/ -int -high_address_setup() -{ - int ind; - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - if ( Test_cases[ind].pathname == High_address ) { - /*if ( strcmp(Test_cases[ind].pathname, HIGH_ADDRESS) == 0 ) { ***/ - Test_cases[ind].pathname = get_high_address(); - break; - } - } - return 0; - -} - -/****************************************************************** - * longpath_setup() - creates a filename that is too long - ******************************************************************/ -int -longpath_setup() -{ - int ind; - - for(ind=0; ind<= PATH_MAX+1; ind++) { - Longpathname[ind] = 'a'; - } - return 0; - -} - -/****************************************************************** - * filepath_setup() creates a file the exists that we will treat as a directory - ******************************************************************/ -int -filepath_setup() -{ - int fd; - - if ( (fd=creat("file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, "creat(file) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - return 0; -} - -/****************************************************************** - * sig11_handler() - our segfault recover hack - ******************************************************************/ -void -sig11_handler(int sig) -{ - longjmp(sig11_recover, 1); -} diff --git a/winsup/testsuite/winsup.api/ltp/symlink01.c b/winsup/testsuite/winsup.api/ltp/symlink01.c deleted file mode 100644 index 54a24b87f..000000000 --- a/winsup/testsuite/winsup.api/ltp/symlink01.c +++ /dev/null @@ -1,2032 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** -* -* OS Test - Silicon Graphics, Inc. -* -* TEST IDENTIFIER : symlink01 (symlink) -* -* TEST TITLE : Make a Symbolic Link to a File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 5 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : readlink01 (readlink) -* -* TEST TITLE : Reads Value of a Symbolic Link -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 4 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : stat04 (stat) -* -* TEST TITLE : Gets File Status Indirectly From a Symbolic Link -* File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : lstat01 (lstat) -* -* TEST TITLE : Get file Status About a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : mkdir05 (mkdir) -* -* TEST TITLE : Fail When Making a Directory File Indirectly From -* a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 1 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : rmdir03 (rmdir) -* -* TEST TITLE : Fail When Removing a Directory File Indirectly -* From a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 1 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : chdir01 (chdir) -* -* TEST TITLE : Changes Current Working DIrectory Location -* Indirectly From a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : link01 (link) -* -* TEST TITLE : Creates a Link To a File Indirectly From a -* Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : unlink01 (unlink) -* -* TEST TITLE : Removes a Link To a File And Not Any Object File -* Which Maybe Pointed At -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 1 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : chmod01 (chmod) -* -* TEST TITLE : Change Object File Permissions Indirectly From a -* Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : utime01 (utime) -* -* TEST TITLE : Set File Access And Modify Object File Times -* Indirectly From a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : rename01 (rename) -* -* TEST TITLE : Rename a Symbolic Link File And Not Any Object -* File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : open01 (open) -* -* TEST TITLE : Create/Open a File For Reading Or Writing -* Indirectly From a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 5 -* -* WALL CLOCK TIME : 3 -* -* EXECUTED BY : whom ever -* -* CPU TYPES : ALL -* -* AUTHOR : David Fenner -* -* CO-PILOT : Jon Hendrickson -* -* DATE STARTED : 07/25/90 -* -* INITIAL RELEASE : UNICOS 6.0 -* -* TEST CASES -* -* For symlink -* -* 1. Create symbolic link with abnormal object name path -* 2. Create symbolic link with normal object name path -* 3. Create symbolic link with path to an existing object file -* 4. Receive EEXIST error when creating an already existing symbolic link file. -* 5. Receive ENAMETOOLONG error when creating symbolic link which exceeds PATH_MAX in length -* -* For readlink -* -* 1. Read a symbolic link file which points at no object file -* 2. Read a symbolic link file which points at an object file -* 3. Receive ENAMETOOLONG error when reading symbolic link which exceeds PATH_MAX in length -* 4. Receive an EINVAL error when reading a file which is not a symbolic -* link file. -* -* For stat -* -* 1. Get object file status through symbolic link file -* 2. Receive ENOENT error when accessing non-existent object file through symbolic link file -* 3. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* For lstat -* -* 1. Get symbolic link file status when pointing at no object file -* 2. Get symbolic link file status when pointing at an object file -* 3. Get object file status when argument is not a symbolic link -* file. -* -* For mkdir -* -* 1. Receive EEXIST error when creating a directory through a symbolic link file -* -* For rmdir -* -* 1. Receive ENOTDIR error when removing an existing directory through a symbolic link file -* -* For chdir -* -* 1. Change current working directory through a symbolic link file -* 2. Receive ENOENT error when accessing non-existent directory through symbolic link file -* 3. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* For link -* -* 1. Link an object file to a new file through symbolic link file -* 2. Receive ENOENT error when accessing non-existent object file through symbolic link file -* 3. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* For unlink -* -* 1. Delete a symbolic link file and not the object file which it points at -* -* For chmod -* -* 1. Change file permissions of object file through a symbolic link file -* 2. Receive ENOENT error when accessing non-existent directory through symbolic link file -* 3. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* For utime -* -* 1. Change inode times of object file through a symbolic link file -* 2. Receive ENOENT error when accessing non-existent directory through symbolic link file -* 3. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* For rename -* -* 1. Rename a symbolic link file which points at no object file -* 2. Rename a symbolic link file which points at an object file without any object file alterations. -* 3. Receive EXDEV when trying to rename a symbolic link file to an address outside of current file system -* -* For open -* -* 1. Create an object file through a symbolic link file -* 2. Open an object file through a symbolic link file -* 3. Receive EEXIST error when exclusively creating an object file through a symbolic link file -* 4. Receive ENOENT error when accessing non-existent object file through symbolic link file -* 5. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* ENVIRONMENTAL NEEDS -* None -* -* DETAILED DESCRIPTION -* -* Self-documenting code so see below -* -*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include /* open(2) system call */ -#include -#include -#include /* utime(2) system call */ -#include -#include /* stat(2) and lstat(2) system calls */ - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void help(); -void delete_files(); -void do_EEXIST(); -void do_ENOENT(); -void do_ELOOP(); -void do_ENOTDIR(); -void do_EXDEV(); -void do_ENAMETOOLONG(); -void do_EINVAL(); -void do_readlink(); -void do_stat(); -void do_chdir(); -void do_link(); -void do_unlink(); -void do_chmod(); -void do_utime(); -void do_rename(); -void do_open(); - -#define S_FILE "symbolic" /* Name of symbolic link file */ -#define O_FILE "object" /* Name of object file */ -#define A_S_FILE "asymbolic" /* Another name for a symbolic link file */ -#define Y_A_S_FILE "/NiCkEr" /* Yet another symbolic link file */ -#define BIG_STRING "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" - -#define DEFAULT_TCID "symlink01" -#define ALL 1 - -#define SYMLINK "symlink01" -#define READLINK "readlink01" -#define STAT "stat04" -#define LSTAT "lstat01" -#define MKDIR "mkdir05" -#define RMDIR "rmdir03" -#define CHDIR "chdir01" -#define LINK "link01" -#define UNLINK "unlink01" -#define CHMOD "chmod01" -#define UTIME "utime01" -#define RENAME "rename01" -#define OPEN "open01" - -#define cktcsid(s1,s2) (!strcmp(s1,s2)) -#define BUFMAX 512 -#define MODE 0700 -#define MASK 0100777 /* A regular file with r,w,x for all mask */ - -/* - * Lets be optimistic and only define messages for passing test cases - */ -const char *msgs[] = { - "Creation of symbolic link file to no object file is ok", - "Creation of symbolic link file and object file via symbolic link is ok", - "Creating an existing symbolic link file error is caught", - "Creating a symbolic link which exceeds maximum pathname error is caught", - "Reading of symbolic link file contents checks out ok", - "Reading a symbolic link which exceeds maximum pathname error is caught", - "Getting stat info about object file through symbolic link file is ok", - "Stat(2) error when accessing non-existent object through symbolic link is caught", - "lstat(2) of symbolic link file which points to no object file is ok", - "lstat(2) of symbolic link file which points at an object file is ok", - "mkdir(2) of object file through symbolic link file failed as expected", - "rmdir(2) of object file through symbolic link file failed as expected", - "chdir(2) to object file location through symbolic link file is ok", - "chdir(2) to non-existent object file location through symbolic link file failed as expected", - "link(2) to a symbolic link, which is pointing to an existing object file worked - file created and link count adjusted", - "link(2) to a symbolic link, which is pointing to a non-existing object file worked ok - file created and link count adjusted.", - "unlink(2) of symbolic link file with no object file removal is ok", - "chmod(2) of object file permissions through symbolic link file is ok", - "chmod(2) error when accessing non-existent object through symbolic link is caught", - "utime(2) change of object file access and modify times through symbolic link file is ok", - "utime(2) error when accessing non-existent object through symbolic link is caught", - "rename(3) of symbolic link file name which points at no object file is ok", - "rename(3) of symbolic link file name which points at object file is ok", - "rename(3) error of symbolic link file name across file systems is caught", - "open(2) with (O_CREAT | O_RDWR) to create object file through symbolic link file and all writes, reads, and lseeks are ok", - "open(2) with O_RDWR of existing object file through symbolic link file and all writes, reads, and lseeks are ok", - "open(2) with (O_CREAT | O_EXCL) error is caught when creating object file through symbolic link file", - "open(2) error with O_RDWR is caught when processing symbolic link file which points at no object file", - "Nested symbolic link access condition caught. ELOOP is returned", - "Reading a nonsymbolic link file error condition is caught. EINVAL is returned", - "lstat(2) of object file returns object file inode information", - "NULL" -}; - -/* - * Define test object setup and validation functions - */ -int creat_both(), creat_symlink(), creat_path_max(), ck_symlink(), - creat_object(), ck_object(), ck_both(), ck_path_max(); - - -/* - * Define test cases - */ -struct all_test_cases -{ - const char *tcid; - int test_fail; - int errno_val; - int pass_msg; - int (*test_setup)(); - int (*ck_test)(); - const char *fn_arg[3]; - -} test_objects[] = { - {SYMLINK, 0, 0, 0, creat_symlink, ck_symlink, {"%bc+eFhi!k", S_FILE, NULL}}, - {SYMLINK, 0, 0, 0, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {SYMLINK, 0, 0, 1, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {SYMLINK, 1, EEXIST, 2, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {SYMLINK, 1, ENAMETOOLONG, 3, creat_path_max, ck_path_max, {O_FILE, S_FILE, NULL}}, - {READLINK, 0, 0, 4, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {READLINK, 0, 0, 4, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {READLINK, 1, ENAMETOOLONG, 5, creat_path_max, ck_path_max, {O_FILE, S_FILE, NULL}}, - {READLINK, 1, EINVAL, 29, creat_object, ck_object, {O_FILE, NULL, NULL}}, - {STAT, 0, 0, 6, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {STAT, 1, ENOENT, 7, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {STAT, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}}, - {LSTAT, 0, 0, 8, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {LSTAT, 0, 0, 9, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {LSTAT, 0, 0, 30, creat_object, ck_object, {O_FILE, NULL, NULL}}, - {MKDIR, 1, EEXIST, 10, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {RMDIR, 1, ENOTDIR, 11, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {CHDIR, 0, 0, 12, creat_symlink, ck_symlink, {O_FILE, S_FILE, O_FILE}}, - {CHDIR, 1, ENOENT, 13, creat_symlink, ck_symlink, {"%bc+eFhi!k", S_FILE, NULL}}, - {CHDIR, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}}, - {LINK, 0, 0, 14, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {LINK, 0, 0, 15, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - /* The following link test case is invalid - leaving it defined so */ - /* I don't have to change all the entries in the all_tcses array after link */ - {LINK, -1, -1, -1, creat_symlink, ck_symlink, {NULL, NULL, NULL}}, - {UNLINK, 0, 0, 16, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {CHMOD, 0, 0, 17, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {CHMOD, 1, ENOENT, 18, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {CHMOD, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}}, - {UTIME, 0, 0, 19, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {UTIME, 1, ENOENT, 20, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {UTIME, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}}, - {RENAME, 0, 0, 21, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {RENAME, 0, 0, 22, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {RENAME, -1, EXDEV, 23, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {OPEN, 0, 0, 24, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {OPEN, 0, 0, 25, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {OPEN, -1, EEXIST, 26, creat_symlink, ck_symlink, {O_FILE, S_FILE, O_FILE}}, - {OPEN, 1, ENOENT, 27, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {OPEN, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}} -}; - -/* - * Define tcses - */ -struct tcses -{ - const char *tcid; - const char *syscall; - int test_cases; /* number of entries in test_objects array */ - struct all_test_cases *tc_ptr; - const char *desc; -} all_tcses[] = { - - { SYMLINK, "symlink", 5, &test_objects[0], - "Make a Symbolic Link to a File" }, - { READLINK, "readlink", 4, &test_objects[5], - "Reads Value of a Symbolic Link" }, - { STAT, "stat", 3, &test_objects[9], - "Gets File Status Indirectly From a Symbolic Link file" }, - { LSTAT, "lstat", 3, &test_objects[12], - "Get file Status About a Symbolic Link File" }, - { MKDIR, "mkdir", 1, &test_objects[15], - "Fail When Making a Directory File Indirectly from a symlink" }, - { RMDIR, "rmdir", 1, &test_objects[16], - "Fail When Removing a Directory File Indirectly from a symlink" }, - { CHDIR, "chdir", 3, &test_objects[17], - "Changes CWD Location Indirectly from a symlink" }, - { LINK, "link", 2, &test_objects[20], - "Creates a Link To a File Indirectly From a Symbolic" }, - { UNLINK, "unlink", 1, &test_objects[23], - "Removes a Link To a File but not the Object File" }, - { CHMOD, "chmod", 3, &test_objects[24], - "Change Object File Permissions Indirectly From a Symbolic" }, - { UTIME, "utime", 3, &test_objects[27], - "Set File Access And Modify Object File Times via symlink" }, - { RENAME, "rename", 3, &test_objects[30], - "Rename a Symbolic Link File And Not Any Object file" }, - { OPEN, "open", 5, &test_objects[33], - "Create/Open a File For Reading Or Writing via symlink" }, -}; - -/* - * Define GLOBAL variables - */ - -int TST_TOTAL; -int TEST_RESULT; -time_t a_time_value = 100; -const char *TCID = NULL; -char *Selectedtests = NULL; /* Name (tcid) of selected test cases */ -char test_msg[BUFMAX]; -char full_path[PATH_MAX+1]; -extern int Tst_count; -extern char *TESTDIR; -extern char *strrchr(); -extern int errno; - -struct stat asymlink, statter; -char Buffer[1024]; -char Buf[1024]; - -char *Tcid = NULL; - -option_t Options[] = { - { "T:", NULL, &Tcid }, /* -T tcid option */ - { NULL, NULL, NULL } -}; - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int argc, char *argv[]) -{ - struct tcses *tcs_ptr, *get_tcs_info(); - int do_syscalltests(); - void cleanup(); - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(argc, argv, Options, &help)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* - * If the -T option was used, use that TCID or use the default - */ - if ( Tcid != NULL ) { - TCID = Tcid; - Selectedtests=Tcid; - - } - else { - TCID = DEFAULT_TCID; -#ifndef ALL - Selectedtests = DEFAULT_TCID; -#else - Selectedtests = NULL; -#endif - } - - /* - * Get test case specification information and assign TST_TOTAL - */ - if ((tcs_ptr=get_tcs_info(Selectedtests)) == NULL) { - TST_TOTAL=1; - tst_brkm(TBROK, cleanup, - "Unknown symbolic link test case specification executed"); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Execute tcs testing function and all defined test cases - */ - do_syscalltests(tcs_ptr); - - } /* End for TEST_LOOPING */ - - /* - * End appropriately - */ - cleanup(); - - return 0; -} - -/*********************************************************************** - * This function maps the name of the process to a test case specification - * defined in the all_tcses array of tcses structures. Either a pointer - * to the mapped test case specification information is returned or a - * null pointer. - * - * Argument is path to program name. - ***********************************************************************/ -struct tcses *get_tcs_info(ptr) -char *ptr; -{ - unsigned ctr; - struct tcses *tcs_ptr; - -#if ALL - if ( ptr == NULL ) { - - TST_TOTAL=0; - for (ctr=1; ctr < sizeof(all_tcses)/sizeof(struct tcses); ctr++) - TST_TOTAL += all_tcses[ctr].test_cases; - return all_tcses; - } -#endif - - - for(ctr=0; ctr < (sizeof(all_tcses)/sizeof(struct tcses)); ctr++) { - if ( strcmp(ptr, all_tcses[ctr].tcid) == 0 || - strcmp(ptr, all_tcses[ctr].syscall) == 0 ) { - tcs_ptr = &all_tcses[ctr]; - TCID = all_tcses[ctr].tcid; - TST_TOTAL=tcs_ptr->test_cases; - return(tcs_ptr); - } - - } - return(NULL); -} - -/*********************************************************************** - * Determines if what path points at is a symbolic link file - * - * Argument is path to symbolic link file. - * - * Return status is one if a symbolic link file. Zero if not a symbolic - * link file and a minus one if the path doesn't point at a file. - ***********************************************************************/ -int -see_if_a_symlink(path) -char *path; -{ - if (lstat(path, &asymlink) < 0) - return(-1); - - if ((asymlink.st_mode & S_IFMT) == S_IFLNK) - return(1); - else - return(0); -} - -/*********************************************************************** - * This function performs without any hesitation, file(s) deletions - ***********************************************************************/ -void -delete_files(path1, path2) -char *path1, *path2; -{ - unlink(path1); - unlink(path2); -} - -/*********************************************************************** - * - * This routine creates a symbolic link file. - * - * Argument one is symbolic link pathname to point at. - * Argument two is name of symbolic link file. - * - ***********************************************************************/ -int -creat_symlink(path1, path2) -char *path1, *path2; -{ - TEST( symlink(path1, path2) ); - errno=TEST_ERRNO; - if (TEST_RETURN == -1) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "symlink(2) Failure when creating setup %s object file: errno:%d %s", - path1, errno, strerror(errno)); - return(0); - } - else { - sprintf(Buf, "symlink(%s, %s) was succesful.\n", path1, path2); - strcat(Buffer, Buf); -#if DEBUG - tst_resm(TPASS, "symlink(%s, %s) was succesful.", path1, path2); -#endif - } - return(1); -} - -/*********************************************************************** - * - * This routine creates a regular file. - * - * Argument one is a pathname - * - ***********************************************************************/ -int -creat_object(path1) -char *path1; -{ - int fd; - if ((fd=creat(path1, MODE)) == -1) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "creat(2) Failure when creating setup %s object file: errno:%d %s", - path1, errno, strerror(errno)); - return(0); - } - else { - sprintf(Buf, "creat(%s, %#o) was succesful.\n", path1, MODE); - strcat(Buffer, Buf); -#if DEBUG - tst_resm(TPASS, "creat(%s, %#o) was succesful.", path1, MODE); -#endif - } - if (close(fd) == -1) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "close(2) Failure when closing setup %s object file: errno:%d %s", - path1, errno, strerror(errno)); - return(0); - } - return(1); -} - -/*********************************************************************** - * - * This routine creates a symbolic link file and a regular file. - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - * - ***********************************************************************/ -int -creat_both(path1, path2, path3) -char *path1, *path2, *path3; -{ - if (creat_symlink(path1, path2) == -1) - return(0); - else if (creat_object(path3) == -1) - return(0); - return(1); -} - -/*********************************************************************** - * - * This routine checks if symbolic link file is a symbolic link file. - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - * - ***********************************************************************/ -int -ck_symlink(path1, path2, path3) -char *path1, *path2, *path3; -{ - int ret; - - if ((ret=see_if_a_symlink(path2)) == -1) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "lstat(2) Failure when accessing %s symbolic link file which should contain %s path to %s file ", - path2, path1, path3); - return(0); - } - else if (ret == 0) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "%s is not a symbolic link file which contains %s path to %s file", - path2, path1, path3); - return(0); - } - return(1); -} - -/*********************************************************************** - * - * This routine checks if symbolic link file points at object file. - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - * - ***********************************************************************/ -int -ck_both(path1, path2, path3) -char *path1, *path2, *path3; -{ - if (ck_symlink(path1, path2, path3) == 0) - return(0); - else if ((stat(path3, &statter) == -1) && (errno == ENOENT)) { - TEST_RESULT=TBROK; - sprintf(test_msg, "stat(2) Failure when accessing %s object file ", path3); - return(0); - } - else if ((stat(path2, &asymlink) == -1) && (errno == ENOENT)) { - TEST_RESULT=TBROK; - sprintf(test_msg, "stat(2) Failure when accessing %s symbolic link file ", - path2); - return(0); - } - else if (statter.st_ino != asymlink.st_ino) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "stat(2) Failure when accessing %s object file through %s symbolic link file ", - path3, path2); - return(0); - } - return(1); - -} - -/*********************************************************************** - * This routine populates full_path with a pathname whose length exceeds - * the PATH_MAX define value in param.h - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - ***********************************************************************/ -int -creat_path_max(path1, path2, path3) -char *path1, *path2, *path3; -{ - int ctr, to_go, size, whole_chunks; - char buf [PATH_MAX]; - char *cwd; - - if ((cwd = getcwd(buf, sizeof (buf))) == NULL) - { - TEST_RESULT=TBROK; - sprintf(test_msg, - "getcwd(3) Failure in setup of %s %s %s test case object elements", - path1, path2, path3); - return(0); - } - size = strlen(cwd); - - to_go = PATH_MAX - size; - size = strlen(path1); - whole_chunks = to_go / size; - strcpy(full_path, cwd); - for (ctr=0; ctr < whole_chunks; ctr++) { - strcat(full_path, path1); - } - size= strlen(full_path); - to_go = PATH_MAX - size; - strcat(full_path, "/"); - for (ctr=0; ctr < to_go; ctr++) - strcat(full_path, "Z"); - - return(1); -} - -/*********************************************************************** - * This routine checks that full_path's length exceeds the PATH_MAX - * define value in param.h - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - ***********************************************************************/ -int -ck_path_max(path1, path2, path3) -char *path1, *path2, *path3; -{ - if (strlen(full_path) == (PATH_MAX+1)) - return(1); - else - { - TEST_RESULT=TBROK; - sprintf(test_msg, "%s %d %s %s %s %s", - "full_path character array length was not", (PATH_MAX+1), - "characters long for test case object elements", - path1, path2, path3); - return(0); - } -} - -/*********************************************************************** - * This routine checks if the stat(2) and lstat(2) calls return the same - * information when the path is not a symbolic link file - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - * - ***********************************************************************/ -int -ck_object(path1, path2, path3) -char *path1, *path2, *path3; -{ - int ret; - - if ((ret=see_if_a_symlink(path1)) < 0) { - TEST_RESULT=TFAIL; - sprintf(test_msg, - "lstat(2) failed to return inode information for a regular object file"); - return(0); - } - else if (ret == 1) { - TEST_RESULT=TFAIL; - sprintf(test_msg, - "lstat(2) detected a regular object file as a symbolic link file"); - return(0); - } - else if (stat(path1, &statter) == -1) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "stat(2) failed to return inode information for a regular object file"); - return(0); - } - else if (bcmp((char *)&statter, (char *)&asymlink, sizeof(statter)) != 0) { - TEST_RESULT=TFAIL; - sprintf(test_msg, - "lstat(2) and stat(2) do not return same inode information for an object file"); - return(0); - - } - return(1); -} - -/*********************************************************************** - * Main test case processing function - * - * Argument is a ptr into the all_tcses array of structures of type tcses - ***********************************************************************/ -int -do_syscalltests(tcs) -struct tcses *tcs; -{ - int ctr, ret; - struct all_test_cases *tc_ptr; - - /* - * loop through desired number of test cases - */ - for (ctr=0, tc_ptr=tcs->tc_ptr; ctr < TST_TOTAL; ctr++, tc_ptr++) { - - if (tc_ptr->test_fail < 0) continue; - - Buffer[0]='\0'; - - /* - * If running all test cases for all tcid, set the TCID if needed. - */ - if ( Selectedtests == NULL ) { - if ( !TCID || strcmp(TCID, tc_ptr->tcid) != 0 ) { - TCID = tc_ptr->tcid; - Tst_count=0; - } - } - /* - * Insure that we are executing the correct tcs test case - */ - if (strcmp(TCID, tc_ptr->tcid) != 0) { - tst_resm(TBROK, "%s TCID attempted to execute %s %d %d test case", - TCID, tc_ptr->tcid, tc_ptr->test_fail, tc_ptr->errno_val); - continue; - } - TEST_RESULT=TPASS; - delete_files(S_FILE, O_FILE); - /* - * Perform test case setup - */ - ret = (tc_ptr->test_setup)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1], - tc_ptr->fn_arg[2], tc_ptr->errno_val); - - /* If an expected error, try it out */ - - if (tc_ptr->test_fail) { - /* - * Try to perform test verification function - */ - if (! (tc_ptr->ck_test)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1], - tc_ptr->fn_arg[2], tc_ptr->errno_val)) - tst_resm(TEST_RESULT, test_msg); - else if (tc_ptr->errno_val == EEXIST) - do_EEXIST(tc_ptr); - else if (tc_ptr->errno_val == ENOENT) - do_ENOENT(tc_ptr); - else if (tc_ptr->errno_val == ELOOP) - do_ELOOP(tc_ptr); - else if (tc_ptr->errno_val == ENOTDIR) - do_ENOTDIR(tc_ptr); - else if (tc_ptr->errno_val == EXDEV) - do_EXDEV(tc_ptr); - else if (tc_ptr->errno_val == ENAMETOOLONG) - do_ENAMETOOLONG(tc_ptr); - else if (tc_ptr->errno_val == EINVAL) - do_EINVAL(tc_ptr); - else - tst_resm(TBROK, "Test Case Declaration Error"); - } - else if (ret == 1) { /* No setup function error */ - - if (tc_ptr->errno_val != 0) - tst_resm(TBROK, "Test Case Declaration Error"); - else { - /* - * Perform test verification function - */ - ret=(tc_ptr->ck_test)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1], - tc_ptr->fn_arg[2], tc_ptr->errno_val); - - /* Perform requested symbolic link system call test */ - - if ((cktcsid(tc_ptr->tcid, SYMLINK)) || - (cktcsid(tc_ptr->tcid, LSTAT))) { - if (ret == 1) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - tst_resm(TEST_RESULT, test_msg); - } - else if (ret == 0) - tst_resm(TEST_RESULT, test_msg); - else if (cktcsid(tc_ptr->tcid, READLINK)) - do_readlink(tc_ptr); - else if (cktcsid(tc_ptr->tcid, STAT)) - do_stat(tc_ptr); - else if (cktcsid(tc_ptr->tcid, CHDIR)) - do_chdir(tc_ptr); - else if (cktcsid(tc_ptr->tcid, LINK)) - do_link(tc_ptr); - else if (cktcsid(tc_ptr->tcid, UNLINK)) - do_unlink(tc_ptr); - else if (cktcsid(tc_ptr->tcid, CHMOD)) - do_chmod(tc_ptr); - else if (cktcsid(tc_ptr->tcid, UTIME)) - do_utime(tc_ptr); - else if (cktcsid(tc_ptr->tcid, RENAME)) - do_rename(tc_ptr); - else if (cktcsid(tc_ptr->tcid, OPEN)) - do_open(tc_ptr); - else - tst_resm(TBROK, "Unknown test case processing actions declared"); - } - } - else - tst_resm(TBROK, "Test Case Declaration Error"); - } - return(0); -} - -/*********************************************************************** - * This routine checks for the return of EEXIST errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_EEXIST(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, SYMLINK)) { - - TEST( symlink(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1]) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == EEXIST)) - if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s", - "Expected EEXIST error when creating a symbolic link file", - "which already existed"); - } - else if (cktcsid(tc_ptr->tcid, MKDIR)) { - - TEST ( mkdir(tc_ptr->fn_arg[1],MODE) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == EEXIST)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else { - - tst_resm(TFAIL, "%s %s", - "Expected EEXIST error when creating a directory by a symbolic", - "link file which pointed at no object file"); - rmdir(tc_ptr->fn_arg[1]); - } - } - else if (cktcsid(tc_ptr->tcid, OPEN)) { - - TEST( open(tc_ptr->fn_arg[1], (O_EXCL | O_CREAT)) ) - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == EEXIST)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected EEXIST error for exclusively opening an object file", - "through a symbolic link file was not received:", - errno, strerror(errno)); - close (TEST_RETURN); - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of ENOENT errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_ENOENT(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, STAT)) { - - if ((stat(tc_ptr->fn_arg[1], &asymlink) == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error for stating a non-existent directory", - "through a symbolic link file was not received:", - errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, CHDIR)) { - if ((chdir(tc_ptr->fn_arg[1]) == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else { - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error for changing to a non-existent", - "directory through a symbolic link file was not received:", - errno, strerror(errno)); - chdir(TESTDIR); - } - } - else if (cktcsid(tc_ptr->tcid, LINK)) { - - if ((link(tc_ptr->fn_arg[1], "nick") == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - { - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error condition when link(2) a symbolic", - "link which pointed at no object:", errno, strerror(errno)); - delete_files("nick", NULL); - } - } - else if (cktcsid(tc_ptr->tcid, CHMOD)) { - - if ((chmod(tc_ptr->fn_arg[1], MODE) == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error condition when chmod(2) a symbolic", - "link which pointed at no object,", errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, UTIME)) { - - if ((utime(tc_ptr->fn_arg[1], NULL) == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error condition when utime(2) a symbolic", - "link which pointed at no object:", errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, OPEN)) { - - if ((open(tc_ptr->fn_arg[1], O_RDWR) == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error for opening a non-existent object", - " file through a symbolic link file was not received,", - errno, strerror(errno)); - close (TEST_RETURN); - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of ELOOP errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_ELOOP(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, STAT)) { - - TEST( stat(tc_ptr->fn_arg[1], &asymlink) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, "%s errno:%d %s", - "Expected ELOOP errno from stat(2) (nested symb link),", - errno, strerror(errno)); - else - Tst_count++; - } - else if (cktcsid(tc_ptr->tcid, CHDIR)) { - - TEST( chdir(tc_ptr->fn_arg[1]) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else { - - tst_resm(TFAIL, "%s errno:%d %s", - "Expected ELOOP error condition when chdir(2) a nested symbolic link:", - errno, strerror(errno)); - chdir(TESTDIR); - } - } - else if (cktcsid(tc_ptr->tcid, LINK)) { - - TEST ( link(tc_ptr->fn_arg[1], O_FILE) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s errno:%d %s", - "Expected ELOOP error condition when link(2) a nested symbolic link:", - errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, CHMOD)) { - - TEST ( chmod(tc_ptr->fn_arg[1], MODE) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s errno:%d %s", - "Expected ELOOP error condition when chmod(2) a nested symbolic link:", - errno, strerror(errno)); - return; - } - else if (cktcsid(tc_ptr->tcid, UTIME)) { - - TEST( utime(tc_ptr->fn_arg[1], NULL) ); - errno=TEST_ERRNO; - - if ((TEST_RETURN == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s errno:%d %s", - "Expected ELOOP error condition when utime(2) a nested symbolic link:", - errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, OPEN)) { - - int fd; - TEST( open(tc_ptr->fn_arg[1], O_CREAT) ); - fd=TEST_RETURN; - errno=TEST_ERRNO; - if ((fd == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s errno:%d %s", - "Expected ELOOP error condition when open(2) a nested symbolic link:", - errno, strerror(errno)); - close (fd); - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of ENOTDIR errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_ENOTDIR(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, RMDIR)) { - - TEST( mkdir(tc_ptr->fn_arg[0], MODE) ); - errno=TEST_ERRNO; - if (TEST_RETURN == -1) - tst_resm(TBROK, "mkdir(2) Failure when creating %s", - tc_ptr->fn_arg[0]); - else if ((rmdir(tc_ptr->fn_arg[1]) == -1) && (errno == ENOTDIR)) { - - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - rmdir(tc_ptr->fn_arg[0]); - } - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOTDIR error for removing a non-existent", - "directory through a symbolic link file was not received,", - errno, strerror(errno)); - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of EXDEV errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_EXDEV(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, RENAME)) { - - TEST( rename(tc_ptr->fn_arg[1], Y_A_S_FILE) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == EXDEV)) { - if (see_if_a_symlink(Y_A_S_FILE) == -1) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s %s file outside of current file system", - "rename(3) returned -1 when trying to move symbolic link file", - "outside of current file system, but created", Y_A_S_FILE); - } - else { - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected EXDEV error for renaming an existing symbolic", - "link file to a location outside of existing file system,", - errno, strerror(errno)); - delete_files("/NiCkEr", NULL); - } - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of ENAMETOOLONG errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_ENAMETOOLONG(tc_ptr) -struct all_test_cases *tc_ptr; -{ - int ret; - - if (cktcsid(tc_ptr->tcid, SYMLINK)) { - - TEST( symlink(tc_ptr->fn_arg[0], full_path) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == ENAMETOOLONG)) - if (see_if_a_symlink(full_path) == -1) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s %d %s", - "symlink(2) returned -1 when trying to create a symbolic", - "link file whose name exceeded", (PATH_MAX+1), - "characters, but it created the symbolic link file"); - else - tst_resm(TFAIL, - "Expected ENAMETOOLONG error when creating %s symbolic link file with a path exceeding %d characters: errno:%d %s", - tc_ptr->fn_arg[1], (PATH_MAX+1), errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, READLINK)) { - - char scratch[PATH_MAX+1]; - - ret=readlink(full_path, scratch, strlen(full_path)); - if (( ret == -1) && (errno == ENAMETOOLONG)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, - "Expected ENAMETOOLONG error when reading %s symbolic link file with a path exceeding %d characters: errno:%d %s", - tc_ptr->fn_arg[1], (PATH_MAX+1), errno, strerror(errno)); - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of EINVAL errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_EINVAL(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, READLINK)) { - TEST( readlink(tc_ptr->fn_arg[0], test_msg, BUFMAX) ); - errno=TEST_ERRNO; - if (TEST_RETURN == -1) { - if (errno == EINVAL) { - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - } else - tst_resm(TFAIL, "readlink(2) ret:-1, errno:%d, : Exp errno:%d", - errno, EINVAL); - } - else { - tst_resm(TFAIL, "readlink(2) did not returned -1 when reading %s", - "a file which is not a symbolic link file"); - } - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks out the readlink(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_readlink(tc_ptr) -struct all_test_cases *tc_ptr; -{ - char scratch[PATH_MAX]; - int ret; - - ret=readlink(tc_ptr->fn_arg[1], scratch, strlen(tc_ptr->fn_arg[0])); - - /*** the TEST macro cannot be used here for some reason ****/ - - if (ret == -1) { - tst_resm(TFAIL, - "readlink(2) failure on %s symbolic link file, errno=%d", - tc_ptr->fn_arg[1], errno); - - } - else if (strncmp(tc_ptr->fn_arg[0], scratch, - strlen(tc_ptr->fn_arg[0])) != 0) { - - /* Must null terminate scratch because readlink(2) doesn't */ - - scratch[strlen(tc_ptr->fn_arg[0])] = '\0'; - - tst_resm(TFAIL, - "readlink(2) Error : Expected %s symbolic link file contents but %s actual contents were returned", - tc_ptr->fn_arg[0], scratch); - } - else if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; -} - -/*********************************************************************** - * This routine checks out the stat(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_stat(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (statter.st_dev != asymlink.st_dev) - tst_resm(TFAIL, - "stat of symbolic link reference to object device info %ld != stat of object file device info %ld", - statter.st_dev, asymlink.st_dev); - - else if (statter.st_mode != asymlink.st_mode) - tst_resm(TFAIL, - "stat of symbolic link reference to object file permissions %ld != stat of object file permissions %ld", - statter.st_mode, asymlink.st_mode); - - else if (statter.st_nlink != asymlink.st_nlink) - tst_resm(TFAIL, - "stat of symbolic link reference to object file link count %ld != stat of object file link count %ld", - statter.st_nlink, asymlink.st_nlink); - - else if (statter.st_uid != asymlink.st_uid) - tst_resm(TFAIL, - "stat of symbolic link reference to object file uid %ld != stat of object file uid %ld", - statter.st_uid, asymlink.st_uid); - - else if (statter.st_gid != asymlink.st_gid) - tst_resm(TFAIL, - "stat of symbolic link reference to object file gid %ld != stat of object file gid %ld", - statter.st_gid, asymlink.st_gid); - - else if (statter.st_size != asymlink.st_size) - tst_resm(TFAIL, - "stat of symbolic link reference to object file size %ld != stat of object file size %ld", - statter.st_size, asymlink.st_size); - - else if (statter.st_atime != asymlink.st_atime) - tst_resm(TFAIL, - "stat of symbolic link reference to object access time %ld != stat of object file access time %ld", - statter.st_atime, asymlink.st_atime); - - else if (statter.st_mtime != asymlink.st_mtime) - tst_resm(TFAIL, - "stat of symbolic link reference to object modify time %ld != stat of object file modify time %ld", - statter.st_atime, asymlink.st_atime); - - else if (statter.st_ctime != asymlink.st_ctime) - tst_resm(TFAIL, - "stat of symbolic link reference to object change time %ld != stat of object file change time %ld", - statter.st_atime, asymlink.st_atime); - else if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; -} - -/*********************************************************************** - * This routine checks out the chdir(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_chdir(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (mkdir(tc_ptr->fn_arg[2],MODE) == -1) - tst_resm(TFAIL, "Could not create a setup directory file"); - else { - - sprintf(Buf, "mkdir(%s, %#o) was successful\n", tc_ptr->fn_arg[2],MODE); - strcat(Buffer, Buf); - - if (chdir(tc_ptr->fn_arg[1]) == -1) - tst_resm(TFAIL, "%sCould not change a directory file through a %s", - Buffer, "symbolic link which which pointed at object"); - else { - - char buf [PATH_MAX]; - char *cwd; - char expected_location[PATH_MAX]; - /* - * Build expected current directory position - */ - strcpy(expected_location, TESTDIR); - strcat(expected_location, "/"); - strcat(expected_location, tc_ptr->fn_arg[2]); - - if ((cwd = getcwd(buf, sizeof (buf))) == NULL) - tst_resm(TFAIL, "getcwd(3) FAILURE"); - else if (strcmp(cwd, expected_location) == 0) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else { - tst_resm(TFAIL, "%s%s %s %s not equal to expected %s", Buffer, - "chdir(2) returned successfully, but getcwd(3) indicated", - "new current working directory location", cwd, expected_location); - } - chdir(TESTDIR); - } - rmdir(tc_ptr->fn_arg[2]); - } -} - -/*********************************************************************** - * This routine checks out the link(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_link(tc_ptr) -struct all_test_cases *tc_ptr; -{ - struct stat stbuf; - - if (link(tc_ptr->fn_arg[1], "nick") == -1) { - tst_resm(TFAIL, "%slink(%s, \"nick\") failed, errno: %d\n%s %s", - Buffer, tc_ptr->fn_arg[1], errno, - "link of new file to object file via symbolic link file failed", - "when expected not to"); - } - else { - sprintf(Buf, "link(%s, \"nick\") was successful\n", tc_ptr->fn_arg[1]); - strcat(Buffer, Buf); - - if ( STD_FUNCTIONAL_TEST ) { - /* - * Check that links counts were properly set - */ - if (lstat(tc_ptr->fn_arg[1], &asymlink) == -1) { - tst_resm(TBROK, "lstat(%s) failed. errno: %d", - tc_ptr->fn_arg[1], errno); - - } else if (lstat("nick", &statter) == -1) { - tst_resm(TBROK, "lstat(nick) failed, errno:%d", errno); - } else { - if (statter.st_ino == asymlink.st_ino) { - if ((statter.st_nlink ==2) && (asymlink.st_nlink == 2)) { - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - } else { - lstat(tc_ptr->fn_arg[2], &stbuf); - - tst_resm(TFAIL, - "%slink(%s, %s) failed to adjust link count.\n\ - count for nick is %d, count for %s is %d, count for %s is %d.", - Buffer, tc_ptr->fn_arg[1], "nick", - statter.st_nlink, tc_ptr->fn_arg[1], asymlink.st_nlink, - tc_ptr->fn_arg[2], stbuf.st_nlink); - } - } else { - tst_resm(TFAIL, - "%sA lstat of %s (ino:%llu) and of\n\t\t\ -%s (ino:%llu), does not show them being the same ino.", Buffer, - tc_ptr->fn_arg[1], asymlink.st_ino, "nick", statter.st_ino); - } - } - } - delete_files("nick", NULL); - } -} - -/*********************************************************************** - * This routine checks out the unlink(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_unlink(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (stat(tc_ptr->fn_arg[2], &asymlink) == -1) - tst_resm(TBROK, - "stat(2) Failure when accessing %s object file", tc_ptr->fn_arg[2]); - else if (unlink(tc_ptr->fn_arg[1]) == -1) - tst_resm(TFAIL, "unlink(2) failed when removing symbolic link file"); - else { - sprintf(Buf, "unlink(%s) was successful\n", tc_ptr->fn_arg[1]); - strcat(Buffer, Buf); - if (stat(tc_ptr->fn_arg[2], &statter) == -1) - tst_resm(TFAIL,"%s %s", - "unlink(2) failed because it not only removed symbolic link", - "file which pointed at object file, but object file as well"); - - else - if ((statter.st_ino == asymlink.st_ino) && - (statter.st_dev == asymlink.st_dev) && - (statter.st_size == asymlink.st_size)) - - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s%s %s %s", Buffer, - "unlink(2) failed because it not only removed symbolic link", - "file which pointed at object file, but it changed object", - "file inode information"); - } - -} - -/*********************************************************************** - * This routine checks out the chmod(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_chmod(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (stat(tc_ptr->fn_arg[2], &asymlink) == -1) - tst_resm(TBROK, - "stat(2) Failure when accessing %s object file", tc_ptr->fn_arg[2]); - else if (chmod(tc_ptr->fn_arg[1], (MODE | MASK)) == -1) - tst_resm(TFAIL, "%s%s %s", Buffer, - "chmod(2) failed when changing file permission", - "through symbolic link file"); - else { - sprintf(Buf, "chmod(%s, %#o) was successful\n", tc_ptr->fn_arg[1], - (MODE | MASK)); - strcat(Buffer, Buf); - - if (stat(tc_ptr->fn_arg[2], &statter) == -1) - tst_resm(TBROK, - "stat(2) Failure when accessing %s object file", tc_ptr->fn_arg[2]); - else - if ((statter.st_mode == (MODE | MASK)) && - (statter.st_mode != asymlink.st_mode)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s%s %o to %o %s", Buffer, - "chmod(2) failed to change object file permissions from", - asymlink.st_mode, (MODE | MASK), - "through symbolic link file"); - } - -} - -/*********************************************************************** - * This routine checks out the utime(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_utime(tc_ptr) -struct all_test_cases *tc_ptr; -{ - struct utimbuf utimes; - - if (stat(tc_ptr->fn_arg[2], &asymlink) == -1) - tst_resm(TBROK, "stat(2) Failure when accessing %s object file", - tc_ptr->fn_arg[2]); - else { - /* Now add a few values to access and modify times */ - - utimes.actime = asymlink.st_atime + a_time_value; - utimes.modtime = asymlink.st_mtime + a_time_value; - - /* Now hand off to utime(2) via symbolic link file*/ - - if (utime(tc_ptr->fn_arg[1], &utimes) == -1) - tst_resm(TFAIL, "%s %s", - "utime(2) failed to process object file access and modify", - "time updates through symbolic link"); - else { - /* Now verify changes were made */ - - if (stat(tc_ptr->fn_arg[2], &statter) == -1) - tst_resm(TBROK, - "stat(2) Failure when accessing %s object file", - tc_ptr->fn_arg[2]); - else { - time_t temp, diff; - - temp = statter.st_atime - asymlink.st_atime; - diff = (statter.st_mtime - asymlink.st_mtime) - temp; - - if (! diff) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s %d greater than original times", - "utime(2) failed to change object file access and", - "modify times through symbolic link to a value", - a_time_value); - } - } - } -} - -/*********************************************************************** - * This routine checks out the rename(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_rename(tc_ptr) -struct all_test_cases *tc_ptr; -{ - int pts_at_object = 0; - - - if (stat(tc_ptr->fn_arg[2], &statter) != -1) - pts_at_object=1; - - TEST (rename(tc_ptr->fn_arg[1], A_S_FILE) ); - errno=TEST_ERRNO; - if (TEST_RETURN == -1) - tst_resm(TFAIL, "rename(3) failed to rename %s symbolic link file to %s", - tc_ptr->fn_arg[2], A_S_FILE); - else if (pts_at_object) - if (ck_both(tc_ptr->fn_arg[0], A_S_FILE, tc_ptr->fn_arg[2])) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, test_msg); - else if ( ! ck_symlink(tc_ptr->fn_arg[0], A_S_FILE, NULL)) - tst_resm(TFAIL, test_msg); - else if (stat(tc_ptr->fn_arg[1], &asymlink) != -1) - tst_resm(TFAIL, - "rename(3) did not remove %s when renaming to %s", - tc_ptr->fn_arg[1], A_S_FILE); - else if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; -} - -/*********************************************************************** - * This routine checks out the open(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_open(tc_ptr) -struct all_test_cases *tc_ptr; -{ - int fd = -1; - int ret, pts_at_object = 0; - char scratch[PATH_MAX]; - - - if (stat(tc_ptr->fn_arg[2], &statter) != -1) - pts_at_object=1; - - if (pts_at_object) { - TEST( open(tc_ptr->fn_arg[1], O_RDWR) ); - errno=TEST_ERRNO; - if ((fd=TEST_RETURN) == -1) { - tst_resm(TFAIL, - "open(2) Failure when opening object file through symbolic link file"); - return; - } - } - else { - TEST(open(tc_ptr->fn_arg[1], (O_CREAT | O_RDWR), MODE) ); - errno=TEST_ERRNO; - if ((fd=TEST_RETURN) == -1) { - tst_resm(TFAIL, - "open(2) Failure when creating object file through symbolic link file"); - return; - } - } - if ((ret=write(fd, BIG_STRING, strlen(BIG_STRING))) == -1) { - tst_resm(TFAIL, - "write(2) Failure to object file opened through a symbolic link file: errno:%d", - errno); - } - else if (ret != strlen(BIG_STRING)) { - tst_resm(TFAIL, - "write(2) Failed to write %d bytes to object file opened through a symbolic link file", - strlen(BIG_STRING)); - } - else if (lseek(fd, 0L, 0) == -1) { - tst_resm(TFAIL, - "lseek(2) Failed to position to beginning of object file opened through a symbolic link file: errno = %d", - errno); - } - else if ((ret=read(fd, scratch, strlen(BIG_STRING))) == -1) { - tst_resm(TFAIL, - "read(2) Failure of object file opened through a symbolic link file: errno = %d", - errno); - } - else if (ret != strlen(BIG_STRING)) { - tst_resm(TFAIL, - "read(2) Failed to read %d bytes to object file opened through a symbolic link file", - strlen(BIG_STRING)); - } - else if (strncmp(BIG_STRING, scratch, strlen(BIG_STRING)) != 0) { - tst_resm(TFAIL, - "Content of write(2) and read(2) Failed to object file through symbolic link file was not as expected. Expected %s and read returned %s", - BIG_STRING, scratch); - } - else { - /* - * Close off symbolic link file to object file access - */ - if (close(fd) == -1) { - tst_resm(TFAIL, - "close(2) Failure when closing object file accessed symbolic link file"); - } - /* - * Now, lets open up and read object file and compare contents - */ - else if ((fd=open(tc_ptr->fn_arg[0], O_RDONLY)) == -1) { - tst_resm(TFAIL, "open(2) Failure when opening %s file: errno:%d %s", - tc_ptr->fn_arg[0], errno, strerror(errno)); - } - else if ((ret=read(fd, scratch, strlen(BIG_STRING))) == -1) { - tst_resm(TFAIL, - "read(2) Failure of object file opened through a symbolic link file: errno:%d", errno); - } - else if (ret != strlen(BIG_STRING)) { - tst_resm(TFAIL, - "read(2) Failed to read %d bytes to object file opened through a symbolic link file", - strlen(BIG_STRING)); - } - else if (strncmp(BIG_STRING, scratch, strlen(BIG_STRING)) != 0) { - tst_resm(TFAIL, - "Content of write(2) and read(2) Failed to object file through symbolic link file was not as expected. Expected %s and read returned %s", - BIG_STRING, scratch); - } - else if (pts_at_object) { - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - } - else { /* Insure newly created object file is pointed at */ - if (ck_both(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1], tc_ptr->fn_arg[0])) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, test_msg); - } - close(fd); - } -} - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - - -/* - * - */ -void help() -{ - unsigned ind; - - printf(" -T id Determines which tests cases to execute:\n"); - - for (ind=0; ind -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="symlink02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255], symlnk[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call symlink(2) - */ - TEST(symlink(fname, symlnk)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "symlink(%s, %s) Failed, errno=%d : %s", - fname, symlnk, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "symlink(%s, %s) returned %d", - fname, symlnk, TEST_RETURN); - } - if (unlink(symlnk) == -1) { - tst_brkm(TBROK, cleanup, - "unlink(%s) Failed, errno=%d : %s", - symlnk, errno, strerror(errno)); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - if (close(fd) == -1 ) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - sprintf(symlnk,"st_%d",getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/symlink03.c b/winsup/testsuite/winsup.api/ltp/symlink03.c deleted file mode 100644 index 4d0542768..000000000 --- a/winsup/testsuite/winsup.api/ltp/symlink03.c +++ /dev/null @@ -1,404 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name : symlink03 - * - * Test Description : - * Verify that, - * 1) symlink(2) returns -1 and sets errno to EACCES if search/write - * permission is denied in the directory where the symbolic link is - * being created. - * 2) symlink(2) returns -1 and sets errno to EEXIST if the specified - * symbolic link already exists. - * 3) symlink(2) returns -1 and sets errno to EFAULT if the specified - * file or symbolic link points to invalid address. - * 4) symlink(2) returns -1 and sets errno to ENAMETOOLONG if the - * pathname component of symbolic link is too long (ie, > PATH_MAX). - * 5) symlink(2) returns -1 and sets errno to ENOTDIR if the directory - * component in pathname of symbolic link is not a directory. - * 6) symlink(2) returns -1 and sets errno to ENOENT if the component of - * symbolic link points to an empty string. - * - * Expected Result: - * symlink() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * symlink03 [-c n] [-e] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * This test should be executed by 'non-super-user' only. - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define MODE_RWX S_IRWXU | S_IRWXG | S_IRWXO -#define FILE_MODE S_IRUSR | S_IRGRP | S_IROTH -#define DIR_TEMP "testdir_1" -#define TESTFILE "testfile" -#define TEST_FILE1 "testdir_1/tfile_1" -#define SYM_FILE1 "testdir_1/sfile_1" -#define TEST_FILE2 "tfile_2" -#define SYM_FILE2 "sfile_2" -#define TEST_FILE3 "tfile_3" -#define SYM_FILE3 "t_file/sfile_3" - -const char *TCID="symlink03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={ENOTDIR, ENOENT, ENAMETOOLONG, EFAULT, EEXIST, EACCES, 0}; - -int no_setup(); -int setup1(); /* setup function to test symlink for EACCES */ -int setup2(); /* setup function to test symlink for EEXIST */ -int setup3(); /* setup function to test symlink for ENOTDIR */ -int longpath_setup(); /* setup function to test chmod for ENAMETOOLONG */ - -char Longpathname[PATH_MAX+2]; -char High_address_node[64]; - -struct test_case_t { /* test case struct. to hold ref. test cond's*/ - const char *file; - const char *link; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { - { TEST_FILE1, SYM_FILE1, "No Search permissions to process", EACCES, setup1 }, - { TEST_FILE2, SYM_FILE2, "Specified symlink already exists", EEXIST, setup2 }, - { TESTFILE, High_address_node, "Address beyond address space", EFAULT, no_setup }, - { TESTFILE, (char *)-1, "Negative address", EFAULT, no_setup }, - { TESTFILE, Longpathname, "Symlink path too long", ENAMETOOLONG, longpath_setup }, - { TESTFILE, "", "Symlink Pathname is empty", ENOENT, no_setup }, -#ifndef __CYGWIN__ - { TEST_FILE3, SYM_FILE3, "Symlink Path contains regular file", ENOTDIR, setup3 }, -#endif - { NULL, NULL, NULL, 0, no_setup } -}; - -extern void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ -char *get_high_address (void); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *test_file; /* testfile name */ - const char *sym_file; /* symbolic link file name */ - const char *test_desc; /* test specific error message */ - int ind; /* counter to test different test conditions */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - /*NOTREACHED*/ - } - - /* - * Invoke setup function to call individual test setup functions - * to simulate test conditions. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - test_file = Test_cases[ind].file; - sym_file = Test_cases[ind].link; - test_desc = Test_cases[ind].desc; - - if (sym_file == High_address_node) { - sym_file = (char *)get_high_address(); - } - /* - * Call symlink(2) to test different test conditions. - * verify that it fails with -1 return value and sets - * appropriate errno. - */ - TEST(symlink(test_file, sym_file)); - - /* Check return code of symlink(2) */ - if (TEST_RETURN == -1) { - /* - * Perform functional verification if - * test executed without (-f) option. - */ - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == Test_cases[ind].exp_errno) { - tst_resm(TPASS, "symlink() Fails, %s, " - "errno=%d", test_desc, - TEST_ERRNO); - } else { - tst_resm(TFAIL, "symlink() Fails, %s, " - "errno=%d, expected errno=%d", - test_desc, TEST_ERRNO, - Test_cases[ind].exp_errno); - } - } else { - tst_resm(TFAIL, "symlink() returned %d, " - "expected -1, errno:%d", TEST_RETURN, - Test_cases[ind].exp_errno); - } - } /* End of TEST CASE LOOPING. */ - - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Call test specific setup functions. - */ -void -setup() -{ - int ind; - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - Test_cases[ind].setupfunc(); - } -} /* End setup() */ - -/* - * int - * no_setup() - Some test conditions for mknod(2) do not any setup. - * Hence, this function just returns 0. - * This function simply returns 0. - */ -int -no_setup() -{ - return 0; -} - -/* - * int - * setup1() - setup function for a test condition for which symlink(2) - * returns -1 and sets errno to EACCES. - * Create a test directory under temporary directory and create a test file - * under this directory with mode "0666" permissions. - * Modify the mode permissions on test directory such that process will not - * have search permissions on test directory. - * - * The function returns 0. - */ -int -setup1() -{ - int fd; /* file handle for testfile */ - - if (mkdir(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TBROK, cleanup, "mkdir(2) of %s failed", DIR_TEMP); - /*NOTREACHED*/ - } - - if ((fd = open(TEST_FILE1, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - /*NOTREACHED*/ - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Modify mode permissions on test directory */ - if (chmod(DIR_TEMP, FILE_MODE) < 0) { - tst_brkm(TBROK, cleanup, "chmod(2) of %s failed", DIR_TEMP); - /*NOTREACHED*/ - } - return 0; -} - -/* - * int - * setup2() - EEXIST - */ -int -setup2() -{ - int fd; /* file handle for testfile */ - - if ((fd = open(TEST_FILE2, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - /*NOTREACHED*/ - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - /*NOTREACHED*/ - } - - if (symlink(TEST_FILE2, SYM_FILE2) < 0) { - tst_brkm(TBROK, cleanup, - "symlink() Fails to create %s in setup2, error=%d", - SYM_FILE2, errno); - /*NOTREACHED*/ - } - return 0; -} - -/* - * int - * longpath_setup() - setup to create a node with a name length exceeding - * the MAX. length of PATH_MAX. - * This function retruns 0. - */ -int -longpath_setup() -{ - int ind; /* counter variable */ - - for (ind = 0; ind <= (PATH_MAX + 1); ind++) { - Longpathname[ind] = 'a'; - } - return 0; -} - -/* - * int - * setup3() - setup function for a test condition for which symlink(2) - * returns -1 and sets errno to ENOTDIR. - * - * Create a symlink file under temporary directory so that test tries to - * create symlink file "tfile_3" under "t_file" which happens to be - * another symlink file. - */ -int -setup3() -{ - int fd; /* file handle for testfile */ - - /* Creat/open a testfile and close it */ - if ((fd = open("t_file", O_RDWR|O_CREAT, MODE_RWX)) == -1) { - tst_brkm(TBROK, cleanup, - "open(2) on t_file failed, errno=%d : %s", - errno, strerror(errno)); - /*NOTREACHED*/ - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(t_file) Failed, errno=%d : %s", - errno, strerror(errno)); - /*NOTREACHED*/ - } - return 0; -} - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Restore the mode permissions on test directory. - * Remove the temporary directory created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Restore mode permissions on test directory created in setup2() */ - if (chmod(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TBROK, NULL, "chmod(2) of %s failed", DIR_TEMP); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/symlink04.c b/winsup/testsuite/winsup.api/ltp/symlink04.c deleted file mode 100644 index c6ddd0630..000000000 --- a/winsup/testsuite/winsup.api/ltp/symlink04.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name : symlink01 - * - * Test Description : - * Verify that, symlink will succeed to creat a symbolic link of an existing - * object name path. - * - * Expected Result: - * symlink() should return value 0 on success and symbolic link of an - * existing object should be created. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * symlink01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * None. - * - */ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" -#define SYMFILE "slink_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="symlink01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; - -extern void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - /*NOTREACHED*/ - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call symlink(2) to create a symlink of - * testfile. - */ - TEST(symlink(TESTFILE, SYMFILE)); - - /* Check return code of symlink(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "symlink(%s, %s) Failed, errno=%d : %s", - TESTFILE, SYMFILE, TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the symlink file status information - * using lstat(2). - */ - if (lstat(SYMFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "lstat(2) of " - "%s failed, error:%d", SYMFILE, - errno); - /*NOTREACHED*/ - } - - /* Check if the st_mode contains a link */ - if (!S_ISLNK(stat_buf.st_mode)) { - tst_resm(TFAIL, - "symlink of %s doesn't exist", - TESTFILE); - } else { - tst_resm(TPASS, "symlink(%s, %s) " - "functionality successful", - TESTFILE, SYMFILE); - } - } else { - tst_resm(TPASS, "Call succeeded"); - } - } - - /* Unlink the symlink file for next loop */ - if (unlink(SYMFILE) == -1) { - tst_brkm(TBROK, cleanup, - "unlink(%s) Failed, errno=%d : %s", - SYMFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } - Tst_count++; /* incr TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and close it - */ -void -setup() -{ - int fd; /* file handle for testfile */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* creat/open a testfile */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Close the temporary file created above */ - if (close(fd) == -1) { - tst_resm(TBROK, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } -} /* End setup() */ - - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/symlink05.c b/winsup/testsuite/winsup.api/ltp/symlink05.c deleted file mode 100644 index 3b2bbcb8c..000000000 --- a/winsup/testsuite/winsup.api/ltp/symlink05.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name : symlink02 - * - * Test Description : - * Verify that, symlink will succeed to creat a symbolic link of an - * non-existing object name path. - * - * Expected Result: - * symlink() should return value 0 on success and symlink of an - * non-existing object should be created. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * symlink02 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" -#define SYMFILE "slink_file" - -const char *TCID="symlink02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; - -extern void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - /*NOTREACHED*/ - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call symlink(2) to create a symlink of - * an non-existing testfile. - */ - TEST(symlink(TESTFILE, SYMFILE)); - - /* Check return code of symlink(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, \ - "symlink(%s, %s) Failed, errno=%d : %s", - TESTFILE, SYMFILE, TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the symlink file status information - * using lstat(2). - */ - if (lstat(SYMFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "lstat(2) of " - "%s failed, error:%d", - SYMFILE, errno); - /*NOTREACHED*/ - } - - /* Check if the st_mode contains a link */ - if (!S_ISLNK(stat_buf.st_mode)) { - tst_resm(TFAIL, \ - "symlink of %s doesn't exist", - TESTFILE); - } else { - tst_resm(TPASS, "symlink(%s, %s) " - "functionality successful", - TESTFILE, SYMFILE); - } - } else { - tst_resm(TPASS, "Call succeeded"); - } - } - - /* Unlink the symlink file for next loop */ - if (unlink(SYMFILE) == -1) { - tst_brkm(TBROK, cleanup, - "unlink(%s) Failed, errno=%d : %s", - SYMFILE, errno, strerror(errno)); - } - Tst_count++; /* incr TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - -} /* End setup() */ - - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/sync01.c b/winsup/testsuite/winsup.api/ltp/sync01.c deleted file mode 100644 index c7df322ea..000000000 --- a/winsup/testsuite/winsup.api/ltp/sync01.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : sync01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for sync(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) sync(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the sync(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * sync(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="sync01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call sync(2) - */ - TEST_VOID(sync()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "sync() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "sync() returned %d", TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/sync02.c b/winsup/testsuite/winsup.api/ltp/sync02.c deleted file mode 100644 index 5535e1add..000000000 --- a/winsup/testsuite/winsup.api/ltp/sync02.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: sync01 - * - * Test Description: - * Open a file for write; modify the file, then do a sync(). - * Verify that the data has been written to disk by re-opening the file. - * - * Expected Result: - * sync() alawys returns 0 in Linux. The data written to the file should - * be updated to the disk. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * sync01 [-c n] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * None. - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "temp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="sync01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -char write_buffer[BUFSIZ]; /* buffer used to write data to file*/ -int fildes; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char read_buffer[BUFSIZ]; /* buffer used to read data from file*/ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call sync(2) to commit buffer data to disk. - */ - TEST_VOID(sync()); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "%s, Failed, errno=%d : %s", - TCID, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* Set the file ptr to b'nning of file */ - if (lseek(fildes, 0, SEEK_SET) < 0) { - tst_brkm(TFAIL, cleanup, "lseek() " - "failed on %s, error=%d", - TEMP_FILE, errno); - /*NOTREACHED*/ - } - - /* Read the contents of file */ - if (read(fildes, read_buffer, \ - sizeof(read_buffer)) > 0) { - if (memcmp(read_buffer, write_buffer, strlen(write_buffer))) { - tst_resm(TFAIL, "Data read " - "from %s doesn't match " - "with witten data", - TEMP_FILE); - } else { - tst_resm(TPASS, "Functionality " - "of sync() successful"); - } - } else { - tst_brkm(TFAIL, cleanup, - "read() Fails on %s, error=%d", - TEMP_FILE, errno); - /*NOTREACHED*/ - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Copy some data into data buffer */ - strcpy(write_buffer, "abcdefghijklmnopqrstuvwxyz"); - - /* Creat a temporary file under above directory */ - if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR | O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Write the buffer data into file */ - if (write(fildes, write_buffer, strlen(write_buffer)) != \ - (int)strlen(write_buffer)) { - tst_brkm(TBROK, cleanup, - "write() failed to write buffer data to %s", - TEMP_FILE); - /*NOTREACHED*/ - } - -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file */ - if (close(fildes) == -1) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/time01.c b/winsup/testsuite/winsup.api/ltp/time01.c deleted file mode 100644 index c5658e260..000000000 --- a/winsup/testsuite/winsup.api/ltp/time01.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : time01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for time(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) time(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the time(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * time(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="time01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call time(2) - */ - TEST(time(0)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "time(0) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "time(0) returned %d", TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/time02.c b/winsup/testsuite/winsup.api/ltp/time02.c deleted file mode 100644 index 011546e8f..000000000 --- a/winsup/testsuite/winsup.api/ltp/time02.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: time01 - * - * Test Description: - * Verify that time(2) returns the value of time in seconds since - * the Epoch and stores this value in the memory pointed to by the parameter. - * - * Expected Result: - * time() should return the time (seconds) since the Epoch and this value - * should be equal to the value stored in the specified parameter. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * - * Usage: - * time01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * None. - * - */ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); /* setup function for the test */ -void cleanup(void) __attribute__((noreturn));/* cleanup function for the test */ - -const char *TCID="time01"; /* Test program identifier. */ -int TST_TOTAL = 1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - time_t tloc; /* time_t variables for time(2) */ - - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc=0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call time() to get the time in seconds - * since Epoch. - */ - TEST(time(&tloc)); - - /* Check return code from time(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "time(0) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test executed - * without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - if (tloc == TEST_RETURN) { - tst_resm(TPASS, "time() returned value " - "%d, stored value %d are same", - TEST_RETURN, tloc); - } else { - tst_resm(TFAIL, "time() returned value " - "%d, stored value %d are " - "different", TEST_RETURN, tloc); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - } - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* cleanup and exit */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/times01.c b/winsup/testsuite/winsup.api/ltp/times01.c deleted file mode 100644 index a1bd1d838..000000000 --- a/winsup/testsuite/winsup.api/ltp/times01.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : times01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for times(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) times(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the times(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * times(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="times01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -struct tms mytimes; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call times(2) - */ - TEST(times(&mytimes)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "times(&mytimes) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "times(&mytimes) returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/times02.c b/winsup/testsuite/winsup.api/ltp/times02.c deleted file mode 100644 index 1dae36c5a..000000000 --- a/winsup/testsuite/winsup.api/ltp/times02.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * times02.c - * - * DESCRIPTION - * Testcase to test that times() sets errno correctly - * - * ALGORITHM - * block1: Pass an invalid address as the "tms" structure, and expect - * that times() would return EFAULT. - * - * USAGE: - * times02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * NONE - */ - -#include -#include -#include -#include - -const char *TCID = "times02"; -int TST_TOTAL = 1; -extern int Tst_count; -int exp_enos[]={EFAULT, 0}; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int argc, char **argv) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *)NULL, NULL)) != - (char *)NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - /* check for looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(times((void *)-1)); - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - if (errno != EFAULT) { - tst_resm(TFAIL, "Expected EFAULT, got %d", - errno); - } else { - tst_resm(TPASS, "Received EFAULT as expected"); - } - - } else { - tst_resm(TFAIL, "times(2) failed to FAIL"); - } - - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - * performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -c option. - */ - TEST_PAUSE; -} - -/* - * cleanup() - * performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); - /*NOTREACHED*/ -} diff --git a/winsup/testsuite/winsup.api/ltp/times03.c b/winsup/testsuite/winsup.api/ltp/times03.c deleted file mode 100644 index 453d311cc..000000000 --- a/winsup/testsuite/winsup.api/ltp/times03.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * times01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the times() system call. - * - * ALGORITHM - * This testcase checks the values that times(2) system call returns. - * Start a process, and spend some CPU time by performing a spin in - * a for-loop. Then use the times() system call, to determine the - * cpu time/sleep time, and other statistics. - * - * USAGE: - * times01 [-c n] [-f] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * NONE - */ - -#include -#include -#include -#include -#include -#include - -const char *TCID = "times01"; -int TST_TOTAL = 1; -extern int Tst_count; -int exp_enos[]={0}; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int argc, char **argv) -{ - const char *msg; /* message returned from parse_opts */ - - struct tms buf1, buf2; - time_t start_time, end_time; - int i, pid2, status, fail=0; - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *)NULL, NULL)) != - (char *)NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - - for (i = 0; i < 1000000; i++); - /* - * At least some CPU time must be used. This is - * achieved by executing the times(2) call for - * atleast 5 secs. This logic makes it independant - * of the processor speed. - */ - start_time = time(NULL); - for (;;) { - if (times(&buf1) == (clock_t)-1) { - TEST_ERROR_LOG(errno); - tst_resm(TFAIL, "Call to times(2) " - "failed, errno = %d", errno); - } - end_time = time(NULL); - if ((end_time - start_time) > 5) { - break; - } - } - if (times(&buf1) == (clock_t)-1) { - TEST_ERROR_LOG(errno); - tst_resm(TFAIL, "Call to times(2) failed, " - "errno = %d", errno); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - if (buf1.tms_utime == 0) { - tst_resm(TFAIL, "Error: times() report " - "0 user time"); - fail=1; - } - if (buf1.tms_stime == 0) { - tst_resm(TFAIL, "Error: times() report " - "0 system time"); - fail=1; - } - if (buf1.tms_cutime != 0) { - tst_resm(TFAIL, "Error: times() report " - "%d child user time", - buf1.tms_cutime); - fail=1; - } - if (buf1.tms_cstime != 0) { - tst_resm(TFAIL, "Error: times() report " "%d child system time", - buf1.tms_cstime); - fail=1; - } - - pid2 = fork(); - if (pid2 < 0) { - tst_brkm(TFAIL, cleanup, "Fork failed"); - /*NOTREACHED*/ - } else if (pid2 == 0) { - for (i = 0; i < 2000000; i++); - /* - * Atleast some CPU time must be used - * even in the child process (thereby - * making it independent of the - * processor speed). In fact the child - * uses twice as much CPU time. - */ - start_time = time(NULL); - for (;;) { - if (times(&buf2) == (clock_t)-1) { - tst_resm(TFAIL, - "Call to times " - "failed, " - "errno = %d", - errno); - exit(1); - } - end_time = time(NULL); - if ((end_time - start_time) - > 10) { - break; - } - } - exit(0); - } - waitpid(pid2, &status, 0); - if (WEXITSTATUS(status) != 0) { - tst_resm(TFAIL, "Call to times(2) " - "failed in child"); - } - if (times(&buf2) == (clock_t)-1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "Call to times failed " - "errno = %d", errno); - fail=1; - } - if (buf1.tms_utime > buf2.tms_utime) { - tst_resm(TFAIL, "Error: parents's " - "user time(%d) before child " - "> parent's user time (%d) " - "after child", - buf1.tms_utime, - buf2.tms_utime); - fail=1; - } - if (buf2.tms_cutime == 0) { - tst_resm(TFAIL, "Error: times() " - "report %d child user " - "time should be > than " - "zero", buf2.tms_cutime); - fail=1; - } - if (buf2.tms_cstime == 0) { - tst_resm(TFAIL, "Error: times() " - "report %d child system time " - "should be > than zero", - buf2.tms_cstime); - fail=1; - } - if (fail == 0) { - tst_resm(TPASS, "%s: Functionality " - "test passed", TCID); - } - - } else { - tst_resm(TPASS, "%s call succeeded", TCID); - } - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - * performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -c option. - */ - TEST_PAUSE; -} - -/* - * cleanup() - * performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); - /*NOTREACHED*/ -} diff --git a/winsup/testsuite/winsup.api/ltp/truncate01.c b/winsup/testsuite/winsup.api/ltp/truncate01.c deleted file mode 100644 index 1e2931605..000000000 --- a/winsup/testsuite/winsup.api/ltp/truncate01.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: truncate01 - * - * Test Description: - * Verify that, truncate(2) succeeds to truncate a file to a specified - * length. - * - * Expected Result: - * truncate(2) should return a value 0 and the length of the file after - * truncation should be equal to the length it is truncated to. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * truncate01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" /* file under test */ -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define BUF_SIZE 256 /* buffer size */ -#define FILE_SIZE 1024 /* test file size */ -#define TRUNC_LEN 256 /* truncation length */ - -const char *TCID="truncate01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; - -void setup(); /* setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat(2) struct contents */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - off_t file_length; /* test file length */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call truncate(2) to truncate a test file to a - * specified length. - */ - TEST(truncate(TESTFILE, TRUNC_LEN)); - - /* check return code of truncate(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "truncate(%s, %d) Failed, errno=%d : %s", - TESTFILE, TRUNC_LEN, TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the testfile information using - * stat(2). - */ - if (stat(TESTFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "stat(2) of " - "%s failed, error:%d", - TESTFILE, errno); - /*NOTREACHED*/ - } - stat_buf.st_mode &= ~S_IFREG; - file_length = stat_buf.st_size; - - /* - * Check for expected size of testfile after - * truncate(2) on it. - */ - if (file_length != TRUNC_LEN) { - tst_resm(TFAIL, "%s: Incorrect file " - "size %d, Expected %d", - TESTFILE, file_length, - TRUNC_LEN); - } else { - tst_resm(TPASS, "Functionality of " - "truncate(%s, %d) successful", - TESTFILE, TRUNC_LEN); - } - } else { - tst_resm(TPASS, "%s call succeeded", TCID); - } - } - Tst_count++; /* incr TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Fill the buffer with some arbitrary data to be written to a file. - * Create a test file under temporary directory and close it - * write arbitrary data into testfile. - */ -void -setup() -{ - int fd, i; /* file handler for testfile */ - int c, c_total = 0; /* no. bytes to be written to file */ - char tst_buff[BUF_SIZE]; /* buffer to hold data */ - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Creat a testfile under temporary directory */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Write to the file 1k data from the buffer */ - while (c_total < FILE_SIZE) { - if ((c = write(fd, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } else { - c_total += c; - } - } - - /* Close the testfile after writing data into it */ - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/truncate02.c b/winsup/testsuite/winsup.api/ltp/truncate02.c deleted file mode 100644 index 4ba802949..000000000 --- a/winsup/testsuite/winsup.api/ltp/truncate02.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Test Name: truncate02 - * - * Test Description: - * Verify that, truncate(2) succeeds to truncate a file to a certain length, - * but the attempt to read past the truncated length will fail. - * - * Expected Result: - * truncate(2) should return a value 0 and the attempt to read past the - * truncated length will fail. In case where the file before truncation was - * shorter, the bytes between the old and new should be all zeroes. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * truncate02 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" /* file under test */ -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define BUF_SIZE 256 /* buffer size */ -#define FILE_SIZE 1024 /* test file size */ -#define TRUNC_LEN1 256 /* truncation length */ -#define TRUNC_LEN2 512 /* truncation length */ - -const char *TCID="truncate02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fd; /* file descriptor of testfile */ -char tst_buff[BUF_SIZE]; /* buffer to hold testfile contents */ -int exp_enos[]={0}; - -void setup(); /* setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat(2) struct contents */ - int lc, i; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - off_t file_length2; /* test file length */ - off_t file_length1; /* test file length */ - int rbytes; /* bytes read from testfile */ - int read_len = 0; /* total no. of bytes read from testfile */ - int err_flag = 0; /* error indicator flag */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call truncate(2) to truncate a test file to a - * specified length (TRUNC_LEN1). - */ - TEST(truncate(TESTFILE, TRUNC_LEN1)); - - /* check return code of truncate(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, \ - "truncate(%s, %d) Failed, errno=%d : %s", - TESTFILE, TRUNC_LEN1, TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the testfile information using - * stat(2). - */ - if (stat(TESTFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "stat(2) of " - "%s failed after 1st truncate, " - "error:%d", TESTFILE, errno); - /*NOTREACHED*/ - } - file_length1 = stat_buf.st_size; - - /* - * Set the file pointer of testfile to the - * beginning of the file. - */ - if (lseek(fd, 0, SEEK_SET) < 0) { - tst_brkm(TFAIL, cleanup, "lseek(2) on " - "%s failed after 1st truncate, " - "error:%d", TESTFILE, errno); - /*NOTREACHED*/ - } - - /* Read the testfile from the beginning. */ - while ((rbytes = read(fd, tst_buff, \ - sizeof(tst_buff))) > 0) { - read_len += rbytes; - } - - /* - * Execute truncate(2) again to truncate - * testfile to a size TRUNC_LEN2. - */ - TEST(truncate(TESTFILE, TRUNC_LEN2)); - - /* check return code of truncate(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "truncate of %s to " - "size %d Failed, errno=%d : %s", - TESTFILE, TRUNC_LEN2, - TEST_ERRNO, - strerror(TEST_ERRNO)); - } - - /* - * Get the testfile information using - * stat(2) - */ - if (stat(TESTFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "stat(2) of " - "%s failed after 2nd truncate, " - "error:%d", TESTFILE, errno); - /*NOTREACHED*/ - } - file_length2 = stat_buf.st_size; - - /* - * Set the file pointer of testfile to the - * offset TRUNC_LEN1 of testfile. - */ - if (lseek(fd, TRUNC_LEN1, SEEK_SET) < 0) { - tst_brkm(TFAIL, cleanup, "lseek(2) on " - "%s failed after 2nd truncate, " - "error:%d", TESTFILE, errno); - /*NOTREACHED*/ - } - - /* Read the testfile contents till EOF */ - while((rbytes = read(fd, tst_buff, \ - sizeof(tst_buff))) > 0) { - for (i = 0; i < rbytes; i++) { - if (tst_buff[i] != 0) { - err_flag++; - } - } - } - - /* - * Check for expected size of testfile after - * issuing truncate(2) on it. - */ - if ((file_length1 != TRUNC_LEN1) || \ - (file_length2 != TRUNC_LEN2) || \ - (read_len != TRUNC_LEN1) || \ - (err_flag != 0)) { - tst_resm(TFAIL, "Functionality of " - "truncate(2) on %s Failed", - TESTFILE); - } else { - tst_resm(TPASS, \ - "Functionality of truncate(2) " - "on %s successful", TESTFILE); - } - } else { - tst_resm(TPASS, "%s call succeeded", TCID); - } - } - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - */ -void -setup() -{ - int i; /* counter variable */ - int wbytes; /* bytes written to testfile */ - int write_len = 0; /* total no. of bytes written to testfile */ - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Creat a testfile and write some data into it */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fd, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } else { - write_len += wbytes; - } - } -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the temporary file opened for reading/writing. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Close the testfile after writing data into it */ - if (close(fd) == -1) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/ulimit01.c b/winsup/testsuite/winsup.api/ltp/ulimit01.c deleted file mode 100644 index c3f09fba3..000000000 --- a/winsup/testsuite/winsup.api/ltp/ulimit01.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : ulimit01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for ulimit(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 6 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) ulimit(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the ulimit(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * ulimit(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="ulimit01"; /* Test program identifier. */ -int TST_TOTAL=6; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int cmd; -long limit; /* saved limit */ - -struct limits_t { - int cmd; - long newlimit; - int nlim_flag; /* special flag for UL_SETFSIZE records */ - int exp_fail; -} Scenarios[] = { - - { UL_GETFSIZE, -1, 0, 0 }, - { UL_SETFSIZE, -1, 0, 1 }, /* negative test */ - { UL_SETFSIZE, -2, 1, 0 }, /* case case: must be after UL_GETFSIZE */ - { UL_SETFSIZE, -2, 2, 0 }, /* case case: must be after UL_GETFSIZE */ - -#if UL_GMEMLIM - { UL_GMEMLIM, -1, 0, 0 }, -#endif -#if UL_GDESLIM - { UL_GDESLIM, -1, 0, 0 }, -#endif -#if UL_GSHMEMLIM - { UL_GSHMEMLIM, -1, 0, 0 }, -#endif - -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - int i; /* inner loop (test case) counter */ - const char *msg; /* message returned from parse_opts */ - int tmp; - - TST_TOTAL = sizeof(Scenarios)/sizeof(struct limits_t); - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for ( i=0; i -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="umask01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call umask(2) - */ - TEST(umask(022)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "umask(022) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "umask(022) returned %d", TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/umask02.c b/winsup/testsuite/winsup.api/ltp/umask02.c deleted file mode 100644 index 9a1c61c53..000000000 --- a/winsup/testsuite/winsup.api/ltp/umask02.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * umask02.c - * - * DESCRIPTION - * Check that umask changes the mask, and that the previous - * value of the mask is returned correctly for each value. - * - * ALGORITHM - * For each mask value (9 bits) set mask, and check that the return - * corresponds to the previous value set. - * - * USAGE: - * umask02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * None - */ - -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "umask02"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int argc, char **argv) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int uret = 0, i, mskval = 0000; - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *)NULL, NULL)) != - (char *) NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - /* Check for looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - for (umask(++mskval), i = 1; mskval < 01000; - uret = umask(++mskval), i++) { - if ((uret != mskval - 1) && (mskval != 0000)) { - tst_brkm(TBROK, cleanup, "bad mask value " - "returned"); - /*NOTREACHED*/ - } else { - tst_resm(TPASS, "umask(%d) susuccessfully " - "returned %d.", mskval, uret); - } - } - mskval = 0000; - uret = 0; - tst_resm(TINFO, "end of loop %d\n", lc); - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - * performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -c option. - */ - TEST_PAUSE; -} - -/* - * cleanup() - * performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); - /*NOTREACHED*/ -} diff --git a/winsup/testsuite/winsup.api/ltp/umask03.c b/winsup/testsuite/winsup.api/ltp/umask03.c deleted file mode 100644 index 341da7507..000000000 --- a/winsup/testsuite/winsup.api/ltp/umask03.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * umask01.c - * - * DESCRIPTION - * Check that umask changes the mask, and that the previous - * value of the mask is returned correctly for each value. - * - * ALGORITHM - * For each mask value (9 bits) set mask, and check that the return - * corresponds to the previous value set. - * - * USAGE: - * umask01 [-c n] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * None - */ - -#include "test.h" -#include "usctest.h" -#include -#include -#include - -const char *TCID = "umask01"; -int TST_TOTAL = 1; -extern int Tst_count; - -char filname[40]; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int argc, char **argv) -{ - int lc; - const char *msg; - - struct stat statbuf; - unsigned mskval = 0000; - int fildes, i; - unsigned low9mode; - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *) NULL, NULL)) - != (char *) NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup */ - - /* check looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - for (umask(mskval = 0077), i = 1; mskval < 01000; - i++, umask(++mskval)) { - unlink(filname); - if ((fildes = creat(filname, 0777)) == -1) { - tst_resm(TBROK, "cannot create " - "file with mskval 0%o %d", - mskval, mskval); - } else { - if (fstat(fildes, &statbuf) != 0) { - tst_resm(TBROK, "cannot fstat file"); - } else { - low9mode = statbuf.st_mode & 0777; - if (low9mode != (~mskval & 0777)) { - tst_brkm(TBROK, cleanup, - "got %0 expected %o" - "mask didnot take", - low9mode, - (~mskval & 0777)); - /*NOTREACHED*/ - } else { - tst_resm(TPASS, "Test " - "condition: %d, umask: " - "0%o", i, mskval); - } - } - } - close(fildes); - } - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup - * performs all ONE TIME setup for this test - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make temp dir and cd to it */ - tst_tmpdir(); - - sprintf(filname, "umask2.%d", getpid()); -} - -/* - * cleanup - * performs all ONE TIME cleanup for this test at completion or - * premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* - * cleanup the temporary files and the temporary directory - */ - unlink(filname); - tst_rmdir(); - - /* - * exit with return code appropriate for results - */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/uname01.c b/winsup/testsuite/winsup.api/ltp/uname01.c deleted file mode 100644 index 36b166786..000000000 --- a/winsup/testsuite/winsup.api/ltp/uname01.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : uname01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for uname(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) uname(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the uname(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * uname(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="uname01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -struct utsname un; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call uname(2) - */ - TEST(uname(&un)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "uname(&un) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "uname(&un) returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/unlink05.c b/winsup/testsuite/winsup.api/ltp/unlink05.c deleted file mode 100644 index 3aae0cf0d..000000000 --- a/winsup/testsuite/winsup.api/ltp/unlink05.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : unlink05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for unlink(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) unlink(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the unlink(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * unlink(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); -void create_file(); - - - -const char *TCID="unlink05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call unlink(2) - */ - TEST(unlink(fname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "unlink(%s) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "unlink(%s) returned %d", fname, TEST_RETURN); - } - /* recreate file for next loop */ - create_file(); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - create_file(); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -void -create_file() -{ - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} diff --git a/winsup/testsuite/winsup.api/ltp/unlink06.c b/winsup/testsuite/winsup.api/ltp/unlink06.c deleted file mode 100644 index a62a268c0..000000000 --- a/winsup/testsuite/winsup.api/ltp/unlink06.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : unlink06 - * - * EXECUTED BY : anyone - * - * TEST TITLE : unlink(2) of a FIFO - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/30/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) unlink(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the unlink(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * unlink(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void create_file(); -void cleanup(void) __attribute__((noreturn)); - - -const char *TCID="unlink06"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255]; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - create_file(); - - /* - * Call unlink(2) - */ - TEST(unlink(Fname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "unlink(%s) Failed, errno=%d : %s", Fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else if ( STD_FUNCTIONAL_TEST ) { - if ( access(Fname, F_OK) != -1 ) { - tst_resm(TFAIL, - "unlink(%s) returned %d, but access says file still exists.", - Fname, TEST_RETURN); - } - else { - tst_resm(TPASS, "unlink(%s) returned %d", Fname, TEST_RETURN); - } - } - else - Tst_count++; - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname, "fifo_unlink%d", getpid()); - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - -/****************************************************************** - * - ******************************************************************/ -void -create_file() -{ - if(mkfifo(Fname, 0777) == -1) { - tst_brkm(TBROK, cleanup, - "mkfifo(%s, 0777) failed errno:%d %s\n", Fname, - errno, strerror(errno)); - } -} diff --git a/winsup/testsuite/winsup.api/ltp/unlink07.c b/winsup/testsuite/winsup.api/ltp/unlink07.c deleted file mode 100644 index 133109621..000000000 --- a/winsup/testsuite/winsup.api/ltp/unlink07.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : unlink07 - * - * EXECUTED BY : anyone - * - * TEST TITLE : unlink(2) negative testcases - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/30/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1-8) See Testcases structure below. - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the unlink(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * unlink(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include /* for PATH_MAX */ -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -extern char *get_high_address(); - -const char *TCID="unlink07"; /* Test program identifier. */ -int TST_TOTAL=6; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int longpath_setup(); -int no_setup(); -int filepath_setup(); -char Longpathname[PATH_MAX+2]; -char High_address[64]; - -struct test_case_t { - const char *pathname; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { - { "nonexistfile", "non-existent file", ENOENT, no_setup}, - { "", "path is empty string", ENOENT, no_setup}, - { "nefile/file", "path contains a non-existent file", - ENOENT, no_setup }, - { High_address, "address beyond address space", EFAULT, no_setup }, -#ifndef __CYGWIN__ - { "file/file", "path contains a regular file", - ENOTDIR, filepath_setup }, -#endif - { High_address, "address beyond address space", EFAULT, no_setup }, - { Longpathname, "pathname too long", ENAMETOOLONG, longpath_setup }, - { (char *)-1, "negative address", EFAULT, no_setup }, - { NULL, NULL, 0, no_setup } -}; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *fname; - const char *desc; - int ind; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - - fname = Test_cases[ind].pathname; - desc = Test_cases[ind].desc; - - if ( fname == High_address ) - fname = get_high_address(); - - /* - * Call unlink(2) - */ - TEST(unlink(fname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == Test_cases[ind].exp_errno ) - tst_resm(TPASS, "unlink(<%s>) Failed, errno=%d", - desc, TEST_ERRNO); - else - tst_resm(TFAIL, - "unlink(<%s>) Failed, errno=%d, expected errno:%d", - desc, TEST_ERRNO, Test_cases[ind].exp_errno); - } - else - Tst_count++; - } else { - tst_resm(TFAIL, - "unlink(<%s>) returned %d, expected -1, errno:%d", - desc, TEST_RETURN, Test_cases[ind].exp_errno); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int ind; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - Test_cases[ind].setupfunc(); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - chmod("unwrite_dir", 0777); - chmod("unsearch_dir", 0777); - - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - -/****************************************************************** - * - ******************************************************************/ -int -no_setup() -{ - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -longpath_setup() -{ - int ind; - - for(ind=0; ind<= PATH_MAX+1; ind++) { - Longpathname[ind] = 'a'; - } - return 0; - -} -/****************************************************************** - * - ******************************************************************/ -int -filepath_setup() -{ - int fd; - - if ( (fd=creat("file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, "creat(file) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - return 0; -} - diff --git a/winsup/testsuite/winsup.api/ltp/unlink08.c b/winsup/testsuite/winsup.api/ltp/unlink08.c deleted file mode 100644 index e793b46f2..000000000 --- a/winsup/testsuite/winsup.api/ltp/unlink08.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : unlink08 - * - * EXECUTED BY : anyone - * - * TEST TITLE : unlink(2) negative testcases - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 3 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/30/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1-3) See Testcases structure below. - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the unlink(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * unlink(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="unlink08"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int unwrite_dir_setup(); -int unsearch_dir_setup(); -int dir_setup(); -int no_setup(); - -struct test_case_t { - const char *pathname; - const char *desc; - int (*setupfunc)(); - int exp_ret; /* -1 means error, 0 means != -1 */ - int exp_errno; -} Test_cases[] = { - { "unwrite_dir/file", "unwritable directory", unwrite_dir_setup, - -1, EACCES}, - { "unsearch_dir/file", "unsearchable directory", unsearch_dir_setup, - -1, EACCES }, -#ifdef linux - { "regdir", "directory", dir_setup, -1, EISDIR}, -#else - { "regdir", "directory", dir_setup, -1, EPERM}, -#endif - - { NULL, NULL, no_setup, -1, 0 } -}; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *fname; - const char *desc; - int ind; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - - fname = Test_cases[ind].pathname; - desc = Test_cases[ind].desc; - - /* - * Call unlink(2) - */ - TEST(unlink(fname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( Test_cases[ind].exp_ret == -1 ) { /* neg test */ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == Test_cases[ind].exp_errno ) - tst_resm(TPASS, "unlink(<%s>) Failed, errno=%d", - desc, TEST_ERRNO); - else - tst_resm(TFAIL, - "unlink(<%s>) Failed, errno=%d, expected errno:%d", - desc, TEST_ERRNO, Test_cases[ind].exp_errno); - } - else - Tst_count++; - } - else { - tst_resm(TFAIL, "unlink(<%s>) Failed, errno=%d", - desc, TEST_ERRNO); - } - } else { - if ( Test_cases[ind].exp_ret == -1 ) { - tst_resm(TFAIL, - "unlink(<%s>) returned %d, expected -1, errno:%d", - desc, TEST_RETURN, Test_cases[ind].exp_errno); - } - else if ( STD_FUNCTIONAL_TEST ) { - tst_resm(TPASS, - "unlink(<%s>) returned %d", - desc, TEST_RETURN); - } - else - Tst_count++; - Test_cases[ind].setupfunc(1); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int ind; - int postest = 0; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - if ( geteuid() == 0 ) { - postest++; - } - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - if ( Test_cases[ind].exp_errno == EACCES && postest ) - Test_cases[ind].exp_ret=0; /* set as a pos test */ - Test_cases[ind].setupfunc(0); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - chmod("unwrite_dir", 0777); - chmod("unsearch_dir", 0777); - - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - -/****************************************************************** - * - ******************************************************************/ -int -unwrite_dir_setup(flag) -int flag; -{ - int fd; - - if ( ! flag ) { /* initial setup */ - if (mkdir("unwrite_dir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "mkdir(unwrite_dir, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - - if ( (fd=creat("unwrite_dir/file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, - "creat(unwrite_dir/file, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - - if ( chmod("unwrite_dir", 0555) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unwrite_dir, 0555) failed, errno:%d %s", - errno, strerror(errno)); - } - } - else { /* resetup */ - if ( chmod("unwrite_dir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unwrite_dir, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - - if ( (fd=creat("unwrite_dir/file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, - "creat(unwrite_dir/file, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - - if ( chmod("unwrite_dir", 0555) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unwrite_dir, 0555) failed, errno:%d %s", - errno, strerror(errno)); - } - } - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -unsearch_dir_setup(flag) -int flag; -{ - int fd; - - if ( ! flag ) { /* initial setup */ - if (mkdir("unsearch_dir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "mkdir(unsearch_dir, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - - if ( (fd=creat("unsearch_dir/file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, - "creat(unsearch_dir/file, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - - if ( chmod("unsearch_dir", 0666) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unsearch_dir, 0666) failed, errno:%d %s", - errno, strerror(errno)); - } - } - else { /* resetup */ - if ( chmod("unsearch_dir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unsearch_dir, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - - if ( (fd=creat("unsearch_dir/file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, - "creat(unsearch_dir/file, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - - if ( chmod("unsearch_dir", 0666) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unsearch_dir, 0666) failed, errno:%d %s", - errno, strerror(errno)); - } - } - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -dir_setup(flag) -int flag; -{ - if (mkdir("regdir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "mkdir(unwrite_dir, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -no_setup(flag) -int flag; -{ - return 0; -} diff --git a/winsup/testsuite/winsup.api/ltp/vfork01.c b/winsup/testsuite/winsup.api/ltp/vfork01.c deleted file mode 100644 index 2792ce08b..000000000 --- a/winsup/testsuite/winsup.api/ltp/vfork01.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * Name: vfork01 - * - * Test Description: - * Fork a process using vfork() and verify that, the attribute values like - * euid, ruid, suid, egid, rgid, sgid, umask, inode and device number of - * root and current working directories are same as that of the parent - * process. - * - * Expected Result: - * The attribute values like euid, ruid, suid, egid, rgid, sgid, umask, inode - * and device number of root and current working directory of the parent and - * child processes should be equal. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * - * Usage: - * vfork01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * None. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID="vfork01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; - -/* Variables to hold parent/child eff/real/saved uid/gid values */ -uid_t Peuid, Ceuid, Csuid, Psuid, Pruid, Cruid; -gid_t Pegid, Cegid, Psgid, Csgid, Prgid, Crgid; -mode_t Pumask,Cumask; - -char Pcwd_buf [PATH_MAX], Ccwd_buf [PATH_MAX]; -char *Pcwd, *Ccwd; /* - * pathname of working directory of - * child/parent process. - */ -/* stat structure to hold directory/inode information for parent/child */ -struct stat StatPbuf; -struct stat StatCbuf; -struct stat Stat_cwd_Pbuf; -struct stat Stat_cwd_Cbuf; - -void setup(); /* Main setup function of test */ -void cleanup() __attribute__((noreturn));/* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t cpid; /* process id of the child process */ - int exit_status; /* exit status of child process */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call vfork(2) to create a child process without - * fully copying the address space of parent. - */ - TEST(vfork()); - - /* check return code of vfork() */ - if ((cpid = TEST_RETURN) == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "vfork() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else if (cpid == 0) { /* Child process */ - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the euid, ruid, egid, rgid, umask value - * and the current working directory of the - * child process - */ -#if (linux) - if (getresuid(&Cruid, &Ceuid, &Csuid) < 0) { - tst_resm(TFAIL, "getresuid() fails to " - "get real/eff./saved uid of " - "child process"); - _exit(1); - } - - if (getresgid(&Crgid, &Cegid, &Csgid) < 0) { - tst_resm(TFAIL, "getresgid() fails to " - "get real/eff./saved gid of " - "child process"); - _exit(1); - } -#else - Cruid = getuid (); - Ceuid = geteuid (); - Csuid = 0; - Crgid = getgid (); - Cegid = getegid (); - Csgid = 0; -#endif - /* - * Get the file mode creation mask value of - * child process by setting value zero and - * restore the previous mask value. - */ - Cumask = umask(0); - - /* - * Restore the process mask of child to - * previous value. - */ - umask(Cumask); - - /* - * Get the pathname of current working - * directory for the child process. - */ - if ((Ccwd = (char *)getcwd(Ccwd_buf, \ - BUFSIZ)) == NULL) { - tst_resm(TFAIL, "getcwd failed for the " - "child process"); - _exit(1); - } - - /* - * Get the device number and the inode - * number of "/" directory for the child - * process. - */ - if (stat("/", &StatCbuf) < 0) { - tst_resm(TFAIL, "stat(2) failed to get " - "info. of'/' in the child " - "process"); - _exit(1); - } - - /* - * Get the device/inode number of "." - * (working directory) for the child process. - */ - if (stat(Ccwd, &Stat_cwd_Cbuf) < 0) { - tst_resm(TFAIL, "stat(2) failed to get " - "info. of working irectory in " - "the child"); - _exit(1); - } - - /* Now, do the actual comparision */ - if (Peuid != Ceuid || Pegid != Cegid || \ - Psuid != Csuid || Psgid != Csgid || \ - Pruid != Cruid || Prgid != Crgid || \ - Pumask != Cumask) { - tst_resm(TFAIL, "Arribute values of " - "parent and child don't match"); - _exit(1); - } else { - tst_resm(TINFO, "Arribute values of " - "parent and child match"); - } - - /* Check for the same working directories */ - if (strcmp(Pcwd, Ccwd) != 0) { - tst_resm(TFAIL, "Working directories " - "of parent and child don't " - "match"); - _exit(1); - } else { - tst_resm(TINFO, "Working directories " - "of parent and child match"); - } - - /* - * Check for the same device/inode number of - * '/' directory. - */ - if ((StatPbuf.st_ino != StatCbuf.st_ino) || \ - (StatPbuf.st_dev != StatCbuf.st_dev)) { - tst_resm(TFAIL, "Device/inode number " - "of parent and childs '/' " - " don't match"); - _exit(1); - } else { - tst_resm(TINFO, "Device/inode number " - "of parent and childs '/' " - "match"); - } - - /* - * Check for the same device and inode number - * of "." (current working directory. - */ - if ((Stat_cwd_Pbuf.st_ino != \ - Stat_cwd_Cbuf.st_ino) || \ - (Stat_cwd_Pbuf.st_dev != \ - Stat_cwd_Cbuf.st_dev)) { - tst_resm(TFAIL, "Device/inode number " - "of parent and childs '.' " - "don't match"); - _exit(1); - } else { - tst_resm(TINFO, "Device/inode number " - "of parent and childs '.' " - "match"); - } - - /* - * Exit with normal exit code if everything - * fine - */ - _exit(0); - } - } else { /* parent process */ - /* - * Let the parent process wait till child completes - * its execution. - */ - wait(&exit_status); - - /* Check for the exit status of child process */ - if (WEXITSTATUS(exit_status) == 0) { - tst_resm(TPASS, \ - "Call of vfork() successful"); - } else if (WEXITSTATUS(exit_status) == 1) { - tst_resm(TFAIL, \ - "Child process exited abnormally"); - } - } - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * This function gets real/effective/saved uid/gid, umask, the device/inode - * number of '/' and current working directory for the parent process. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* - * Get the euid, ruid, egid, rgid, umask value - * and the current working directory of the parent process. - */ -#if (linux) - if (getresuid(&Pruid, &Peuid, &Psuid) < 0) { - tst_brkm(TFAIL, cleanup, "getresuid() fails to get " - "real/eff./saved uid of parent"); - } - - if (getresgid(&Prgid, &Pegid, &Psgid) < 0) { - tst_brkm(TFAIL, cleanup, "getresgid() fails to get " - "real/eff./saved gid of parent"); - } -#else - Pruid = getuid (); - Peuid = geteuid (); - Psuid = 0; - Prgid = getgid (); - Pegid = getegid (); - Psgid = 0; -#endif - /* Get the process file mode creation mask by setting value 0 */ - Pumask = umask(0); - umask(Pumask); /* - * Restore the mask value of the - * process. - */ - /* - * Get the pathname of current working directory of the parent - * process. - */ - if ((Pcwd = (char *) getcwd(Pcwd_buf, BUFSIZ)) == NULL) { - tst_brkm(TFAIL, cleanup, - "getcwd failed for the parent process"); - } - - /* - * Get the device and inode number of root directory for the - * parent process. - */ - if (stat("/", &StatPbuf) == -1) { - tst_brkm(TFAIL, cleanup, "stat(2) failed to get info. of '/' " - "in parent process"); - } - - /* - * Get the device number and the inode number of "." (current- - * working directory) for the parent process. - */ - if (stat(Pcwd, &Stat_cwd_Pbuf) < 0) { - tst_brkm(TFAIL, cleanup, "stat(2) failed to get info. of " - "working directory in parent process"); - } -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/wait02.c b/winsup/testsuite/winsup.api/ltp/wait02.c deleted file mode 100644 index a7de67a28..000000000 --- a/winsup/testsuite/winsup.api/ltp/wait02.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : wait02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for wait(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) wait(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the wait(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * wait(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="wait02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int fork_pid, ret_code; -void trapper(); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* create a child to wait for */ - if ((fork_pid=fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() Failure. errno=%d : %s", errno, strerror(errno)); - } else if (fork_pid == 0) { - /* Child, sleep a second then exit */ - sleep(1); - exit(1); - } - - /* Parent, wait for child to die */ - TEST(wait(&ret_code)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "wait(1) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "wait(&ret_code) returned %d", TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/wait401.c b/winsup/testsuite/winsup.api/ltp/wait401.c deleted file mode 100644 index 51f71da55..000000000 --- a/winsup/testsuite/winsup.api/ltp/wait401.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * wait401.c - * - * DESCRIPTION - * wait401 - check that a call to wait4() correctly waits for a child - * process to exit - * - * ALGORITHM - * loop if that option was specified - * fork a child. - * issue the system call - * check the return value - * if return value == -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * issue a PASS message if the wait4 call returned the child's pid - * else - * issue a FAIL message - * call cleanup - * - * USAGE: - * wait401 [-c n] [-f] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * none - */ - -#include "test.h" -#include "usctest.h" - -#include -#define _USE_BSD -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "wait401()"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t pid; - int status = 1; - struct rusage *rusage = NULL; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* - * Allocate some space for the rusage structure - */ - - if ((rusage = (struct rusage *)malloc(sizeof(struct rusage))) - == NULL) { - tst_brkm(TBROK, cleanup, "malloc() failed"); - } - - pid = fork(); - - if (pid == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (pid == 0) { /* this is the child */ - /* - * sleep for a moment to let us do the test - */ - sleep(1); - exit(0); - } else { /* this is the parent */ - - /* call wait4 with the TEST() macro */ - TEST(wait4(pid, &status, 0, rusage)); - } - - if (TEST_RETURN == -1) { - tst_brkm(TFAIL, cleanup, "%s call failed - errno = %d " - ": %s", TCID, TEST_ERRNO, strerror(TEST_ERRNO)); - } - - if (STD_FUNCTIONAL_TEST) { - /* - * The return from this call should be non-zero. - */ - if (WIFEXITED(status) == 0) { - tst_brkm(TFAIL, cleanup, "%s call succeeded but " - "WIFEXITED() did not return expected value " - "- %d", TCID, WIFEXITED(status)); - } else if (TEST_RETURN != pid) { - tst_resm(TFAIL, "%s did not return the " - "expected value. %d", TCID, - TEST_RETURN); - } else { - - tst_resm(TPASS, "Received child pid as expected."); - } - } - tst_resm(TPASS, "%s call succeeded", TCID); - - /* - * Clean up things in case we are looping. - */ - free(rusage); - rusage = NULL; - } - - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all the ONE TIME setup for this test. - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/wait402.c b/winsup/testsuite/winsup.api/ltp/wait402.c deleted file mode 100644 index 30f7500ac..000000000 --- a/winsup/testsuite/winsup.api/ltp/wait402.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * wait402.c - * - * DESCRIPTION - * wait402 - check for ECHILD errno when using an illegal pid value - * - * ALGORITHM - * loop if that option was specified - * issue the system call with an illegal pid value - * check the errno value - * issue a PASS message if we get ECHILD - * otherwise, the tests fails - * issue a FAIL message - * break any remaining tests - * call cleanup - * - * USAGE: - * wait402 [-c n] [-e] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * none - */ - -#include "test.h" -#include "usctest.h" - -#include -#define _USE_BSD -#include -#include -#include - -/* - * See the Makefile for comments about the following preprocessor code. - */ -#if defined (__CYGWIN__) -#define PID_MAX 0xfffffffd -#else -#ifndef _LTP_TASKS_H -#include /* for PID_MAX value - new */ -#else -#include /* for PID_MAX value - old */ -#endif -#endif - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "wait402()"; -int TST_TOTAL = 1; -extern int Tst_count; - -int exp_enos[] = {10, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t pid; - pid_t epid = PID_MAX + 1; - int status = 1; - struct rusage *rusage=NULL; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - - /* - * Allocate some space for the rusage structure. - */ - - if ((rusage = (struct rusage *)malloc(sizeof(struct rusage))) - == NULL) { - tst_brkm(TBROK, cleanup, "malloc() failed"); - } - - pid = fork(); - - if (pid == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (pid == 0) { /* this is the child */ - /* - * sleep for a moment to let us do the test - */ - sleep(1); - exit(0); - } else { /* this is the parent */ - /* - * call wait4 with the TEST() macro. epid is set - * to an illegal positive value. This should give - * an ECHILD error. - */ - TEST(wait4(epid, &status, 0, rusage)); - } - - if (TEST_RETURN == 0) { - tst_brkm(TFAIL, cleanup, "call failed to produce expected error - errno = %d - %s", TEST_ERRNO, strerror(TEST_ERRNO)); - } - - TEST_ERROR_LOG(TEST_ERRNO); - - switch (TEST_ERRNO) { - case ECHILD: - tst_resm(TPASS, "received expected failure - errno = %d - %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - break; - default: - tst_brkm(TFAIL, cleanup, "call failed to produce expected " - "error - errno = %d - %s", TEST_ERRNO, - strerror(TEST_ERRNO)); - } - - /* - * Clean up things in case we are looping. - */ - if (pid > 0) { - wait4(pid, &status, 0, rusage); - } - free(rusage); - rusage = NULL; - } - - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all the ONE TIME setup for this test. - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Set up the expected error numbers for -e option */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/write01.c b/winsup/testsuite/winsup.api/ltp/write01.c deleted file mode 100644 index 355190af6..000000000 --- a/winsup/testsuite/winsup.api/ltp/write01.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : write01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for write(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) write(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the write(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * write(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * UPDATE HISTORY - * user date description - * ------------------------------------------------------ - * wermager 3/00 Switched sequence of calls to TEST_PAUSE - * and tst_tmpdir() in setup(). - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="write01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -char buf = 'w'; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call write(2) - */ - TEST(write(fd, &buf, 1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "write(%s, F_CLRALF, 1) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "write(%s, F_CLRALF, 1) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/write02.c b/winsup/testsuite/winsup.api/ltp/write02.c deleted file mode 100644 index a5675bd6d..000000000 --- a/winsup/testsuite/winsup.api/ltp/write02.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * write02.c - * - * DESCRIPTION - * Basic functionality test: does the return from write match the count - * of the number of bytes written. - * - * - * ALGORITHM - * Create a file and write some bytes out to it. - * Check the return count against the number returned. - * - * USAGE: - * write02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * None - */ - -#include -#include "test.h" -#include "usctest.h" -#include - -const char *TCID = "write02()"; -int TST_TOTAL = 1; -extern int Tst_count; - -void cleanup(void) __attribute__ ((noreturn)); -void setup(void); - -char pfiln[40] = ""; - -int -main(int argc, char **argv) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int cwrite; - int fild; - int iws; - int badcount = 0; - char pwbuf[BUFSIZ + 1]; - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *) NULL, NULL))) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup for test */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - tst_resm(TINFO, "Block 1: test to see write() returns proper " - "write count"); - - for (iws = 0; iws < BUFSIZ; iws++) { - pwbuf[iws] = 'A' + (iws % 26); - } - pwbuf[BUFSIZ] = '\n'; - - if ((fild = creat(pfiln, 0777)) == -1) { - tst_brkm(TBROK, cleanup, "Can't creat Xwrit"); - /*NOTREACHED*/ - } - for (iws = BUFSIZ; iws > 0; iws--) { - if ((cwrite = write(fild, pwbuf, iws)) != iws) { - TEST_ERROR_LOG(errno); - badcount++; - tst_resm(TINFO, "bad write count"); - } - } - if (badcount != 0) { - tst_resm(TFAIL, "write() FAILED to return proper cnt"); - } else { - tst_resm(TPASS, "write() PASSED"); - } - tst_resm(TINFO, "block 1 passed"); - close(fild); - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - sprintf(pfiln, "./write1.%d", getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - unlink(pfiln); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/write03.c b/winsup/testsuite/winsup.api/ltp/write03.c deleted file mode 100644 index 7d6f1f945..000000000 --- a/winsup/testsuite/winsup.api/ltp/write03.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * NAME - * write03.c - * - * DESCRIPTION - * Testcase to check that write(2) doesn't corrupt a file when it fails - * - * ALGORITHM - * Create a file for writing, write 100 bytes to it. Then make write(2) - * fail with some erroneous parameter, close the fd. Then reopen the - * file in RDONLY mode, and read the contents of the file. Compare the - * buffers, to see whether they are same. - * - * USAGE: - * write03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * NONE - */ - -#include -#include -#include -#include -#include - -/* 0 terminated list of expected errnos */ -int exp_enos[] = {14,0}; - -const char *TCID = "write03"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int fd = -1; -char filename[100]; - -int -main(int argc, char **argv) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - char wbuf[BUFSIZ], rbuf[BUFSIZ]; - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *)NULL, NULL)) != - (char *)NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* global setup */ - setup(); - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - tst_resm(TINFO, "Enter Block 1: test to check if write " - "corrupts the file when write fails"); - - fd = creat(filename, 0644); - if (fd < 0) { - tst_resm(TBROK, "creating a new file failed"); - cleanup(); - /*NOTREACHED*/ - } - - (void)memset(wbuf, '0', 100); - - if (write(fd, wbuf, 100) == -1) { - tst_resm(TFAIL, "failed to write to %s", filename); - cleanup(); - /*NOTREACHED*/ - } - - if (write(fd, (void *)-1, 100) != -1) { - tst_resm(TFAIL, "write(2) failed to fail"); - cleanup(); - /*NOTREACHED*/ - } - TEST_ERROR_LOG(errno); - close(fd); - fd = -1; - - if ((fd = open(filename, O_RDONLY)) == -1) { - tst_resm(TBROK, "open(2) failed, errno: %d", errno); - cleanup(); - /*NOTREACHED*/ - } - - if (read(fd, rbuf, 100) == -1) { - tst_resm(TBROK, "read(2) failed, errno: %d", errno); - cleanup(); - /*NOTREACHED*/ - } - - if (memcmp(wbuf, rbuf, 100) == 0) { - tst_resm(TPASS, "failure of write(2) didnot corrupt " - "the file"); - } else { - tst_resm(TFAIL, "failure of write(2) corrupted the " - "file"); - } - tst_resm(TINFO, "Exit block 1"); - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Set up the expected error numbers for -e option */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* Create a unique temporary directory and chdir() to it. */ - tst_tmpdir(); - - sprintf(filename, "./write03.%d", getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (fd >= 0) - close (fd); - - unlink(filename); - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - /*NOTREACHED*/ -} diff --git a/winsup/testsuite/winsup.api/mmaptest01.c b/winsup/testsuite/winsup.api/mmaptest01.c deleted file mode 100644 index fe3226d1b..000000000 --- a/winsup/testsuite/winsup.api/mmaptest01.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - Copyright 2001 Free Software Foundation, Inc. - Written by Michael Chastain, - Changes by Corinna Vinschen, : - - Using mkstemp to generate filenames. - - Adding tests - - 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. - - This program demonstrates a bug in cygwin's mmap. - I open one file, mmap it, and close it. - I open a different file, mmap it, and close it. - - The second file re-uses the file handle (which is OK), - but then it re-uses the buffer as well! Ouch! - - This bug occurs on cygwin1.dll dated 2001-01-31. - It causes gnu cpp to screw up its include file buffers. - - Compile with "gcc -o y1 y1.c". - - Output from a bad cygwin1.dll: - - y1.txt: 3 0x4660000 y1 y1 y1 y1 y1 y1 y1 - y2.txt: 3 0x4660000 y1 y1 y1 y1 y1 y1 y1 - - Output from a good cygwin1.dll: - - y1.txt: 3 0x14060000 y1 y1 y1 y1 y1 y1 y1 - y2.txt: 3 0x14070000 y2 y2 y2 y2 y2 y2 y2 - - Output from Red Hat Linux 7: - - y1.txt: 3 0x40017000 y1 y1 y1 y1 y1 y1 y1 - y2.txt: 3 0x40018000 y2 y2 y2 y2 y2 y2 y2 - */ - -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID = "mmaptest01"; /* Test program identifier. */ -int TST_TOTAL = 7; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -/* some systems have O_BINARY and some do not */ -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -/* filler for file 1 */ -char const line1 [] = "y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1\n"; -#define size1 (sizeof(line1) - 1) -#define count1 ((4096 / size1) + 1) - -/* filler for file 2 */ -char const line2 [] = "y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2\n"; -#define size2 (sizeof(line2) - 1) -#define count2 ((4096 / size2) + 1) - -int main () -{ - char fnam1[32]; - char fnam2[32]; - - int fd1; - char * buf1; - - int fd2; - char * buf2; - - char buf3[20]; - - unsigned i; - - strcpy (fnam1, "mmaptest01.1.XXXXXX"); - strcpy (fnam2, "mmaptest01.2.XXXXXX"); - - /* create file 1 */ - //fd1 = open (fnam1, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644); - fd1 = mkstemp (fnam1); - for (i = 0; i < count1; i++) - write (fd1, line1, size1); - close (fd1); - - /* create file 2 */ - //fd2 = open (fnam2, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644); - fd2 = mkstemp (fnam2); - for (i = 0; i < count2; i++) - write (fd2, line2, size2); - close (fd2); - - /* mmap file 1 */ - fd1 = open (fnam1, O_RDONLY | O_BINARY, 0644); - buf1 = mmap (0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd1, 0); - close (fd1); - - /* mmap file 2 */ - fd2 = open (fnam2, O_RDONLY | O_BINARY, 0644); - buf2 = mmap (0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd2, 0); - close (fd2); - - /* the buffers have to be different */ - Tst_count = 0; - tst_resm (buf1 == buf2 || !memcmp (buf1, buf2, 20) ? TFAIL : TPASS, - "mmap uses unique buffers when mapping different already closed files"); - munmap (buf2, 4096); - - /* mmap file 1 twice with MAP_PRIVATE */ - fd2 = open (fnam1, O_RDONLY | O_BINARY, 0644); - buf2 = mmap (0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd2, 0); - close (fd2); - - tst_resm (buf1 == buf2 ? TFAIL : TPASS, - "mmap uses different buffers on MAP_PRIVATE mapping"); - - tst_resm (memcmp (buf1, buf2, 20) ? TFAIL : TPASS, - "two private buffers of the same file are identical"); - - buf1[0] = 0x7f; - tst_resm (!memcmp (buf1, buf2, 20) ? TFAIL : TPASS, - "changes are private in MAP_PRIVATE mappings"); - - munmap (buf1, 4096); - munmap (buf2, 4096); - - /* mmap file 1 twice with MAP_SHARED */ - fd1 = open (fnam1, O_RDWR | O_BINARY, 0644); - buf1 = mmap (0, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, 0); - close (fd1); - - fd2 = open (fnam1, O_RDWR | O_BINARY, 0644); - buf2 = mmap (0, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, 0); - close (fd2); - - tst_resm (memcmp (buf1, buf2, 20) ? TFAIL : TPASS, - "two shared buffers of the same file are identical"); - - buf1[0] = 0x7f; - tst_resm (memcmp (buf1, buf2, 20) ? TFAIL : TPASS, - "changes are shared between MAP_SHARED mappings of the same file"); - if (buf1 == buf2) /* Win 9x weirdness */ - msync (buf2, 4096, MS_SYNC); - else - munmap (buf2, 4096); - - fd2 = open (fnam1, O_RDWR | O_BINARY, 0644); - memset (buf3, 0, 20); - read (fd2, buf3, 20); - close (fd2); - - tst_resm (memcmp (buf1, buf3, 20) ? TFAIL : TPASS, - "changes are propagated to the mapped file on MAP_SHARED mapping"); - - munmap (buf1, 4096); - unlink (fnam1); - unlink (fnam2); - tst_exit (); -} - diff --git a/winsup/testsuite/winsup.api/mmaptest02.c b/winsup/testsuite/winsup.api/mmaptest02.c deleted file mode 100644 index bec7c392c..000000000 --- a/winsup/testsuite/winsup.api/mmaptest02.c +++ /dev/null @@ -1,190 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -sigset_t unblock_sigsegv; -jmp_buf r; -size_t pg; - -int fd; - -/* Checks behaviour of anonymous mmap. - - test_1: If we map a 2-page region and unmap its second page, the first page - must remain. - - test_2: If we map a 2-page region and unmap its first page, the second - page must remain. - - test_3: If we map two consecutive 1-page regions and unmap them both with - one munmap, both must go away. -*/ - -void -perror_exit (const char *str, int code) -{ - printf ("%s: %s\n", str, strerror (errno)); - exit (code); -} - -void -anonmap_init () -{ - sigemptyset (&unblock_sigsegv); - sigaddset (&unblock_sigsegv, SIGSEGV); - pg = getpagesize (); - fd = open ("/dev/zero", O_RDWR); -} - -char * -anonmap (size_t size) -{ - return (char *) mmap (0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); -} - -void -anonfree (char *loc, size_t size) -{ - munmap (loc, size); -} - -void -sigsegv (int unused) -{ - sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0); - longjmp (r, 1); -} - -int -compare_pointers (const void *a, const void *b) -{ - const char *x = *(const char *const *)a; - const char *y = *(const char *const *)b; - - if (x > y) - return 1; - if (x < y) - return -1; - return 0; -} - -void -test_1 () -{ - char *x = anonmap (pg * 2); - if (x == (char *)MAP_FAILED) - perror_exit ("test 1 mmap", 1); - - signal (SIGSEGV, sigsegv); - if (setjmp (r)) - perror_exit ("test 1 fault", 2); - - x[0] = 1; - x[pg] = 1; - - anonfree (x + pg, pg); - x[0] = 2; - - if (setjmp (r) == 0) - { - x[pg] = 1; - perror_exit ("test 1 no fault", 3); - } -} - -void -test_2 () -{ - char *x = anonmap (pg * 2); - if (x == (char *)MAP_FAILED) - perror_exit ("test 2 mmap", 4); - - signal (SIGSEGV, sigsegv); - if (setjmp (r)) - perror_exit ("test 2 fault", 5); - - x[0] = 1; - x[pg] = 1; - - anonfree (x, pg); - x[pg] = 2; - - if (setjmp (r) == 0) - { - x[0] = 1; - perror_exit ("test 2 no fault", 6); - } -} - -void -test_3 () -{ - char *x[10]; - char *y; - int i; - - /* There's no way to guarantee we get consecutive pages from the OS. The - approach taken here is to allocate ten of them, sort the list, and - look for consecutive pages. */ - for (i = 0; i < 10; i++) - { - x[i] = anonmap (pg); - if (x[i] == (char *)MAP_FAILED) - perror_exit ("test 3 mmap 1", 7); - } - qsort (x, 10, sizeof (char *), compare_pointers); - - y = 0; - for (i = 0; i < 9; i++) - if (x[i] + pg == x[i+1]) - { - y = x[i]; - break; - } - if (y == 0) - { - fputs ("test 3: couldn't get two consecutive pages, giving up\n", stdout); - exit (65); - } - - signal (SIGSEGV, sigsegv); - if (setjmp (r)) - perror_exit ("test 3 fault", 8); - - y[0] = 1; - y[pg] = 1; - - anonfree (y, pg * 2); - - if (setjmp (r) == 0) - { - y[0] = 1; - perror_exit ("test 3 no fault 1", 9); - } - - signal (SIGSEGV, sigsegv); - if (setjmp (r) == 0) - { - y[pg] = 1; - perror_exit ("test 3 no fault 2", 10); - } -} - -int -main () -{ - anonmap_init(); - - test_1(); - test_2(); - test_3(); - - exit(0); -} diff --git a/winsup/testsuite/winsup.api/mmaptest03.c b/winsup/testsuite/winsup.api/mmaptest03.c deleted file mode 100644 index 8046f0bf8..000000000 --- a/winsup/testsuite/winsup.api/mmaptest03.c +++ /dev/null @@ -1,154 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - Checks if mapping of already closed file survives fork() - - Checks if mapping the same region of the same file twice - is done correctly. -*/ - -sigset_t unblock_sigsegv; -jmp_buf r; - -static const char *msg; -static const char *what; -/* filler for file */ -char const line[] = "y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1"; - -void -perror_exit (const char *str) -{ - printf ("%s: %s\n", str, strerror (errno)); - fflush (stdout); - exit (1); -} - -void -sigsegv (int unused) -{ - sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0); - if (msg) - { - char buf[132]; - sprintf (buf, "%s %s\n", what, msg); - write (1, buf, strlen (buf)); - msg = NULL; - } - longjmp (r, 1); -} - -int -main(int argc, char **argv) -{ - int fd, status; - struct stat statbuf; - volatile char c, *buf1, *buf2; - pid_t pid; - - /* Create data file */ - if ((fd = open("y.txt", O_RDWR | O_CREAT | O_TRUNC, 0644)) == -1) - perror_exit ("Can't create data file"); - write (fd, line, sizeof(line) - 1); - close (fd); - - /* Open data file */ - if ((fd = open("y.txt", O_RDONLY)) == -1) - perror_exit ("Can't open data file"); - - if (fstat(fd, &statbuf) < 0) - perror_exit ("fstat failed"); - - if (!statbuf.st_size) - perror_exit ("filesize is 0"); - - if ((buf1 = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0)) - == MAP_FAILED) - perror_exit ("mmap 1 failed"); - - close(fd); - - /* Open data file a second time */ - if ((fd = open("y.txt", O_RDONLY)) == -1) - perror_exit ("Can't open data file in second run"); - - if ((buf2 = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0)) - == MAP_FAILED) - perror_exit ("mmap 2 failed"); - - close(fd); - - sigemptyset (&unblock_sigsegv); - sigaddset (&unblock_sigsegv, SIGSEGV); - signal (SIGSEGV, sigsegv); - - if (setjmp (r)) - perror_exit ("SEGV in fork"); - - if ((pid = fork())) - { - // write (1, "continuing in parent\n", strlen ("continuing in parent\n")); - what = "parent"; - } - else - { - // write (1, "continuing in child\n", strlen ("continuing in child\n")); - what = "child"; - } - - if (pid == -1) - perror_exit ("fork failed"); - - if (setjmp (r)) - perror_exit (pid ? "SEGV in parent" : "SEGV in child"); - - msg = "testing buf1"; - c = buf1[0]; - msg = "testing buf2"; - c = buf2[0]; - - if (setjmp (r)) - perror_exit (pid ? "SEGV in parent's munmap" : "SEGV in child's munmap"); - - if (munmap((void *) buf1, statbuf.st_size)) - perror_exit (pid ? "munmap failed in parent" : "munmap failed in child"); - - if (setjmp (r) == 0) - { - msg = "testing buf1 after unmap"; - c = buf1[0]; - perror_exit (pid ? "no SEGV in parent after munmap" : "no SEGV in child after munmap"); - } - - if (setjmp (r)) - perror_exit (pid ? "SEGV in parent after munmap" : "SEGV in child after munmap"); - - msg = "testing buf2 again"; - c = buf2[0]; - - if (setjmp (r)) - perror_exit (pid ? "SEGV in parent's munmap" : "SEGV in child's munmap"); - - if (munmap((void *) buf2, statbuf.st_size)) - perror_exit (pid ? "munmap failed in parent" : "munmap failed in child"); - - if (pid) - { - waitpid (pid, &status, 0); - unlink ("y.txt"); - if (!WIFEXITED (status) || WEXITSTATUS (status)) - { - printf ("forked process exited with status %p\n", (char *) status); - return 1; - } - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/mmaptest04.c b/winsup/testsuite/winsup.api/mmaptest04.c deleted file mode 100644 index 52302bae1..000000000 --- a/winsup/testsuite/winsup.api/mmaptest04.c +++ /dev/null @@ -1,103 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -int -main () -{ - char *data, *data2 = NULL, *data3; - int i, pagesize; - int fd; - - pagesize = 65536; //getpagesize(); - - /* - * First, make a file with some known garbage in it. - */ - data = (char *) malloc (pagesize); - if (!data) - exit (1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand (); - umask (0); - fd = open ("conftestmmap", O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0600); - if (fd < 0) - { - printf ("creat: %d\n", errno); - exit (1); - } - if (write (fd, data, pagesize) != pagesize) - { - printf ("write: %d\n", errno); - exit (1); - } - close (fd); - - /* - * Next, try to mmap the file. - */ - fd = open ("conftestmmap", O_RDWR | O_BINARY); - if (fd < 0) - { - printf ("write: %d\n", errno); - exit (1); - } - if ((data2 = mmap (data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE, fd, 0L)) == MAP_FAILED) - { - printf ("mmap: %d\n", errno); - exit (1); - } - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - { - printf ("check-if: %d\n", errno); - exit (1); - } - - /* - * 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) - { - printf ("malloc2: %d\n", errno); - exit (1); - } - if (read (fd, data3, pagesize) != pagesize) - { - printf ("read: %d\n", errno); - exit (1); - } - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - { - printf ("check-if2: %d\n", errno); - exit (1); - } - if (msync (data2, pagesize, MS_SYNC)) - { - printf ("msync: %d\n", errno); - exit (1); - } - if (munmap (data2, pagesize)) - { - printf ("munmap: %d\n", errno); - exit (1); - } - close (fd); - unlink ("conftestmmap"); - exit (0); -} diff --git a/winsup/testsuite/winsup.api/msgtest.c b/winsup/testsuite/winsup.api/msgtest.c deleted file mode 100644 index e002a7fda..000000000 --- a/winsup/testsuite/winsup.api/msgtest.c +++ /dev/null @@ -1,348 +0,0 @@ -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * 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 NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. - * - * Obtained from: $NetBSD: msgtest.c,v 1.7 2002/07/20 08:36:25 grant Exp $ - * $FreeBSD: /repoman/r/ncvs/src/tools/regression/sysvmsg/msgtest.c,v 1.1 2002/08/15 06:34:37 alfred Exp $ - */ - -/* - * Test the SVID-compatible Message Queue facility. - */ - -/* - * CV, 2003-11-17: Add to Cygwin testsuite. - */ -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID = "msgtest"; /* Test program identifier. */ -int TST_TOTAL = 31; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -void print_msqid_ds (struct msqid_ds *, mode_t); -void sigsys_handler(int); -void sigchld_handler (int); -void cleanup (void); -void receiver (void); - -#define MESSAGE_TEXT_LEN 255 - -/* - * Define it as test_mymsg because we already have struct mymsg and we dont - * want to conflict with it. Also, regression fails when the default mymsg - * struct is used, because mtext[] array is '1', so the passed string cannot - * be processed. - */ -struct test_mymsg { - long mtype; - char mtext[MESSAGE_TEXT_LEN]; -}; - -const char *m1_str = "California is overrated."; -const char *m2_str = "The quick brown fox jumped over the lazy dog."; - -#define MTYPE_1 1 -#define MTYPE_1_ACK 2 - -#define MTYPE_2 3 -#define MTYPE_2_ACK 4 - -int sender_msqid = -1; -pid_t child_pid; - -key_t msgkey; - -int -main(int argc, char *argv[]) -{ - struct sigaction sa; - struct msqid_ds m_ds; - struct test_mymsg m; - sigset_t sigmask; - - Tst_count = 0; - - /* - * Install a SIGSYS handler so that we can exit gracefully if - * System V Message Queue support isn't in the kernel. - */ - sa.sa_handler = sigsys_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGSYS, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGSYS"); - - /* - * Install and SIGCHLD handler to deal with all possible exit - * conditions of the receiver. - */ - sa.sa_handler = sigchld_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGCHLD, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGCHLD"); - - msgkey = ftok("/", 4160); - tst_resm (msgkey == (key_t)-1 ? TFAIL : TPASS, - "ftok(\"/\") returns valid value"); - - /* - * Initialize child_pid to ourselves to that the cleanup function - * works before we create the receiver. - */ - child_pid = getpid(); - - sender_msqid = msgget(msgkey, IPC_CREAT | 0640); - tst_resm (sender_msqid == -1 ? TFAIL : TPASS, "sender calls msgget"); - - tst_resm (msgctl(sender_msqid, IPC_STAT, &m_ds) == -1 ? TFAIL : TPASS, - "msgctl IPC_STAT"); - - print_msqid_ds(&m_ds, 0640); - - m_ds.msg_perm.mode = (m_ds.msg_perm.mode & ~0777) | 0600; - - tst_resm (msgctl(sender_msqid, IPC_SET, &m_ds) == -1 ? TFAIL : TPASS, - "msgctl IPC_SET"); - - bzero(&m_ds, sizeof m_ds); - - tst_resm (msgctl(sender_msqid, IPC_STAT, &m_ds) == -1 ? TFAIL : TPASS, - "msgctl IPC_STAT"); - - tst_resm ((m_ds.msg_perm.mode & 0777) != 0600 ? TFAIL : TPASS, - "IPC_SET of mode holds"); - - print_msqid_ds(&m_ds, 0600); - - switch ((child_pid = fork())) { - case -1: - tst_brkm (TBROK, cleanup, "fork"); - /* NOTREACHED */ - - case 0: - tst_resm (TPASS, "fork"); - receiver(); - break; - - default: - Tst_count += 8; - break; - } - - /* - * Send the first message to the receiver and wait for the ACK. - */ - m.mtype = MTYPE_1; - strcpy(m.mtext, m1_str); - tst_resm (msgsnd(sender_msqid, &m, sizeof(m), 0) == -1 ? TFAIL : TPASS, - "sender: msgsnd 1"); - - tst_resm (msgrcv(sender_msqid, &m, sizeof(m), MTYPE_1_ACK, 0) - != sizeof(m) ? TFAIL : TPASS, "sender: msgrcv 1 ack"); - - print_msqid_ds(&m_ds, 0600); - - /* - * Send the second message to the receiver and wait for the ACK. - */ - m.mtype = MTYPE_2; - strcpy(m.mtext, m2_str); - tst_resm (msgsnd(sender_msqid, &m, sizeof(m), 0) == -1 ? TFAIL : TPASS, - "sender: msgsnd 2"); - - tst_resm (msgrcv(sender_msqid, &m, sizeof(m), MTYPE_2_ACK, 0) - != sizeof(m) ? TFAIL : TPASS, "sender: msgrcv 2 ack"); - - /* - * Suspend forever; when we get SIGCHLD, the handler will exit. - */ - sigemptyset(&sigmask); - (void) sigsuspend(&sigmask); - - /* - * ...and any other signal is an unexpected error. - */ - tst_brkm (TBROK, cleanup, "sender: received unexpected signal"); - exit (1); -} - -void -sigsys_handler(int signo) -{ - - tst_brkm (TBROK, cleanup, - "System V Message Queue support is not present in the kernel"); -} - -void -sigchld_handler(int signo) -{ - struct msqid_ds m_ds; - int cstatus; - - /* - * Reap the child; if it exited successfully, then the test passed! - */ - if (waitpid(child_pid, &cstatus, 0) != child_pid) - tst_brkm (TBROK, cleanup, "waitpid"); - - if (WIFEXITED(cstatus) == 0) - tst_brkm (TBROK, cleanup, "receiver exited abnormally"); - - if (WEXITSTATUS(cstatus) != 0) - tst_brkm (TBROK, cleanup, "receiver exited with status %d", - WEXITSTATUS(cstatus)); - - /* - * If we get here, the child has exited normally, and thus - * we should exit normally too. First, tho, we print out - * the final stats for the message queue. - */ - - tst_resm (msgctl(sender_msqid, IPC_STAT, &m_ds) == -1 ? TFAIL : TPASS, - "msgctl IPC_STAT"); - - print_msqid_ds(&m_ds, 0600); - - cleanup (); -} - -void -cleanup() -{ - - /* - * If we're the sender, and it exists, remove the message queue. - */ - if (child_pid != 0 && sender_msqid != -1) { - tst_resm (msgctl(sender_msqid, IPC_RMID, NULL) == -1 - ? TFAIL : TPASS, "msgctl IPC_RMID"); - } - tst_exit (); -} - -void -print_msqid_ds(struct msqid_ds *mp, mode_t mode) -{ - uid_t uid = geteuid(); - gid_t gid = getegid(); - - printf("PERM: uid %d, gid %d, cuid %d, cgid %d, mode 0%o\n", - (int)mp->msg_perm.uid, (int)mp->msg_perm.gid, - (int)mp->msg_perm.cuid, (int)mp->msg_perm.cgid, - mp->msg_perm.mode & 0777); - - printf("qnum %lu, qbytes %lu, lspid %d, lrpid %d\n", - mp->msg_qnum, (u_long)mp->msg_qbytes, mp->msg_lspid, - mp->msg_lrpid); - - printf("stime: %s", ctime(&mp->msg_stime)); - printf("rtime: %s", ctime(&mp->msg_rtime)); - printf("ctime: %s", ctime(&mp->msg_ctime)); - - /* - * Sanity check a few things. - */ - - tst_resm (mp->msg_perm.uid != uid || mp->msg_perm.cuid != uid - ? TFAIL : TPASS, "uid matches"); - - tst_resm (mp->msg_perm.gid != gid || mp->msg_perm.cgid != gid - ? TFAIL : TPASS, "gid matches"); - - tst_resm ((mp->msg_perm.mode & 0777) != mode ? TFAIL : TPASS, - "mode matches"); -} - -void -receiver() -{ - struct test_mymsg m; - int msqid; - - tst_resm ((msqid = msgget(msgkey, 0)) == -1 ? TFAIL : TPASS, - "receiver: msgget"); - - /* - * Receive the first message, print it, and send an ACK. - */ - - tst_resm (msgrcv(msqid, &m, sizeof(m), MTYPE_1, 0) != sizeof(m) - ? TFAIL : TPASS, "receiver: msgrcv 1"); - - printf("%s\n", m.mtext); - tst_resm (strcmp(m.mtext, m1_str) != 0 ? TFAIL : TPASS, - "receiver: message 1 data is correct"); - - m.mtype = MTYPE_1_ACK; - - tst_resm (msgsnd(msqid, &m, sizeof(m), 0) == -1 ? TFAIL : TPASS, - "receiver: msgsnd ack 1"); - - /* - * Receive the second message, print it, and send an ACK. - */ - - tst_resm (msgrcv(msqid, &m, sizeof(m), MTYPE_2, 0) != sizeof(m) - ? TFAIL : TPASS, "receiver: msgrcv 2"); - - printf("%s\n", m.mtext); - tst_resm (strcmp(m.mtext, m2_str) != 0 ? TFAIL : TPASS, - "receiver: message 2 data is correct"); - - m.mtype = MTYPE_2_ACK; - - tst_resm (msgsnd(msqid, &m, sizeof(m), 0) == -1 ? TFAIL : TPASS, - "receiver: msgsnd ack 2"); - - /* Allow parent to receive message before getting SIGCHLD. */ - sleep (1); - exit(0); -} diff --git a/winsup/testsuite/winsup.api/nullgetcwd.c b/winsup/testsuite/winsup.api/nullgetcwd.c deleted file mode 100644 index 25bdf4514..000000000 --- a/winsup/testsuite/winsup.api/nullgetcwd.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include -#include -int -main (int argc, char **argv) -{ - char *cwd = getcwd (NULL, 256); - if (cwd == NULL) - { - fprintf (stderr, "%s: getcwd returns NULL\n", argv[0]); - exit (1); - } - - exit (0); -} - diff --git a/winsup/testsuite/winsup.api/pthread/cancel1.c b/winsup/testsuite/winsup.api/pthread/cancel1.c deleted file mode 100644 index 96ae390ce..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel1.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * File: cancel1.c - * - * Test Synopsis: Test setting cancel state and cancel type. - * - - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - pthread_setcancelstate function - * - pthread_setcanceltype function - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - pthread_create, pthread_self work. - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -void * -mythread(void * arg) -{ - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* ... */ - { - int oldstate; - int oldtype; - - assert(pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate) == 0); - assert(oldstate == PTHREAD_CANCEL_ENABLE); /* Check default */ - assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0); - assert(pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL) == 0); - assert(pthread_setcancelstate(oldstate, &oldstate) == 0); - assert(oldstate == PTHREAD_CANCEL_DISABLE); /* Check setting */ - - assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype) == 0); - assert(oldtype == PTHREAD_CANCEL_DEFERRED); /* Check default */ - assert(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) == 0); - assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0); - assert(pthread_setcanceltype(oldtype, &oldtype) == 0); - assert(oldtype == PTHREAD_CANCEL_ASYNCHRONOUS); /* Check setting */ - } - - return 0; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - - /* - * Give threads time to run. - */ - Sleep(NUMTHREADS * 1000); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - failed = !threadbag[i].started; - - if (failed) - { - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print ouput on failure. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - /* ... */ - } - - assert(!failed); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel10.c b/winsup/testsuite/winsup.api/pthread/cancel10.c deleted file mode 100644 index 5e0cc6770..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel10.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * File: cancel10.c - * - * Test Synopsis: Test if system is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static int cancelled = 0; - -static void *Thread(void *punused) -{ - while (!cancelled) - Sleep (0); - - system (NULL); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - assert (pthread_cancel (t) == 0); - cancelled = 1; - assert (pthread_join (t, &result) == 0); - assert (result == PTHREAD_CANCELED); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel11.c b/winsup/testsuite/winsup.api/pthread/cancel11.c deleted file mode 100644 index b6554ed69..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel11.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * File: cancel11.c - * - * Test Synopsis: Test if system is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static void sig_handler(int sig) -{ -} - -static void *Thread(void *punused) -{ - system ("sleep 10"); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - signal (SIGINT, sig_handler); - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - sleep (5); - assert (pthread_cancel (t) == 0); - assert (pthread_join (t, &result) == 0); - assert (result == PTHREAD_CANCELED); - - assert ((void *)signal (SIGINT, NULL) == sig_handler); - - /* Wait until child process has terminated */ - sleep (10); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel12.c b/winsup/testsuite/winsup.api/pthread/cancel12.c deleted file mode 100644 index 12273d676..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel12.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * File: cancel12.c - * - * Test Synopsis: Test if system is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static void sig_handler(int sig) -{ -} - -static void *Thread(void *punused) -{ - signal (SIGINT, sig_handler); - - system ("sleep 5"); - - assert ((void *)signal (SIGINT, NULL) == sig_handler); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - assert (pthread_join (t, &result) == 0); - assert (result == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel2.c b/winsup/testsuite/winsup.api/pthread/cancel2.c deleted file mode 100644 index 14889313e..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel2.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * File: cancel2.c - * - * Test Synopsis: Test SEH or C++ cancel exception handling within - * application exception blocks. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_self, pthread_mutex_lock/unlock - * pthread_testcancel, pthread_cancel, pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -static pthread_mutex_t waitLock = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; - -void * -mythread(void * arg) -{ - int result = 0; - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Set to known state and type */ - - assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0); - - switch (bag->threadnum % 2) - { - case 0: - assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0); - result = 0; - break; - case 1: - assert(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) == 0); - result = 1; - break; - } - - /* Wait for go from main */ - assert(pthread_mutex_lock(&waitLock) == 0); - assert(pthread_mutex_unlock(&waitLock) == 0); - sched_yield(); - - for (;;) - { - pthread_testcancel(); - } - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - assert(pthread_mutex_lock(&waitLock) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(500); - - assert(pthread_mutex_unlock(&waitLock) == 0); - - Sleep(500); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_cancel(t[i]) == 0); - } - - /* - * Give threads time to run. - */ - Sleep(NUMTHREADS * 100); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - assert(pthread_join(t[i], (void **) &result) == 0); - fail = (result != (int) PTHREAD_CANCELED); - if (fail) - { - fprintf(stderr, "Thread %d: started %d: location %d: cancel type %s\n", - i, - threadbag[i].started, - result, - ((result % 2) == 0) ? "ASYNCHRONOUS" : "DEFERRED"); - } - failed |= fail; - } - - assert(!failed); - - /* - * Success. - */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/cancel3.c b/winsup/testsuite/winsup.api/pthread/cancel3.c deleted file mode 100644 index 3ac03e4b6..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel3.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * File: cancel3.c - * - * Test Synopsis: Test asynchronous cancelation. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_self, pthread_mutex_lock/unlock - * pthread_testcancel, pthread_cancel, pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ - int count; -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -void * -mythread(void * arg) -{ - int result = ((int)PTHREAD_CANCELED + 1); - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Set to known state and type */ - - assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0); - - assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0); - - /* - * We wait up to 10 seconds, waking every 0.1 seconds, - * for a cancelation to be applied to us. - */ - for (bag->count = 0; bag->count < 100; bag->count++) - Sleep(100); - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(500); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_cancel(t[i]) == 0); - } - - /* - * Give threads time to run. - */ - Sleep(NUMTHREADS * 100); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - /* - * The thread does not contain any cancelation points, so - * a return value of PTHREAD_CANCELED confirms that async - * cancelation succeeded. - */ - assert(pthread_join(t[i], (void **) &result) == 0); - - fail = (result != (int) PTHREAD_CANCELED); - - if (fail) - { - fprintf(stderr, "Thread %d: started %d: count %d\n", - i, - threadbag[i].started, - threadbag[i].count); - } - failed = (failed || fail); - } - - assert(!failed); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel4.c b/winsup/testsuite/winsup.api/pthread/cancel4.c deleted file mode 100644 index d6b2ffadf..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel4.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * File: cancel4.c - * - * Test Synopsis: Test cancelation does not occur in deferred - * cancelation threads with no cancelation points. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - pthread_create - * pthread_self - * pthread_cancel - * pthread_join - * pthread_setcancelstate - * pthread_setcanceltype - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ - int count; -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -void * -mythread(void * arg) -{ - int result = ((int)PTHREAD_CANCELED + 1); - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Set to known state and type */ - - assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0); - - assert(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) == 0); - - /* - * We wait up to 10 seconds, waking every 0.1 seconds, - * for a cancelation to be applied to us. - */ - for (bag->count = 0; bag->count < 100; bag->count++) - Sleep(100); - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(500); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_cancel(t[i]) == 0); - } - - /* - * Give threads time to run. - */ - Sleep(NUMTHREADS * 100); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - /* - * The thread does not contain any cancelation points, so - * a return value of PTHREAD_CANCELED indicates that async - * cancelation occurred. - */ - assert(pthread_join(t[i], (void **) &result) == 0); - - fail = (result == (int) PTHREAD_CANCELED); - - if (fail) - { - fprintf(stderr, "Thread %d: started %d: count %d\n", - i, - threadbag[i].started, - threadbag[i].count); - } - failed = (failed || fail); - } - - assert(!failed); - - /* - * Success. - */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/cancel5.c b/winsup/testsuite/winsup.api/pthread/cancel5.c deleted file mode 100644 index 9dd579543..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel5.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * File: cancel5.c - * - * Test Synopsis: Test calling pthread_cancel from the main thread - * without calling pthread_self() in main. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_self, pthread_mutex_lock/unlock - * pthread_testcancel, pthread_cancel, pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ - int count; -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -void * -mythread(void * arg) -{ - int result = ((int)PTHREAD_CANCELED + 1); - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Set to known state and type */ - - assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0); - - assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0); - - /* - * We wait up to 10 seconds, waking every 0.1 seconds, - * for a cancelation to be applied to us. - */ - for (bag->count = 0; bag->count < 100; bag->count++) - Sleep(100); - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(500); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_cancel(t[i]) == 0); - } - - /* - * Give threads time to run. - */ - Sleep(NUMTHREADS * 100); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - /* - * The thread does not contain any cancelation points, so - * a return value of PTHREAD_CANCELED confirms that async - * cancelation succeeded. - */ - assert(pthread_join(t[i], (void **) &result) == 0); - - fail = (result != (int) PTHREAD_CANCELED); - - if (fail) - { - fprintf(stderr, "Thread %d: started %d: count %d\n", - i, - threadbag[i].started, - threadbag[i].count); - } - failed = (failed || fail); - } - - assert(!failed); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel6.c b/winsup/testsuite/winsup.api/pthread/cancel6.c deleted file mode 100644 index 8f0bdd849..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel6.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * File: cancel6.c - * - * Test Synopsis: Test if pause is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static void *Thread(void *punused) -{ - pause (); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - assert (pthread_cancel (t) == 0); - assert (pthread_join (t, &result) == 0); - assert (result == PTHREAD_CANCELED); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel7.c b/winsup/testsuite/winsup.api/pthread/cancel7.c deleted file mode 100644 index 7a631f695..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel7.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * File: cancel7.c - * - * Test Synopsis: Test if sleep is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static int has5secsleeped = 0; - -static void *Thread(void *punused) -{ - assert (pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL) == 0); - /* thread should sleep 5 seconds and not get canceled */ - sleep(5); - has5secsleeped = 1; - assert (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) == 0); - /* thread should cancel here */ - sleep (5); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - assert (pthread_cancel (t) == 0); - assert (pthread_join (t, &result) == 0); - assert (has5secsleeped == 1); - assert (result == PTHREAD_CANCELED); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel8.c b/winsup/testsuite/winsup.api/pthread/cancel8.c deleted file mode 100644 index fb30fd93b..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel8.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * File: cancel8.c - * - * Test Synopsis: Test if usleep is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static int has5secsleeped = 0; - -static void *Thread(void *punused) -{ - assert (pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL) == 0); - /* thread should usleep 5 seconds and not get canceled */ - usleep(5000000); - has5secsleeped = 1; - assert (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) == 0); - /* thread should cancel here */ - usleep(5000000); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - assert (pthread_cancel (t) == 0); - assert (pthread_join (t, &result) == 0); - assert (has5secsleeped == 1); - assert (result == PTHREAD_CANCELED); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel9.c b/winsup/testsuite/winsup.api/pthread/cancel9.c deleted file mode 100644 index 1cbf62d2c..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel9.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * File: cancel9.c - * - * Test Synopsis: Test if waitpid is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include -#include - -static pid_t pid; - -static void *Thread(void *punused) -{ - int res; - - pid = fork (); - assert (pid != -1); - switch (pid) - { - case 0: - sleep (10); - break; - default: - assert (waitpid (pid, &res, 0) != -1); - } - - return NULL; -} - -int main (void) -{ - int res; - - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - sleep (5); - assert (pthread_cancel (t) == 0); - assert (pthread_join (t, &result) == 0); - assert (result == PTHREAD_CANCELED); - assert (waitpid (pid, &res, 0) != -1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cleanup2.c b/winsup/testsuite/winsup.api/pthread/cleanup2.c deleted file mode 100644 index bcbaad3a7..000000000 --- a/winsup/testsuite/winsup.api/pthread/cleanup2.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * File: cleanup2.c - * - * Test Synopsis: Test cleanup handler executes (when thread is not canceled). - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_self, pthread_mutex_lock/unlock - * pthread_testcancel, pthread_cancel, pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ - int count; -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -static int pop_count = 0; - -static void -increment_pop_count(void * arg) -{ - int * c = (int *) arg; - - (*c)++; -} - -void * -mythread(void * arg) -{ - int result = 0; - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - pthread_cleanup_push(increment_pop_count, (void *) &pop_count); - - sched_yield(); - - pthread_cleanup_pop(1); - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(1000); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - assert(pthread_join(t[i], (void **) &result) == 0); - - fail = (result != 0); - - if (fail) - { - fprintf(stderr, "Thread %d: started %d: result: %d\n", - i, - threadbag[i].started, - result); - } - failed = (failed || fail); - } - - assert(!failed); - - assert(pop_count == NUMTHREADS); - - /* - * Success. - */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/cleanup3.c b/winsup/testsuite/winsup.api/pthread/cleanup3.c deleted file mode 100644 index f8201faa0..000000000 --- a/winsup/testsuite/winsup.api/pthread/cleanup3.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * File: cleanup3.c - * - * Test Synopsis: Test cleanup handler does not execute (when thread is - * not canceled). - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_self, pthread_mutex_lock/unlock - * pthread_testcancel, pthread_cancel, pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ - int count; -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -static int pop_count = 0; - -static void -increment_pop_count(void * arg) -{ - int * c = (int *) arg; - - (*c)++; -} - -void * -mythread(void * arg) -{ - int result = 0; - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - pthread_cleanup_push(increment_pop_count, (void *) &pop_count); - - sched_yield(); - - pop_count--; - - pthread_cleanup_pop(0); - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(1000); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - assert(pthread_join(t[i], (void **) &result) == 0); - - fail = (result != 0); - - if (fail) - { - fprintf(stderr, "Thread %d: started %d: result: %d\n", - i, - threadbag[i].started, - result); - } - failed = (failed || fail); - } - - assert(!failed); - - assert(pop_count == -(NUMTHREADS)); - - /* - * Success. - */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/condvar1.c b/winsup/testsuite/winsup.api/pthread/condvar1.c deleted file mode 100644 index daa0f420e..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar1.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * File: condvar1.c - * - * Test Synopsis: - * - Test initialisation and destruction of a CV. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Creates and then imediately destroys a CV. Does not - * test the CV. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_init returns 0, and - * - pthread_cond_destroy returns 0. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_init returns non-zero, or - * - pthread_cond_destroy returns non-zero. - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static pthread_cond_t cv = NULL; - -int -main() -{ - assert(cv == NULL); - - assert(pthread_cond_init(&cv, NULL) == 0); - - assert(cv != NULL); - - assert(pthread_cond_destroy(&cv) == 0); - - assert(cv == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar2.c b/winsup/testsuite/winsup.api/pthread/condvar2.c deleted file mode 100644 index 309f5dfdf..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar2.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * File: condvar2.c - * - * Test Synopsis: - * - Test timed wait on a CV. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Because the CV is never signaled, we expect the wait to time out. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait does not return ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -pthread_cond_t cv; -pthread_mutex_t mutex; - -int -main() -{ - struct timespec abstime = { 0, 0 }; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - int result; - - assert(pthread_cond_init(&cv, NULL) == 0); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - assert(pthread_mutex_lock(&mutex) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert(pthread_cond_timedwait(&cv, &mutex, &abstime) == ETIMEDOUT); - - assert(pthread_mutex_unlock(&mutex) == 0); - - result = pthread_cond_destroy(&cv); - assert(result == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar2_1.c b/winsup/testsuite/winsup.api/pthread/condvar2_1.c deleted file mode 100644 index da3416203..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar2_1.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * File: condvar2_1.c - * - * Test Synopsis: - * - Test timeout of multiple waits on a CV with no signal/broadcast. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Because the CV is never signaled, we expect the waits to time out. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait does not return ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -static pthread_cond_t cv; -static pthread_mutex_t mutex; -static struct timespec abstime = { 0, 0 }; - -enum { - NUMTHREADS = 60 -}; - -void * -mythread(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_cond_timedwait(&cv, &mutex, &abstime) == ETIMEDOUT); - - assert(pthread_mutex_unlock(&mutex) == 0); - - return arg; -} - -int -main() -{ - int i; - pthread_t t[NUMTHREADS + 1]; - int result = 0; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert(pthread_cond_init(&cv, NULL) == 0); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert(pthread_mutex_lock(&mutex) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0); - } - - assert(pthread_mutex_unlock(&mutex) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_join(t[i], (void **) &result) == 0); - assert(result == i); - } - - result = pthread_cond_destroy(&cv); - assert(result == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar3.c b/winsup/testsuite/winsup.api/pthread/condvar3.c deleted file mode 100644 index 249e260aa..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar3.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * File: condvar3.c - * - * Test Synopsis: - * - Test basic function of a CV - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - The primary thread takes the lock before creating any threads. - * The secondary thread blocks on the lock allowing the primary - * thread to enter the cv wait state which releases the lock. - * The secondary thread then takes the lock and signals the waiting - * primary thread. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns 0. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -static pthread_cond_t cv; -static pthread_mutex_t mutex; -static int shared = 0; - -enum { - NUMTHREADS = 2 /* Including the primary thread. */ -}; - -void * -mythread(void * arg) -{ - int result = 0; - - assert(pthread_mutex_lock(&mutex) == 0); - - shared++; - - assert(pthread_mutex_unlock(&mutex) == 0); - - if ((result = pthread_cond_signal(&cv)) != 0) - { - printf("Error = %s\n", error_string[result]); - } - assert(result == 0); - - return (void *) 0; -} - -int -main() -{ - pthread_t t[NUMTHREADS]; - struct timespec abstime = { 0, 0 }; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert((t[0] = pthread_self()) != NULL); - - assert(pthread_cond_init(&cv, NULL) == 0); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - assert(pthread_mutex_lock(&mutex) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - assert(pthread_create(&t[1], NULL, mythread, (void *) 1) == 0); - - abstime.tv_sec += 5; - - while (! (shared > 0)) - assert(pthread_cond_timedwait(&cv, &mutex, &abstime) == 0); - - assert(shared > 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_cond_destroy(&cv) == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar3_1.c b/winsup/testsuite/winsup.api/pthread/condvar3_1.c deleted file mode 100644 index b08b04889..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar3_1.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * File: condvar3_1.c - * - * Test Synopsis: - * - Test timeout of multiple waits on a CV with some signaled. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Because some CVs are never signaled, we expect their waits to time out. - * Some are signaled, the rest time out. Pthread_cond_destroy() will fail - * unless all are accounted for, either signaled or timedout. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait does not return ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -static pthread_cond_t cv; -static pthread_cond_t cv1; -static pthread_mutex_t mutex; -static struct timespec abstime = { 0, 0 }; -static int timedout = 0; -static int signaled = 0; -static int awoken = 0; -static int waiting = 0; - -enum { - NUMTHREADS = 60 -}; - -void * -mythread(void * arg) -{ - int result; - - assert(pthread_mutex_lock(&mutex) == 0); - - if ( ++waiting == NUMTHREADS) - assert(pthread_cond_signal(&cv1) == 0); - - result = pthread_cond_timedwait(&cv, &mutex, &abstime); - if (result == ETIMEDOUT) - { - timedout++; - } - else - { - awoken++; - } - - assert(pthread_mutex_unlock(&mutex) == 0); - - return arg; -} - -int -main() -{ - int i; - pthread_t t[NUMTHREADS + 1]; - int result = 0; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert(pthread_cond_init(&cv, NULL) == 0); - assert(pthread_cond_init(&cv1, NULL) == 0); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert(pthread_mutex_lock(&mutex) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0); - } - - do { - assert(pthread_cond_wait(&cv1,&mutex) == 0); - } while ( NUMTHREADS != waiting ); - - assert(pthread_mutex_unlock(&mutex) == 0); - - for (i = NUMTHREADS/3; i <= 2*NUMTHREADS/3; i++) - { - assert(pthread_cond_signal(&cv) == 0); - signaled++; - } - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_join(t[i], (void **) &result) == 0); - assert(result == i); - } - - printf("awk = %d\n", awoken); - printf("sig = %d\n", signaled); - printf("tot = %d\n", timedout); - - assert(signaled == awoken); - assert(timedout == NUMTHREADS - signaled); - - result = pthread_cond_destroy(&cv); - assert(result == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar3_2.c b/winsup/testsuite/winsup.api/pthread/condvar3_2.c deleted file mode 100644 index 57e7eb439..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar3_2.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * File: condvar3_2.c - * - * Test Synopsis: - * - Test timeout of multiple waits on a CV with remainder broadcast awoken. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Because some CVs are never signaled, we expect their waits to time out. - * Some time out, the rest are broadcast signaled. Pthread_cond_destroy() will fail - * unless all are accounted for, either signaled or timedout. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait does not return ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -static pthread_cond_t cv; -static pthread_mutex_t mutex; -static struct timespec abstime = { 0, 0 }; -static struct timespec abstime2 = { 0, 0 }; -static int timedout = 0; -static int awoken = 0; - -enum { - NUMTHREADS = 60 -}; - -void * -mythread(void * arg) -{ - int result; - - assert(pthread_mutex_lock(&mutex) == 0); - - abstime2.tv_sec = abstime.tv_sec; - - if ((int) arg % 3 == 0) - { - abstime2.tv_sec += 2; - } - - result = pthread_cond_timedwait(&cv, &mutex, &abstime2); - if (result == ETIMEDOUT) - { - timedout++; - } - else - { - awoken++; - } - - assert(pthread_mutex_unlock(&mutex) == 0); - - return arg; -} - -int -main() -{ - int i; - pthread_t t[NUMTHREADS + 1]; - int result = 0; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert(pthread_cond_init(&cv, NULL) == 0); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = abstime.tv_sec = currSysTime.time + 5; - abstime.tv_nsec = abstime2.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - assert(pthread_mutex_lock(&mutex) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0); - } - - assert(pthread_mutex_unlock(&mutex) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_join(t[i], (void **) &result) == 0); - assert(result == i); - /* - * Approximately 2/3rds of the threads are expected to time out. - * Signal the remainder after some threads have woken up and exited - * and while some are still waking up after timeout. - * Also tests that redundant broadcasts don't return errors. - */ - if (awoken > NUMTHREADS/3) - { - assert(pthread_cond_broadcast(&cv) == 0); - } - } - - assert(awoken == NUMTHREADS - timedout); - - result = pthread_cond_destroy(&cv); - assert(result == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar3_3.c b/winsup/testsuite/winsup.api/pthread/condvar3_3.c deleted file mode 100644 index f6bcca9fa..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar3_3.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * File: condvar3_3.c - * - * Test Synopsis: - * - Test timeouts and lost signals on a CV. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait does not return ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -/* Timur Aydin (taydin@snet.net) */ - -#include "test.h" - -#include - -pthread_cond_t cnd; -pthread_mutex_t mtx; - -int main() -{ - int rc; - - struct timespec abstime = { 0, 0 }; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert(pthread_cond_init(&cnd, 0) == 0); - assert(pthread_mutex_init(&mtx, 0) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - abstime.tv_sec += 1; - - /* Here pthread_cond_timedwait should time out after one second. */ - - assert(pthread_mutex_lock(&mtx) == 0); - - assert((rc = pthread_cond_timedwait(&cnd, &mtx, &abstime)) == ETIMEDOUT); - - assert(pthread_mutex_unlock(&mtx) == 0); - - /* Here, the condition variable is signaled, but there are no - threads waiting on it. The signal should be lost and - the next pthread_cond_timedwait should time out too. */ - - assert(pthread_mutex_lock(&mtx) == 0); - - assert((rc = pthread_cond_signal(&cnd)) == 0); - - assert(pthread_mutex_unlock(&mtx) == 0); - - assert(pthread_mutex_lock(&mtx) == 0); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - abstime.tv_sec += 1; - - assert((rc = pthread_cond_timedwait(&cnd, &mtx, &abstime)) == ETIMEDOUT); - - assert(pthread_mutex_unlock(&mtx) == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar4.c b/winsup/testsuite/winsup.api/pthread/condvar4.c deleted file mode 100644 index 7a2007a4a..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar4.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * File: condvar4.c - * - * Test Synopsis: - * - Test PTHREAD_COND_INITIALIZER. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Test basic CV function but starting with a static initialised - * CV. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns 0. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -enum { - NUMTHREADS = 2 -}; - -void * -mythread(void * arg) -{ - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_cond_signal(&cvthing.notbusy) == 0); - - return (void *) 0; -} - -int -main() -{ - pthread_t t[NUMTHREADS]; - struct timespec abstime = { 0, 0 }; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - cvthing.shared = 0; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - assert(cvthing.lock != PTHREAD_MUTEX_INITIALIZER); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == ETIMEDOUT); - - assert(cvthing.notbusy != PTHREAD_COND_INITIALIZER); - - assert(pthread_create(&t[1], NULL, mythread, (void *) 1) == 0); - - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - assert(cvthing.shared > 0); - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar5.c b/winsup/testsuite/winsup.api/pthread/condvar5.c deleted file mode 100644 index b493ab136..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar5.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * File: condvar5.c - * - * Test Synopsis: - * - Test pthread_cond_broadcast. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Test broadcast with one waiting CV. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns 0. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -enum { - NUMTHREADS = 2 -}; - -void * -mythread(void * arg) -{ - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_cond_broadcast(&cvthing.notbusy) == 0); - - return (void *) 0; -} - -int -main() -{ - pthread_t t[NUMTHREADS]; - struct timespec abstime = { 0, 0 }; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - cvthing.shared = 0; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - assert(cvthing.lock != PTHREAD_MUTEX_INITIALIZER); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == ETIMEDOUT); - - assert(cvthing.notbusy != PTHREAD_COND_INITIALIZER); - - assert(pthread_create(&t[1], NULL, mythread, (void *) 1) == 0); - - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - assert(cvthing.shared > 0); - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar6.c b/winsup/testsuite/winsup.api/pthread/condvar6.c deleted file mode 100644 index f011bea13..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar6.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * File: - * - * Test Synopsis: - * - Test pthread_cond_broadcast. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Test broadcast with NUMTHREADS (=5) waiting CVs. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 5 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -static pthread_mutex_t start_flag = PTHREAD_MUTEX_INITIALIZER; - -static struct timespec abstime = { 0, 0 }; - -static int awoken; - -void * -mythread(void * arg) -{ - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Wait for the start gun */ - assert(pthread_mutex_lock(&start_flag) == 0); - assert(pthread_mutex_unlock(&start_flag) == 0); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - assert(cvthing.shared > 0); - - awoken++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - return (void *) 0; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - cvthing.shared = 0; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - assert(pthread_mutex_lock(&start_flag) == 0); - - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert((t[0] = pthread_self()) != NULL); - - awoken = 0; - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - - assert(pthread_mutex_unlock(&start_flag) == 0); - - /* - * Give threads time to start. - */ - Sleep(2000); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_cond_broadcast(&cvthing.notbusy) == 0); - - /* - * Give threads time to complete. - */ - Sleep(2000); - - /* - * Cleanup the CV. - */ - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - failed = !threadbag[i].started; - - if (failed) - { - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. - */ - - assert(awoken == NUMTHREADS); - - /* - * Success. - */ - return 0; -} - - diff --git a/winsup/testsuite/winsup.api/pthread/condvar7.c b/winsup/testsuite/winsup.api/pthread/condvar7.c deleted file mode 100644 index 8e9808f48..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar7.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * File: condvar7.c - * - * - * Test Synopsis: - * - Test pthread_cond_broadcast with thread cancelation. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Test broadcast with NUMTHREADS (=5) waiting CVs, one is canceled while waiting. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 5 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -static pthread_mutex_t start_flag = PTHREAD_MUTEX_INITIALIZER; - -static struct timespec abstime = { 0, 0 }; - -static int awoken; - -void * -mythread(void * arg) -{ - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Wait for the start gun */ - assert(pthread_mutex_lock(&start_flag) == 0); - assert(pthread_mutex_unlock(&start_flag) == 0); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - -#ifdef _MSC_VER -#pragma inline_depth(0) -#endif - pthread_cleanup_push((void *) pthread_mutex_unlock, (void *) &cvthing.lock); - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - pthread_cleanup_pop(0); -#ifdef _MSC_VER -#pragma inline_depth() -#endif - - assert(cvthing.shared > 0); - - awoken++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - return (void *) 0; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - cvthing.shared = 0; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - assert(pthread_mutex_lock(&start_flag) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 10; - - assert((t[0] = pthread_self()) != NULL); - - awoken = 0; - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - - assert(pthread_mutex_unlock(&start_flag) == 0); - - /* - * Give threads time to start. - */ - Sleep(1000); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - /* - * Cancel one of the threads. - */ - assert(pthread_cancel(t[3]) == 0); - Sleep(500); - - /* - * Signal all remaining waiting threads. - */ - assert(pthread_cond_broadcast(&cvthing.notbusy) == 0); - - /* - * Give threads time to complete. - */ - Sleep(2000); - - /* - * Cleanup the CV. - */ - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - failed = !threadbag[i].started; - - if (failed) - { - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. - */ - - assert(awoken == (NUMTHREADS - 1)); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar8.c b/winsup/testsuite/winsup.api/pthread/condvar8.c deleted file mode 100644 index 771d91cb5..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar8.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * File: condvar8.c - * - * Test Synopsis: - * - Test multiple pthread_cond_broadcasts. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Make NUMTHREADS threads wait on CV, broadcast signal them, and then repeat. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 5 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -static pthread_mutex_t start_flag = PTHREAD_MUTEX_INITIALIZER; - -static struct timespec abstime = { 0, 0 }; - -static int awoken; - -static void * -mythread(void * arg) -{ - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Wait for the start gun */ - assert(pthread_mutex_lock(&start_flag) == 0); - assert(pthread_mutex_unlock(&start_flag) == 0); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - pthread_cleanup_push((__cleanup_routine_type)pthread_mutex_unlock, - (void *) &cvthing.lock); - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - pthread_cleanup_pop(0); - - assert(cvthing.shared > 0); - - awoken++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - return (void *) 0; -} - -int -main() -{ - int failed = 0; - int i; - int first, last; - pthread_t t[NUMTHREADS + 1]; - - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 10; - - assert((t[0] = pthread_self()) != NULL); - - awoken = 0; - - for (first = 1, last = NUMTHREADS / 2; - first < NUMTHREADS; - first = last + 1, last = NUMTHREADS) - { - assert(pthread_mutex_lock(&start_flag) == 0); - - for (i = first; i <= last; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - assert(pthread_detach(t[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - cvthing.shared = 0; - - assert(pthread_mutex_unlock(&start_flag) == 0); - - /* - * Give threads time to start. - */ - Sleep(1000); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_cond_broadcast(&cvthing.notbusy) == 0); - - /* - * Give threads time to complete. - */ - Sleep(1000); - - assert(awoken == (i - 1)); - } - - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - failed = !threadbag[i].started; - - if (failed) - { - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - /* - * Cleanup the CV. - */ - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - assert(!failed); - - /* - * Check any results here. - */ - - assert(awoken == NUMTHREADS); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar9.c b/winsup/testsuite/winsup.api/pthread/condvar9.c deleted file mode 100644 index 294556266..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar9.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * File: condvar9.c - * - * - * Test Synopsis: - * - Test multiple pthread_cond_broadcasts with thread cancelation. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Make NUMTHREADS threads wait on CV, broadcast signal them, cancel them - * and then repeat. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 9 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -static pthread_mutex_t start_flag = PTHREAD_MUTEX_INITIALIZER; - -static struct timespec abstime = { 0, 0 }; - -static int awoken; -static int not_canceled; - -static void * -mythread(void * arg) -{ - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Wait for the start gun */ - assert(pthread_mutex_lock(&start_flag) == 0); - assert(pthread_mutex_unlock(&start_flag) == 0); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - /* - * pthread_cond_timedwait is a cancelation point and we - * going to cancel one deliberately. - */ -#ifdef _MSC_VER -#pragma inline_depth(0) -#endif - pthread_cleanup_push((void *) pthread_mutex_unlock, (void *) &cvthing.lock); - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - assert(cvthing.shared > 0); - - awoken++; - - pthread_testcancel(); - - pthread_cleanup_pop(0); -#ifdef _MSC_VER -#pragma inline_depth() -#endif - - not_canceled++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - return (void *) 0; -} - -int -main() -{ - int failed = 0; - int i; - int first, last; - pthread_t t[NUMTHREADS + 1]; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert((t[0] = pthread_self()) != NULL); - - awoken = 0; - not_canceled = 0; - - for (first = 1, last = NUMTHREADS / 2; - first < NUMTHREADS; - first = last + 1, last = NUMTHREADS) - { - assert(pthread_mutex_lock(&start_flag) == 0); - - for (i = first; i <= last; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - assert(pthread_detach(t[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - cvthing.shared = 0; - - assert(pthread_mutex_unlock(&start_flag) == 0); - - /* - * Give threads time to start. - */ - Sleep(1000); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_cond_broadcast(&cvthing.notbusy) == 0); - for (i = first; i <= last; i++) - assert(pthread_cancel(t[i]) == 0); - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - /* - * Give threads time to complete. - */ - Sleep(1000); - } - - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - failed = !threadbag[i].started; - - if (failed) - { - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - /* - * Cleanup the CV. - */ - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - assert(!failed); - - /* - * Check any results here. - */ - - assert(awoken == NUMTHREADS); - assert(not_canceled == 0); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/count1.c b/winsup/testsuite/winsup.api/pthread/count1.c deleted file mode 100644 index ae30ed0a2..000000000 --- a/winsup/testsuite/winsup.api/pthread/count1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * count1.c - * - * Description: - * Test some basic assertions about the number of threads at runtime. - */ - -#include "test.h" - -#if ! defined (__MINGW32__) || defined (__MSVCRT__) -#define NUMTHREADS (60) -#else -#define NUMTHREADS (59) -#endif - -static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; -static pthread_t threads[NUMTHREADS]; -static unsigned numThreads = 0; - -void * -myfunc(void *arg) -{ - pthread_mutex_lock(&lock); - numThreads++; - pthread_mutex_unlock(&lock); - - Sleep(1000); - return 0; -} -int -main() -{ - int i; - int maxThreads = sizeof(threads) / sizeof(pthread_t); - - /* - * Spawn NUMTHREADS threads. Each thread should increment the - * numThreads variable, sleep for one second. - */ - for (i = 0; i < maxThreads; i++) - { - assert(pthread_create(&threads[i], NULL, myfunc, 0) == 0); - } - - /* - * Wait for all the threads to exit. - */ - for (i = 0; i < maxThreads; i++) - { - assert(pthread_join(threads[i], NULL) == 0); - } - - /* - * Check the number of threads created. - */ - assert((int) numThreads == maxThreads); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/create1.c b/winsup/testsuite/winsup.api/pthread/create1.c deleted file mode 100644 index 192e52d9d..000000000 --- a/winsup/testsuite/winsup.api/pthread/create1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * create1.c - * - * Description: - * Create a thread and check that it ran. - * - * Depends on API functions: None. - */ - -#include "test.h" - -static int washere = 0; - -void * func(void * arg) -{ - washere = 1; - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_create(&t, NULL, func, NULL) == 0); - - /* A dirty hack, but we cannot rely on pthread_join in this - primitive test. */ - Sleep(2000); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/create2.c b/winsup/testsuite/winsup.api/pthread/create2.c deleted file mode 100644 index 40e637b9d..000000000 --- a/winsup/testsuite/winsup.api/pthread/create2.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * File: create2.c - * - * Test Synopsis: - * - Test that threads have a Win32 handle when started. - * - * Test Method (Validation or Falsification): - * - Statistical, not absolute (depends on sample size). - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -const int NUMTHREADS = 10000; - -static int washere = 0; - -void * func(void * arg) -{ - washere = 1; - return (void *) 0; -} - -int -main() -{ - pthread_t t; - pthread_attr_t attr; - void * result = NULL; - int i; - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - for (i = 0; i < NUMTHREADS; i++) - { - washere = 0; - assert(pthread_create(&t, &attr, func, NULL) == 0); - pthread_join(t, &result); - assert(washere == 1); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/equal1.c b/winsup/testsuite/winsup.api/pthread/equal1.c deleted file mode 100644 index 617a95664..000000000 --- a/winsup/testsuite/winsup.api/pthread/equal1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Test for pthread_equal. - * - * Depends on functions: pthread_create(). - */ - -#include "test.h" - -void * func(void * arg) -{ - Sleep(2000); - return 0; -} - -int -main() -{ - pthread_t t1, t2; - - assert(pthread_create(&t1, NULL, func, (void *) 1) == 0); - - assert(pthread_create(&t2, NULL, func, (void *) 2) == 0); - - assert(pthread_equal(t1, t2) == 0); - - assert(pthread_equal(t1,t1) != 0); - - /* This is a hack. We don't want to rely on pthread_join - yet if we can help it. */ - Sleep(4000); - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/exit1.c b/winsup/testsuite/winsup.api/pthread/exit1.c deleted file mode 100644 index 06b7692de..000000000 --- a/winsup/testsuite/winsup.api/pthread/exit1.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Test for pthread_exit(). - * - * Depends on API functions: None. - */ - -#include "test.h" - -int -main(int argc, char * argv[]) -{ - /* A simple test first. */ - pthread_exit((void *) 0); - - /* Not reached */ - assert(0); - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/exit2.c b/winsup/testsuite/winsup.api/pthread/exit2.c deleted file mode 100644 index 684305b40..000000000 --- a/winsup/testsuite/winsup.api/pthread/exit2.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Test for pthread_exit(). - * - * Depends on API functions: - * pthread_create() - * pthread_exit() - */ - -#include "test.h" - -void * -func(void * arg) -{ - pthread_exit(arg); - - /* Never reached. */ - assert(0); -} - -int -main(int argc, char * argv[]) -{ - pthread_t t; - - assert(pthread_create(&t, NULL, func, (void *) NULL) == 0); - - Sleep(1000); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/exit3.c b/winsup/testsuite/winsup.api/pthread/exit3.c deleted file mode 100644 index 0b6ec31c5..000000000 --- a/winsup/testsuite/winsup.api/pthread/exit3.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Test for pthread_exit(). - * - * Depends on API functions: pthread_create(). - */ - -#include "test.h" - -void * -func(void * arg) -{ - pthread_exit(arg); - - /* Never reached. */ - assert(0); -} - -int -main(int argc, char * argv[]) -{ - pthread_t id[4]; - int i; - - /* Create a few threads and then exit. */ - for (i = 0; i < 4; i++) - { - assert(pthread_create(&id[i], NULL, func, (void *) i) == 0); - } - - Sleep(1000); - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/inherit1.c b/winsup/testsuite/winsup.api/pthread/inherit1.c deleted file mode 100644 index a909eb763..000000000 --- a/winsup/testsuite/winsup.api/pthread/inherit1.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * File: inherit1.c - * - * Test Synopsis: - * - Test thread priority inheritance. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -void * func(void * arg) -{ - int policy; - struct sched_param param; - - assert(pthread_getschedparam(pthread_self(), &policy, ¶m) == 0); - return (void *) param.sched_priority; -} - -int -main() -{ - pthread_t t; - pthread_t mainThread = pthread_self(); - pthread_attr_t attr; - void * result = NULL; - struct sched_param param; - struct sched_param mainParam; - int maxPrio; - int minPrio; - int prio; - int policy; - int inheritsched = -1; - - assert((maxPrio = sched_get_priority_max(SCHED_OTHER)) != -1); - assert((minPrio = sched_get_priority_min(SCHED_OTHER)) != -1); - - assert(pthread_attr_init(&attr) == 0); - assert(pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED) == 0); - assert(pthread_attr_getinheritsched(&attr, &inheritsched) == 0); - assert(inheritsched == PTHREAD_INHERIT_SCHED); - - for (prio = minPrio; prio < maxPrio; prio++) - { - mainParam.sched_priority = prio; - - /* Change the main thread priority */ - assert(pthread_setschedparam(mainThread, SCHED_OTHER, &mainParam) == 0); - assert(pthread_getschedparam(mainThread, &policy, &mainParam) == 0); - assert(policy == SCHED_OTHER); - assert(mainParam.sched_priority == prio); - - for (param.sched_priority = prio; - param.sched_priority <= maxPrio; - param.sched_priority++) - { - /* The new thread create should ignore this new priority */ - assert(pthread_attr_setschedparam(&attr, ¶m) == 0); - assert(pthread_create(&t, &attr, func, NULL) == 0); - pthread_join(t, &result); - assert((int) result == mainParam.sched_priority); - } - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/join0.c b/winsup/testsuite/winsup.api/pthread/join0.c deleted file mode 100644 index 54b0bee6b..000000000 --- a/winsup/testsuite/winsup.api/pthread/join0.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Test for pthread_join(). - * - * Depends on API functions: pthread_create(), pthread_exit(). - */ - -#include "test.h" - -void * -func(void * arg) -{ - Sleep(2000); - - pthread_exit(arg); - - /* Never reached. */ - exit(1); -} - -int -main(int argc, char * argv[]) -{ - pthread_t id; - int result; - - /* Create a single thread and wait for it to exit. */ - assert(pthread_create(&id, NULL, func, (void *) 123) == 0); - - assert(pthread_join(id, (void **) &result) == 0); - -#if ! defined (__MINGW32__) || defined (__MSVCRT__) - assert(result == 123); -#else -# warning pthread_join not fully supported in this configuration. - assert(result == 0); -#endif - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/join1.c b/winsup/testsuite/winsup.api/pthread/join1.c deleted file mode 100644 index d74e0c484..000000000 --- a/winsup/testsuite/winsup.api/pthread/join1.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Test for pthread_join(). - * - * Depends on API functions: pthread_create(), pthread_join(), pthread_exit(). - */ - -#include "test.h" - -void * -func(void * arg) -{ - int i = (int) arg; - - Sleep(i * 500); - - pthread_exit(arg); - - /* Never reached. */ - exit(1); -} - -int -main(int argc, char * argv[]) -{ - pthread_t id[4]; - int i; - int result; - - /* Create a few threads and then exit. */ - for (i = 0; i < 4; i++) - { - assert(pthread_create(&id[i], NULL, func, (void *) i) == 0); - } - - /* Some threads will finish before they are joined, some after. */ - Sleep(1000); - - for (i = 0; i < 4; i++) - { - assert(pthread_join(id[i], (void **) &result) == 0); -#if ! defined (__MINGW32__) || defined (__MSVCRT__) - assert(result == i); -#else -# warning pthread_join not fully supported in this configuration. - assert(result == 0); -#endif - } - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/join2.c b/winsup/testsuite/winsup.api/pthread/join2.c deleted file mode 100644 index cdc8ca2d9..000000000 --- a/winsup/testsuite/winsup.api/pthread/join2.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Test for pthread_join() returning return value from threads. - * - * Depends on API functions: pthread_create(). - */ - -#include "test.h" - -void * -func(void * arg) -{ - Sleep(1000); - return arg; -} - -int -main(int argc, char * argv[]) -{ - pthread_t id[4]; - int i; - int result; - - /* Create a few threads and then exit. */ - for (i = 0; i < 4; i++) - { - assert(pthread_create(&id[i], NULL, func, (void *) i) == 0); - } - - for (i = 0; i < 4; i++) - { - assert(pthread_join(id[i], (void **) &result) == 0); -#if ! defined (__MINGW32__) || defined (__MSVCRT__) - /* CRTDLL _beginthread doesn't support return value, so - the assertion is guaranteed to fail. */ - assert(result == i); -#endif - } - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mainthreadexits.c b/winsup/testsuite/winsup.api/pthread/mainthreadexits.c deleted file mode 100644 index b3a3653b8..000000000 --- a/winsup/testsuite/winsup.api/pthread/mainthreadexits.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include -#include - -static void * Thread (void *); - -static pthread_t main_thread; -static pthread_t secondThread; -static int result = 2; - -int main(void) -{ - main_thread = pthread_self (); - - if (pthread_create (&secondThread, NULL, Thread, NULL)) - exit (1); - sleep (5); - pthread_exit (&result); - /* If pthread_exit doesm't (which would be a bug) then we do */ - return 1; -} - -static void * Thread (void *not_used) -{ - void *myresult; - /* We should be able to join this */ - if (pthread_join (main_thread, &myresult)) - exit (1); - - if (*(int *)myresult != 2) - exit (1); - - exit (0); -} -/* -This valid code doesn't work at all. The mainthread object in MTinterface -is not properly initialized, the cancel_event is NULL and the win32_obj_id -is NULL because myself->hProcess is NULL when MTinterface is initialized -(and i don't think that a process handle can be used as thread handle). -Even if the handles would be valid the pthread_join call would try to -delete a thread object that is created static which would result in a -corrupted heap. - -Concept test Contributed by Thomas Pfaff -Scriptable test by Robert Collins - -*/ diff --git a/winsup/testsuite/winsup.api/pthread/mutex1.c b/winsup/testsuite/winsup.api/pthread/mutex1.c deleted file mode 100644 index b7f6b6f15..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex1.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * mutex1.c - * - * Create a simple mutex object, lock it, and then unlock it again. - * This is the simplest test of the pthread mutex family that we can do. - * - * Depends on API functions: - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() - * pthread_mutex_destroy() - */ - -#include "test.h" - -pthread_mutex_t mutex = NULL; - -int -main() -{ - assert(mutex == NULL); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex1d.c b/winsup/testsuite/winsup.api/pthread/mutex1d.c deleted file mode 100644 index 354b106d1..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex1d.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * mutex1d.c - * - * As for mutex1.c but with type set to PTHREAD_MUTEX_DEFAULT. - * - * Create a simple mutex object, lock it, unlock it, then destroy it. - * This is the simplest test of the pthread mutex family that we can do. - * - * Depends on API functions: - * pthread_mutexattr_settype() - * pthread_mutex_init() - * pthread_mutex_destroy() - */ - -#include "test.h" - -pthread_mutex_t mutex = NULL; -pthread_mutexattr_t mxAttr; - -int -main() -{ - assert(pthread_mutexattr_init(&mxAttr) == 0); - - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_DEFAULT) == 0); - - assert(mutex == NULL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex1e.c b/winsup/testsuite/winsup.api/pthread/mutex1e.c deleted file mode 100644 index 2feb16c08..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex1e.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * mutex1e.c - * - * As for mutex1.c but with type set to PTHREAD_MUTEX_ERRORCHECK. - * - * Create a simple mutex object, lock it, unlock it, then destroy it. - * This is the simplest test of the pthread mutex family that we can do. - * - * Depends on API functions: - * pthread_mutexattr_settype() - * pthread_mutex_init() - * pthread_mutex_destroy() - */ - -#include "test.h" - -pthread_mutex_t mutex = NULL; -pthread_mutexattr_t mxAttr; - -int -main() -{ - assert(pthread_mutexattr_init(&mxAttr) == 0); - - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_ERRORCHECK) == 0); - - assert(mutex == NULL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex1n.c b/winsup/testsuite/winsup.api/pthread/mutex1n.c deleted file mode 100644 index 9af3d5f5c..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex1n.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * mutex1n.c - * - * As for mutex1.c but with type set to PTHREAD_MUTEX_NORMAL. - * - * Create a simple mutex object, lock it, unlock it, then destroy it. - * This is the simplest test of the pthread mutex family that we can do. - * - * Depends on API functions: - * pthread_mutexattr_settype() - * pthread_mutex_init() - * pthread_mutex_destroy() - */ - -#include "test.h" - -pthread_mutex_t mutex = NULL; -pthread_mutexattr_t mxAttr; - -int -main() -{ - assert(pthread_mutexattr_init(&mxAttr) == 0); - - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_NORMAL) == 0); - - assert(mutex == NULL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex1r.c b/winsup/testsuite/winsup.api/pthread/mutex1r.c deleted file mode 100644 index b5131bb0e..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex1r.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * mutex1r.c - * - * As for mutex1.c but with type set to PTHREAD_MUTEX_RECURSIVE. - * - * Create a simple mutex object, lock it, unlock it, then destroy it. - * This is the simplest test of the pthread mutex family that we can do. - * - * Depends on API functions: - * pthread_mutexattr_settype() - * pthread_mutex_init() - * pthread_mutex_destroy() - */ - -#include "test.h" - -pthread_mutex_t mutex = NULL; -pthread_mutexattr_t mxAttr; - -int -main() -{ - assert(pthread_mutexattr_init(&mxAttr) == 0); - - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE) == 0); - - assert(mutex == NULL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex2.c b/winsup/testsuite/winsup.api/pthread/mutex2.c deleted file mode 100644 index 731c47fab..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex2.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * mutex2.c - * - * Declare a static mutex object, lock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - -int -main() -{ - assert(mutex == PTHREAD_MUTEX_INITIALIZER); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(mutex != PTHREAD_MUTEX_INITIALIZER); - - assert(mutex != NULL); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex3.c b/winsup/testsuite/winsup.api/pthread/mutex3.c deleted file mode 100644 index 07e75b187..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex3.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * mutex3.c - * - * Declare a static mutex object, lock it, trylock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; - -static int washere = 0; - -void * func(void * arg) -{ - assert(pthread_mutex_trylock(&mutex1) == EBUSY); - - washere = 1; - - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_mutex_lock(&mutex1) == 0); - - assert(pthread_create(&t, NULL, func, NULL) == 0); - assert(pthread_join(t, NULL) == 0); - - assert(pthread_mutex_unlock(&mutex1) == 0); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex4.c b/winsup/testsuite/winsup.api/pthread/mutex4.c deleted file mode 100644 index 8a983fee9..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex4.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * mutex4.c - * - * Thread A locks mutex - thread B tries to unlock. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int wasHere = 0; - -static pthread_mutex_t mutex1; - -void * unlocker(void * arg) -{ - int expectedResult = (int) arg; - - wasHere++; - assert(pthread_mutex_unlock(&mutex1) == expectedResult); - wasHere++; - return NULL; -} - -int -main() -{ - pthread_t t; - pthread_mutexattr_t ma; - - assert(pthread_mutexattr_init(&ma) == 0); - - wasHere = 0; - assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ERRORCHECK) == 0); - assert(pthread_mutex_init(&mutex1, &ma) == 0); - assert(pthread_mutex_lock(&mutex1) == 0); - assert(pthread_create(&t, NULL, unlocker, (void *) EPERM) == 0); - assert(pthread_join(t, NULL) == 0); - assert(pthread_mutex_unlock(&mutex1) == 0); - assert(pthread_mutex_destroy(&mutex1) == 0); - assert(wasHere == 2); - - wasHere = 0; - assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ERRORCHECK) == 0); - assert(pthread_mutex_init(&mutex1, &ma) == 0); - assert(pthread_mutex_lock(&mutex1) == 0); - assert(pthread_create(&t, NULL, unlocker, (void *) EPERM) == 0); - assert(pthread_join(t, NULL) == 0); - assert(pthread_mutex_unlock(&mutex1) == 0); - assert(pthread_mutex_destroy(&mutex1) == 0); - assert(wasHere == 2); - - wasHere = 0; - assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE) == 0); - assert(pthread_mutex_init(&mutex1, &ma) == 0); - assert(pthread_mutex_lock(&mutex1) == 0); - assert(pthread_create(&t, NULL, unlocker, (void *) EPERM) == 0); - assert(pthread_join(t, NULL) == 0); - assert(pthread_mutex_unlock(&mutex1) == 0); - assert(pthread_mutex_destroy(&mutex1) == 0); - assert(wasHere == 2); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex5.c b/winsup/testsuite/winsup.api/pthread/mutex5.c deleted file mode 100644 index 7029da12f..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex5.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * mutex5.c - * - * Confirm the equality/inequality of the various mutex types, - * and the default not-set value. - */ - -#include "test.h" - -static pthread_mutexattr_t mxAttr; - -int -main() -{ - int mxType = -1; - int success = 0; /* Use to quell GNU compiler warnings. */ - - assert(success = PTHREAD_MUTEX_DEFAULT == PTHREAD_MUTEX_NORMAL); - assert(success = PTHREAD_MUTEX_DEFAULT != PTHREAD_MUTEX_RECURSIVE); - assert(success = PTHREAD_MUTEX_RECURSIVE != PTHREAD_MUTEX_ERRORCHECK); - - if (success == success) - { - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_ERRORCHECK); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex6d.c b/winsup/testsuite/winsup.api/pthread/mutex6d.c deleted file mode 100644 index f39c1ac53..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex6d.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * mutex6d.c - * - * Tests PTHREAD_MUTEX_DEFAULT mutex type. - * Thread locks mutex twice (recursive lock). - * The thread should deadlock. - * - * Depends on API functions: - * pthread_create() - * pthread_mutexattr_init() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - - /* Should wait here (deadlocked) */ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_DEFAULT) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_NORMAL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - Sleep(1000); - - assert(lockCount == 1); - - /* - * Should succeed even though we don't own the lock - * because FAST mutexes don't check ownership. - */ - assert(pthread_mutex_unlock(&mutex) == 0); - - Sleep (1000); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex6e.c b/winsup/testsuite/winsup.api/pthread/mutex6e.c deleted file mode 100644 index e22550f7a..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex6e.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * mutex6e.c - * - * Tests PTHREAD_MUTEX_ERRORCHECK mutex type. - * Thread locks mutex twice (recursive lock). - * This should fail with an EDEADLK error. - * The second unlock attempt should fail with an EPERM error. - * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_lock(&mutex) == EDEADLK); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == EPERM); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int result = 0; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_ERRORCHECK) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_ERRORCHECK); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - assert(pthread_join(t, (void **) &result) == 0); - assert(result == 555); - - assert(lockCount == 2); - - assert(pthread_mutex_destroy(&mutex) == 0); - assert(pthread_mutexattr_destroy(&mxAttr) == 0); - - exit(0); - - /* Never reached */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/mutex6n.c b/winsup/testsuite/winsup.api/pthread/mutex6n.c deleted file mode 100644 index 38cbba034..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex6n.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * mutex6n.c - * - * Tests PTHREAD_MUTEX_NORMAL mutex type. - * Thread locks mutex twice (recursive lock). - * The thread should deadlock. - * - * Depends on API functions: - * pthread_create() - * pthread_mutexattr_init() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - - /* Should wait here (deadlocked) */ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_NORMAL) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_NORMAL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - Sleep(1000); - - assert(lockCount == 1); - - /* - * Should succeed even though we don't own the lock - * because FAST mutexes don't check ownership. - */ - assert(pthread_mutex_unlock(&mutex) == 0); - - Sleep (1000); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/mutex6r.c b/winsup/testsuite/winsup.api/pthread/mutex6r.c deleted file mode 100644 index 586cc841b..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex6r.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * mutex6r.c - * - * Tests PTHREAD_MUTEX_RECURSIVE mutex type. - * Thread locks mutex twice (recursive lock). - * Both locks and unlocks should succeed. - * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == 0); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int result = 0; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_RECURSIVE); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - assert(pthread_join(t, (void **) &result) == 0); - assert(result == 555); - - assert(lockCount == 2); - - assert(pthread_mutex_destroy(&mutex) == 0); - assert(pthread_mutexattr_destroy(&mxAttr) == 0); - - exit(0); - - /* Never reached */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex7.c b/winsup/testsuite/winsup.api/pthread/mutex7.c deleted file mode 100644 index d2c9f8bee..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex7.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * mutex7.c - * - * Test the default (type not set) mutex type. - * Should be the same as PTHREAD_MUTEX_ERRORCHECK. - * Thread locks then trylocks mutex (attempted recursive lock). - * The thread should lock first time and EBUSY second time. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_trylock(&mutex) == EBUSY); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == EPERM); - - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - Sleep(1000); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex7d.c b/winsup/testsuite/winsup.api/pthread/mutex7d.c deleted file mode 100644 index 906d0f043..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex7d.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * mutex7d.c - * - * Test the default (type not set) mutex type. - * Should be the same as PTHREAD_MUTEX_ERRORCHECK. - * Thread locks then trylocks mutex (attempted recursive lock). - * The thread should lock first time and EBUSY second time. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_trylock(&mutex) == EBUSY); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == EPERM); - - return 0; -} - -int -main() -{ - int result = 0; - pthread_t t; - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - assert(pthread_join(t, (void **) &result) == 0); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex7e.c b/winsup/testsuite/winsup.api/pthread/mutex7e.c deleted file mode 100644 index 05722512d..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex7e.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * mutex7e.c - * - * Tests PTHREAD_MUTEX_ERRORCHECK mutex type. - * Thread locks and then trylocks mutex (attempted recursive lock). - * Trylock should fail with an EBUSY error. - * The second unlock attempt should fail with an EPERM error. - * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_trylock(&mutex) == EBUSY); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == EPERM); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int result = 0; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_ERRORCHECK) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_ERRORCHECK); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - assert(pthread_join(t, (void **) &result) == 0); - assert(result == 555); - - assert(lockCount == 2); - - assert(pthread_mutex_destroy(&mutex) == 0); - assert(pthread_mutexattr_destroy(&mxAttr) == 0); - - exit(0); - - /* Never reached */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/mutex7n.c b/winsup/testsuite/winsup.api/pthread/mutex7n.c deleted file mode 100644 index e9a36fec0..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex7n.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * mutex7n.c - * - * Tests PTHREAD_MUTEX_NORMAL mutex type. - * Thread locks then trylocks mutex (attempted recursive lock). - * The thread should lock first time and EBUSY second time. - * - * Depends on API functions: - * pthread_create() - * pthread_mutexattr_init() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_trylock(&mutex) == EBUSY); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == EPERM); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_NORMAL) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_NORMAL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - Sleep(1000); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/mutex7r.c b/winsup/testsuite/winsup.api/pthread/mutex7r.c deleted file mode 100644 index 6f9ed744b..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex7r.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * mutex7r.c - * - * Tests PTHREAD_MUTEX_RECURSIVE mutex type. - * Thread locks mutex then trylocks mutex (recursive lock twice). - * Both locks and unlocks should succeed. - * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_trylock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == 0); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int result = 0; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_RECURSIVE); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - assert(pthread_join(t, (void **) &result) == 0); - assert(result == 555); - - assert(lockCount == 2); - - assert(pthread_mutex_destroy(&mutex) == 0); - assert(pthread_mutexattr_destroy(&mxAttr) == 0); - - exit(0); - - /* Never reached */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex8e.c b/winsup/testsuite/winsup.api/pthread/mutex8e.c deleted file mode 100644 index 7108b02af..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex8e.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * mutex8e.c - * - * Tests PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -pthread_mutex_t mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; - -int -main() -{ - assert(mutex == PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(mutex != PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == EDEADLK); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex8n.c b/winsup/testsuite/winsup.api/pthread/mutex8n.c deleted file mode 100644 index 46fc9c676..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex8n.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * mutex8n.c - * - * Tests PTHREAD_NORMAL_MUTEX_INITIALIZER_NP. - * Thread locks mutex twice (recursive lock). - * The thread should deadlock. - * - * Depends on API functions: - * pthread_create() - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -pthread_mutex_t mutex = PTHREAD_NORMAL_MUTEX_INITIALIZER_NP; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - - /* Should wait here (deadlocked) */ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - Sleep(1000); - - assert(lockCount == 1); - - /* - * Should succeed even though we don't own the lock - * because FAST mutexes don't check ownership. - */ - assert(pthread_mutex_unlock(&mutex) == 0); - - Sleep (1000); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/mutex8r.c b/winsup/testsuite/winsup.api/pthread/mutex8r.c deleted file mode 100644 index ecaccd3ec..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex8r.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * mutex8r.c - * - * Tests PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; - -int -main() -{ - assert(mutex == PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(mutex != PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/once1.c b/winsup/testsuite/winsup.api/pthread/once1.c deleted file mode 100644 index 91dc03832..000000000 --- a/winsup/testsuite/winsup.api/pthread/once1.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * once1.c - * - * Create a static pthread_once and test that it calls myfunc once. - * - * Depends on API functions: - * pthread_once() - * pthread_create() - */ - -#include "test.h" - -pthread_once_t once = PTHREAD_ONCE_INIT; - -static int washere = 0; - -void -myfunc(void) -{ - washere++; -} - -void * -mythread(void * arg) -{ - assert(pthread_once(&once, myfunc) == 0); - - return 0; -} - -int -main() -{ - pthread_t t1, t2; - - assert(pthread_create(&t1, NULL, mythread, NULL) == 0); - - assert(pthread_create(&t2, NULL, mythread, NULL) == 0); - - Sleep(2000); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/priority1.c b/winsup/testsuite/winsup.api/pthread/priority1.c deleted file mode 100644 index a31102895..000000000 --- a/winsup/testsuite/winsup.api/pthread/priority1.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * File: priority1.c - * - * Test Synopsis: - * - Test thread priority explicit setting using thread attribute. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -void * func(void * arg) -{ - int policy; - struct sched_param param; - - assert(pthread_getschedparam(pthread_self(), &policy, ¶m) == 0); - assert(policy == SCHED_OTHER); - return (void *) param.sched_priority; -} - -int -main() -{ - pthread_t t; - pthread_attr_t attr; - void * result = NULL; - struct sched_param param; - int maxPrio = sched_get_priority_max(SCHED_OTHER); - int minPrio = sched_get_priority_min(SCHED_OTHER); - - assert(pthread_attr_init(&attr) == 0); - assert(pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) == 0); - - for (param.sched_priority = minPrio; - param.sched_priority <= maxPrio; - param.sched_priority++) - { - assert(pthread_attr_setschedparam(&attr, ¶m) == 0); - assert(pthread_create(&t, &attr, func, NULL) == 0); - pthread_join(t, &result); - assert((int) result == param.sched_priority); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/priority2.c b/winsup/testsuite/winsup.api/pthread/priority2.c deleted file mode 100644 index 4dcf3859f..000000000 --- a/winsup/testsuite/winsup.api/pthread/priority2.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * File: priority2.c - * - * Test Synopsis: - * - Test thread priority setting after creation. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -pthread_mutex_t startMx = PTHREAD_MUTEX_INITIALIZER; - -void * func(void * arg) -{ - int policy; - struct sched_param param; - - assert(pthread_mutex_lock(&startMx) == 0); - assert(pthread_getschedparam(pthread_self(), &policy, ¶m) == 0); - assert(pthread_mutex_unlock(&startMx) == 0); - assert(policy == SCHED_OTHER); - return (void *) param.sched_priority; -} - -int -main() -{ - pthread_t t; - void * result = NULL; - struct sched_param param; - int maxPrio = sched_get_priority_max(SCHED_OTHER); - int minPrio = sched_get_priority_min(SCHED_OTHER); - - for (param.sched_priority = minPrio; - param.sched_priority <= maxPrio; - param.sched_priority++) - { - assert(pthread_mutex_lock(&startMx) == 0); - assert(pthread_create(&t, NULL, func, NULL) == 0); - assert(pthread_setschedparam(t, SCHED_OTHER, ¶m) == 0); - assert(pthread_mutex_unlock(&startMx) == 0); - pthread_join(t, &result); - assert((int) result == param.sched_priority); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock1.c b/winsup/testsuite/winsup.api/pthread/rwlock1.c deleted file mode 100644 index 25e29f6ac..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock1.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * rwlock1.c - * - * Create a simple rwlock object and then destroy it. - * - * Depends on API functions: - * pthread_rwlock_init() - * pthread_rwlock_destroy() - */ - -#include "test.h" - -pthread_rwlock_t rwlock = NULL; - -int -main() -{ - assert(rwlock == NULL); - - assert(pthread_rwlock_init(&rwlock, NULL) == 0); - - assert(rwlock != NULL); - - assert(pthread_rwlock_destroy(&rwlock) == 0); - - assert(rwlock == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock2.c b/winsup/testsuite/winsup.api/pthread/rwlock2.c deleted file mode 100644 index cfb32282c..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock2.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * rwlock2.c - * - * Declare a static rwlock object, lock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_rwlock_rdlock() - * pthread_rwlock_unlock() - */ - -#include "test.h" - -pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER; - -int -main() -{ - assert(rwlock == PTHREAD_RWLOCK_INITIALIZER); - - assert(pthread_rwlock_rdlock(&rwlock) == 0); - - assert(rwlock != PTHREAD_RWLOCK_INITIALIZER); - - assert(rwlock != NULL); - - assert(pthread_rwlock_unlock(&rwlock) == 0); - - assert(pthread_rwlock_destroy(&rwlock) == 0); - - assert(rwlock == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock3.c b/winsup/testsuite/winsup.api/pthread/rwlock3.c deleted file mode 100644 index 0703c1a2d..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock3.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * rwlock3.c - * - * - * Declare a static rwlock object, wrlock it, trywrlock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_rwlock_wrlock() - * pthread_rwlock_trywrlock() - * pthread_rwlock_unlock() - */ - -#include "test.h" - -pthread_rwlock_t rwlock1 = PTHREAD_RWLOCK_INITIALIZER; - -static int washere = 0; - -void * func(void * arg) -{ - assert(pthread_rwlock_trywrlock(&rwlock1) == EBUSY); - - washere = 1; - - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_rwlock_wrlock(&rwlock1) == 0); - - assert(pthread_create(&t, NULL, func, NULL) == 0); - - Sleep(2000); - - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock4.c b/winsup/testsuite/winsup.api/pthread/rwlock4.c deleted file mode 100644 index 8cae52e6f..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock4.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * rwlock4.c - * - * Declare a static rwlock object, rdlock it, trywrlock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_rwlock_rdlock() - * pthread_rwlock_trywrlock() - * pthread_rwlock_unlock() - */ - -#include "test.h" - -pthread_rwlock_t rwlock1 = PTHREAD_RWLOCK_INITIALIZER; - -static int washere = 0; - -void * func(void * arg) -{ - assert(pthread_rwlock_trywrlock(&rwlock1) == EBUSY); - - washere = 1; - - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_rwlock_rdlock(&rwlock1) == 0); - - assert(pthread_create(&t, NULL, func, NULL) == 0); - - Sleep(2000); - - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock5.c b/winsup/testsuite/winsup.api/pthread/rwlock5.c deleted file mode 100644 index 3ada946e3..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock5.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * rwlock5.c - * - * - * Declare a static rwlock object, rdlock it, tryrdlock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_rwlock_rdlock() - * pthread_rwlock_tryrdlock() - * pthread_rwlock_unlock() - */ - -#include "test.h" - -pthread_rwlock_t rwlock1 = PTHREAD_RWLOCK_INITIALIZER; - -static int washere = 0; - -void * func(void * arg) -{ - assert(pthread_rwlock_tryrdlock(&rwlock1) == 0); - - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - washere = 1; - - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_rwlock_rdlock(&rwlock1) == 0); - - assert(pthread_create(&t, NULL, func, NULL) == 0); - - Sleep(2000); - - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock6.c b/winsup/testsuite/winsup.api/pthread/rwlock6.c deleted file mode 100644 index d5f2320d0..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock6.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * rwlock6.c - * - * Check writer and reader locking - * - * Depends on API functions: - * pthread_rwlock_rdlock() - * pthread_rwlock_wrlock() - * pthread_rwlock_unlock() - */ - -#include "test.h" - -static pthread_rwlock_t rwlock1 = PTHREAD_RWLOCK_INITIALIZER; - -static int bankAccount = 0; - -void * wrfunc(void * arg) -{ - int ba; - - assert(pthread_rwlock_wrlock(&rwlock1) == 0); - Sleep(2000); - bankAccount += 10; - ba = bankAccount; - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - return ((void *) ba); -} - -void * rdfunc(void * arg) -{ - int ba; - - assert(pthread_rwlock_rdlock(&rwlock1) == 0); - ba = bankAccount; - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - return ((void *) ba); -} - -int -main() -{ - pthread_t wrt1; - pthread_t wrt2; - pthread_t rdt; - int wr1Result = 0; - int wr2Result = 0; - int rdResult = 0; - - bankAccount = 0; - - assert(pthread_create(&wrt1, NULL, wrfunc, NULL) == 0); - Sleep(500); - assert(pthread_create(&rdt, NULL, rdfunc, NULL) == 0); - Sleep(500); - assert(pthread_create(&wrt2, NULL, wrfunc, NULL) == 0); - - assert(pthread_join(wrt1, (void **) &wr1Result) == 0); - assert(pthread_join(rdt, (void **) &rdResult) == 0); - assert(pthread_join(wrt2, (void **) &wr2Result) == 0); - - assert(wr1Result == 10); - assert(rdResult == 20); - assert(wr2Result == 20); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock7.c b/winsup/testsuite/winsup.api/pthread/rwlock7.c deleted file mode 100644 index ded882d9f..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock7.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * rwlock7.c - * - * Hammer on a bunch of rwlocks to test robustness and fairness. - * Printed stats should be roughly even for each thread. - */ - -#include "test.h" -#include -#include - -#ifdef __GNUC__ -#include -#endif - -#define THREADS 5 -#define DATASIZE 15 -#define ITERATIONS 1000000 - -#define rand_r( _seed ) \ - ( _seed == _seed? rand() : rand() ) - -/* - * Keep statistics for each thread. - */ -typedef struct thread_tag { - int thread_num; - pthread_t thread_id; - int updates; - int reads; - int interval; -} thread_t; - -/* - * Read-write lock and shared data - */ -typedef struct data_tag { - pthread_rwlock_t lock; - int data; - int updates; -} data_t; - -static thread_t threads[THREADS]; -static data_t data[DATASIZE]; - -/* - * Thread start routine that uses read-write locks - */ -void *thread_routine (void *arg) -{ - thread_t *self = (thread_t*)arg; - int repeats = 0; - int iteration; - int element = 0; - - for (iteration = 0; iteration < ITERATIONS; iteration++) - { - if (iteration % (ITERATIONS / 10) == 0) - { - putchar('.'); - fflush(stdout); - } - /* - * Each "self->interval" iterations, perform an - * update operation (write lock instead of read - * lock). - */ - if ((iteration % self->interval) == 0) - { - assert(pthread_rwlock_wrlock (&data[element].lock) == 0); - data[element].data = self->thread_num; - data[element].updates++; - self->updates++; - assert(pthread_rwlock_unlock (&data[element].lock) == 0); - } else { - /* - * Look at the current data element to see whether - * the current thread last updated it. Count the - * times, to report later. - */ - assert(pthread_rwlock_rdlock (&data[element].lock) == 0); - - self->reads++; - - if (data[element].data == self->thread_num) - { - repeats++; - } - - assert(pthread_rwlock_unlock (&data[element].lock) == 0); - } - - element++; - - if (element >= DATASIZE) - { - element = 0; - } - } - - if (repeats > 0) - { - printf ("\nThread %d found unchanged elements %d times", - self->thread_num, repeats); - fflush(stdout); - } - - return NULL; -} - -int -main (int argc, char *argv[]) -{ - int count; - int data_count; - int thread_updates = 0; - int data_updates = 0; - int seed = 1; - - struct timeb currSysTime1; - struct timeb currSysTime2; - - /* - * Initialize the shared data. - */ - for (data_count = 0; data_count < DATASIZE; data_count++) - { - data[data_count].data = 0; - data[data_count].updates = 0; - - assert(pthread_rwlock_init (&data[data_count].lock, NULL) == 0); - } - - ftime(&currSysTime1); - - /* - * Create THREADS threads to access shared data. - */ - for (count = 0; count < THREADS; count++) - { - threads[count].thread_num = count; - threads[count].updates = 0; - threads[count].reads = 0; - while (!(threads[count].interval = rand_r (&seed) % 71)) - continue; - - assert(pthread_create (&threads[count].thread_id, - NULL, thread_routine, (void*)&threads[count]) == 0); - } - - /* - * Wait for all threads to complete, and collect - * statistics. - */ - for (count = 0; count < THREADS; count++) - { - assert(pthread_join (threads[count].thread_id, NULL) == 0); - thread_updates += threads[count].updates; - printf ("%02d: interval %d, updates %d, reads %d\n", - count, threads[count].interval, - threads[count].updates, threads[count].reads); - } - - putchar('\n'); - fflush(stdout); - - /* - * Collect statistics for the data. - */ - for (data_count = 0; data_count < DATASIZE; data_count++) - { - data_updates += data[data_count].updates; - printf ("data %02d: value %d, %d updates\n", - data_count, data[data_count].data, data[data_count].updates); - assert(pthread_rwlock_destroy (&data[data_count].lock) == 0); - } - - printf ("%d thread updates, %d data updates\n", - thread_updates, data_updates); - - ftime(&currSysTime2); - - printf( "\nstart: %ld/%d, stop: %ld/%d, duration:%ld\n", - currSysTime1.time,currSysTime1.millitm, - currSysTime2.time,currSysTime2.millitm, - (currSysTime2.time*1000+currSysTime2.millitm) - - (currSysTime1.time*1000+currSysTime1.millitm)); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/self1.c b/winsup/testsuite/winsup.api/pthread/self1.c deleted file mode 100644 index d46081830..000000000 --- a/winsup/testsuite/winsup.api/pthread/self1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * self1.c - * - * Test for pthread_self(). - * - * Depends on API functions: - * pthread_self() - * - * Implicitly depends on: - * pthread_getspecific() - * pthread_setspecific() - */ - -#include "test.h" - -int -main(int argc, char * argv[]) -{ - /* - * This should always succeed unless the system has no - * resources (memory) left. - */ - assert(pthread_self() != NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/self2.c b/winsup/testsuite/winsup.api/pthread/self2.c deleted file mode 100644 index 83339f101..000000000 --- a/winsup/testsuite/winsup.api/pthread/self2.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * self2.c - * - * Test for pthread_self(). - * - * Depends on API functions: - * pthread_create() - * pthread_self() - * - * Implicitly depends on: - * pthread_getspecific() - * pthread_setspecific() - */ - -#include "test.h" -#include - -static pthread_t me; - -void * -entry(void * arg) -{ - me = pthread_self(); - - return arg; -} - -int -main() -{ - pthread_t t; - - assert(pthread_create(&t, NULL, entry, NULL) == 0); - - Sleep(2000); - - /* - * Not much more we can do here but bytewise compare t with - * what pthread_self returned. - */ - assert(t == me); - assert(memcmp((const void *) t, (const void *) me, sizeof t) == 0); - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/test.h b/winsup/testsuite/winsup.api/pthread/test.h deleted file mode 100644 index 0e7246420..000000000 --- a/winsup/testsuite/winsup.api/pthread/test.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * test.h - * - * Useful definitions and declarations for tests. - */ - -#ifndef _PTHREAD_TEST_H_ -#define _PTHREAD_TEST_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* #define assert(x) do { fprint (stderr, "assertion failed\n"); exit(1) } while (0) */ - -const char * error_string[] = { - "ZERO_or_EOK", - "EPERM", - "ENOFILE_or_ENOENT", - "ESRCH", - "EINTR", - "EIO", - "ENXIO", - "E2BIG", - "ENOEXEC", - "EBADF", - "ECHILD", - "EAGAIN", - "ENOMEM", - "EACCES", - "EFAULT", - "UNKNOWN_15", - "EBUSY", - "EEXIST", - "EXDEV", - "ENODEV", - "ENOTDIR", - "EISDIR", - "EINVAL", - "ENFILE", - "EMFILE", - "ENOTTY", - "UNKNOWN_26", - "EFBIG", - "ENOSPC", - "ESPIPE", - "EROFS", - "EMLINK", - "EPIPE", - "EDOM", - "ERANGE", - "UNKNOWN_35", - "EDEADLOCK_or_EDEADLK", - "UNKNOWN_37", - "ENAMETOOLONG", - "ENOLCK", - "ENOSYS", - "ENOTEMPTY", - "EILSEQ", -}; - -/* - * The Mingw32 assert macro calls the CRTDLL _assert function - * which pops up a dialog. We want to run in batch mode so - * we define our own assert macro. - */ -#ifdef assert -# undef assert -#endif - -#ifdef NDEBUG - -# define assert(e) ((void)0) - -#else /* NDEBUG */ - -#ifndef ASSERT_TRACE -# define ASSERT_TRACE 0 -#else -# undef ASSERT_TRACE -# define ASSERT_TRACE 1 -#endif - -# define assert(e) \ - ((e) ? ((ASSERT_TRACE) ? fprintf(stderr, \ - "Assertion succeeded: (%s), file %s, line %d\n", \ - #e, __FILE__, (int) __LINE__), \ - fflush(stderr) : \ - 0) : \ - (fprintf(stderr, "Assertion failed: (%s), file %s, line %d\n", \ - #e, __FILE__, (int) __LINE__), exit(1), 0)) - -#endif /* NDEBUG */ - - -#endif diff --git a/winsup/testsuite/winsup.api/pthread/threadidafterfork.c b/winsup/testsuite/winsup.api/pthread/threadidafterfork.c deleted file mode 100644 index 473eaecfd..000000000 --- a/winsup/testsuite/winsup.api/pthread/threadidafterfork.c +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include -#include -#include -#include - -static void * TestThread ( void * ); - -int main (void) -{ - pthread_t t; - - pthread_create (&t, NULL, TestThread, NULL); - pthread_join (t, NULL); - - return 0; -} - -static void * TestThread ( void *not_used ) -{ - pthread_t iAm = pthread_self(); - int status; - switch (fork ()) - { - case -1: - exit(1); - case 0: - if (iAm != pthread_self()) - exit (1); - else - exit (0); - break; - default: - wait (&status); - if (status != 0) - exit (1); - } - exit(0); -} - -/* -The forked child will not get the same thread handle as its parent, it -will get the thread handle from the main thread instead. The child will -not terminate because the threadcount is still 2 after the fork (it is -set to 1 in MTinterface::Init and then set back to 2 after the childs -memory gets overwritten by the parent). - -concept test by Thomas Pfaff -scritable test by Robert Collins -*/ diff --git a/winsup/testsuite/winsup.api/pthread/tsd1.c b/winsup/testsuite/winsup.api/pthread/tsd1.c deleted file mode 100644 index a65cf66c8..000000000 --- a/winsup/testsuite/winsup.api/pthread/tsd1.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * tsd1.c - * - * Test Thread Specific Data (TSD) key creation and destruction. - * - * Description: - * - - * - * Test Method (validation or falsification): - * - validation - * - * Requirements Tested: - * - keys are created for each existing thread including the main thread - * - keys are created for newly created threads - * - keys are thread specific - * - destroy routine is called on each thread exit including the main thread - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Environment: - * - - * - * Input: - * - none - * - * Output: - * - text to stdout - * - * Assumptions: - * - already validated: pthread_create() - * pthread_once() - * - main thread also has a POSIX thread identity - * - * Pass Criteria: - * - stdout matches file reference/tsd1.out - * - * Fail Criteria: - * - fails to match file reference/tsd1.out - * - output identifies failed component - */ - -#include -#include "test.h" - -static pthread_key_t key = NULL; -static int accesscount[10]; -static int thread_set[10]; -static int thread_destroyed[10]; - -static void -destroy_key(void * arg) -{ - int * j = (int *) arg; - - (*j)++; - - assert(*j == 2); - - thread_destroyed[j - accesscount] = 1; -} - -static void -setkey(void * arg) -{ - int * j = (int *) arg; - - thread_set[j - accesscount] = 1; - - assert(*j == 0); - - assert(pthread_getspecific(key) == NULL); - - assert(pthread_setspecific(key, arg) == 0); - - assert(pthread_getspecific(key) == arg); - - (*j)++; - - assert(*j == 1); -} - -static void * -mythread(void * arg) -{ - while (key == NULL) - { - sched_yield(); - } - - setkey(arg); - - return 0; - - /* Exiting the thread will call the key destructor. */ -} - -int -main() -{ - int i; - int fail = 0; - pthread_t thread[10]; - - for (i = 1; i < 5; i++) - { - accesscount[i] = thread_set[i] = thread_destroyed[i] = 0; - assert(pthread_create(&thread[i], NULL, mythread, (void *)&accesscount[i]) == 0); - } - - Sleep(2000); - - /* - * Here we test that existing threads will get a key created - * for them. - */ - assert(pthread_key_create(&key, destroy_key) == 0); - - /* - * Test main thread key. - */ - accesscount[0] = 0; - setkey((void *) &accesscount[0]); - - /* - * Here we test that new threads will get a key created - * for them. - */ - for (i = 5; i < 10; i++) - { - accesscount[i] = thread_set[i] = thread_destroyed[i] = 0; - assert(pthread_create(&thread[i], NULL, mythread, (void *)&accesscount[i]) == 0); - } - - /* - * Wait for all threads to complete. - */ - for (i = 1; i < 10; i++) - { - int result = 0; - - assert(pthread_join(thread[i], (void **) &result) == 0); - } - - assert(pthread_key_delete(key) == 0); - - for (i = 1; i < 10; i++) - { - /* - * The counter is incremented once when the key is set to - * a value, and again when the key is destroyed. If the key - * doesn't get set for some reason then it will still be - * NULL and the destroy function will not be called, and - * hence accesscount will not equal 2. - */ - if (accesscount[i] != 2) - { - fail++; - fprintf(stderr, "Thread %d key, set = %d, destroyed = %d\n", - i, thread_set[i], thread_destroyed[i]); - } - } - - fflush(stderr); - - return (fail); -} diff --git a/winsup/testsuite/winsup.api/resethand.c b/winsup/testsuite/winsup.api/resethand.c deleted file mode 100644 index 7d58dcd2c..000000000 --- a/winsup/testsuite/winsup.api/resethand.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include -#include -#include - -int doit = 0; -void -ouch (int sig) -{ - if (doit++ > 0) - kill (getpid (), SIGTERM); -} - -int -main (int argc, char **argv) -{ - static struct sigaction act; - if (argc == 1) - act.sa_flags = SA_RESETHAND; - act.sa_handler = ouch; - sigaction (SIGSEGV, &act, NULL); - int pid = fork (); - int status; - if (pid > 0) - waitpid (pid, &status, 0); - else - { - int *i = 0; - *i = 9; - exit (0x42); - } - status &= ~0x80; // remove core dump flag - printf ("pid %d exited with status %p\n", pid, (void *) status); - exit (argc == 1 ? !(status == SIGSEGV) : !(status == SIGTERM)); -} diff --git a/winsup/testsuite/winsup.api/samples/sample-fail.c b/winsup/testsuite/winsup.api/samples/sample-fail.c deleted file mode 100644 index d0d3e4a6a..000000000 --- a/winsup/testsuite/winsup.api/samples/sample-fail.c +++ /dev/null @@ -1,5 +0,0 @@ -int -main() -{ - return 1; -} diff --git a/winsup/testsuite/winsup.api/samples/sample-miscompile.c b/winsup/testsuite/winsup.api/samples/sample-miscompile.c deleted file mode 100644 index bc0d21d2e..000000000 --- a/winsup/testsuite/winsup.api/samples/sample-miscompile.c +++ /dev/null @@ -1 +0,0 @@ -foo bar grill diff --git a/winsup/testsuite/winsup.api/samples/sample-pass.c b/winsup/testsuite/winsup.api/samples/sample-pass.c deleted file mode 100644 index 8e8f518aa..000000000 --- a/winsup/testsuite/winsup.api/samples/sample-pass.c +++ /dev/null @@ -1,5 +0,0 @@ -int -main() -{ - return 0; -} diff --git a/winsup/testsuite/winsup.api/semtest.c b/winsup/testsuite/winsup.api/semtest.c deleted file mode 100644 index dfb8c08eb..000000000 --- a/winsup/testsuite/winsup.api/semtest.c +++ /dev/null @@ -1,348 +0,0 @@ -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * 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 NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. - * - * Obtained from: $NetBSD: semtest.c,v 1.4 2002/07/20 08:36:25 grant Exp $ - * $FreeBSD: /repoman/r/ncvs/src/tools/regression/sysvsem/semtest.c,v 1.1 2002/08/15 06:34:37 alfred Exp $ - */ - -/* - * Test the SVID-compatible Semaphore facility. - */ - -/* - * CV, 2003-11-17: Add to Cygwin testsuite. - */ -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID = "semtest"; /* Test program identifier. */ -int TST_TOTAL = 54; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int main (int, char *[]); -void print_semid_ds (struct semid_ds *, mode_t); -void sigsys_handler (int); -void sigchld_handler(int); -void cleanup (void); -void waiter (void); - -int sender_semid = -1; -pid_t child_pid; -int child_count; -int signal_was_sigchld; - -key_t semkey; - -/* - * This is the original semun union used by the sysvsem utility. - * It is deliberately kept here under #if 0'ed condition for future - * reference. PLEASE DO NOT REMOVE. The {SET,GET}ALL in FreeBSD - * are signed values, so the default version in sys/sem.h suffices. - */ -#if 1 /*0*/ -union semun { - int val; /* value for SETVAL */ - struct semid_ds *buf; /* buffer for IPC_{STAT,SET} */ - u_short *array; /* array for GETALL & SETALL */ -}; -#endif - -int -main(int argc, char *argv[]) -{ - struct sigaction sa; - union semun sun; - struct semid_ds s_ds; - sigset_t sigmask; - int i; - - Tst_count = 0; - - /* - * Install a SIGSYS handler so that we can exit gracefully if - * System V Semaphore support isn't in the kernel. - */ - sa.sa_handler = sigsys_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGSYS, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGSYS"); - - /* - * Install and SIGCHLD handler to deal with all possible exit - * conditions of the receiver. - */ - sa.sa_handler = sigchld_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGCHLD, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGCHLD"); - - semkey = ftok("/", 4160); - tst_resm (semkey == (key_t)-1 ? TFAIL : TPASS, - "ftok(\"/\") returns valid value"); - - /* - * Initialize child_pid to ourselves to that the cleanup function - * works before we create the receiver. - */ - child_pid = getpid(); - - sender_semid = semget(semkey, 1, IPC_CREAT | 0640); - tst_resm (sender_semid == -1 ? TFAIL : TPASS, "sender calls semget"); - - sun.buf = &s_ds; - tst_resm (semctl(sender_semid, 0, IPC_STAT, sun) == -1 ? TFAIL : TPASS, - "semctl IPC_STAT"); - - print_semid_ds(&s_ds, 0640); - - s_ds.sem_perm.mode = (s_ds.sem_perm.mode & ~0777) | 0600; - - sun.buf = &s_ds; - tst_resm (semctl(sender_semid, 0, IPC_SET, sun) == -1 ? TFAIL : TPASS, - "semctl IPC_SET"); - - memset(&s_ds, 0, sizeof(s_ds)); - - sun.buf = &s_ds; - tst_resm (semctl(sender_semid, 0, IPC_STAT, sun) == -1 ? TFAIL : TPASS, - "semctl IPC_STAT"); - - tst_resm ((s_ds.sem_perm.mode & 0777) != 0600 ? TFAIL : TPASS, - "IPC_SET of mode holds"); - - print_semid_ds(&s_ds, 0600); - - for (child_count = 0; child_count < 5; child_count++) { - switch ((child_pid = fork())) { - case -1: - tst_brkm (TBROK, cleanup, "fork"); - /* NOTREACHED */ - - case 0: - Tst_count += 22 + child_count * 4; - tst_resm (TPASS, "fork"); - waiter(); - break; - - default: - break; - } - } - - /* - * Wait for all of the waiters to be attempting to acquire the - * semaphore. - */ - for (;;) { - i = semctl(sender_semid, 0, GETNCNT); - if (i == -1) - tst_brkm (TBROK, cleanup, "semctl GETNCNT"); - if (i == 5) - break; - } - - /* - * Now set the thundering herd in motion by initializing the - * semaphore to the value 1. - */ - sun.val = 1; - tst_resm (semctl(sender_semid, 0, SETVAL, sun) == -1 ? TFAIL : TPASS, - "sender: semctl SETVAL to 1"); - - /* - * Suspend forever; when we get SIGCHLD, the handler will exit. - */ - sigemptyset(&sigmask); - for (;;) { - (void) sigsuspend(&sigmask); - if (signal_was_sigchld) - signal_was_sigchld = 0; - else - break; - } - - /* - * ...and any other signal is an unexpected error. - */ - - tst_brkm (TBROK, cleanup, "sender: received unexpected signal"); - exit (1); -} - -void -sigsys_handler(int signo) -{ - - tst_brkm (TBROK, cleanup, - "System V Semaphore support is not present in the kernel"); -} - -void -sigchld_handler(int signo) -{ - union semun sun; - struct semid_ds s_ds; - int cstatus; - - /* - * Reap the child; if it exited successfully, then we're on the - * right track! - */ - if (wait(&cstatus) == -1) - tst_brkm (TBROK, cleanup, "wait"); - - if (WIFEXITED(cstatus) == 0) - tst_brkm (TBROK, cleanup, "receiver exited abnormally"); - - if (WEXITSTATUS(cstatus) != 0) - tst_brkm (TBROK, cleanup, "receiver exited with status %d", - WEXITSTATUS(cstatus)); - - /* - * If we get here, the child has exited normally, and we should - * decrement the child count. If the child_count reaches 0, we - * should exit. - */ - - sun.buf = &s_ds; - tst_resm (semctl(sender_semid, 0, IPC_STAT, sun) == -1 ? TFAIL : TPASS, - "semctl IPC_STAT"); - - print_semid_ds(&s_ds, 0600); - - if (--child_count != 0) { - signal_was_sigchld = 1; - return; - } - - cleanup (); -} - -void -cleanup() -{ - - /* - * If we're the sender, and it exists, remove the message queue. - */ - if (child_pid != 0 && sender_semid != -1) { - tst_resm (semctl(sender_semid, 0, IPC_RMID) == -1 - ? TFAIL : TPASS, "semctl IPC_RMID"); - } - tst_exit (); -} - -void -print_semid_ds(struct semid_ds *sp, mode_t mode) -{ - uid_t uid = geteuid(); - gid_t gid = getegid(); - - printf("PERM: uid %d, gid %d, cuid %d, cgid %d, mode 0%o\n", - (int)sp->sem_perm.uid, (int)sp->sem_perm.gid, - (int)sp->sem_perm.cuid, (int)sp->sem_perm.cgid, - sp->sem_perm.mode & 0777); - - printf("nsems %u\n", sp->sem_nsems); - - printf("otime: %s", ctime(&sp->sem_otime)); - printf("ctime: %s", ctime(&sp->sem_ctime)); - - /* - * Sanity check a few things. - */ - - tst_resm (sp->sem_perm.uid != uid || sp->sem_perm.cuid != uid - ? TFAIL : TPASS, "uid matches"); - - tst_resm (sp->sem_perm.gid != gid || sp->sem_perm.cgid != gid - ? TFAIL : TPASS, "gid matches"); - - tst_resm ((sp->sem_perm.mode & 0777) != mode - ? TFAIL : TPASS, "mode matches"); -} - -void -waiter() -{ - struct sembuf s; - int semid; - - tst_resm ((semid = semget(semkey, 1, 0)) == -1 ? TFAIL : TPASS, - "waiter: semget"); - - /* - * Attempt to acquire the semaphore. - */ - s.sem_num = 0; - s.sem_op = -1; - s.sem_flg = SEM_UNDO; - - tst_resm (semop(semid, &s, 1) == -1 ? TFAIL : TPASS, - "waiter: semop -1"); - - printf("WOO! GOT THE SEMAPHORE!\n"); - sleep(1); - - /* - * Release the semaphore and exit. - */ - s.sem_num = 0; - s.sem_op = 1; - s.sem_flg = SEM_UNDO; - - tst_resm (semop(semid, &s, 1) == -1 ? TFAIL : TPASS, - "waiter: semop +1"); - - /* Allow parent to receive message before getting SIGCHLD. */ - sleep (1); - exit(0); -} diff --git a/winsup/testsuite/winsup.api/shmtest.c b/winsup/testsuite/winsup.api/shmtest.c deleted file mode 100644 index 54a2493a8..000000000 --- a/winsup/testsuite/winsup.api/shmtest.c +++ /dev/null @@ -1,293 +0,0 @@ -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * 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 NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. - * - * Obtained from: $NetBSD: shmtest.c,v 1.3 2002/07/20 08:36:26 grant Exp $ - * $FreeBSD: /repoman/r/ncvs/src/tools/regression/sysvshm/shmtest.c,v 1.1 2002/08/15 06:34:37 alfred Exp $ - */ - -/* - * Test the SVID-compatible Shared Memory facility. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID = "shmtest"; /* Test program identifier. */ -int TST_TOTAL = 22; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int main __P((int, char *[])); -void print_shmid_ds __P((struct shmid_ds *, mode_t)); -void sigsys_handler __P((int)); -void sigchld_handler __P((int)); -void cleanup __P((void)); -void receiver __P((void)); - -const char *m_str = "The quick brown fox jumped over the lazy dog."; - -int sender_shmid = -1; -pid_t child_pid; - -key_t shmkey; - -size_t pgsize; - -int -main(argc, argv) - int argc; - char *argv[]; -{ - struct sigaction sa; - struct shmid_ds s_ds; - sigset_t sigmask; - char *shm_buf; - - Tst_count = 0; - - /* - * Install a SIGSYS handler so that we can exit gracefully if - * System V Shared Memory support isn't in the kernel. - */ - sa.sa_handler = sigsys_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGSYS, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGSYS"); - - /* - * Install and SIGCHLD handler to deal with all possible exit - * conditions of the receiver. - */ - sa.sa_handler = sigchld_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGCHLD, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGCHLD"); - - pgsize = sysconf(_SC_PAGESIZE); - - shmkey = ftok("/", 4160); - tst_resm (shmkey == (key_t)-1 ? TFAIL : TPASS, - "ftok(\"/\") returns valid value"); - - /* - * Initialize child_pid to ourselves to that the cleanup function - * works before we create the receiver. - */ - child_pid = getpid(); - - sender_shmid = shmget(shmkey, pgsize, IPC_CREAT | 0640); - tst_resm (sender_shmid == -1 ? TFAIL : TPASS, "sender calls shmget"); - - tst_resm (shmctl(sender_shmid, IPC_STAT, &s_ds) == -1 ? TFAIL : TPASS, - "shmctl IPC_STAT"); - - print_shmid_ds(&s_ds, 0640); - - s_ds.shm_perm.mode = (s_ds.shm_perm.mode & ~0777) | 0600; - - tst_resm (shmctl(sender_shmid, IPC_SET, &s_ds) == -1 ? TFAIL : TPASS, - "shmctl IPC_SET"); - - memset(&s_ds, 0, sizeof(s_ds)); - - tst_resm (shmctl(sender_shmid, IPC_STAT, &s_ds) == -1 ? TFAIL : TPASS, - "shmctl IPC_STAT"); - - tst_resm ((s_ds.shm_perm.mode & 0777) != 0600 ? TFAIL : TPASS, - "IPC_SET of mode holds"); - - print_shmid_ds(&s_ds, 0600); - - tst_resm ((shm_buf = shmat(sender_shmid, NULL, 0)) == (void *) -1 - ? TFAIL : TPASS, "sender: shmat"); - - /* - * Write the test pattern into the shared memory buffer. - */ - strcpy(shm_buf, m_str); - - switch ((child_pid = fork())) { - case -1: - tst_brkm (TBROK, cleanup, "fork"); - /* NOTREACHED */ - - case 0: - tst_resm (TPASS, "fork"); - receiver(); - break; - - default: - Tst_count += 4; - break; - } - - /* - * Suspend forever; when we get SIGCHLD, the handler will exit. - */ - sigemptyset(&sigmask); - (void) sigsuspend(&sigmask); - - /* - * ...and any other signal is an unexpected error. - */ - tst_brkm (TBROK, cleanup, "sender: received unexpected signal"); - exit (1); -} - -void -sigsys_handler(signo) - int signo; -{ - - tst_brkm (TBROK, cleanup, - "System V Shared Memory support is not present in the kernel"); -} - -void -sigchld_handler(signo) - int signo; -{ - struct shmid_ds s_ds; - int cstatus; - - /* - * Reap the child; if it exited successfully, then the test passed! - */ - if (waitpid(child_pid, &cstatus, 0) != child_pid) - tst_brkm (TBROK, cleanup, "waitpid"); - - if (WIFEXITED(cstatus) == 0) - tst_brkm (TBROK, cleanup, "receiver exited abnormally"); - - if (WEXITSTATUS(cstatus) != 0) - tst_brkm (TBROK, cleanup, "receiver exited with status %d", - WEXITSTATUS(cstatus)); - - /* - * If we get here, the child has exited normally, and thus - * we should exit normally too. First, tho, we print out - * the final stats for the message queue. - */ - - tst_resm (shmctl(sender_shmid, IPC_STAT, &s_ds) == -1 ? TFAIL : TPASS, - "shmctl IPC_STAT"); - - print_shmid_ds(&s_ds, 0600); - - cleanup (); -} - -void -cleanup() -{ - - /* - * If we're the sender, and it exists, remove the shared memory area. - */ - if (child_pid != 0 && sender_shmid != -1) { - tst_resm (shmctl(sender_shmid, IPC_RMID, NULL) == -1 - ? TFAIL : TPASS, "shmctl IPC_RMID"); - } - tst_exit (); -} - -void -print_shmid_ds(sp, mode) - struct shmid_ds *sp; - mode_t mode; -{ - uid_t uid = geteuid(); - gid_t gid = getegid(); - - printf("PERM: uid %d, gid %d, cuid %d, cgid %d, mode 0%o\n", - (int)sp->shm_perm.uid, (int)sp->shm_perm.gid, - (int)sp->shm_perm.cuid, (int)sp->shm_perm.cgid, - sp->shm_perm.mode & 0777); - - printf("segsz %lu, lpid %d, cpid %d, nattch %u\n", - (u_long)sp->shm_segsz, sp->shm_lpid, sp->shm_cpid, - sp->shm_nattch); - - printf("atime: %s", ctime(&sp->shm_atime)); - printf("dtime: %s", ctime(&sp->shm_dtime)); - printf("ctime: %s", ctime(&sp->shm_ctime)); - - /* - * Sanity check a few things. - */ - - tst_resm (sp->shm_perm.uid != uid || sp->shm_perm.cuid != uid - ? TFAIL : TPASS, "uid matches"); - - tst_resm (sp->shm_perm.gid != gid || sp->shm_perm.cgid != gid - ? TFAIL : TPASS, "gid matches"); - - tst_resm ((sp->shm_perm.mode & 0777) != mode ? TFAIL : TPASS, - "mode matches"); -} - -void -receiver() -{ - int shmid; - void *shm_buf; - - tst_resm ((shmid = shmget(shmkey, pgsize, 0)) == -1 ? TFAIL : TPASS, - "receiver: shmget"); - - tst_resm ((shm_buf = shmat(shmid, NULL, 0)) == (void *) -1 - ? TFAIL : TPASS, "receiver: shmat"); - - printf("%s\n", (const char *)shm_buf); - tst_resm (strcmp((const char *)shm_buf, m_str) != 0 ? TFAIL : TPASS, - "receiver: data is correct"); - - exit(0); -} diff --git a/winsup/testsuite/winsup.api/sigchld.c b/winsup/testsuite/winsup.api/sigchld.c deleted file mode 100644 index b12876d4a..000000000 --- a/winsup/testsuite/winsup.api/sigchld.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -#include -#include - -int no_signal_caught = 1; - -void handler ( int signo ) -{ - no_signal_caught = 0; -} - -int -main() -{ - pid_t pid; - signal ( SIGCHLD, handler ); - pid = fork(); - if ( pid == 0 ) exit ( 0 ); - sleep ( 2 ); - exit ( no_signal_caught ); -} diff --git a/winsup/testsuite/winsup.api/signal-into-win32-api.c b/winsup/testsuite/winsup.api/signal-into-win32-api.c deleted file mode 100755 index 57ab8b5c8..000000000 --- a/winsup/testsuite/winsup.api/signal-into-win32-api.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Test if signal is delivered to the application which is - * currently inside of native syscall - */ - -#include -#include -#include -#include -#include - -int saw_sigchld = 0; -int sleep_stage = -1; - -void -handle_child (int signo) -{ - printf ( "saw SIGCHLD, %d", sleep_stage); - saw_sigchld = 1; -} - -int -main (int argc, char** argv) -{ - pid_t pid; - if (argc > 1) - { - Sleep (200); - return 0; - } - - signal (SIGCHLD, handle_child); - pid = fork (); - if (pid < 0) - { - perror ( "fork" ); - return 2; - } - else if (pid == 0) - execl ( argv[0], argv[0], "child", NULL ); - else - { - sleep_stage = 0; - Sleep (3000); - sleep_stage = 1; - sleep (10); - sleep_stage = 2; - if (!saw_sigchld) - { - printf ( "oops\n" ); - kill (pid, SIGTERM); - return 1; - } - else - return 0; - } - exit (0); -} diff --git a/winsup/testsuite/winsup.api/systemcall.c b/winsup/testsuite/winsup.api/systemcall.c deleted file mode 100644 index 91dd748c0..000000000 --- a/winsup/testsuite/winsup.api/systemcall.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - int fd, pid, n; - int fds[2]; - static char buf[4096]; - - close (0); - if ((fd = open ("/dev/null", O_WRONLY)) != 0) - { - fprintf (stderr, "couldn't redirect stdin to /dev/null, fd %d - %s\n", fd, strerror (errno)); - exit (1); - } - - close (1); - if ((fd = open ("/dev/null", O_WRONLY)) != 1) - { - fprintf (stderr, "couldn't redirect stdout to /dev/null, fd %d - %s\n", fd, strerror (errno)); - exit (1); - } - if (pipe (fds)) - { - fprintf (stderr, "pipe call failed - %s\n", strerror (errno)); - exit (1); - } - if ((pid = fork ()) == 0) - { - close (fds[0]); - if (dup2 (fds[1], 2) != 2) - { - fprintf (stderr, "couldn't redirect stderr to pipe - %s\n", strerror (errno)); - exit (1); - } - exit (system ("ls")); - } - else if (pid < 0) - { - perror ("couldn't fork"); - exit (1); - } - - close (fds[1]); - if (read (fds[0], buf, 4096) != 0) - { - fprintf (stderr, "system() call failed?\n%s\n", buf); - exit (1); - } - - if (waitpid (pid, &n, 0) < 0) - { - perror ("waitpid failed"); - exit (1); - } - if (n != 0) - { - fprintf (stderr, "system() call returned %p\n", (void *) n); - exit (1); - } - exit (0); -} diff --git a/winsup/testsuite/winsup.api/user_malloc.c b/winsup/testsuite/winsup.api/user_malloc.c deleted file mode 100644 index 8685f86ab..000000000 --- a/winsup/testsuite/winsup.api/user_malloc.c +++ /dev/null @@ -1,216 +0,0 @@ -/* Test of external malloc, calloc, realloc and free capability */ - -#if 1 -#include "test.h" -#include "usctest.h" -#else -enum {TPASS, TFAIL, TBROK, TINFO}; -#define tst_resm(xxx, yyy...) printf(yyy), printf(" RES %d\n", xxx) -#define tst_brkm(xxx, yyy, zzz...) printf(zzz), printf(" RES %d\n", xxx) -#define tst_exit() -int Tst_count; -#endif - -#include -#include -#include -#include -#include -#include - -const char *TCID = "malloc"; /* Test program identifier. */ -int TST_TOTAL = 2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -/* Main test. - Verbose mode if argc > 0 - Note that malloc and friends are also called by Cygwin before main, - and that malloc can call getenv. */ - -int malloc_error = 0, realloc_error = 0, free_error = 0; -int calloc_count = 0, malloc_count = 0, realloc_count = 0, free_count = 0; - -void -cleanup (void) -{ - tst_exit(); -} - -int -syncwithchild (pid_t pid, int expected_exit_status) -{ - int status; - - if (waitpid (pid, &status, 0) != pid) - { - tst_brkm (TBROK, cleanup, "Wait for child: %s", strerror (errno)); - return 1; - } - if (!WIFEXITED (status)) - { - tst_brkm (TBROK, cleanup, "Child had abnormal exit"); - return 1; - } - if (WEXITSTATUS (status) != expected_exit_status) - { - tst_brkm (TFAIL, cleanup, "Child had exit status %d != %d", - WEXITSTATUS (status), expected_exit_status); - return 1; - } - return 0; -} - -#if 0 -void * mallocX (size_t size); -void * callocX (size_t nmemb, size_t size); -void * reallocX (void * ptr, size_t size); -void freeX(void *); - -#define malloc mallocX -#define calloc callocX -#define realloc reallocX -#define free freeX -#endif - -int main (int argc, char * argv[]) -{ - void * ptr; - int error = 0; - pid_t pid; - - Tst_count = 0; - - tst_resm(TINFO, "Testing if external malloc works. ppid %d", getppid()); - - ptr = malloc (16); - ptr = calloc (1, 16); - ptr = realloc (ptr, 24); - free (ptr); - - error = (malloc_count == 0 || calloc_count == 0 || realloc_count == 0 || free_count == 0); - - if (error || argc > 1) - { - printf ("malloc_count %d, calloc_count %d, realloc_count %d, free_count %d\n", - malloc_count, calloc_count, realloc_count, free_count); - printf ("malloc_error %d, realloc_error %d, free_error %d\n", - malloc_error, realloc_error, free_error); - } - tst_resm (!error ? TPASS : TFAIL, "Running in pid %d", getpid()); - - /* If run from Windows, run also from Cygwin */ - if (getppid() == 1) - { - tst_resm(TINFO, "Ready to test if malloc works from Cygwin"); - - if ((pid = fork()) == 0) - { - tst_resm(TINFO, "Ready to exec with pid %d\n", getpid()); - error = execl(argv[0], argv[0], argc > 1? argv[1]:NULL, NULL); - exit(error); - } - else if (pid < 0) - tst_brkm (TBROK, cleanup, "Fork failed: %s", strerror (errno)); - else - { - error = syncwithchild (pid, 0); - tst_resm (!error ? TPASS : TFAIL, "Running in pid %d", pid); - } - } - - tst_exit (); -} - -/**************************************** -Actual malloc & friends implementation -****************************************/ - -typedef unsigned long long ull; - -#define SIZE (1024*1024ULL) /* long long */ -ull buffer[SIZE]; -ull * current = buffer; - -static int is_valid (void * ptr) -{ - unsigned int iptr = (unsigned int) ptr; - ull * ullptr = (ull *) ptr; - - iptr = (iptr / sizeof(ull)) * sizeof(ull); - if (iptr != (int) ptr) - return 0; - if (--ullptr < buffer || ullptr[0] > SIZE || ullptr + ullptr[0] > current) - return 0; - return 1; -} - -void * malloc (size_t size) -{ - ull llsize = (size + 2 * sizeof (ull) - 1) / sizeof (ull); - static char * envptr; - void * ret; - - /* Make sure getenv works */ - if (!envptr) - envptr = getenv ("PATH"); - - malloc_count++; - if (current + llsize >= buffer + SIZE) - { - malloc_error++; - errno = ENOMEM; - return NULL; - } - *current = llsize; - ret = (void *) (current + 1); - current += llsize; - - return ret; -} - -void * calloc (size_t nmemb, size_t size) -{ - calloc_count++; - void * ptr = malloc (nmemb * size); - malloc_count--; - if (ptr) - memset(ptr, 0, nmemb * size); - return ptr; -} - -void * realloc (void * ptr, size_t size) -{ - const ull ullsize = (size + 2 * sizeof (ull) - 1) / sizeof (ull); - ull * const ullptr = (ull *) ptr; - void * newptr; - - realloc_count++; - - if (ptr) - { - if (!is_valid (ptr)) - { - realloc_error++; - errno = ENOMEM; - return NULL; - } - if (ullptr[-1] >= ullsize) - return ptr; - } - - newptr = malloc (size); - malloc_count--; - - if (ptr && newptr) - memcpy (newptr, ptr, size); - - return newptr; -} - -void free (void * x) -{ - free_count++; - if (x && ! is_valid (x)) - free_error++; -} - diff --git a/winsup/testsuite/winsup.api/waitpid.c b/winsup/testsuite/winsup.api/waitpid.c deleted file mode 100644 index ee2925c4c..000000000 --- a/winsup/testsuite/winsup.api/waitpid.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - int pid, n; - if ((pid = fork ()) == 0) - exit (0); - sleep (2); - if ((n = waitpid (pid, NULL, 0)) != pid) - { - printf ("wait pid failed, pid %d, n %d, errno %d\n", pid, n, errno); - exit(1); - } - else - { - printf ("wait pid succeeded, pid %d, n %d, errno %d\n", pid, n, errno); - exit (0); - } -} diff --git a/winsup/testsuite/winsup.api/winsup.exp b/winsup/testsuite/winsup.api/winsup.exp deleted file mode 100644 index 639096267..000000000 --- a/winsup/testsuite/winsup.api/winsup.exp +++ /dev/null @@ -1,85 +0,0 @@ -source "site.exp" -source "$srcdir/winsup.api/known_bugs.tcl" - -if { ! [isnative] } { - verbose "skipping winsup.api because it's not native" - return -} - -set rv "" - -set ltp_includes "-I$ltp_includes" -set ltp_libs "$rootme/libltp.a" - -set add_includes $ltp_includes -set add_libs $ltp_libs - -set test_filter "" - -if { [info exists env(CYGWIN_TESTSUITE_TESTS)] } { - set test_filter "$env(CYGWIN_TESTSUITE_TESTS)" -} - -proc ws_spawn {cmd args} { - global rv - verbose "running $cmd\n" - catch "exec $cmd" rv - verbose send "catchCode = $rv\n" -} - -verbose "Filter: $test_filter" - -foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.{cc,c}]] { - if { $test_filter != "" && ! [regexp $test_filter $src] } { - verbose -log "Skipping $src" - continue - } - - regsub "^$srcdir/$subdir/" $src "" testcase - regsub ".c$" $testcase "" base - regsub ".*/" $base "" basename - regsub "/" $base "-" base - - if { [lsearch -exact $xfail_list $basename] >= 0 } { - set xfail_expected 1 - setup_xfail "*-*-*" - } else { - set xfail_expected 0 - clear_xfail - } - - if [ file exists "$srcdir/$subdir/$basename.exp" ] then { - source "$srcdir/$subdir/$basename.exp" - } else { - ws_spawn "$CC -nodefaultlibs -mwin32 $CFLAGS $src $add_includes $add_libs $runtime_root/binmode.o -lgcc $runtime_root/libcygwin0.a -lkernel32 -luser32 -o $base.exe" - if { $rv != "" } { - verbose -log "$rv" - fail "$testcase (compile)" - } else { - if { $verbose } { - set redirect_output "./$base.log" - } else { - set redirect_output /dev/null - } - ws_spawn "$rootme/cygrun ./$base.exe > $redirect_output" - if { $rv != "" } { - verbose -log "$testcase: $rv" - fail "$testcase (execute)" - if { $xfail_expected } { - catch { file delete "$base.exe" } err - if { $err != "" } { - note "error deleting $base.exe: $err" - } - } - } else { - pass "$testcase" - if { ! $xfail_expected } { - catch { file delete "$base.exe" } err - if { $err != "" } { - note "error deleting $base.exe: $err" - } - } - } - } - } -} diff --git a/winsup/utils/COPYING.dumper b/winsup/utils/COPYING.dumper deleted file mode 100644 index 623b6258a..000000000 --- a/winsup/utils/COPYING.dumper +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog deleted file mode 100644 index ba9ad3faa..000000000 --- a/winsup/utils/ChangeLog +++ /dev/null @@ -1,3897 +0,0 @@ -2014-02-07 Jon TURNEY - - * minidumper.cc: New file. - * Makefile.in (CYGWIN_BINS): Add minidumper. - * utils.xml (minidumper): New section. - -2013-11-19 Corinna Vinschen - - * cygcheck.cc (RtlGetVersion): Declare. - (dump_sysinfo): Call RtlGetVersion rather than GetVersionEx to get - correct OS info even on Windows 8.1. Don't check return value since - RtlGetVersion never fails per MSDN. Move fetching kernel32 module - handle where it's really needed. Drop temporary comment added by - previous checkin. - -2013-11-19 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Revert Windows 8.1 hack. It's not - working. Add a (hopefully temporary) comment. - -2013-11-19 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Drop code trying to fetch OSVERSIONINFO - if fetching OSVERSIONINFOEX failed. Drop code handling unsupported - platform IDs. Add code to tweak dwMinorVersion on Windows 8.1 if no - manifest is present. - -2013-11-19 Corinna Vinschen - - * Makefile.in (cygcheck.exe): Link against wininet.dll. - (dumper.exe): Link against psapi.dll. - * cygcheck.cc (_WIN32_WINNT): Define as 0x0602. - (pInternetCloseHandle): Drop pointer. - (PRODUCT_UNLICENSED): Drop definition. - (PRODUCT_PROFESSIONAL_WMC): Ditto. - (package_grep): Delete code loading wininet functions dynamically, just - call functions directly. - * module_info.cc: Drop code loading psapi functions dynamically since - all supported OS versions have it anyway. Call psapi functions - directly. - -2013-11-19 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Distinguish Windows 8 and 8.1, as well - as Windows Server 2012 and 2012 R2. Add missing commas in products - array to avoid crashes. Drop Windows NT4 and 2000 printouts. Just - call IsWow64Process, GetNativeSystemInfo, and GetDiskFreeSpaceEx - directly, rather than loading them dynamically, since they are exported - by all supported OS versions. Fix questionable type usage in call to - GetDiskFreeSpaceEx. - -2013-11-06 Christopher Faylor - - * configure.ac: Detect windows headers/libs after we've figured out the - C compiler. - * configure: Regenerate. - * aclocal.m4: Regenerate. - -2013-09-16 Christopher Faylor - - * dump_setup.cc (find_tar_ext): Generalize search for .tar extension, - avoiding looking for specific compression types. - -2013-08-23 Christopher Faylor - - * cygcheck.cc (package_grep): Accommodate arch-specific package layout. - -2013-07-31 Corinna Vinschen - - * Makefile.in (MINGW_LDFLAGS): Don't link against w32api libs. These - are only for Cygwin executables. - -2013-07-07 Christopher Faylor - - * cygcheck.cc (dll_info): Detect and report on symlinks. Output wrong - architecture message inline with stdout for clarity. - * path.cc (is_symlink): Always reset file pointer to beginning on exit. - (readlink): Assume that file pointer is set to the beginning. - -2013-06-26 Corinna Vinschen - - * cygpath.cc (do_pathconv): when -p option is given, generate wide - path without long path prefixing. - * wide_path.h (wide_path::wide_path): Allow extra bool parameter to - specify whether or not performing Windows long path prefixing. - -2013-05-21 Corinna Vinschen - - Reinstantiate accidentally removed patch from 2009-05-16: - * Makefile.in (cygpath.exe): Link against cygwin.a before linking - against ntdll.dll to avoid linking symbols defined in both DLLs - from ntdll. - (ps.exe): Ditto. - -2013-05-10 Warren Young - - * utils.sgml utils.xml: Renamed utils.sgml to utils.xml, added - and tags to the top, and formatted it. No - content change. - -2013-04-23 Corinna Vinschen - - * Merge in cygwin-64bit-branch. See ChangeLog.64bit for details. - -2013-02-20 Yaakov Selkowitz - - * Makefile.in (CYGWIN_LDFLAGS): Replace -static-lib* with -static. - (MINGW_LDFLAGS): Ditto. - (ZLIB): Simplify accordingly. - -2012-12-14 Corinna Vinschen - - * utils.sgml (mount): Document sparse mount option. - -2012-11-27 Christopher Faylor - - * Makefile.in: Move CFLAGS and CXXFLAGS so that they can be manipulated - by Makefile.common. Add -static-libstdc++ to *LDFLAGS. Add - dependencies for loadlib.h. - * loadlib.h: Update copyright. - (_load_sys_library): Properly define set_dll_library as WINAPI to avoid - stack corruption. - -2012-11-27 Christopher Faylor - - * Makefile.in (ZLIBS): Common define to force static load. - (MINGW_LDFLAGS): Use static libgcc. - -2012-11-27 Christopher Faylor - - * Makefile.in: Make sure that libz is always loaded staticly. - -2012-11-26 Christopher Faylor - - * configure.ac: Rename from configure.in. - * configure.in: Delete. - * configure: Regenerate. - -2012-11-26 Corinna Vinschen - - * bloda.cc: Drop Mingw.org considerations. - * dump_setup.cc: Ditto. - * strace.cc: Ditto. - -2012-11-12 Christopher Faylor - - * aclocal.m4: Regenerate. - * configure: Ditto. - * autogen.sh: New script. - * configure.in: Revamp for new configury. - * Makefile.in: Revamp for new configury. Rename ALL_* to just *. - Always use "VERBOSE" setting. - (MINGW_CXX): Don't include CFLAGS in definition. - (all): Define target first, before everything else so that it is the - default. - (ps.exe): Don't add useless -lcygwin. - (ldh.exe): For consistency, add to existing MINGW_LDFLAGS rather than - redefining them. - (cygcheck.exe): Always include -lz for MINGW_LDFLAGS. Don't try to - figure out where to find it. - (dumper.exe): Simplify check. Assume libraries are installed rather - than trying to retrieve from source tree. - (install): Just use /bin/mkdir to create directories. - (Makefile): Regenerate when standard dependencies change. - * dump_setup.cc: Always include zlib.h. Remove accommodations for it - possibly not existing. - * parse_pe.cc: Add define which allows building with installed - binutils package. - * dumper.cc: Ditto. - -2012-11-09 Corinna Vinschen - - * path.cc (vcygpath): Handle cygdrive prefix. - -2012-11-07 Corinna Vinschen - - * Makefile.in ($(MINGW_BINS)): Drop -B$(mingw_build)/ from build - expression. - -2012-11-05 Corinna Vinschen - - * Makefile.in (MINGW_CXX): Attach $(CFLAGS) to allow providing - build option tweaks to mingw compiler as well. - -2012-10-24 Corinna Vinschen - - * configure.in: Add AC_NO_EXECUTABLES, - * configure: Regenerate. - -2012-10-24 Kai Tietz - Yaakov Selkowitz - Corinna Vinschen - - * configure.in: Add check for MINGW_CXX. Remove libiconv check. - * configure: Regenerate. - * Makefile.in: Remove references to mingw and w32api directories. - Use MINGW_CXX instead of mingw script to build MINGW_BINS. - Check for libiconv with $CC --print-file-name. - * cygcheck.cc: Use relative include paths for Cygwin headers. - * path.cc: Ditto. - * strace.cc: Ditto - * mingw: Remove. - -2012-10-19 Corinna Vinschen - - * Makefile.in (cygcheck.exe): Add temporary (1.7.17-only) hack to - allow cygcheck running on pre-Vista despite of the new w32api not - matching the locally used w32api. - -2012-10-09 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Convert "if/else if" chain to a switch - statement. Drop "not yet supported" and "Server" from Windows 2012 - output string. - -2012-09-02 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Drop "not yet supported" text from - Windows 8. Update products array. - -2012-07-11 Corinna Vinschen - - * Makefile.in (cygcheck.exe): Link against psapi.dll. - * bloda.cc: Change include section to work with Mingw64 headers. - Include psapi.h. Use SystemProcessInformation instead of - SystemProcessesAndThreadsInformation throughout and add define for - w32api headers. Ditto for PSYSTEM_PROCESS_INFORMATION vs. - PSYSTEM_PROCESSES. - (system_module_list): New type to replace SYSTEM_MODULE_INFORMATION. - Change usage throughout accordingly. - (get_module_list): Fetch module list using PSAPI functions - EnumDeviceDrivers and GetDeviceDriverBaseNameA. - * cygcheck.cc (max): Define as __max if not defined already. - (alloca): Only define if not defined already. - (handle_unique_object_name): Use explicit sharing flags rather than - FILE_SHARE_VALID_FLAGS which officially is only available in DDK - headers. - (PRODUCT_ULTIMATE_E): Only define if not defined already. - * dump_setup.cc: Change include section to work with Mingw64 headers. - (NtQueryAttributesFile): Drop NTOSAPI aka DECLSPEC_IMPORT. - * strace.cc: Change include section to work with Mingw64 headers. - (alloca): Only define if not defined already. - -2012-07-06 Corinna Vinschen - - * cygpath.cc: Change including headers to allow building against - Mingw64 headers. Include ntdef.h and ntdll.h rather than ddk headers. - Define _WIN32_WINNT and WINVER as 0x0602. - (RtlEqualUnicodePathPrefix): Drop definition. Pulled in from ntdll.h - now. - (get_device_name): s/Zw/Nt. - * dumper.cc: Include sys/param.h - (dumper::dump_memory_region): Use MIN rather than min. - * locale.cc: Include stdlib.h. Define _WIN32_WINNT and WINVER as - 0x0602. - * ps.cc: Include ntdef.h and ntdll.h rather than ddk headers. - * regtool.cc (regDeleteKeyEx): Drop WINADVAPI qualifier. - -2012-06-03 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Change "Server 8" to official - "Server 2012". - -2012-05-05 Corinna Vinschen - - * mkpasswd.c (current_user): Actually *use* $HOME if it's available. - Add comment to explain what we're doing here. - -2012-04-05 Corinna Vinschen - - * mkgroup.c (print_special_by_sid): Rename from print_special. Change - calls throughout. - (print_special_by_name): New function. - (main): Call print_special_by_name for TrustedInstaller account. - * mkpasswd.c (print_special_by_sid): Rename from print_special. Change - calls throughout. - (print_special_by_name): New function. - (enum_std_accounts): Call print_special_by_name for TrustedInstaller - account. - -2012-02-24 Yaakov Selkowitz - - * pldd.c: Fix typo in license header. - -2012-02-24 Yaakov Selkowitz - - * Makefile.in (CYGWIN_BINS): Add pldd. - (pldd.exe): Add -lpsapi to ALL_LDFLAGS. - * pldd.c: New file. - * utils.sgml (pldd): New section. - -2012-02-09 Corinna Vinschen - - * passwd.cc: Add -v option to print version information as well, since - it's used in older csih. - -2012-02-04 Corinna Vinschen - - * utils.sgml: Fix typos. - -2012-01-31 Christopher Faylor - - * strace.cc (proc_child): Don't right-shift exit value. - (main): Call ExitProcess() to exit exactly the same way as any straced - child. - -2012-01-29 Corinna Vinschen - - * tzset.c: Throughout use wide characters to be locale agnostic. - (main): Call setlocale. - -2012-01-29 Corinna Vinschen - - * Makefile.in (CYGWIN_BINS): Add tzset. - * tzset.c: New tool, new file. - * utils.sgml (tzset): New section. - -2012-01-24 Yaakov Selkowitz - - * ldd.cc (start_process): Handle .oct and .so as DLLs. - -2011-12-22 Corinna Vinschen - - * Makefile.in (ps.exe): Revert previous change. - * ps.cc: Include psapi.h again. - (main): In CW_GETPINFO_FULL case. Evaluate minimal process access mask - required per OS and use that in OpenProcess call. Use - GetModuleFileNameExW on Windows 2000 or if fetching the drive mapping - failed. Handle empty process name. - -2011-12-22 Corinna Vinschen - - * Makefile.in (ps.exe): Drop -lpsapi from ALL_LDFLAGS. - * ps.cc: Don't include psapi.h. - (dosdevs): Drop. - (unicode_buf): Define. - (main): Simplify path evaluation in CW_GETPINFO_FULL case. Fetch drive - map from Cygwin DLL. Use it to convert NT device paths to Win32 paths. - -2011-12-02 Corinna Vinschen - - * Makefile.in (cygpath.exe): Add -luserenv to ALL_LDFLAGS. - * cygpath.cc: Throughout, use cygwin_conv_path WIN_W rather than WIN_A - conversion. - (get_long_path_name_w32impl): Remove. - (get_long_name): Drop pre-Windows 2000 accommodations. Just call - GetLongPathNameW here directly. - (get_special_folder): Convert first parameter to WCHAR buffer pointer. - Drop conversion of result from WCHAR * to char *. - (do_sysfolders): Accommodate change to get_special_folder and only - convert result to char * last. Drop pre-Windows 2000 accommodations - and just call GetProfilesDirectoryW directly. Replace call to - GetWindowsDirectoryW with call to GetSystemWindowsDirectoryW. - Just call GetShortPathNameW directly. - (do_pathconv): Simplify buffer handling. - -2011-12-01 Corinna Vinschen - - * mkgroup.c: Drop support for NT4 domains. - * mkpasswd.c: Ditto. - (psx_dir): Remove. - (current_user): Drop support for -m option. Use $HOME as is since it's - a POSIX path anyway. - (enum_users): Drop support for -m option. - (usage): Mention -m option as ignored. - (main): Drop support for -m option. Mark ignored options as deprecated. - * utils.sgml (mkpasswd): Remove description of -m option. - -2011-11-28 Corinna Vinschen - - * locale.cc (print_locale_with_codeset): Fetch Windows path as UNICODE - path and convert that to POSIX. - -2011-11-28 Corinna Vinschen - - * ps.cc: Remove all Win 9x considerations. Use psapi functions - directly. Drop support for older Cygwin DLLs. Just use progname_long - as is since it's already a POSIX path now. Rename "tty" to "pty" as in - the Cygwin DLL. Call setlocale to make sure wcstombs does the right - thing according to the current locale. - * Makefile.in (ps.exe): Link against psapi.dll. - -2011-11-24 Christopher Faylor - - * strace.cc (attach_process): Use NT_SUCCESS to figure out if - NtSetInformationProcess succeeded. - (handle_output_debug_string): Put back DebugActiveProcess since it - seems to still be needed (on my system at least). Detect new format - _STRACE_INTERFACE_ACTIVATE_ADDR which informs whether this is a forked - process or not. Use that to decide if forkdebug should be handled. - -2011-11-14 Christopher Faylor - - * strace.cc (handle_output_debug_string): Disable code which attempted - to add stuff in between '****' blocks since they no longer are the - first thing output by an straced process. - -2011-10-13 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Add Windows 8 recognition. Note as - unsupported. Update products array. - -2011-10-11 Yaakov Selkowitz - - * utils.sgml (getconf): Expand documentation. - -2011-10-10 Corinna Vinschen - - * ldd.cc (VERSION): Remove. - -2011-10-10 Christopher Faylor - - * ldd.cc: Update copyright. - -2011-10-10 Corinna Vinschen - - * Align usage output, version output, as well as usage and version - option handling to use the same style throughout all Cygwin utils. - Throughout use program_invocation_short_name to refer to current - process name in Cygwin executables. - * utils.sgml: Align documentation to above change. Add missing - sections for getconf, ldd, and setmetamode. - * strace.cc (proc_child): Avoid compiler warning. - -2011-10-10 Andy Koppe - Corinna Vinschen - - * locale.cc (usage): Restructure, rephrase, add new options. Drop - arguments, don't exit. - (print_version): New function. - (longopts): Add -f, -n, and -V options. Reorder. - (opts): Add -f, -n, and -V options. - (main): Call GetSystemDefaultUILanguage for -s option. Call - GetUserDefaultUILanguage for -u option. Add -f and -n options and - call GetUserDefaultLCID and GetSystemDefaultLCID respectively. Return - 0 after calling usage in -h case. Add -V option and call print_version. - Don't print full usage in default case, rather just a short help message - similar to GNU tools. - * utils.sgml (locale): Align to above changes. Rephrase description. - -2011-10-10 Corinna Vinschen - - * cygcheck.cc (check_keys): Use UNICODE Win32 functions. - -2011-09-12 Jon TURNEY - - * strace.cc (attach_process): Try to turn off DEBUG_ONLY_THIS_PROCESS - if Attaching to a process with the trace-children flag set. - (handle_output_debug_string): Apparently we don't need to explicitly - attach for debugging when a child process starts - * Makefile.in (strace.exe): Link with ntdll - -2011-08-21 Christopher Faylor - - * Makefile.in: Check for header file existence when building dumper.exe - too. - -2011-08-10 Corinna Vinschen - - * ps.cc (main): Don't overwrite process name, just attach - to it for zombie processes. - -2011-07-19 Yaakov Selkowitz - - * Makefile.in (CYGWIN_BINS): Add getconf. - (getconf.c): New file. - -2011-06-14 Christopher Faylor - - * mingw: Force use of bash. - -2011-05-29 Christopher Faylor - - * ps.cc (ttynam): Accommodate new console numbering. - (main): Ditto. - -2011-05-03 Corinna Vinschen - - * locale.cc (print_locale_with_codeset): Align printing of locale names - to POSIX. - -2011-04-18 Corinna Vinschen - - * setfacl.c (getaclentry): Allow extra colon in mask and other entries. - -2011-04-12 Jon TURNEY - - * utils.sgml (strace): Fix a pair of exchanged lines in usage text. - -2011-04-04 Corinna Vinschen - - * passwd.c (main): Add the ability to specify a username for the -R - command. - * utils.sgml: Document the aforementioned change. - -2011-02-29 Corinna Vinschen - - * regtool.cc (cmd_set): Avoid a compiler warning. - -2011-02-29 Corinna Vinschen - - * cygcheck.cc (handle_unique_object_name): Avoid a compiler warning. - (dump_sysinfo): Ditto. - * loadlib.h (_load_sys_library): Mark as used, to avoid a compiler - warning. - * path.cc (oopt): Gurad with !FSTAB_ONLY to avoid a compiler warning. - (read_flags): Ditto. - -2011-02-28 Corinna Vinschen - - * setfacl.c (strchrnul): Drop local implementation. - -2011-02-15 Corinna Vinschen - - * cygcheck.cc: Fix copyright dates. - -2011-01-10 Jon TURNEY - - * cygcheck.cc (main): don't imply -d from -s option to cygcheck - -2010-12-11 Corinna Vinschen - - * setfacl.c (strchrnul): New function. - (getaclentry): Rewrite. - -2010-12-06 Corinna Vinschen - - * cygpath.cc (get_device_name): Fix path length test. - -2010-10-30 Dmitry Potapov - - * regtool.c (cmd_set): Write correct number of bytes for REG_MULTI_SZ - case. - -2010-09-06 Corinna Vinschen - - * cygpath.cc (RtlEqualUnicodePathPrefix): New helper function. - (HARDDISK_PREFIX): Move. - (GLOBALROOT_PREFIX): Define. - (get_device_name): Take GLOBALROOT_PREFIX into account. - Improve check for path to allow filesystem access via block devices. - Potentially drop \\.\ prefix if resulting path is a valid DOS - pathname. - (do_pathconv): Make sure to drop \\?\ prefix only if path is - actually a filesystem based path. - (print_version): Fix copyright. - -2010-08-28 Corinna Vinschen - - * ldh.cc (WinMain): Change DONT_RESOLVE_DLL_REFERENCES to - LOAD_WITH_ALTERED_SEARCH_PATH. - -2010-08-28 Corinna Vinschen - - * loadlib.h: New header implementing safe LoadLibrary calls. - Include throughout files using LoadLibrary function. - * cygcheck.cc (dump_sysinfo): Retrieve kernel32.dll handle via - GetModuleHandle, rather than using LoadLibrary. - * cygpath.cc (get_long_name): Ditto. - (do_sysfolders): Append .dll suffix in LoadLibrary call. - * ldh.cc (WinMain): Use LoadLibraryExW with DONT_RESOLVE_DLL_REFERENCES - to avoid loading malicious library code. - * locale.cc (print_locale_with_codeset): Change way to retrieve - kernel32.dll path. - -2010-08-26 Corinna Vinschen - - * cygpath.cc (get_device_name): Prefer the \\.\X: DOS device for - harddisks, if available. - -2010-08-21 Corinna Vinschen - - * ldd.cc (report): Drop long pathname considerations which result in - invalid path, now that this is done in cygwin_conv_path. - -2010-08-13 Corinna Vinschen - - * mount.cc (from_fstab): Fix potentially fatal typo. - -2010-08-11 Corinna Vinschen - - * mount.cc (do_mount): Don't treat "bind" mount as remote mount. - (mount_entries): Drop the "bind" option from output. - * utils.sgml (mount): Match examples to actual mount output. Add - "bind" option and add example. - -2010-08-10 Yaakov Selkowitz - - * mingw: Use sysroot, if present, for mingw_dir. - -2010-07-21 Corinna Vinschen - - * dump_setup.cc (tfx_chars): New WCHAR array, copied from Cygwin. - (transform_chars): New function, copied from Cygwin. - (simple_nt_stat): New function to check file existance using native - NT function. Explain why. - (directory_exists): Call simple_nt_stat. - (file_exists): Ditto. - -2010-07-05 Christopher Faylor - - * ldd.cc: Clean up formatting throughout. - (head): Move earlier. - (saw_file): Ditto. - (print_dlls): Reset head here. Record seen dll names so they will - not potentially be printed later. - (process_file): Remove clearing of head here. - -2010-07-05 Corinna Vinschen - - * dump_setup.cc (dump_file): Read requested content from setup.rc - file created by newer setup.exe. - -2010-06-29 Corinna Vinschen - - * utils.sgml (locale): Change stray local cygdrive prefix to Cygwin's - default. - -2010-04-29 Corinna Vinschen - - * utils.sgml (mount): Add description for "dos" and "ihash" mount - options. - -2010-04-29 Corinna Vinschen - - * path.cc: Include sys/cygwin.h if built for mount(1). - (struct opt): Add "dos" and "ihash" options. - (from_fstab_line): Call cygwin_internal rather than read_flags if - built for mount(1). - -2010-04-29 Corinna Vinschen - - * mount.cc (oopts): Remove entirely. - (usage): Call cygwin_internal (CW_LST_MNT_OPTS) to create list of - mount options. - (print_version): Fix copyright date. - (main): Replace option processing loop with single call to - cygwin_internal (CW_CVT_MNT_OPTS). - -2010-04-28 Corinna Vinschen - - * locale.cc (print_lc_xxx_charset): Remove. - (enum type_t): Change according to the fact that nl_langinfo now returns - all locale category values. - (lc_ctype_names): Add new category members. Redefine for exclusive - nl_langinfo usage. - (lc_numeric_names): Ditto. - (lc_time_names): Ditto. - (lc_collate_names): Ditto. - (lc_monetary_names): Ditto. - (lc_messages_names): Ditto. - (print_lc): Change switch according to new type_t values. - -2010-03-27 Corinna Vinschen - - * locale.cc (print_charmaps): Add EUC-CN and GB2312. - -2010-03-24 Corinna Vinschen - - * regtool.cc (find_key): Fix allocation size of "value". - -2010-03-23 Corinna Vinschen - - * locale.cc (add_locale_alias_locales): Always use loc_num at function - start to avoid confusing bsearch. - -2010-03-23 Corinna Vinschen - - * locale.cc: Revert accidental checkin of unfinished changes. - -2010-03-23 Corinna Vinschen - - * locale.cc (print_locale_with_codeset): Drop redundant name parameter. - Simplify creating locale string. Add "@" in case of a modifier. - (print_locale): Drop name parameter in calls to - print_locale_with_codeset. - -2010-02-25 Yaakov Selkowitz - - * utils.sgml (kill): Add SIGIO, SIGCLD, and SIGPWR. - -2010-02-25 Corinna Vinschen - - * utils.sgml (locale): Change description of -a and -av to match - latest changes. - -2010-02-23 Corinna Vinschen - - * locale.cc (printlocale): Remove. - (loc_t): New type to keep locale information for printing. - (print_codeset): New function to print codeset as on Linux. - (print_locale_with_codeset): New function to print single locale. - Print verbose style as the Linux locale(1) tool. - (print_locale): New function to print single locale plus its UTF-8 - variation, if available. - (compare_locales): New helper function for bsearch and qsort on loc_t. - (add_locale): New function to store locale in loc_t array. - (add_locale_alias_locales): New function to store locales from - locale.alias file in loc_t. - (print_all_locales): Call add_locale instead of printlocale. - Call add_locale_alias_locales, sort locales alphabetically and print - them. - -2010-02-22 Christopher Faylor - - * strace.cc (mnemonic_table): Add "special" mask option. - (usage): Document it. - * utils.sgml: Ditto. - -2010-02-22 Corinna Vinschen - - * cygpath.cc (do_pathconv): Fix erroneously printing native NT path - prefix introduced by previous patch. - -2010-02-22 Corinna Vinschen - - * locale.cc (lc_time_names): Add "date_fmt" entry. - -2010-02-19 Christopher Faylor - - * strace.cc (mnemonic_table): Add pthread mask option. - (usage): Document strace pthread mask option. - * utils.sgml: Ditto. - -2010-02-19 Corinna Vinschen - - * locale.cc (print_lc_mstrings): New function to print - semicolon-separated strings. - (enum type_t): New type is_sepstrings_linf. - (lc_time_names): Change type of era and alt_digits entry to - is_sepstrings_linf. - (print_lc): Add case for is_sepstrings_linf and call print_lc_mstrings - in that case. - -2010-02-17 Corinna Vinschen - - * Makefile.in (CYGWIN_BINS): Rename getlocale to locale. - * getlocale.c: Rename to ... - * locale.cc: Revamp to add full functionality of POSIX locale(1) tool, - as far as Cygwin supports it. - * utils.sgml (getlocale): Move and rename to ... - (locale): Accommodate new functionality. - -2010-02-13 Ilguiz Latypov - - * cygpath.cc (do_pathconv): Fix potential crash. - -2010-02-11 Corinna Vinschen - - * getlocale.c (main): Rename local variable to avoid problems. - Avoid string comparisons, rather test language and sublanguage codes - wheere possible. Add more code to handle Serbian language/territory - state identical on all Windows versions. Fix handling for "@latin" - modifier in Belarusian locale. - * utils.sgml (getlocale): Try to make wording and example clearer. - -2010-02-10 Corinna Vinschen - - * getlocale.c (usage): Change text slightly. - -2010-02-10 Corinna Vinschen - - * getlocale.c (main): Restrict -a loop to avoid psudo language entries - on Vista and later. - -2010-02-10 Corinna Vinschen - - * getlocale.c (main): Revamp -a loop to avoid duplicates and to print - locales with the correct, supported modifiers. - -2010-01-25 Corinna Vinschen - - * getlocale.c (main): Use setlocale and fetch string from Windows - using GetLocaleInfoW. Explain why. - -2010-01-22 Corinna Vinschen - - * Makefile.in (CYGWIN_BINS): Add getlocale. - * getlocale.c: New file. - * utils.sgml (getlocale): New section describing new getlocale tool. - -2010-01-16 Corinna Vinschen - - * cygpath.cc (get_mixed_name): Drop function. Replace with call to - convert_slashes throughout. - (do_sysfolders): Free allocated buffer. - (do_pathconv): Fix freeing last buffer. - -2010-01-11 Corinna Vinschen - - * mount.cc (do_mount_from_fstab): Allow to change cygdrive prefix, too. - -2010-01-07 Corinna Vinschen - - * cygpath.cc: Throughout, free obsolete path buffers. - -2010-01-07 Corinna Vinschen - - * cygpath.cc (main): Remove enforcing "en_US.UTF-8" locale. - Revert usage of argz functions when reading input from file and - simplify option usage. Allow only one option argument and use - the rest as filename argument to allow spaces in filenames. Restrict - processing special folder type options to one line. - -2009-12-17 Christopher Faylor - - * ps.cc (main): Return 0 if pid found. - -2009-12-16 Corinna Vinschen - - * regtool.cc: Throughout, convert all registry calls to wide char - calls and use string conversion according to current locale. - (longopts): Change "dword-le" to "dword-be", as was originally - intended. - (usage): Change usage accordingly. - (print_version): Simplify copyright dates in output. - (cmd_list): Handle REG_LINK like REG_SZ. - (cmd_get): Ditto. - (main): Call setlocale. - * utils.sgml (regtool): Fix options and add missing descriptions for - new features. - -2009-11-29 Corinna Vinschen - - * setfacl.c (getaclentry): Allow to delete default entries for the - owner and owner group. - -2009-11-27 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Fix typo in products. - -2009-11-11 Corinna Vinschen - - * getfacl.c (print_version): Fix copyright. - (main): Don't reuse local variables confusingly. Don't print any file - information if acl() fails. Improve error message. Always print a - trailing empty line. Set return code to 2 if accessing some file fails. - -2009-11-04 Corinna Vinschen - - * path.cc (read_mounts): Skip unnecessary test if path has been - fetched from loaded cygwin1.dll. - -2009-11-04 Corinna Vinschen - - * cygcheck.cc (cygwin_dll_path): New global variable. - (load_cygwin): Fetch cygwin DLL path and store in cygwin_dll_path. - * strace.cc: Full ditto. - * path.cc (read_mounts): First use the path stored in cygwin_dll_path, - if available. Then fall back to fetching own path. Add comment. - Drop printing warnings since they look funny in strace output. - -2009-11-04 Corinna Vinschen - - * path.cc (read_mounts): First get installation path from own path. - Check if cygwin1.dll exists in same directory. Only if not, try to - get installation path from setup registry key. Add ample warnings. - -2009-11-04 Corinna Vinschen - - * Makefile.in (cygpath.exe): Add -fno-threadsafe-statics to CXXFLAGS. - -2009-10-31 Corinna Vinschen - - * cygcheck.cc: Include cygprops.h. - (del_orphaned_reg): New option variable. - (unique_object_name_opt): Ditto. - (handle_reg_installation): New function. - (print_reg_installations): Ditto. - (del_orphaned_reg_installations): Ditto. - (memmem): Ditto. - (handle_unique_object_name): Ditto. - (dump_sysinfo): Call print_reg_installations from here. - (usage): Add usage for new options --delete-orphaned-installation-keys, - --enable-unique-object-names, --disable-unique-object-names, and - --show-unique-object-names. - (longopts): Add new options --delete-orphaned-installation-keys, - --enable-unique-object-names, --disable-unique-object-names, and - --show-unique-object-names. - (main): Handle new options. - * utils.sgml (cygcheck): Change documentaion accordingly. - -2009-10-28 Corinna Vinschen - - * cygcheck.cc (pretty_id): Drop arguments. Don't change CYGWIN - environment variable. - (dump_sysinfo): Don't tweak CYGWIN environment variable, just call - pretty_id once. - -2009-10-20 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Update with latest NT 6.1 versions. - -2009-10-15 Corinna Vinschen - - * cygpath.cc (get_special_folder): Fetch path as WCHAR and convert - using my_wcstombs. - (get_user_folder): Remove. - (do_sysfolders): Use get_special_folder instead of get_user_folder. - Fetch system paths as WCHAR and convert using my_wcstombs. - -2009-10-12 Corinna Vinschen - - * kill.cc (main): Skip to PID loop on invalid option to handle - negative pids there. - -2009-08-11 Corinna Vinschen - - * mkgroup.c (enum_local_groups): Avoid error message if given group - name isn't found and return 0 to allow searching to proceed. Always - return 0 or 1, not -1. - (enum_groups): Avoid error message if given group name isn't found. - * mkpasswd.c (enum_users): Ditto. - -2009-08-10 Dave Korn - - * mingw: Add fallbacks to search for MinGW components in standard - install locations if not found in compiler's $prefix. - -2009-08-09 Corinna Vinschen - - * mount.cc (do_mount): Don't exit, just return. - -2009-07-23 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Add missing "Server Foundation" to - products array. - -2009-07-22 Corinna Vinschen - - * mount.cc (do_mount): Replace --no-executable flag with notexec - mount option in hint for remote filesystems. - * path.cc (getmntent): Fix typo (noexec -> notexec). - -2009-07-22 Corinna Vinschen - - * Makefile.in (path-mount.o): Add a rule to build stripped down version - of path.cc for usage in mount. - (mount.exe): Add dependency to path-mount.o. - * mount.cc (force): Convert to bool value. Accommodate throughout. - (from_fstab): New function. - (do_mount_from_fstab): New function. - (longopts): Add --all option. - (opts): Add -a option. - (usage): Document -a/--all option. - (main): Handle -a option as well as single parameter. - * path.cc: Add FSTAB_ONLY conditional to allow building path-mount.o. - (mount_table): Remove static storage class. - (max_mount_entry): Ditto. - (root_here): Unused. Remove. - (from_fstab_line): Remove static. - * path.h (struct mnt_t): Define here rather than in path.cc. - (from_fstab_line): Declare. - (mount_table): Declare. - (max_mount_entry): Declare. - * utils.sgml (mount): Document -a/--all option and mounting of single - path from fstab files. - -2009-07-15 Corinna Vinschen - - * strace.cc (main): Open trace output file in UNIX mode. - -2009-07-13 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Remove "not yet supported" text. - -2009-07-04 Christopher Faylor - - * cygwin-console-helper.cc: New file. - -2009-06-10 Corinna Vinschen - - * path.cc (oopts): Sort alphabetically, add missing "auto" and - "override" entries. - (from_fstab_line): Handle mount points same as Cygwin itself. Use - "cygdrive prefix" as posix name of cygdrive prefix. - (from_fstab): Add auto entries for /usr/bin and /usr/lib. Add - MOUNT_AUTOMATIC and MOUNT_IMMUTABLE flags to default root dir entry. - Use "cygdrive prefix" as posix name of default cygdrive prefix. - (getmntent): Allocate smaller buffers. Align output closer to output - of mount(1). - -2009-05-17 Corinna Vinschen - - * cygpath.cc (codepage): New variable. - (long_options): Add --codepage option. - (options): Add -C option. - (usage): Add -C/--codepage description. - (my_wcstombs): New function. Use througout instead of wcstombs. - (do_options): Handle -C/--codepage option. - * utils.sgml (cygpath): Add description for new -C/--codepage option. - -2009-05-16 Corinna Vinschen - - * Makefile.in (cygpath.exe): Link against cygwin.a before linking - against ntdll.dll to avoid linking symbols defined in both DLLs - from ntdll. - (ps.exe): Ditto. - -2009-05-15 Corinna Vinschen - - * cygpath.cc (main): Only setlocale for LC_CTYPE category. Fallback - to UTF-8 if locale is "C". - * ldd.cc (main): Ditto. - * mkgroup.c (main): Ditto. - * mkpasswd.c (main): Ditto. - * passwd.c (main): Ditto. - -2009-05-13 Corinna Vinschen - Christopher Faylor - - * mount.cc (oopts): Sort. Add override option. Add dummy "auto" - option for consistency. - (mount_entries): Avoid adding auto-mounted entries to -m output. - - * utils.sgml: Sort mount options. Add description of override option. - -2009-05-11 Corinna Vinschen - - * Makefile.in: Link ps.exe agains ntdll.dll. - * ps.cc (main): Enable SE_DEBUG_NAME privilege if Windows processes - have to be enumerated. Workaround EnumProcessModules problem when - running under WOW64 and use NtQueryInformationProcess to fetch - process image name. - -2009-05-06 Corinna Vinschen - - * mkpasswd.c (current_user): Don't use HOMEDRIVE/HOMEPATH to generate - user's homedir. - - * mkgroup.c: Accommodate ctype changes. - * mkpasswd.c: Ditto. - * setfacl.c: Ditto. - * ssp.c: Ditto. - -2009-05-04 Christopher Faylor - - * cygcheck.cc (find_app_on_path): Avoid using NULL pointer if - find_on_path doesn't find the app on the path. - -2009-05-04 Corinna Vinschen - - * cygcheck.cc (usage): Fix option order and print. - -2009-04-22 Christopher Faylor - - * strace.cc (create_child): Set CYGWIN=noglob when starting new process - so that Cygwin will leave already-parsed the command line alonw. - -2009-04-15 Corinna Vinschen - - * cygpath.cc (do_pathconv): Only skip \\?\ prefix if it's really - given. Do backslash to slash conversion for mixed paths after - handling \\?\ prefix. - -2009-04-13 Dave Korn - - * Makefile.in (dumper.exe): Add -lz to ALL_LDFLAGS. - -2009-04-07 Corinna Vinschen - - * path.cc (readlink): Accommodate new UTF-16 symlinks. - -2009-04-03 Kevin Buettner - - * utils.sgml: Various syntactical and semantical fixes. - * cygcheck.cc (usage): Fix --find-package explanation. - -2009-03-26 Yaakov Selkowitz - - * utils.sgml (passwd -R): Remove references to CYGWIN="server". - -2009-03-24 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Fix compiler warning in printf. - * strace.cc (proc_child): Ditto. - * ldd.cc: Remove now useless undef wcscasecmp. - -2009-03-23 Corinna Vinschen - - * passwd.c (usage): Change description for -d option according to - previous change. - (main): Fix typo. - * utils.sgml: Add missing description for passwd -d option. - -2009-03-23 Corinna Vinschen - - * passwd.c (caller_is_admin): New function to test if calling user - is an administrator by inspecting user token. - (main): Drop fetching caller info from logonserver. Only fetch - server from environment when trying to change password for own - account. Drop admin check entirely in case of doing account - maintainance. Otherwise replace check for admin by result of - caller_is_admin call. - -2009-03-22 Corinna Vinschen - - * passwd.c (main): Always get logonserver from environment and - use when fetching user info for caller. - -2009-03-22 Corinna Vinschen - - * ldd.cc: Fix compiler warning. - - * passwd.c: Use mbstowcs instead of MultiByteToWideChar throughout. - (main): Call setlocale. Fix a bug in fetching the logon server from - the environment. - -2009-03-18 Christopher Faylor - - * ldh.cc: New file. - -2009-03-17 Christopher Faylor - - * ldd.cc (load_dll): Start helper program rather than ldd.exe. - (set_entry_point_break): Rename from get_entry_point. - (print_dlls): Rename from print_dlls_and_kill_inferior. Avoid printing - specific dll name if we're looking at a dll. - (report): Always dump dlls on process exit. Don't allow thread - creation. Accommodate get_entry_point rename. - (start_process): Start process with DEBUG_ONLY_THIS_PROCESS. - (longopts): Eliminate "dll" option. - (main): Ditto. - -2009-03-17 Corinna Vinschen - Christopher Faylor - - * ldd.cc: Use wide character Win32 paths throughout. - (load_dll): Fix size expression (add fn) in realloc. - -2009-03-14 Christopher Faylor - - * ldd.cc (longopts): Add --dll option. - (get_module_filename): Generalized wrapper function which avoid path - length restrictions. - (load_dll): Handle special-case of inspecting a DLL. - (start_process): Accept an output parameter "isdll". Detect when file - to start is a DLL and start a wrapper instead. - (print_dlls_and_kill_inferior): When dealing with a DLL, avoid printing - everything before the DLL itself first appears. (This is not strictly - correct and should be fixed eventually) - (report): Deal with DLLs. Don't set a breakpoint for DLLs, just let - captive ldd process terminate normally. Pass dll info to - print_dlls_and_kill_inferior. - (main): Handle special-case "--dll" option by loading the DLL and - exiting. - -2009-03-14 Corinna Vinschen - - * path.cc (from_fstab): Use wcstombs/mbstowcs instead of - WideCharToMultiByte/MultiByteToWideChar to accommodate current locale. - -2009-03-14 Corinna Vinschen - - * wide_path.h (class wide_path): New class to convert Windows path - to WCHAR win32 path, including long path conversion if necessary. - * cygcheck.cc: Use class wide_path throughout to call Win32 functions - taking potentially long filenames. - (display_error): Use snprintf rather than sprintf. - (display_error_fmt): Ditto. - (dump_sysinfo): Use FindFirstFileW/FindNextFileW. - * cygpath.cc: Use class wide_path throughout to call Win32 functions - taking potentially long filenames. - (get_device_name): Raise buffer size to take long pathnames. - (get_short_paths): Convert to using GetShortPathNameW. - (get_short_name): Ditto. - (get_long_path_name_w32impl): Convert to equivalent of GetLongPathNameW. - (get_long_name): Convert to using GetLongPathNameW. - (do_sysfolders): Raise buffer size for POSIX pathname to PATH_MAX. - (do_pathconv): In case of POSIX->Win32 conversion, convert to wchar_t - Win32 path name and drop long pathname prefix if possible. - (main): Call setlocale to accommodate wide char/multibyte conversions. - -2009-03-14 Christopher Faylor - - * ldd.cc: Rework to detect missing DLLs. - (start_process): Change to expect windows filename as input. - (tocyg): New function - convert cygwin fn to windows fn. - (print_dlls_and_kill_inferior): Accept extra argument denoting whether - to open input and look for nonexistent DLLs. Use tocyg to convert - filename and pass it to start_process. - (report): Flag when an DLL-not-found exception occurs and pass this - information to print_dlls_and_kill_inferior. - (filelist): New structure. - (saw_file): New function. - (dump_import_directory): Ditto. - (map_file): Ditto. - (skip_dos_stub): Ditto. - (get_directory_index): Ditto. - (process_file): Ditto. - -2009-03-09 Corinna Vinschen - - * utils.sgml: Fix typo. - -2009-03-08 Christopher Faylor - - * cygcheck.cc (usage): Fix typo. - -2009-03-02 Corinna Vinschen - - * utils.sgml: Set example prompt to "$" throughout. Don't use "/" - as example cygdrive prefix. Remove reference to -u and -s options. - Add an example using the -o flag. - -2009-03-02 Corinna Vinschen - - * mount.cc (mount_entries): Handle a "/" cygdrive prefix correctly. - Add comments. - -2009-02-23 Sjors Gielen - - * Makefile.in: Add DESTDIR functionality. - -2009-01-29 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Evaluate and print state of - obcaseinsensitive kernel flag. - -2009-01-21 Corinna Vinschen - - * passwd.c: Remove CYGWIN=server requirement from usage text. - -2009-01-17 Corinna Vinschen - - * Makefile.in: Fix copyright date. - * cygcheck.cc (scan_registry): Take additional parameter and add code - to avoid recursion in Wow6432Node subkey. Rename variable cygnus to - cygwin. Scan for "Cygwin" instead of for "cygnus" substring. - (dump_sysinfo): Drop unused calls to scan_registry. Drop scanning - HKEY_CURRENT_CONFIG. - -2009-01-16 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Raise size of osname. Add Windows 7 - and Windows 2008 R2 as recognized OSes. Update products array to - the latest documented list. - -2009-01-09 Christopher Faylor - - * ldd.cc: New file. First stab at implementing ldd-like functionality - for Cygwin. - * Makefile.in (CYGWIN_BINS): Add ldd. - (ldd.exe): Use -lpsapi. - -2009-01-05 Pierre Humblet - - * cygcheck.cc (dump_sysinfo_services): Quote the path for popen. - -2008-12-30 Pierre Humblet - - * cygcheck.cc (pretty_id): Quote the path for popen. - (dump_sysinfo_services): Ditto. - -2008-12-16 Corinna Vinschen - - * utils.sgml: Fix typo in passwd screen text. - -2008-12-15 Corinna Vinschen - - * passwd.c (main): Put how to delete the registry password on its own - line in passwd -R output. - -2008-12-13 Christopher Faylor - - * utils.sgml: Convert some backslashes to slashes. - -2008-11-26 Corinna Vinschen - - * passwd.c (longopts): Add --reg-store-pwd option. - (opts): Add -R option. - (usage): Add text for -R/--reg-store-pwd option. - (main): Fix size of local user and password string arrays. - Handle -R option. - * utils.sgml: Add text for passwd -R/--reg-store-pwd option. - -2008-10-29 Christopher Faylor - - * Makefile.in (ALL_LDFLAGS): Link libgcc statically for everything - here. - -2008-10-12 Christopher Faylor - - * mingw: Set sawcfile when -xc* is detected. Extend list of detected - source files. - -2008-10-12 Christopher Faylor - - * mingw: Add more checks to allow more varied use. - -2008-10-11 Christopher Faylor - - * mingw: Use a better method to find where mingw directory lives. - -2008-10-11 Christopher Faylor - - * mingw: New front-end script to control building of MinGW files - without using the deprecated -mno-cygwin option. - * Makefile.in: Use mingw front-end. - -2008-09-12 Christopher Faylor - - * cygcheck.cc (pathlike::check_existence): Remove class name from - declaration. - (display_internet_error): Use proper format specifier for DWORD. - (environ): Remove unneeded declaration. - (main): Use brace around nested if to avoid an overly-helpful compiler - warning. - * dump_setup.cc (parse_filename): Reorganize nested if to avoid an - overly-helpful compiler warning. - * path.cc (GUID_shortcut): Use braces around part of initializer which - needs them. - (conv_fstab_spaces): Parenthesize assignment in while loop to avoid a - compiler warning. - (struct opt): Make static. - * ps.cc (main): Reorganize nested if to avoid an overly-helpful - compiler warning. - * regtool.cc: Make some anonymous structs static to avoid a compiler - warning. - * ssp.c (lookup_thread_id): Initialize *tix to zero to avoid potential - uninitialized use. - * strace.cc (add_child): Use proper format specifier for DWORD. - (remove_child): Ditto. - (proc_child): Ditto. - -2008-08-27 Christopher Faylor - - * cygcheck.cc (nuke): Use malloc rather than alloca for environment - variables. - (load_cygwin): Ditto. - * dump_setup.cc (parse_filename): Cosmetic changes. - (get_packages): Ditto. - -2008-08-25 Corinna Vinschen - - * mkgroup.c (enum_local_groups): Don't skip printing groups when - print_current is set and group SID is not curr_pgrp. - (enum_groups): Ditto. - (main): Fix condition when SYSTEM group gets printed. - * mkpasswd.c (enum_users): Don't skip printing users when print_current - is set and user SID is not curr_user. - (main): Allow printing standard accounts even when print_current is set. - -2008-08-18 Corinna Vinschen - - * mkgroup.c (enum_local_groups): Use NetLocalGroupGetInfo to find out - if a group exists, rather than just allocating a buffer and going ahead. - -2008-08-18 Corinna Vinschen - - * mkgroup.c (enum_local_groups): Call print_win_error with GetLastError - as argument when LookupAccountXXX failed. - (enum_groups): Ditto. - -2008-08-18 Corinna Vinschen - - * mkgroup.c (enum_local_groups): Return failure if looking for a single - group succeeded. Add comment. - -2008-08-18 Corinna Vinschen - - * mkgroup.c (main): Keep correctly track of optional arguments. - * mkpasswd.c (main): Ditto. - -2008-08-18 Corinna Vinschen - - * mkgroup.c (main): Always unset environment variable POSIXLY_CORRECT. - Keep track of optional argumnts and fix up optind afterwards. - * mkpasswd.c (main): Ditto. - -2008-08-17 Christopher Faylor - - * cygcheck.cc (print_version): Update copyright dates. - -2008-08-17 Christopher Faylor - - * mkpasswd.c (main): Avoid printing system accounts when a single user - name has been requested. - -2008-08-17 Christopher Faylor - - * Makefile.in (ALL_LDFLAGS): Add --enable-auto-import option to quiet - ld warnings. - * mkgroup.c: Change all global variables and most functions to static. - (enum_local_groups): Add a print_current parameter to control whether - entries for everything should be printed or just the current user. - (enum_groups): Ditto. - (main): Move call fetch_current_pgrp_sid earlier to avoid a NULL - deference when no command line arguments are specified. Accommodate - argument changes to above functions. Avoid printing SYSTEM account - when print_current is specified. Issue error when extra stuff is found - on the command line. - * mkpasswd.c: Change all global variables and most functions to static. - (enum_users): Add a print_current parameter to control whether entries - for everything should be printed or just the current user. - (main): Move call fetch_current_user_sid earlier to avoid a NULL - deference when no command line arguments are specified. Accommodate - argument change to above function. Avoid printing standard accounts - when print_current is specified. Issue error when extra stuff is found - on the command line. - -2008-08-15 Corinna Vinschen - - * mkgroup.c (fetch_current_pgrp_sid): New function to fetch primary - group SID from user token. - (current_group): Move up in file. Move fetching primary group SID to - fetch_current_pgrp_sid. - (enum_local_groups): Check if current SID is the same as current user's - primary group SID. - (enum_groups): Ditto. - (main): Call fetch_current_pgrp_sid before enumerating groups. Call - current_group only if current group hasn't been enumerated already. - * mkpasswd.c (fetch_current_user_sid): New function to fetch current - user SID from user token. - (current_user): Move fetching current user SID to - fetch_current_user_sid. - (enum_users): Check if current SID is the same as current user's SID. - (main): Call fetch_current_user_sid before enumerating users. Call - current_user only if current user hasn't been enumerated already. - -2008-08-13 Corinna Vinschen - - * mount.cc (NT_MAX_PATH): Define. - (longopts): Rename mount-commands option to mount-entries. - (opts): Remove removed options. - (struct opt): Move up in file to allow using it in usage. - (usage): Change text for --mount-entries option. Remove - -X option. Add valid options output. - (main): Remove handling -b option. - (convert_spaces): New static function to convert spaces to "\040" - string. - (mount_entries): Renamed from mount_commands. Rewrite to emit - /etc/fstab compatible output. - (show_cygdrive_info): Print "nouser" rather than "system". - * umount.cc (longopts): Remove remove-all-mounts, - remove-cygdrive-prefix, remove-system-mounts, system and user options. - (opts): Remove A, c, s, S, u options. - (usage): Remove text for all removed options. - (main): Remove handling for all removed options. - (remove_all_mounts): Remove. - (remove_all_system_mounts): Remove. - (remove_cygdrive_prefix): Remove. - * utils.sgml: Fix mount and umount documentation. Move description - of (cyg,not)exec options to mount table section. - -2008-08-04 Christopher Faylor - - * cygcheck.cc (load_cygwin): Duplicate argv list since it disappears - when cygwin1.dll is unloaded. - -2008-07-30 Yaakov Selkowitz - - * Makefile.in: Link cygcheck with -lntdll even without mingw-zlib. - -2008-07-27 Christopher Faylor - - * cygcheck.cc (load_cygwin): Free the cygwin dll after we're done with - it. - -2008-07-25 Christopher Faylor - - * mount.cc: Remove non-unix-like options (-x,-t,b) throughout. - (oopts): Use boolean constants for slightly increased clarity. - - * configure.in: Remove apparently unneeded program_transfer_name code. - * configure: Regenerate. - -2008-07-24 Corinna Vinschen - - * utils.sgml: Remove useless text. - -2008-07-23 Corinna Vinschen - - * mkgroup.c (main): Fix test for duplicate domain/machine request. - * mkpasswd.c (main): Ditto. - -2008-07-23 Corinna Vinschen - - * mkgroup.c: Rework to allow per-domain/per-machine id_offset. - Add -b option to skip builtin groups. - (main): Simplify code. - * mkpasswd.c: Rework to allow per-domain/per-machine id_offset. - (main): Simplify code. - * utils.sgml: Explain changed mkgroup/mkpasswd -d/-D/-l/-L options. - Add mkgroup -b option. - -2008-07-23 Corinna Vinschen - - * mkgroup.c: Consolidate variable names. - (enum_unix_groups): New function. - (print_special): Use LookupAccountSidW instead of LookupAccountSidA. - (current_group): Ditto. - (usage): Add -U option. - (longopts): Add --unix option. - (opts): Add -U option. - (main): Handle -U option. Call enum_unix_groups if set. - * mkpasswd.c: Consolidate variable names. - (current_user): Use LookupAccountSidW instead of LookupAccountSidA. - (enum_unix_users): New function. - (usage): Add -U option. - (longopts): Add --unix option. - (opts): Add -U option. - (main): Handle -U option. Call enum_unix_groups if set. - * utils.sgml: Add -U option text to mkgroup and mkpasswd description. - -2008-07-22 Corinna Vinschen - - * mkgroup.c (enum_groups): Create full qualified groupname using - domain or servername, depending on printing domain or machine accounts. - * mkpasswd.c (enum_users): Ditto for users. - -2008-07-22 Corinna Vinschen - - * mkgroup.c (main): Remove special root group code. Only print - SYSTEM group in case of printing local machine or local domain groups. - -2008-07-22 Corinna Vinschen - - * Makefile.in (cygcheck.exe): Link against ntdll. - * bloda.cc: Use statically linked functions throughout. - * cygpath.cc: Drop 9x considerations. - * mkgroup.c: Revamp. Redefine -l and -d options to take optional - machine and domain parameters. Redefine -c to work always, using - token information. Add -L, -D, -C to create unique groupnames in - domain\group syntax. Add -S option to define domain\group separator - char. Ignore -u and -s options. - * mkpasswd.c: Revamp. Redefine -l and -d options to take optional - machine and domain parameters. Redefine -c to work always, using - token information. Add -L, -D, -C to create unique usernames in - domain\user syntax. Add -S option to define domain\user separator - char. Ignore -g and -s options. Prefer to take homedir from $HOME - over $HOMEDRIVE/$HOMEPATH. - * path.cc (oopts): Add "acl", "noacl", "posix=0" and "posix=1" options. - (getmntent): Accomodate throughout. - * ps.cc: Fix copyright dates. - * utils.sgml: Fix text for mkgroup and mkpasswd. - -2008-07-17 Corinna Vinschen - - * mount.cc (do_mount): Remove MOUNT_ENC code. - (oopts): Remove "managed" option. - (mount_commands): Drop "managed" handling. - * path.cc (oopts): Remove "managed" option. - (getmntent): Remove MOUNT_ENC code. - -2008-07-17 Corinna Vinschen - - * utils.sgml: Add id's to all examples. - -2008-07-09 Corinna Vinschen - - * mkgroup.c: Use statically linked functions throughout, except for - DsGetDcNameW. Reformat. Convert to use WCHAR for names throughout. - Use defines instead of constants throughout. - (MAX_SID_LEN): Define. - (load_netapi): Just load DsGetDcNameW pointer. - (psx_dir): Remove. - (uni2ansi): Remove. - (enum_local_users): Take server name and use in Net... call. - (DBGSID): Define datastructure. - (MAX_BUILTIN_SIDS): Define. - (builtin_sid_list): Define global sid list. - (builtin_sid_cnt): Define counter for global sid list. - (enum_local_groups): Take server name and use in Net... and Lookup... - calls. Take offset argument. Use MAX_PREFERRED_LENGTH in call to - NetLocalGroupEnum. Check for duplicate builtin groups. - (enum_users): Take server name and use in Net... call. - (usage): Change text slightly. - (print_version): Fix copyright. - (main): Call enum_local_groups for domains as well. - * mkpasswd.c: Use statically linked functions throughout, except for - DsGetDcNameW. Reformat. Convert to use WCHAR for names throughout. - Use defines instead of constants throughout. - (MAX_SID_LEN): Define. - (load_netapi): Just load DsGetDcNameW pointer. - (uni2ansi): Use wcstombs. - (current_user): Replace "unused_by_nt/2000/xp" by - just "unused". - (enum_users): Ditto. - (print_version): Fix copyright. - -2008-05-22 Corinna Vinschen - - * setfacl.c (setfacl): Change from void to int. Return 2 in case of - error. - (main): Return with error code from setfacl. - -2008-05-15 Corinna Vinschen - - * Makefile.in (CYGWIN_BINS): Remove ipcrm and ipcs. - * ipcrm.c: Remove. - * ipcs.c: Remove. - -2008-03-23 Corinna Vinschen - - * mount.cc (usage): Mark -s and -u as ignored. - (print_version): Simplify printing copyright dates. - (main): Remove default_flag. Dont set flags on -s and -u options. - (mount_commands): Drop handling -s and -u options. - -2008-03-22 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Fix multiple Cygwin DLL test. - * path.cc: Fetch mount points from fstab files instead of from - registry. Use adapted functions copied from Cygwin DLL. - (mnt_t): Drop issys member. Define as "mnt_t" instead of "struct mnt_t" - subsequently. - (max_mount_entry): New variable. - (unconvert_slashes): Move to earlier location in file. Make inline. - (find2): Remove. - (get_cygdrive0): Remove. - (get_cygdrive): Remove. - (skip_ws): New function. - (find_ws): Ditto. - (conv_fstab_spaces): Ditto. - (read_flags): Ditto. - (from_fstab_line): Ditto. - (get_user): Ditto. - (from_fstab): Ditto. - (mnt_sort): Ditto. - (read_mounts): Drop old registry code. Fetch - "Software\Cygwin\Setup\rootdir" value from HKCU or HKLM key. Use - rootdir extracted from module path as fallback. Call from_fstab for - nouser and user mount points. - (setmntent): Check max_mount_entry to test if read_mounts must be - called. - (getmntent): Use MOUNT_SYSTEM flag instead of mnt_t's issys member. - -2008-03-16 Brian Dessent - - * path.cc: Include malloc.h for alloca. - (is_symlink): Rewrite. Just read the whole file in memory rather - than by parts. Account for an ITEMIDLIST if present, as well as - the new style of Cygwin shortcut supporting targets > MAX_PATH. - -2008-03-12 Corinna Vinschen - - * cygpath.cc (do_sysfolders): Use cygwin_conv_path. - (do_pathconv): Use cygwin_conv_path and cygwin_conv_path_list. - * dumper.cc (main): Use cygwin_conv_path. Allocate target path - dynamically. - * mkpasswd.c (current_user): Use cygwin_conv_path. - (enum_users): Ditto. - * ps.cc (NT_MAX_PATH): Define. - (main): Use cygwin_conv_path. - * regtool.cc (find_key): Ditto. Allocate target path dynamically. - (cmd_save): Ditto. - -2008-03-11 Brian Dessent - - * cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1 - chars. - -2008-03-11 Brian Dessent - - * cygcheck.cc (dirname): New static function. - (find_app_on_path): Use SYMLINK_MAX. Resolve symlink relative - to link's location. Adjust to the fact that cygpath already - normalizes its return value. - * path.cc (rel_vconcat): Add cwd parameter, and use it instead - of calling GetCurrentDirectory() if possible. Rename throughout. - (vcygpath): Rename from cygpath and accept cwd and va_list. Pass - cwd on to rel_vconcat(). - (cygpath_rel): New front end for vcygpath. - (cygpath): Ditto. - * path.h (cygpath_rel): Declare. - (SYMLINK_MAX): Define to 4095. - -2008-03-09 Brian Dessent - - * Makefile.in (install): Don't install the testsuite. - -2008-03-08 Brian Dessent - - * Makefile.in: Add a 'check' target that builds and runs - testsuite.exe from path-testsuite.o and testsuite.o. - * path.cc: Include testsuite.h. - (struct mnt): Change to a mnt_t typedef and don't define - mount_table when TESTSUITE is defined. - (find2): Don't include when TESTSUITE is defined to avoid warning. - (get_cygdrive0): Ditto. - (get_cygdrive): Ditto. - (read_mounts): Provide empty implementation when TESTSUITE is - defined. - (vconcat): Use the isslash macro. - (unconvert_slashes): New helper to convert to backslashses. - (rel_vconcat): Handle relative paths more gracefully. - (cygpath): Skip a leading "./" sequence. Avoid double-slashes. - Normalize final output to backslashes and remove redundant path - sequences. - * testsuite.cc: New file implementing testsuite driver. - * testsuite.h: New header implementing harness mount table and - series of tests. - -2008-03-08 Brian Dessent - - * Makefile.in: Reorganize considerably, using GNU make's - static pattern rules and target-specific variables. - -2008-02-28 Corinna Vinschen - - * mkpasswd.c (main): Simplify generating SYSTEM entry. Add entries - for LocalService and NetworkService accounts. Change comments. - -2008-01-13 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Always try to get a OSVERSIONINFOEX - first. Load kernel32.dll earlier. Make osname a buffer. Simplify - Non-NT code. Use GetProductInfo in Vista/2008 case. Clean up - non-Vista version info. Exit early if not on NT. - -2007-12-29 Dave Korn - - * bloda.cc (enum bad_app): Add BYTEMOBILE. - (dodgy_app_detects[]): Add FILENAME entry to detect bmnet.dll. - (big_list_of_dodgy_apps[]): Add description for BYTEMOBILE. - -2007-12-20 Brian Dessent - - * Makefile.in (cygcheck.exe): Don't link to ntdll. - * bloda.cc (pNtQuerySystemInformation): Add. - (pRtlAnsiStringToUnicodeString): Add. - (get_process_list): Use function pointers for NT functions. - (dump_dodgy_apps): Skip dodgy app check on non-NT platforms. - Use GetProcAddress for NT-specific functions. - -2007-12-07 Corinna Vinschen - - * regtool.cc (opts): Add missing 'W'. - -2007-12-06 Corinna Vinschen - - * ps.cc: Include limits.h. - (main): Set file name buffer size to PATH_MAX. Use progname or - progname_long member of struct external_pinfo dependent of the value of - the struct's version member. - -2007-08-31 Dave Korn - - * mkgroup.c (enum_groups): Use MAX_PREFERRED_LENGTH in netgroupenum - call so that it will automatically size returned buffer sufficiently. - -2007-08-03 Dave Korn - - * Makefile.in (cygcheck.exe): Add bloda.o as prerequisite, adjusting - dependency-filtering $(wordlist ...) call appropriately. Link ntdll. - (bloda.o): New rule to build bloda.o - * cygcheck.cc (dump_sysinfo): Call bloda function dump_dodgy_apps(). - * bloda.cc: New file implements detection of applications from the - Big List Of Dodgy Apps. - -2007-07-24 Corinna Vinschen - - * COPYING.dumper: New file. - * dumper.cc: Change license to plain GPLv2 + later. - * dumper.h: Ditto. - * parse_pe.cc: Ditto. - -2007-07-23 Christopher Faylor - - * strace.cc (create_child): Don't convert a path from cygwin format - unless it has a slash. - -2007-07-09 Christopher Faylor - - * strace.cc (usage): Add missing description for -q. - -2007-07-09 Christopher Faylor - - * Makefile.in (kill.exe): Remove reliance on libiberty. - * kill.cc (strsigno): New function patterned after libiberty but using - newly exported cygwin array. - -2007-06-03 Christopher Faylor - - * cygcheck.cc (pathlike): New class. - (paths): Redefine as type pathlike. - (display_error): Declare a few different ways to allow more flexible - usage throughout. - (display_error_fmt): New function for those cases where C++ just isn't - enough. - (add_path): Rewrite to allocate pathlike paths. Always tack on a - trailing slash since that's what everyone who uses it wants. NULL - terminate the path list. Register "it's a system path" field. - (init_path): Call add_path with info regarding whether path is a system - path or not. - (pathlike::check_existence): Move into pathlike class. Accept file and - extension arguments to build up path on the fly. Modify other - arguments. - (find_on_path): Constify return value and appropriate arguments. - Eliminate short-circuit for fully-qualified paths. Simplify loop which - iterates over path. - (already_did): Constify argument. - (track_down): Ditto. Regularize some error messages. - (find_app_on_path): Ditto. - (cygcheck): Constify argument. Use 20th century string handling - functions. - (dump_sysinfo): Remove odd inclusion of '\\bin' "Just in case". - Accommodate change of paths to pathlike. - * path.cc (isslash): Rename from SLASH_P and use throughout. - (rel_vconcat): Front-end to vconcat which prepends cwd to path before - passing along for conversion to native windows. - (cygpath): Remove "./" test. Call rel_vconcat if filename appears to - be relative. - -2007-05-29 Pedro Alves - - * dumper.cc (dumper::prepare_core_dump): Record a phdr for each section. - -2007-05-29 Corinna Vinschen - - * cygpath.cc (do_options): Allow outputflag combined with other - basic flags. Only check options_from_file_flag if reading options - from command line. - (main): Check for NULL argz vector. Don't free argz vector prematurely. - Don't force flag combination in !options_from_file_flag case. - -2007-05-23 Corinna Vinschen - - * cygpath.cc: Include argz.h. - (options_from_file_flag): Move from main to global static variable. - (mode_flag): Ditto. - (do_sysfolders): Rename from dowin and accommodate throughout. - Don't exit from here. - (do_pathconv): Rename from doit and accommodate throughout. - (print_version): Change copyright. - (do_options): New function, centralizing option processing. - Rework checking options for correctness. - (action): New function, centralizing calling worker functions. - (main): Simplify. Move option processing to do_options. Move calling - worker functions to action. Rework getting arguments from files. - -2007-03-30 Mark Mitchell - - * utils/cygpath.cc (get_long_path_name_w32impl): Close handles returned - by FindFirstFile. - -2007-03-30 Christopher Faylor - - * mount.cc (main): Turn dos file warnings off since we know what we're - doing. - -2007-02-22 Corinna Vinschen - - * ipcs.c (_POSIX2_LINE_MAX): Drop definition. - -2007-02-20 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Add "not supported" to osname on 9x - machines. Drop "not supported" for Vista. Drop "Longhorn" text - for now. - -2007-01-09 Christian Franke - - * cygpath.cc (usage): Add -O and -F, remove tabs. - (get_special_folder): New function. - (get_user_folder): New function. - (dowin): Add -O and -F, better -D, -P error handling. - (main): Add -O and -F. - * utils.sgml (cygpath): Document -O and -F. - -2006-12-21 Corinna Vinschen - - * dumper.cc: Include ansidecl.h before including bfd.h to woraround - a problem with the order in which system include files are included. - -2006-12-11 Christopher Faylor - - * dumper.cc: Add an include to accommodate new include/elf usage. - -2006-12-10 Christopher Faylor - - * mount.cc (do_mount): Avoid unnecessary cygwin_conv_to_win32_path and - pass POSIX path directly - this avoids a cygwin DLL warning. - -2006-10-21 Corinna Vinschen - - * regtool.cc (key_type): Drop. - (REG_AUTO): Define. - (value_type): Replace key_type. Use REG_xxx values directly. - Accomodate change throughout. - (longopts): Add --dword, --dword-le, --none, --qword and --hex options. - (opts): Add -d, -D, -n, -Q and -x options. - (types): Array to convert REG_xxx into strings. - (hex): New variable to keep value of --hex option. - (usage): Accomodate new options. Print only the necessary by default. - Only be verbose in case of -h/--help option. - (cmd_list): Use key separator from -K option when printing. - Print value type when verbose option is given. Handle so far not - handled REG_xxx types. - (cmd_set): Avoid SEGV due to missing argument. Handle so far not - handled REG_xxx types. - (cmd_get): Handle --binary option type agnostic. Handle so far not - handled REG_xxx types. - (main): Handle new options. - -2006-10-19 Corinna Vinschen - - * regtool.cc (longopts): Add --wow32 option. - (opts): Add -W option. - (usage): Add text for --wow32/-W option. - (main): Handle --wow32/-W option. - * utils.sgml: Document the new -W option. - -2006-10-16 Corinna Vinschen - - * regtool.cc (KEY_WOW64_64KEY): Drop definition. Instead define - WINVER to 0x0502 before including windows.h. - -2006-10-16 Corinna Vinschen - - * regtool.cc (KEY_WOW64_64KEY): Define. - (longopts): Add --wow64 option. - (opts): Add -w option. - (wow64): New variable to control usage of KEY_WOW64_64KEY access flag. - (usage): Add text for --wow64/-w option. - (print_version): Fix copyright. - (find_key): Use wow64 value in calls to RegOpenKeyEx and RegCreateKeyEx. - (cmd_add): Use wow64 value in call to RegCreateKeyEx. - (regDeleteKeyEx): New function pointer to load RegDeleteKeyEx function - dynamically. - (cmd_remove): Load and use regDeleteKeyEx when wow64 is set. - (main): Handle --wow64/-w option. - * utils.sgml: Document the new -w option. - -2006-10-05 Igor Peshansky - - * cygcheck.cc (get_word, get_dword): Move to path.cc. - (LINK_EXTENSION): New macro. - (check_existence): New static function. - (find_on_path): Check for symbolic links if asked. - (dll_info): New error handling. - (track_down): Only call dll_info() for executables, display - an error for symlinks, and print magic number for others. - (find_app_on_path): New static function. - (cygcheck, dump_sysinfo): Call find_app_on_path() instead of - find_on_path(). - * path.cc (cmp_shortcut_header): New static function. - (get_word, get_dword): Moved from cygcheck.cc. - (EXE_MAGIC, SHORTCUT_MAGIC, SYMLINK_COOKIE, SYMLINK_MAGIC): New - macros. - (is_exe, is_symlink, readlink): New functions. - * path.h (is_exe, is_symlink, readlink): Declare. - (get_word, get_dword): Ditto. - -2006-09-12 Christopher Faylor - - * Makefile.in: Fix -ntdll typo. - -2006-09-11 Eric Blake - - * cygcheck.cc (main): Restore POSIXLY_CORRECT before displaying user's - environment. - -2006-08-03 Corinna Vinschen - - * path.cc (vconcat): Don't convert backslahes to slashes. - (cygpath): Return native path with all backslashes. - -2006-08-02 Corinna Vinschen - - * Makefile.in (cygpath.exe): Add rule to link cygpath against ntdll.dll. - * cygpath.cc: Include DDK headers. - (RtlAllocateUnicodeString): New static inline function. - (get_device_name): New static function to evaluate DOS path from - native NT path. - (get_device_paths): New function to do the same for path lists. - (doit): Call get_device_paths/get_device_name where appropriate. - -2006-07-30 Ilya Bobir - - * cygpath.cc (get_long_name): Fallback to get_long_path_name_w32impl. - -2006-07-27 Corinna Vinschen - - * cygpath.c (get_long_name): Cover the case that GetLongPathName - doesn't return valid information for non-existant files. Just return - incoming filename in that case. - -2006-07-03 Kazuhiro Fujieda - - * Makefile.in: Build setmetamode.exe. - * setmetamode.c: New file. - -2006-05-24 Christopher Faylor - - * configure.in: Update to newer autoconf. - (thanks to Steve Ellcey) - * configure: Regenerate. - * aclocal.m4: New file. - -2006-05-24 Christopher Faylor - - * strace.cc (proc_child): Propagate return code from child process. - (dostrace): Ditto. - (main): Ditto. - -2006-03-03 Christian Franke - - * regtool.cc (options): Add 'binary'. - (usage): Document 'load|unload|save' and '-b'. - (find_key): Add 'options' parameter, add load/unload. - (cmd_set): Add KT_BINARY case. - (cmd_get): Add hex output in KT_BINARY case. - (cmd_load): New function. - (cmd_unload): New function. - (set_privilege): New function. - (cmd_save): New function. - (commands): Add load, unload and save. - (main): Add '-b' - * utils.sgml (regtool): Document it. - -2006-02-17 Corinna Vinschen - - * cygpath.cc (get_long_name): Load GetLongPathNameA instead of incorrect - GetLongPathName. - (doit): Create mixed filename after converting to short or long pathname - respectively. - -2006-02-17 Jerry D. Hedden - - * ps.cc (main): Set aflag if -p option is given. - -2006-02-16 Jerry D. Hedden - - * ps.cc (longopts): Add --process option. - (opts): Add -p option. - (usage): Mention -p/--process option. - (main): Handle -p option. - * utils.sgml: Describe -p/--process option. - -2006-02-15 Igor Peshansky - - * regtool.cc (usage): Clarify help for "-K". - -2006-02-08 Corinna Vinschen - - * cygcheck.cc (find_on_path): Update copyright text. - -2006-02-08 Corinna Vinschen - - * cygcheck.cc (find_on_path): Create copy of rv on successful access - check, since rv can be reused in subsequent calls. - -2006-01-19 Christopher Faylor - - * cygcheck.cc (common_paths): Add "patch". - -2006-01-19 Christopher Faylor - - * cygcheck.cc (init_paths): Record first_nonsys_path. - (find_on_path): Start on first nonsys path when !search_sysdirs. - -2006-01-18 Christopher Faylor - - * Makefile.in (sysconfdir): Remove unneeded variable. - - * mkgroup.c: Replace ` with ' throughout. - * mkpasswd.c: Ditto. - * setfacl.c: Ditto. - * ssp.c: Ditto. - -2006-01-18 Dave Korn - - * cygpath.cc (dowin): Remove stray debugging printf statement. - -2006-01-17 Corinna Vinschen - - * Makefile.in: Replace etcdir with sysconfdir. - -2006-01-13 Brian Dessent - - * Makefile.in (cygcheck.exe): Do not link against libwininet.a. - * cygcheck.cc (pInternetCloseHandle): Define global function pointer. - (display_internet_error): Use it. - (package_grep): Attempt to load wininet.dll at runtime. Call WinInet - API through function pointers throughout. - -2006-01-13 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Convert k32 to HMODULE. - -2006-01-13 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Convert osname to const and remove casts - in subsequent assignments. Recognize Longhorn/Vista and report as not - yet supported. Recognize when running under WOW64 and report native - CPU type. Slightly rearrange \n printing. - -2006-01-12 Christopher Faylor - - * cygcheck.cc: Replace ` with ' throughout. - -2006-01-05 Christopher Faylor - - * cygcheck.cc (dump_sysinfo): Report the failing drive to prevent - having to guess. - -2005-12-29 Christopher Faylor - - * strace.cc (nprocesses): Make static global. - (quiet): New variable. - (strace_active): Ditto. - (add_child): Increment nprocesses here. Don't add a child if it is - already added (windows bug?). Report on child if not quiet. - (get_child): Just return NULL if child not found. - (remove_child): Report on child if not quiet. - (attach_process): Don't complain if given a windows process. Use - windows pid in error. - (handle_output_debug_string): Issue error if trying to manipulate a process that we don't know about. - Handle _STRACE_CHILD_PID - attach to reported child when we get this. - (proc_child): Move nprocesses to file scope. - Report on exceptions. - (longopts): Implement "--quiet". - (opts): Implement "-q". - (main): Manipulate quiet flag. - * utils.sgml (strace): Add words describing '-q'. - -2005-12-29 Christopher Faylor - - * cygcheck.cc (common_apps): Add crontab, vi, vim. - -2005-12-19 Igor Pechtchanski - - * dump_setup.cc (package_find): Fix is_alias computation for "/usr/lib". - -2005-12-14 Christopher Faylor - - * cygcheck.cc (common_apps): Add a few more binaries to look for. - -2005-12-05 Christopher Faylor - - * strace.cc (show_usecs): Renamed from 'usecs'. - (main): Use show_usecs rather than usecs. Toggle delta if '-u' is - specified. - (handle_output_debug_string): Avoid printing microsecond timestamp if - show_usecs == 0. - * utils.sgml (strace): Add words to describe '-u'. - -2005-11-22 Brian Dessent - - * Makefile.in: Link cygcheck with libwininet.a. - * cygcheck.cc: Add includes. - (grep_packages): New global variable. - (display_internet_error): New function. - (safe_chars): New global variable. - (base_url): Ditto. - (package_grep): New function. - (usage): Reword --help output for clarity. Document new argument. - (longopts): Add 'package-query' option. - (opts): Add 'p' option, reorder to be consistent with 'longopts'. - (main): Accommodate new option. - * utils.sgml (cygcheck): Update --help output. Document new -p option. - -2005-09-22 Corinna Vinschen - - Align error message handling to mkpasswd's error messages throughout. - * mkgroup.c (print_win_error): Create macro calling ... - (_print_win_error): ... this function created from former - print_win_error. Move up in source. - (PDOMAIN_CONTROLLER_INFOW): Define return type of DsGetDcNameW. - (dsgetdcname): New function pointer for DsGetDcNameW. - (load_netapi): Get DsGetDcNameW address. - (main): If DsGetDcNameW is available, use it. - * mkpasswd.c (PDOMAIN_CONTROLLER_INFOW): Define return type of - DsGetDcNameW. - (dsgetdcname): New function pointer for DsGetDcNameW. - (load_netapi): Get DsGetDcNameW address. - (main): If DsGetDcNameW is available, use it. Rename local variable - domain_name_specified to domain_specified as in mkgroup.c. - -2005-09-08 Bas van Gompel - - * regtool.cc: Extend copyright-years. - (print_version): Ditto. - (cmd_list): Don't depend on terminating '\0' being present on - string-values. - (cmd_get): Don't attempt to read more than present, but keep - extra space for terminating '\0'. Really output REG_BINARY. - Don't leak memory. - (cmd_set): Include trailing '\0' in string's length. - -2005-08-18 Corinna Vinschen - - * passwd.c (longopts): Add --logonserver option. - (opts): Add -d option. - (GetPW): Add server parameter which is given to Net functions. - (ChangePW): Ditto. - (PrintPW): Ditto. - (SetModals): Ditto. - (usage): Add description for -d/--logonserver option. - (main): Add option handling for -d/--logonserver. Use LOGONSERVER - environment variable content for server to contact, unless - -d/--logonserver option is given. If both is missing, use NULL. - -2005-08-16 Brian Dessent - - * cygcheck.cc (dump_sysinfo_services): Properly null-terminate 'buf'. - Avoid extraneous cygrunsrv invocation if 'verbose' is true. - -2005-08-03 Corinna Vinschen - - * mount.cc (longopts): Fix typo which disallows --options option. - -2005-07-19 Christopher Faylor - Eric Blake - - * cygcheck.cc (find_on_path): Perform .exe magic on non-PATH search. - -2005-07-05 Eric Blake - - * cygcheck.cc (track_down, cygcheck): Return true on success. - (main): Reflect cygcheck failures in exit status. - -2005-06-14 Corinna Vinschen - - * parse_pe.c (exclusion::sort_and_check): Remove crude cast. - -2005-05-30 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Recognize XP Media Center and Tablet PC - Editions. Change .NET to 2003 throughout. Recognize 2003 Web Server - and Datacenter Server. Report when running in terminal server session. - -2005-05-27 Christopher Faylor - - * cygcheck.cc (load_cygwin): Make half-hearted attempt to work with - older DLLs. - * strace.cc (load_cygwin): Ditto. - -2005-05-22 Brian Dessent - - * cygcheck.cc (dump_sysinfo_services): Add new function that uses - new cygrunsrv options to dump service info. - (dump_sysinfo): Call dump_sysinfo_services if running under NT. - Change 'Cygnus' to 'Cygwin' in output. - -2005-05-20 Christopher Faylor - - * cygcheck.cc (load_cygwin): Remove debugging statement. - -2005-05-20 Christopher Faylor - - * cygcheck.cc (dump_sysinfo): Don't attempt to use path if it is not - set. - (nuke): Fix off by one error in allocation of environment variable. - (load_cygwin): Always set PATH even if cygwin environment is empty. - -2005-05-16 Christopher Faylor - - * cygcheck.cc (cygwin_internal): Define as a "C" function. - * strace.cc (cygwin_internal): Ditto. - - * cygpath.cc (print_version): Update copyright. - -2005-05-15 Christopher Faylor - - * cygcheck.cc (load_cygwin): Avoid calling putenv with a NULL path. - -2005-05-15 Corinna Vinschen - - * cygcheck.cc (load_cygwin): Don't touch $PATH for now. - (print_version): Fix copyright. - * strace.cc (print_version): Ditto. - -2005-05-13 Christopher Faylor - - * mount.cc (mount_commands): Display "-X" option when appropriate. - -2005-05-08 Christopher Faylor - - * cygcheck.cc (nuke): New function. - (load_cygwin): New function. - (main): Use load_cygwin to load argv/envp from cygwin environment, if - appropriate. - -2005-05-08 Christopher Faylor - - * strace.cc (attach_process): Don't call load_cygwin(). Assume that - it's already happened. - (dotoggle): Ditto. - (main): Set argv from cygwin environment, if it exists. - -2005-05-01 Christopher Faylor - - * mount.cc (usage): Clarify action of -m option. - -2005-04-29 Dave Korn - - * path.cc (getmntent): Add previously-omitted 'noexec' and 'managed' - flags to mnt_opts string if present in mount flags. - -2005-04-20 Brian Dessent - - * utils.sgml (mount): Clarify setting cygdrive prefix for user - and system-wide. - -2005-03-24 Brian Dessent - - * cygcheck.cc (init_paths): Use full path instead of "." for the - current directory. Do not add "." if present in $PATH. - (dump_sysinfo): Skip placeholder first value of paths[]. - -2005-03-07 Christopher Faylor - - * kill.cc (getsig): Rectify bug introduced by 2005-02-26 change. Don't - pad signal name with spaces. - -2005-03-07 Corinna Vinschen - - * strace.cc (handle_output_debug_string): Fix compiler warning. - -2005-03-06 Christopher Faylor - - * cygpath.cc (usage): Pass in one more copy of program_name to printf - to avoid a SEGV. - -2005-02-27 Christopher Faylor - - * regtool.cc (opts): The argument to 'K' is not optional. - (main): Revert previous change. Just let getopt deal with missing - argument. - -2005-02-27 Christopher Faylor - - * regtool.cc (main): Avoid a SEGV when nothing follows -K. - -2005-02-26 Christopher Faylor - - * kill.cc (getsig): Avoid buffer overflow when generating a signal name. - - * strace.cc (handle_output_debug_string): Make error a little more specific. - -2005-02-23 Joshua Daniel Franklin - - * cygpath.cc (usage): Clarify help output to indicate acceptance - of multiple file names as arguments. - -2005-01-16 Christopher Faylor - - * ps.cc (main): Eliminate use of PID_ZOMBIE. - * strace.cc (main): Recognize new option for displaying hex value of - strace type. - (handle_output_debug_string): Prepend output with hex value of strace - message if -H is specified. - -2005-01-11 Pierre Humblet - - * mkpasswd.c (print_win_error): Transform into macro. - (_print_win_error): Upgrade former print_win_error by - printing the line. - (current_user): Call _print_win_error. - (enum_users): Print name in case of lookup failure. - (enum_local_groups): Ditto. - -2004-11-18 Bas van Gompel - - * cygcheck.cc (eprintf): New function. - -2004-11-16 Bas van Gompel - - * cygcheck.cc (find_on_path): Clear show_error and/or print_failed - parameters to display_error. - (rva_to_offset): Ditto. - (dll_info): Ditto. - (track_down): Ditto. - -2004-11-13 Pierre Humblet - - * kill.cc (forcekill): Do not pass negative pids to - cygwin_internal. Check if sig == 0. Improve error messages. - (main): Make pid a long long and distinguish between pids, gpids - (i.e. negative pids) and Win9x pids. - -2004-11-11 Bas van Gompel - - * cygcheck.cc: Change "keyeprint" to "display_error" throughout. - -2004-11-11 Christopher Faylor - - * cygcheck.cc (main): Allow a '-l' without an additional argument. - -2004-11-11 Bas van Gompel - - * cygcheck.cc (keyeprint): New optional parameters: show_error and - print_failed. - -2004-10-31 Bas van Gompel - - * cygcheck.cc (get_dword): Fix errormessage. - (cygwin_info): Ditto. - (track_down): Ditto. - (check_keys): Ditto. - -2004-10-27 Bas van Gompel - - * cygcheck.cc (dump_sysinfo): Warn about missing or multiple cygwin1 - dlls. - -2004-10-25 Bas van Gompel - - * cygcheck.cc (dump_sysinfo): Add leading newline before legend for - drive-list. - -2004-10-22 Bas van Gompel - - * cygcheck.cc (dump_sysinfo): In legend for drive-list: Add ``ram'' and - ``unk''. Use single puts. Add leading newline. Line up equal-signs. - -2004-10-20 Bas van Gompel - - * cygcheck.cc (dump_sysinfo): Allow for larger drives in drive-list. - Change ``Used'' to ``Free'' in helptext-title for drive-list. - -2004-10-18 Bas van Gompel - - * cygcheck.cc (pretty_id): Don't let i become negative. Fix - printf-format. - -2004-10-17 Bas van Gompel - - * cygcheck.cc (pretty_id): Allocate space for ')' in uid and guid. - -2004-10-17 Bas van Gompel - Christopher Faylor - - * cygcheck.cc (pretty_id): Allocate space for trailing '\0' in uid and - guid. - -2004-10-15 Bas van Gompel - Christopher Faylor - - * cygcheck.cc (pretty_id): Don't exit on id error. Fix size - calculations. - -2004-10-14 Christopher Faylor - Bas van Gompel - - * cygcheck.cc (pretty_id): Correct column calculations. Abort if id is - acting funny. - -2004-10-10 Bas van Gompel - - * cygcheck.cc (add_path): Don't leak memory when path is already in - ``paths''. - -2004-10-10 Bas van Gompel - - * cygcheck.cc (dump_sysinfo): Warn about trailing (back)slash on mount - entries. - -2004-10-10 Bas van Gompel - - * cygcheck.cc (dump_sysinfo): Don't warn about empty path components, - just display ``.''. - -2004-10-06 Corinna Vinschen - - * strace.cc (_impure_ptr): Remove. - -2004-10-06 Bas van Gompel - - * cygcheck.cc (dump_sysinfo): Warn about empty path components. - -2004-10-04 Bas van Gompel - - * cygcheck.cc (pretty_id): Close pipe. - -2004-09-23 Bas van Gompel - - * dump_setup.cc (dump_setup): Remove unneeded strlen when check_files - is not set. - -2004-09-22 Bas van Gompel - Corinna Vinschen - - * dump_setup.cc (dump_setup): Avoid trailing spaces on package-list. - -2004-09-15 Bas van Gompel - - * getfacl.c (main): Correct layout when nopt is set. - -2004-07-12 Igor Pechtchanski - - * mkgroup.cc (netapibufferallocate,netgroupgetinfo): New function - pointers. - (load_netapi): Load NetApiBufferAllocate and NetGroupGetInfo. - (enum_local_groups,enum_groups): Add disp_groupname parameter. - Load info for disp_groupname if specified. - (usage): Add description of "-g/--group" option. - (longopts,opts): Add "-g/--group" option. - (main): Process "-g/--group" option. - * utils.sgml (mkgroup): Add description of "-g/--group" option - -2004-06-15 Alan Modra - - * dumper.cc (dumper::prepare_core_dump): Use bfd_get_section_size - instead of _raw_size. - (dumper::write_core_dump): Likewise. - * parse_pe.cc (select_data_section): Likewise. - -2004-05-29 John Paul Wallington - - * ssp.c (usage): Add missing linefeed. - -2004-05-27 Christopher Faylor - - * kill.cc (listsig): Fix "kill -l" segv. NSIG includes Signal 0, so we - need to avoid calling strtosigno with NSIG - 1. - -2004-03-21 Christopher Faylor - - * cygcheck.cc (dump_sysinfo): Remove "Win95/NT" from output. - -2004-03-15 Christopher Faylor - - * cygpath.cc (usage): Don't issue helpful message if -i is used. - (from Igor Pechtchanski) - -2004-03-13 Rob Siklos - - * kill.cc (get_debug_priv): New function. - (forcekill): Call get_debug_priv before trying to kill process. - -2004-02-24 Christopher Faylor - - * cygpath.cc (long_options): Add "mode" option. - (options): Ditto. - (usage): Report on new option. - (report_mode): New function. - (main): Implement -M option. - -2004-02-20 Christopher Faylor - - * Makefile.in (build_dumper): Detect missing iconv library. - - * cygpath.cc (dowin): Report on filename conversion errors. - (doit): Ditto. - - * strace.cc (main): Use symbolic constant for _STRACE_ALL when setting - mask. - -2004-02-14 Corinna Vinschen - - * ssp.c (opts): Add leading '+' to force posixly correct behaviour. - -2004-02-11 Corinna Vinschen - - * strace.cc (opts): Add leading '+' to force posixly correct - behaviour. - (main): Revert POSIXLY_CORRECT manipulations. - -2004-02-10 Christopher Faylor - - * strace.cc (main): Guard against previous setting of POSIXLY_CORRECT. - -2004-02-10 Christopher Faylor - - * strace.cc: Update copyrights. - * cygcheck.cc: Update copyrights. - -2004-02-10 Christopher Faylor - - * strace.cc (main): Ensure POSIXLY_CORRECT argument ordering. - * cygcheck.cc (main): Ditto. - -2004-01-23 Christopher Faylor - - * cygcheck.cc (pretty_id): Make more robust in absence of id.exe. - -2004-01-22 Corinna Vinschen - - * cygpath.cc (dowin): Revert accidental checkin from November. - -2003-11-26 Corinna Vinschen - - * mkgroup.c (main): Print "root" group with local admins group sid - and gid 0. - -2003-11-19 Corinna Vinschen - - * Makefile.in: Add rules to build ipcrm and ipcs. - * ipcrm.c: New file. - * ipcs.c: New file. - -2003-11-14 Corinna Vinschen - - * mkgroup.c: Avoid compiler warnings throughout. - * mkpasswd.c: Ditto. - * passwd.c: Ditto. - -2003-11-07 Mark Blackburn - - * cygpath.cc (main): Allow multiple pathnames on command line. - -2003-11-04 Corinna Vinschen - - * passwd.c (PrintPW): Turn around meaning printed for "Password not - required" option to be in line with Windows meaning. - (main): Use more appropriate 1008 option when calling - NetUserSetInfo to change flag values. - -2003-11-04 Corinna Vinschen - - * passwd.c (UF_LOCKOUT): Remove (defined in lmaccess.h). - (version): Bump version number to 1.5. - (longopts): Add -c, -C, -e, -E, -p, -P options. - (opts): Ditto. - (PrintPW): Print values of UF_PASSWD_CANT_CHANGE and - UF_DONT_EXPIRE_PASSWD flags. Slightly reformat output. Don't suppress - correct system password settings just because the account has admin - privileges. - (usage): Define as "noreturn" function. Restructure and rephrase - output. Accommodate new options. - (print_version): Fix copyright dates. - (main): Accommodate new options for setting UF_PASSWD_CANT_CHANGE, - UF_DONT_EXPIRE_PASSWD and UF_PASSWD_NOTREQD settings. - -2003-10-17 Christopher Faylor - - * cygcheck.cc (pretty_id): Don't exec if `id' program is not found. - -2003-09-20 Christopher Faylor - - * kill.cc (main): Allow negative pids (indicates process groups). - -2003-09-17 Christopher Faylor - - * parse_pe.cc (exclusion::sort_and_check): Make error message a little - more explicit and ignore (hopefully) harmless region overlap. - -2003-09-13 Christopher Faylor - - * kill.c (forcekill): Wait for process to terminate even if - TerminateProcess says it failed. - -2003-09-11 Christopher Faylor - - * Makefile.in: Tweak mingw libz.a detection to make it more reliably - detect when libz.a is not available. - -2003-09-11 Igor Pechtchanski - - * cygcheck.cc (dump_only): New global variable. - (usage): Add "--dump-only" option, fix "--verbose" line. - (longopts, opts): Add "--dump-only" option. - (main): Process the "--dump-only" flag. Add new semantic check. - Pass dump_only information to dump_setup(). - -2003-09-11 Corinna Vinschen - - * getfacl (main): Remove extern declaration of optind. - * setfacl (main): Remove extern declaration of optarg and optind. - -2003-09-10 Christopher Faylor - - * Makefile.in (cygcheck.o): Use MINGW_CXX for compilation. - * cygcheck.cc: Just include rather than cygwin version. - (pretty_id): Avoid compiler warnings. - * cygpath.cc (usage): Ditto. - -2003-09-10 Christopher Faylor - - * Makefile.in (MINGW_CXX): Define and use for mingw-compiled files. - * path.cc: Include more path info in cygwin-specific includes since the - cygwin directory is no longer included by default. - -2003-09-10 Christopher Faylor - - * Makefile.in: More fixups to adjust for the fact that mingw_getopt.o - is no longer built. - -2003-09-10 Christopher Faylor - - * Makefile.in: Remove references to getopt since it is now part of - mingwex. - -2003-09-08 Christopher Faylor - - * Makefile.in: Rename libz.h -> zlib.h. - -2003-09-07 Christopher Faylor - - * Makefile.in: Detect existence of mingw zlib headers and libraries. - Build cygcheck without package checking if they are unavailable. - * dump_setup.cc: Generate dummy zlib macros when zlib is not available. - (open_package_list): Use zlib functions to uncompress package lists. - Return gzFile rather than FILE *. - (check_package_files): Change fp to gzFile to accommodate zlib - functions. Use gzgets to read from package file. Use gzclose to close - the handle. - (package_list): Ditto. - (package_find): Ditto. - -2003-09-05 Igor Pechtchanski - - * dump_setup.cc (check_package_files): Don't fail on empty package. - -2003-09-01 AJ Reins - - * mount.cc (mount_commands): Ensure user mode is actually user mode and - not the default system mode. - -2003-08-31 Christopher Faylor - - * kill.cc (forcekill): Silence some compiler warnings. - -2003-08-31 Christopher Faylor - - * Makefile.in: Oops. Put the '...' in the right place. - -2003-08-31 Christopher Faylor - - * Makefile.in: Display "..." when not-verbose. - - * kill.cc (forcekill): Default to entered pid when pinfo fails. Issue - some warnings when things don't work. - -2003-08-17 David Rothenberger - - * dump_setup.cc (check_package_files): Strip leading / and ./ from - package file names. - -2003-08-16 David Rothenberger - - * dump_setup.cc (package_find): Don't stop searching on missing - file list. - (package_list): Ditto. - -2003-08-16 Igor Pechtchanski - - * dump_setup.cc: (package_list): Make output terse unless - verbose requested. Fix formatting. - (package_find): Ditto. - -2003-08-15 Corinna Vinschen - - * cygcheck.cc (main): Fix some formatting and help text printing. - -2003-08-15 Igor Pechtchanski - - * cygcheck.cc (find_package,list_package): New global - variables. - (usage): Add "--find-package" and "--list-package" options, - reformat output. - (longopts, opts): Add "--find-package" and "--list-package" - options. - (main): Process the "--find-package" and "--list-package" - flags. Add new semantic checks. Add calls to find_package() - and list_package(). - * dump_setup.cc: Fix header comment. - (match_argv): Change return type to int to distinguish - between real matches and default ones. - (open_package_list): New static function. - (check_package_files): Factor out opening the package list - file into open_package_list(). - (get_packages): New static function. - (dump_setup): Factor out getting a list of packages into - get_packages(). - (package_list, package_find): New global functions. - -2003-08-15 Corinna Vinschen - - * regtool.cc (usage): Add missing linefeed. Move example to --help - text. Fix forward slash description. - -2003-08-13 Igor Pechtchanski - - * dump_setup.cc (check_package_files): Fix extra '/' in filename. - Resize command buffer. Fix buffer overflow bug. - -2003-08-09 Igor Pechtchanski - Christopher Faylor - - * dump_setup.cc (dump_setup): Check for the existence of the package - list file. Rework slightly to use static buffer for popen commands. - -2003-08-07 Igor Pechtchanski - Christopher Faylor - - * dump_setup.cc (version_len): New static variable. - (could_not_access,directory_exists): New static function. - (file_exists): Ditto. - (check_package_files): Ditto. - (dump_setup): Check the contents of each package if check_files is true - and output the result in the "Status" column. Flush output after each - package. - -2003-08-07 Igor Pechtchanski - Christopher Faylor - - * dump_setup.cc (dump_setup): Remove redundant null check. Add - informative message if package info not found. - -2003-07-26 Christopher Faylor - - * mount.cc (do_mount): Issue warning when using managed mount option on - non-empty directory. - -2003-07-25 Christopher Faylor - - * configure.in: Use 'install-sh -c'. - * configure: Regenerate. - -2003-07-25 Christopher Faylor - - * configure.in: Always use install-sh. - * configure: Regenerate. - -2003-07-03 Christopher Faylor - - * mount.cc (struct opt): Remove posix option. - -2003-07-03 Christopher Faylor - - * mount.cc (longopts): Add long "options" keyword. - (opts): Add -o option. - (usage): Display -o option. - (struct opt): New. - (concat3): New function. - (main): Handle -o flag. - -2003-06-12 Christopher Faylor - - * cygcheck.cc (pretty_id): Rework slightly to not rely on spaces. - -2003-06-12 Christopher Faylor - - * cygpath.cc: Throughout, always return error when GetShortPathName - returns 0. - -2003-04-26 Joshua Daniel Franklin - - * mkpasswd.c (usage) Remove extra newline from description output. - -2003-04-26 Joshua Daniel Franklin - - * cygcheck.cc (usage) Add description output. - * cygpath.cc (usage) Add description output. - * dumper.cc (usage) Add newline to description output. - * kill.cc (usage) Add description output. - * mkgroup.c (usage) Grammatical change to description output. - * mkpasswd.c (usage) Grammatical change to description output. - * mount.cc (usage) Add description output. - * passwd.c (usage) Add description output. - * ps.cc (usage) Add description output. - * regtool.cc (usage) Add description output. - * setfacl.c (usage) Remove extra newline from description output. - * ssp.c (usage) Add description output. - * strace.cc (usage) Add description output. - * umount.cc (usage) Add description output. - -2003-04-10 Pierre Humblet - - * mkpasswd.c (current_user): print uid and gid as unsigned. - (enum_users): Ditto. Do not free servername. - (usage): Update to allow several domains and improve -p. - (main): On Win9x limit uids to 1000. Only print specials - when -l is specified. Add a loop to allow several domains - and free servername in the loop. - * mkgroup.c (enum_groups): Do not free servername. - (usage): Update to allow several domains. Change uid to gid. - (main): Only print specials when -l is specified. Add a - loop to allow several domains and free servername in the loop. - -2003-03-24 Christopher Faylor - - * cygcheck.cc (dump_sysinfo): Ensure that CYGWIN environment variable - is correctly set. - -2003-03-09 Corinna Vinschen - - * getfacl.c (username): Fix ambiguous printf calls. - (groupname): Ditto. - (main): Ditto. - -2003-03-04 Christopher Faylor - - * Makefile.in (strace.exe): Include mingw_getopt.o in link line. - * cygcheck.cc (print_version): Update copyright. - * strace.cc (print_version): Ditto. - (main): Allow cygwin paths for -o option. - (create_child): Allow cygwin path as argv[0]. - * path.cc (path.cc): Allow UNC paths. - -2003-03-01 Pierre Humblet - - * mkpasswd.cc (main): On Win95, output both a default line and a - line for the current user (if known) with a pseudorandom uid. If - the -u switch is given, produce a line for the specified user. - * mkgroup.cc (main): On Win95 change the group name from "unknown" to - "all". - -2003-02-28 Christopher Faylor - - * Makefile.in (cygcheck.o): Fix so that actual mingw include files are - used. - * cygcheck.cc (find_on_path): Translate from cygwin path when qualified - path name found. - (pretty_id): New function. Dump output of id command. - (dump_sysinfo): Call pretty_id for CYGWIN=ntsec and CYGWIN=nontsec cases. - -2003-02-12 Christopher Faylor - - * cygpath.cc (doit): Allocate more space for non-path filename. - -2003-02-07 Christopher Faylor - - * dump_setup.cc (compar): Use case insensitive comparisons. - (dump_setup): Calculate package_len based on already used "len". Don't - bother with version_len. - -2003-02-07 Igor Pechtchanski - - * dump_setup.cc (dump_setup): Compute the longest package name - and align columns properly. - -2003-02-06 Christopher Faylor - - * cygcheck.cc (common_apps): Add some more apps. - * path.cc (get_cygdrive): Correctly set system flag. - -2003-01-22 Corinna Vinschen - - * Makefile.in (ALL_LDFLAGS): Remove newlib/libm from tools paths. - (MINGW_LDFLAGS): Remove in favor of definition from Makefile.common. - -2003-01-15 Corinna Vinschen - - * mkgroup.c: Fix copyright date. - * mkpasswd.c: Ditto. - * setfacl.c: Ditto. - -2003-01-09 Pierre Humblet - - * setfacl.c (usage): Remove double ":" for mask and other. - -2003-01-07 Pierre Humblet - - * mkpasswd.c (current_user): Create. - (usage): Reorganize to support Win95/98/ME. - (main): Add option for -c. Reorganize to parse options for - Win95/98/ME and to call current_user. Add username in gecos field - on Win95/98/ME. - * mkgroup.c (enum_groups): Print gid with %u. - (print_win_error): Create from passwd.cc. - (current_group): Create. - (usage): Reorganize to support Win95/98/ME. - (main): Add option for -c. Reorganize to parse options for - Win95/98/ME and to call current_group. - -2002-12-14 Pierre Humblet - - * setfacl.c (main): Place a single : after other and mask. - * getfacl.c (getaclentry): Allow both : and :: for other and mask. - (main): Remove extraneous break. - -2002-11-25 Corinna Vinschen - - * mkpasswd.c (main): Set pw_passwd field to '*' on 9x/Me. - -2002-11-24 Corinna Vinschen - - * setfacl.c (getperm): Set only `other' permission bits. - (getaclentry): Set a_id to -1 by default. - -2002-11-24 Corinna Vinschen - - * getfacl.c (permstr): Use `other' permission bits for requesting - ace permissions. - -2002-11-08 Corinna Vinschen - - * setfacl.c (usage): Add missing LF. - -2002-10-30 Christopher Faylor - - * cygpath.cc (get_long_path_name_w32impl): Define similarly to - GetLongPathName. - (get_long_name): Correctly prototype GetLongPathName. - (get_long_paths): Implement using get_long_name to cut down on code - duplication. - (doit): Do various things to make path output work predictably. - -2002-10-19 Christopher Faylor - - * mount.cc (usage): Correctly report default mode. - * strace.cc (main): Use strtoul as appropriate. - -2002-09-29 Christopher Faylor - - * cygpath.cc (close_arg): Remove unused static. - * mkgroup.c (enum_local_users): Avoid compiler warning. - (enum_users): Ditto. - * mkpasswd.c: Ditto throughout. - * ssp.c: Ditto throughout. - -2002-09-18 Christopher Faylor - - * cygcheck.cc: Include sys/time.h rather than time.h to avoid a - compiler error. - -2002-09-17 Christopher Faylor - - * cygcheck.cc: Reorder includes to avoid compiler error. - -2002-09-15 Joshua Daniel Franklin - - * cygcheck.cc (print_version) Add final newline. - * getfacl.c (print_version) Add final newline. - * kill.cc (print_version) Add final newline. - * mkgroup.c (print_version) Add final newline. - * mkpasswd.c (print_version) Add final newline. - * mount.cc (print_version) Add final newline. - * passwd.c (print_version) Add final newline. - * ps.cc (print_version) Add final newline. - * regtool.cc (print_version) Add final newline. - * setfacl.c (print_version) Add final newline. - * ssp.c (print_version) Add final newline. - * strace.cc (print_version) Add final newline. - * umount.cc (print_version) Add final newline. - -2002-09-12 Igor Pechtchanski - - * cygpath.cc (options) New global variable. - (main) Make short options global for easier change. - (print_version) Add a missing newline. - -2002-08-07 Igor Pechtchanski - - * regtool.cc (find_key): Add support for custom key separator. - (usage): Document it. - -2002-08-02 Corinna Vinschen - - * mkgroup.c (main): Don't print an entry for "Everyone". - * mkpasswd.c (print_special): Set pw_gid to 544 for SYSTEM user. - (main): Don't print an entry for "Everyone". - -2002-07-06 Christopher Faylor - - * configure.in: Check for libiconv.a. - * configure: Regenerate. - * Makefile.in: Add libiconv.a to libraries required for dumper.exe. - -2002-07-06 Christopher Faylor - - * Makefile.in: Use MINGW stuff from Makefile.common. - -2002-07-01 Corinna Vinschen - - * mkgroup.c: Add function pointers for functions from advapi32.dll. - (load_netapi): Load used functions from advapi32.dll. - (main): Use function pointers instead of statically linked functions - from advapi32.dll. - -2002-07-01 Christopher Faylor - - * mount.cc (main): Ensure that mount_already_exists() also gets default - flag that is passed to do_mount. - -2002-06-22 Joshua Daniel Franklin - - * cygpath.cc (long_options): Add "dos" and "mixed", correct "close", - "file" and "type" to use NULL flag. - (usage): Clean up usage output (more), accomodate new options. - (main): Add --dos and --mixed options; accomodate all output forms in - --type. Make UNIXy output default. - -2002-06-18 Joshua Daniel Franklin - - * cygpath.cc (usage): Clean up usage output. - (dowin): Correct output of -t mixed for -ADHPSW options. - -2002-06-14 Corinna Vinschen - - * passwd.c: Rearrange includes to avoid unnecessary warnings. - (GetPW): Add parameter to (dis)allow printing of Windows username. - Use defines instead of numerical constants where possible. - Try avoiding impersonation problem. Rearrange to print Windows - username only if it's different from Cygwin username. - (ChangePW): Use defines instead of numerical constants where possible. - (main): Call GetPW with additional parameter. Change error text. - -2002-06-14 Joshua Daniel Franklin - - * passwd.c (GetPW): Handle case of user-edited /etc/passwd - with cygwin_internal (CW_EXTRACT_DOMAIN_AND_USER, ...). - -2002-06-09 Christopher Faylor - - * path.cc (cygpath): Change MOUNT_AUTO to MOUNT_CYGDRIVE. - (getmntent): Ditto. - -2002-06-09 Christopher Faylor - - * mount.cc (main): Use default system/user flag for cygdrive stuff, - too. - (change_cygdrive_prefix): Change MOUNT_AUTO to MOUNT_CYGDRIVE. - * umount.cc (remove_cygdrive_prefix): Ditto. - (main): Use default system/user flag for cygdrive stuff, too. - -2002-06-08 Christopher Faylor - - * mount.cc (opts): Remove '-i' option. - (usage): Ditto. - (main): Ditto. - (longopts): Remove --import-old-mounts option. - -2002-06-07 David Peterson - Christopher Faylor - - * cygpath.cc: Add option to output windows paths in different formats: - "dos" and "mixed". - (main): Process options. - (doit): Check new options flags. - -2002-06-06 Egor Duda - - * regtool.cc (Fail): Be more verbose. - (find_key): Add support for remote registry access. - (usage): Document it. - * utils.sgml: Document it. - -2002-06-06 Christopher Faylor - - * strace.cc (main): Make toggle a local variable. - -2002-06-07 Conrad Scott - - * strace.cc (toggle): New global variable. - (error): Use exit instead of ExitProcess so that stdio buffers get - flushed. - (create_child): Remove command line error checking. - (dostrace): Ditto. - (dotoggle): New function. - (usage): Add entry for new option -T|--toggle. Alphabetize. - (longopts): Add new option -T|--toggle. - (opts): Ditto. - (main): Handle new -T|--toggle option. Move all command line checking - here from other functions. - * utils.sgml: Update section for strace. - -2002-06-05 Joshua Daniel Franklin - - * strace.cc (version): New global variable. - (usage): Accommodate stdout output. - (print_version): New function. - -2002-06-03 Joshua Daniel Franklin - - * ssp.c (version): New global variable. - (longopts): Ditto. - (opts): Ditto. - (run_program): Correct cmd_line typos to cmdline. - (usage): New function. Standardize usage output. Add ssp.txt to - --help output. - (print_version): New function. - (main): Accommodate getopt. - -2002-06-03 Joshua Daniel Franklin - - * umount.cc (version): New global variable. - (longopts): Accommodate new --version option. - (opts): Ditto. - (usage): Standardize usage output. - (print_version): New function. - (main): Accommodate --help, --version options. - -2002-06-02 Joshua Daniel Franklin - - * regtool.cc (prog_name): New global variable. - (longopts): Ditto. - (opts): Ditto. - (usage): Standardize usage output. Rearrange/add descriptions. - (print_version): New function. - (main): Accommodate longopts and new --help, --version options. Add - check for (_argv[optind+1] == NULL). - -2002-06-02 Christopher Faylor - - * strace.cc (forkdebug): Make true by default. - (attach_process): Use window pid if cygwin pid isn't available (yet). - (create_child): Use either DEBUG_ONLY_THIS_PROCESS or DEBUG_PROCESS, - exclusively. (Suggested by Conrad.Scott@dsl.pipex.com) - -2002-05-30 Christopher Faylor - - * mkpasswd.cc (main): Don't reset to binmode if stdout is a terminal. - -2002-05-29 Christopher Faylor - - * mount.cc (main): Make -b the default. - -2002-05-29 Corinna Vinschen - - * ps.cc (main): Use uid or uid32 member of struct external_pinfo - dependent of the value of the struct's version member. - -2002-05-29 Corinna Vinschen - - * ps.cc (main): Change print format for uid to unsigned. Use uid32 - member of struct external_pinfo instead of uid. - -2002-05-28 Joshua Daniel Franklin - - * passwd.c (prog_name): New global variable. - (longopts): Ditto. - (opts): Ditto. - (usage): Standardize output. Accommodate new options. - (print_version): New function. - (main): Accommodate longopts and new --help, --version options. - -2002-05-28 Joshua Daniel Franklin - - * ps.cc (usage): Fix typo. - -2002-05-27 Joshua Daniel Franklin - - * ps.cc (prog_name): New global variable. - (longopts): Ditto. - (opts): Ditto. - (usage): New function. - (print_version): New function. - (main): Accommodate longopts and new --help, --version options. - -2002-05-26 Christopher Faylor - - * strace.cc (attach_process): Don't tell process to start stracing - here. - (proc_child): Do it here, instead, after first debug event. This - should work around inexplicable races with DebugActiveProcess. - (dostrace): Pass any pid argument to proc_child. - -2002-05-23 Joshua Daniel Franklin - - * getfacl.c (usage): Standardize usage output. Change return type to - static void. - (print_version): New function. - (longopts): Added longopts for all options. - (main): Accommodate new help and version options. - -2002-05-22 Joshua Daniel Franklin - - * mount.cc (version): New global variable. - (usage): Standardize usage output. Accommodate new version option. - (print_version): New function. - (longopts): Accommodate new version option. - (opts): Ditto. - (main): Ditto. - -2002-05-22 Corinna Vinschen - - * cygpath.cc (usage): Change usage output slightly. - -2002-05-20 Joerg Schaible - - * cygpath.cc (main): Add option l to support conversion to - Windows long file names. Refactured code for capital options. - Support of options from file for capital options. - (dowin): New function. Refactured from main. - (doit): Call long path conversion. - (get_long_name): New function. - (get_long_paths): New function. - (get_long_path_name_w32impl): New function. Reimplementation - of Windows API function GetLongPathName (only 98/Me/2000/XP or - higher). - (get_short_name): Call GetShortPathName only once. - (get_short_paths): Fix calculating buffer size. - * utils.sgml: Update cygpath section for l option. - -2002-05-18 Christopher Faylor - - * strace.cc (add_child): Use calloc since new requires working - libstdc++.a. - (remove_child): Ditto for delete/free. - -2002-05-15 Mark Blackburn - - * cygpath.cc (get_short_paths): Fix more error checking. - (get_short_name): Ditto. - -2002-05-14 Joerg Schaible - - * cygpath.cc (main): Add option H to show the Windows' profiles - directory. Support short names for options DPSW. Clean up - copied code lines. - * utils.sgml: Update cygpath section for H option and s support. - -2002-05-14 Mark Blackburn - - * cygpath.cc (get_short_paths): Fix error checking. - -2002-05-13 Joshua Daniel Franklin - - * kill.cc (prog_name): New global variable. - (usage): Standardize usage output. Add descriptions. - (print_version): New function. - (longopts): Accommodate new version option. - (opts): Ditto. - (main): Ditto. - -2002-05-13 Christopher Faylor - - * kill.cc (listsig): Display numeric id when given symbolic input. - -2002-05-13 Christopher Faylor - - * kill.cc (usage): Show new options. Allow specification of output - stream. - (main): Implement 'h' option. - -2002-05-13 Christopher Faylor - - * Makefile.in (kill.exe): Add as a specific target. - * kill.cc (longopts): New. - (opts): Ditto. - (get_sig): Accept const char * parameter. Return -1 on unknown signal. - (test_for_unknown_sig): New function. - (listsig): New function. - (main): Use getopt_long for option parsing. Implement -l, and -s - options. Use test_for_unknown_sig() to test for signal validity. - - * mount.cc (longopts): Make static. - (opts): Ditto. - -2002-05-12 Christopher Faylor - - * mount.cc (do_mount): Default to non-exec option for remote drives. - Report warnings before attempting a mount. - (longopts): Add no-executable option. - (mount_commands): Ditto. - (opts): Ditto. - (usage): Ditto. Indicate that system mount is now the default. - (main): Accommodate no-executable option. Make system mount the - default. - * umount.cc (usage): Indicate that system umount is now the default. - (main): Make system umount the default. - -2002-05-07 Joshua Daniel Franklin - - * dumper.cc (usage): Standardize usage output. Generalize to allow use - for help. - (longopts): New struct. Added longopts for all options. - (print_version): New function. - (main): Change getopt to getopt_long. Accommodate new help and version - options. - -2002-03-29 Corinna Vinschen - - * mkgroup.c (main): Change call to exit() to a return statement. - * mkpasswd.c (main): Ditto. - -2002-03-27 Joshua Daniel Franklin joshuadfranklin@yahoo.com - - * mkpasswd.c (usage): Simplify usage output. Generalize to allow use - for help. Correct '?' typo to 'h'. - (longopts): Add version option. - (opts): Add 'v' version option. - (print_version): New function. - (main): Accommodate new version option. Accommodate usage parameter - changes. - -2002-03-19 Christopher Faylor - - * mkgroup.c (usage): Use one just fprintf + string concatenation for - output message. - (print_version): Add void to function type and update copyright. - -2002-03-16 Joshua Daniel Franklin - - * mkgroup.c (usage): Simplify usage output. Generalize to allow use - for help. Correct '?' typo to 'h'. - (longopts): Add version option. - (opts): Add 'v' version option. - (print_version): New function. - (main): Accommodate new version option. Accommodate usage parameter - changes. Use usage to output help message. - -2002-03-15 Corinna Vinschen - - * mkgroup.c (main): When generating group 513, check for computer's - primary domain instead of current user's domain. - -2002-03-14 Corinna Vinschen - - * mkgroup.c (main): When generating group 513, check for domain SID - if computer name isn't mapped to a SID. - -2001-03-11 Joshua Daniel Franklin - - * kill.cc (usage): Move to top of file. - (getsig): Ditto. - (forcekill): Ditto. - -2002-03-06 Christopher Faylor - - * cygcheck.cc: Reformat. - -2002-03-06 Christopher Faylor - - * cygcheck.cc (longopts): Use correct short option for --version. - -2002-03-06 Christopher Faylor - - * cygpath.cc: Reformat. - -2002-02-27 Joshua Daniel Franklin - - * cygpath.cc (print_version): New function. - (main): Accommodate new version function. Initialize 'o' to prevent - warning. - -2002-02-27 Christopher Faylor - - * cygcheck.cc (main): Eliminate non-GNU formatting glitch. - -2002-02-27 Christopher Faylor - - * ssp.c (help_desk): Fix compiler warning. - -2002-02-27 Joshua Daniel Franklin - Christopher Faylor - - Change appropriate globals to statics throughout. - * cygcheck.cc (usage): Simplify usage output. Generalize to allow use - for help. - (longopts): Add version option. - (opts): Add 'V" version option. - (print_version): New function. - (main): Accommodate new version option. Accommodate usage parameter - changes. Use usage to output help message. - -002-02-19 Christopher Faylor - - * Makefile.in (CXXFLAGS): Add override so that HAVE_DECL_GETOPT is - defined. - (libbfd): Use -B rather than -L so that bfd from build directory is - correctly found. - (libintl): Ditto. - -2002-02-15 Christopher Faylor - - * mount.cc (usage): Fix typo in output. - -2002-02-14 Christopher Faylor - - * strace.cc (attach_process): Change CW_STRACE_ON to CW_STRACE_TOGGLE. - -2002-01-31 Corinna Vinschen - - * mkpasswd.c (main): Set default home path for 9x/Me if --path-to-home - isn't given. - -2002-01-30 Corinna Vinschen - - * passwd.cc (ChangePW): Add parameter to differ between called for - checking old password and called for changing password. If called - for checking old password, return non-zero only if password is surely - incorrect. - (main): Call ChangePW() with additional parameter. - -2002-01-29 Christopher Faylor - - * dump_setup.cc (parse_filename): Don't consider '_' part of the - version. - -2002-01-28 Christopher Faylor - - * cygcheck.cc: Fix typo. Remove uid_t kludge. Rely on kludge in - sys/cygwin.h instead. - * getfacl.c: Add include to remove warning. - * mkgroup.c (main): Assign variables outside of parameter passing. - This seems to eliminate some compiler warnings. - -2002-01-28 Christopher Faylor - - * cygcheck.cc: Use specific cygwin includes, as required. - -2002-01-28 Christopher Faylor - - * Makefile.in (MINGW_INCLUDES): Change cygwin include. - * strace.cc: Use specific cygwin includes, as required. - (load_cygwin): New function. Loads cygwin DLL, if necessary. - (attach_process): Attaches strace to a running process. - (dostrace): Accept pid argument. Attach to pid if supplied. - (usage): Describe -p option. Correct system description. - (longopts): Alphabetize. - (opts): Ditto. - (main): Ditto. Handle -p option. - -2002-01-21 Christopher Faylor - - * Makefile.in (CXXFLAGS): Ensure that important settings are preserved - even when overriden by command line. - -2002-01-21 Christopher Faylor - - * Makefile.in: Build intermediate cygcheck.o to force use of MINGW_CXXFLAGS. - * cygcheck.cc (cygwin_info): Intitialize variable to quiet g++ warning. - (dump_sysinfo): Make variables unsigned to quiet g++ warnings. - * strace.cc (version_string): Rename from SCCSid. - (add_child): Remove unused variable. - (version): Use version_string. Avoid use of fprintf. - -2002-01-21 DJ Delorie - - * Makefile.in: Use CXX instead of CC to compile C++ sources. - -2002-01-17 DJ Delorie - - * cygcheck.cc (already_did): Avoid default constructors, which may - require exception support. - -2001-01-16 Joshua Daniel Franklin - - * cygpath.cc (main): Add options to show Desktop and Start - Menu's Programs directory for current user or all users. - Move bulk of DPWS options outside the getopt case statement. - * utils.sgml: Update cygpath section for ADPWS options. - -2002-01-15 Joerg Schaible - - * cygpath.cc (doit): Empty file ignored using option -i. - -2002-01-15 Mark Bradshaw - - * mkpasswd.c (print_win_error): Add a new function. - (enum_users): Use print_win_error. - (enum_local_groups): Ditto. - (main): Ditto. - -2001-12-26 Jonathan Kamens - - * cygpath.cc (doit): Detect and warn about an empty path. Detect and - warn about errors converting a path. - (main): Set prog_name correctly -- don't leave an extra slash or - backslash at the beginning of it. - -Fri Dec 14 14:04:37 2001 Jason Tishler - - * mkpasswd.c (enum_users): Change to unconditionally use - the --path-to-home option, if supplied by the user. Use default - --path-to-home option value, if appropriate. - (usage): Change usage statement to reflect new semantics. - (main): Remove defaulting of the --path-to-home option. - -Fri Dec 14 12:10:39 2001 Jason Tishler - - * mkpasswd.c (opts): Add indication that '-p' option requires an - argument. - -2001-12-11 Christopher Faylor - - * Makefile.in: Add define to CXXFLAGS. - -2001-12-03 Christopher Faylor - - * cygcheck.cc (usage): Add -c description. - * cygpath.cc (usage): Alphabetize options. - * strace.cc (usage): Ditto. - -2001-11-21 Christopher Faylor - - * path.cc (cygpath): Don't consider cygdrive stuff when trying to derive - native paths. - -2001-11-20 Mark Bradshaw - - * mkpasswd.c: include lmerr.h - (main): New -u option to allow specifying a - specific user. If specified, groups aren't displayed and - output is limited to only the specified user. - (enum_users): If specific user is specified, via -u option, - display only that user's record. With -u use NetUserGetInfo - instead of NetUserEnum. - (load_netapi): Added netusergetinfo. - -2001-11-15 Gary R. Van Sickle - - * strace.cc (main): Change getopt() to getopt_long(). - Add support for help and version info. - Use new parse_mask() function for -m/--mask option. - (longopts): Add long options structure. - (opts): Move options string from getopts call to static var. - (usage): Print usage information. - (SCCSid): Version info. - (version): New function for displaying version info. - (parse_mask): New function supporting parsing of mnemonics, - hex, and basic expressions in masks. - (mnemonic2ul): New mnemonic parsing function. - (tag_mask_mnemonic): New type. - (mnemonic_table): New table of mnemonics for mnemonic2ul() to - search through. - -2001-11-12 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Redefine output format slightly. - Print correct build number on 9x/ME systems. - -2001-11-12 Christopher Faylor - - * cygcheck.cc (main): Slight formatting tweak. - -2001-11-12 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Add some more details. - -2001-11-12 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Print more detailed OS information string - using OSVERSIONINFOEX information. - -2001-11-11 Christopher Faylor - - * path.h: New file. - -2001-11-11 Christopher Faylor - - * cygcheck.cc (scan_registry): Open registry with read-only access. - (main): Reflect argument change for dump_setup. - * dump_setup.cc (dump_setup): Add preliminary extra argument for future - use. - * path.cc (read_mounts): Open registry with read-only access. - -2001-11-11 Christopher Faylor - - * cygcheck.cc (main): Display package info when '-s' is specified. - * dump_setup.cc (dump_setup): Change header. Remove typo. Always sort - packages output. - -2001-11-11 Christopher Faylor - - * dump_setup.cc: New file. - * Makefile.in: Add info for dump_setup.o. - * cygcheck.cc (main): Recognize '-c' option for checking setup - installed base. - * path.cc (cygpath): Read mount table if not loaded. - -2001-11-10 Christopher Faylor - - * Makefile.in (cygcheck.exe): Compile as -mno-cygwin executable. - * path.cc: New file. - * cygcheck.cc (init_paths): Use MS-DOS path syntax. - (cygwin_info): Properly display cygwin version numbers. Prettify some - output. - (dump_sysinfo): Calculate max names of posix and ms-dos paths for - prettier output. - -2001-11-09 Corinna Vinschen - - * cygcheck.cc (dump_sysinfo): Print more detailed OS information string. - -2001-11-04 Corinna Vinschen - - * getfacl.c (username): New function. - (groupname): Ditto. - (usage): Ditto. Add more user friendly help text. - (main): Add -n and --help option. Print names instead of IDs - unless -n option is given. - * setfacl.c (getperm): Tolerate whitespace and comment chars in input. - (getaclentry): Fix several input string misdetections. - (getaclentries): Allow - as input file name to read from stdin. - Tolerate whitespace and comment chars in input. - (usage): Add more user friendly help text. - (main): Add --help option. - -2001-11-04 Egor Duda - - * strace.cc (main): New option '-w'. Start traced process in separate - window. New option '-S x'. Flush buffered output every x seconds. - (create_child): Start child process in new window, when requested. - When requested, periodically flush debugging output. - -2001-10-24 Christopher Faylor - - * Makefile.in: Remove EXEEXT consideration. We always need .exe - extensions. - -2001-10-20 Corinna Vinschen - - * mkgroup.c: Avoid compiler warnings. - (print_special): New function. - (main): Print special accounts by calling print_special(). - * mkpasswd.c: Avoid compiler warnings. - (enum_users): Print additional U-domain\username info in gecos - field when SIDs are printed. - (print_special): New function. - (main): Print special accounts by calling print_special(). - -2001-10-15 Christopher Faylor - - * mkpasswd.cc (enum_users): Shorten "unused" passwd field. - -2001-10-13 Christopher Faylor - - * Makefile.in: Allow stdinc searching for dumper. - -Tue Oct 9 21:59:00 2001 Christopher Faylor - - * Makefile.in (MINGW_INCLUDES): Accommodate changes in Makefile.common. - -Sun Oct 7 23:06:39 2001 Christopher Faylor - - * kill.cc (main): Set exit value to 1 on invalid pid. Perform minor - cleanup. - -Fri Sep 21 20:40:30 2001 Christopher Faylor - - * Makefile.in (mingw_getopt.o): Ensure that newlib include directories - are not searched. - -Thu Sep 20 21:00:20 2001 Christopher Faylor - - * Makefile.in (MINGW_INCLUDES): Still need cygwin/include directory. - -Wed Sep 19 12:22:08 2001 Christopher Faylor - - * Makefile.in: Filter newlib includes from mingw compilation. - -2001-09-14 Egor Duda - - * dumper.cc (dumper::dumper): Print error code in case of error. - (dumper::add_thread): Ditto. - (dumper::collect_memory_sections): Ditto. - (dumper::dump_memory_region): Ditto. - (dumper::collect_process_information): Ditto. - (print_section_name): Fix formatting. - -2001-09-13 Egor Duda - - * dumper.cc (main): Properly recognize negative pids (used by w9x). - -2001-09-09 Egor Duda - - * dumper.cc (main): Change command-line arguments format to be - similar to gdb. Allow adding error_start=x:\path\to\dumper.exe to - CYGWIN environment variable to perform core dumping in case of - program crash. - (usage): Ditto. - -Wed Sep 5 22:37:21 2001 Christopher Faylor - - * Makefile.in (dumper): Change logic for libbfd and libintl so that - they will be found either in the build tree or the installed directory. - * mkpasswd.c (enum_users): Add a comment as a password for NT. - -2001-09-03 Michael A Chase - - * mount.cc (mount_commands): Don't write /cygdrive/u mount points. - -2001-09-03 Michael A Chase - - * mount.cc (longopts): Add mount-commands to options list. - (usage): Add mount-commands option. - (mount_commands): New function. Write commands to recreate current - mounts. - -Sat Sep 1 15:58:11 2001 Christopher Faylor - - * mount.cc (main): Eliminate excess arguments in printf. - -2001-08-30 Egor Duda - - * dumper.h: Update copyright notice. - * dumper.cc: Ditto. - * dumper.cc: (dumper::print_core_section_list): New function. - * dumper.h: (dumper::print_core_section_list): Declare it. - * dumper.cc (print_section_name): New function. - (dumper::collect_process_information): Augment debugging output. - Stop debugee processing if it posts double exception. - (usage): Fix typo in option name. - -Tue Aug 28 14:45:02 2001 Christopher Faylor - - * mount.cc (main): Issue correct warning for 'not enough arguments'. - -2001-08-14 Joerg Schaible - - * cygpath.cc (main): Support -w for Windows (System) directories and - return physical correct orthography for the Windows System dir. - -2001-07-14 Chris Genly - - * regtool.cc (find_key): Handle keys with only one subkey. - -Wed Jun 27 22:46:10 2001 Christopher Faylor - - * regtool.cc (find_key): Revert previous change. - -Wed Jun 27 13:37:41 2001 Keith Starsmeare" - - * regtool.cc (find_key): Allow '/' as a synonym for '\\'. - -Fri Jun 15 00:49:21 2001 Christopher Faylor - - * mkpasswd.c (main): Output passwd file in binary mode so that there - are no CRs in the file. - * umount.cc (remove_all_user_mounts): Don't try to remove /cygdrive - mounts. - -Tue May 1 10:50:48 2001 Christopher Faylor - - * mkpasswd.c (enum_users): Use /bin/bash as the default shell. - (main): Ditto. - -Sat Apr 28 22:32:01 2001 Christopher Faylor - - * passwd.cc (ttymnam): New function. - (main): Use ttynam() to report name of tty. - -2001-04-19 Egor Duda - - * dumper.cc (dumper::init_core_dump): Set architecture field in dump - header. - -Mon Apr 16 15:08:00 2001 Corinna Vinschen - - * mkgroup.c: Add function pointers `netlocalgroupgetmembers' and - `netgroupgetusers'. - (load_netapi): Load function pointers `netlocalgroupgetmembers' - and `netgroupgetusers'. - (enum_local_users): New function. - (enum_local_groups): Call `enum_local_users' for each group if - `print_users' is set. - (enum_users): New function. - (enum_groups): Call `enum_users' for each group if `print_users' is set. - (usage): Add usage text for `-u/--users'. - (longopts): Add option `--users'. - (opts): Add option character `u'. - (main): Set `print_users' according to option `-u/--users'. - Call `enum_local_groups' and `enum_groups' with additional parameter - `print_users'. - -2001-04-15 Michael A Chase - - * mount.cc (longopts): Add help to options list. - (opts): Add 'h' to options string. - * umount.cc (longopts): Add help to options list. - (opts): Add 'h' to options string and change 'R' to 'A'. - -2001-04-13 Kazuhiro Fujieda - - * mkgroup.c (enum_groups): Use RID + offset specified an additional - argument as ID. - (usage): Add description of -o option. - (longopts, opts): Add specifications of -o/--id-offset option. - (main): Add -o option. Invoke enum_groups with specified offset. - * mkpasswd.c (enum_users): Just like mkgroup.c. - (usage, longopts, opts): Ditto. - (main): Add -o option. Invoke enum_users with specified offset only - against domain accounts. - -2001-04-11 Egor Duda - - * mkgroup.c (uni2ansi): Use native method to convert from Unicode - to multi-byte strings. - * mkpasswd.c (uni2ansi): Ditto. - (enum_users): Pass buffer size when converting string. - (enum_local_groups): Ditto. - * mkgroup.c (enum_groups): Ditto. - (enum_local_groups): Ditto. - -Mon Apr 2 22:41:33 2001 Christopher Faylor - - * mount.cc (main): Use getopt_long for parsing arguments. - (usage): Reformat, show long and short options. - * umount.cc (main): Ditto, all of the above. - -Mon Apr 2 10:58:26 2001 Christopher Faylor - - * mount.cc (show_mounts): Change format string to more closely resemble - UNIX when displaying mount table. - -Sat Mar 17 21:46:06 2001 Christopher Faylor - - * kill.cc (forcekill): Use dwProcessId when opening a process, not the - Cygwin pid. - -Mon Mar 5 18:50:00 2001 Corinna Vinschen - - * getfacl.c: Add copyright hint. - * setfacl.c: Ditto. - * strace.cc: Ditto. - -Tue Jan 09 10:26:23 2001 Tony Sideris - - * regtool.cc (cmd_list): Add new registry display options. - (cmd_list): Add code to implement -p, -k, and -l options. - - * regtool.cc (Fail): Add call to LocalFree to free memory allocated by - FormatMessage. - -Wed Jan 10 09:16:57 2001 Christopher Faylor - - * regtool.cc (translate): Ensure that 'c' is initialized. - (cmd_set): Ditto for rv. diff --git a/winsup/utils/ChangeLog-2000 b/winsup/utils/ChangeLog-2000 deleted file mode 100644 index 7ea5ae186..000000000 --- a/winsup/utils/ChangeLog-2000 +++ /dev/null @@ -1,347 +0,0 @@ -Fri Dec 15 23:41:48 2000 Christopher Faylor - - * cygcheck.cc (cygwin_info): Add some more bounds checking. - -Fri Dec 15 23:41:34 2000 Christopher Faylor - - From Matt Harget : - * utils/cygcheck.cc (keyeprint): Move declaration before other - functions so it could be used by all functions to report error - messages. Add comment. - (add_path): Check for NULL return from malloc. - (find_on_path): Check initial uses of pointers for NULL. - (rva_to_offset): Ditto. - (init_paths): Add checking for return values of Win32 calls. - (get_dword): Ditto. - (get_word): Ditto. - (dll_info): Ditto, also add NULL pointer checks. - (scan_registry): Ditto. - (check_keys): Ditto. - (dump_sysinfo): Ditto. Add default case to switch. Add error - reporting if GetVolumeInformation fails, except when it - returns ERROR_NOT_READY. - (track_down): Add checking for NULL pointers and - return values of Win32 calls. - (cygwin_info): Ditto. Correct small memory leak. - -Sun Dec 10 19:08:58 2000 Christopher Faylor - - * Makefile.in: Compile/link dumper.exe with c++. - -Tue Dec 7 11:15:00 2000 Corinna Vinschen - - * mkpasswd.c: Slight formatting changes to the below patch. - (longopts): Fix typo in `local-groups' option. - (main): Initialize `passed_home_path' before first usage. - -Tue Dec 7 11:15:00 2000 Chris Abbey - - * mkpasswd.c: make default home directory /home/$user if one - can't be found in user registry. Allow user to override - that with command line arg. - -Sun Dec 3 00:40:47 2000 Christopher Faylor - - * Makefile.in: Use CXX to build the DLL. - * configure.in: Find correct c++ compiler. - * configure: Regenerate. - -Sat Nov 18 23:53:59 2000 Christopher Faylor - - * utils.sgml: Document new options for ps and strace. - -Wed Nov 8 08:49:27 2000 Jason Tishler - - * mount.cc (main): Call show_cygdrive_info instead of - show_cygdrive_prefixes. - * mount.cc (show_cygdrive_prefixes): Remove function. - * mount.cc (show_cygdrive_info): New function. Actually, - show_cygdrive_info is really an enhanced version of - show_cygdrive_prefixes renamed to show_cygdrive_info that also displays - the user and system flags. - -Wed Nov 8 15:52:00 2000 Corinna Vinschen - - * mkgroup.c (load_netapi): New function to load netapi32.dll functions - dynamically so that mkgroup works on 9x/ME as well. - Use corresponding function pointers throughout. - (usage): Change to `int'. Change text to be conformant to mkpasswd. - (main): Use `getlongopt' to process options. - Special handling to create a group entry on 9x/ME. - * mkpasswd.c (load_netapi): New function to load netapi32.dll functions - dynamically so that mkpasswd works on 9x/ME as well. - Use corresponding function pointers throughout. - (usage): Change to `int'. Change text to be conformant to mkgroup. - (main): Use `getlongopt' to process options. - Special handling to create a passwd entry on 9x/ME. - Change conditional to create an entry for the local administrators - group when appropriate. - -Thu Nov 2 2:01:00 2000 Corinna Vinschen - - * kill.cc (main): Return 1 in case of errors. - -Sat Oct 28 01:37:55 2000 Christopher Faylor - - * Makefile.in: Accomodate newer gcc's which require linking of c++ - programs with g++. Fixup output for some compilations. - * cygcheck.cc: Respond to compiler warnings. - * dumper.cc (main): Ditto. - * parse_pe.cc (exclusion::sort_and_check): Ditto. - * setfacl.cc (getaclentry): Ditto. - -Fri Oct 27 20:20:29 2000 Christopher Faylor - - * strace.cc (main): Add a '-b' option. - -2000-10-18 DJ Delorie - - * ssp.c: new - * ssp.txt: new - * Makefile.in: build ssp.exe - -Wed Oct 18 18:57:46 2000 Christopher Faylor - - * ps.cc (main): Add some extra space to Windows pid output for - Windows 95. - -Tue Oct 17 23:49:04 2000 Christopher Faylor - - * ps.cc (main): Add some extra space to pid output for Windows 95. - -Tue Oct 17 1:09:00 2000 Corinna Vinschen - - Patch suggested by Brad Town : - * cygcheck.cc (main): Fix argument counting. - -Sat Oct 14 23:42:58 2000 Christopher Faylor - - * ps.cc (main): Accomodate new PID_ constant. - -Thu Oct 12 02:19:12 2000 Christopher Faylor - - * strace.cc (proc_child): Handle exceptions correctly. - -Sun Oct 8 23:11:17 2000 Christopher Faylor - - * ps.cc (main): Change order of reporting slightly so that windows pids - are more obvious. - * strace.cc (add_child): Just add child's pid directly. - (remove_child): No need to close the child process pid since - ContinueDebugEvent does that automatically. - (proc_child): Ditto for child thread. - -Fri Sep 29 13:12:00 2000 Corinna Vinschen - - * cygcheck.cc (keyeprint): New function. - (check_keys): New function. Perform checking keycodes. - (main): Add option `-k' for invoking check_keys. - Change option processing to use long options and getopt_long. - * cygkeycheck.cc: Removed. Functionality moved to `cygcheck.cc'. - * Makefile.in: Remove cygkeycheck from the dependencies. - -Wed Sep 27 16:24:00 2000 Corinna Vinschen - - * cygkeycheck.cc: New file. Utility to retrieve keycodes. - * Makefile.in: Add cygkeycheck to the dependencies. - -2000-09-15 Joerg Schaible - - * cygpath.cc: Add new options: -s and -i. - * utils.sgml: Document the new options. - -Tue Sep 12 22:45:28 2000 Christopher Faylor - - * kill.cc (main): Change behavior of -f so that it will force the - killing of a cygwin process after waiting 2 tenths of a second for it - to terminate. - (forcekill): Add an extra argument determining whether to wait for the - process to exit. - -Sun Sep 10 12:50:02 2000 Christopher Faylor - - * Makefile.in: Refine dumper.exe message. - -Mon Aug 28 21:55:56 2000 Christopher Faylor - - * kill.c (main): Avoid skipping next argument when a signal number is - specified. - * Makefile.in: Always clean dumper.exe. - -Fri Aug 25 12:41:53 2000 Christopher Faylor - - * Makefile.in: Only build dumper.exe when all of its library and - include dependencies are available. - -Fri Aug 25 11:44:29 2000 Christopher Faylor - - * Makefile.in: Make failure to build dumper.exe a non-error. - -Thu Aug 24 18:02:35 2000 Christopher Faylor - - * ps.cc (main): Always print a cygwin process using cygwin paths. - -2000-08-24 Egor Duda - - * Makefile.in: Add dumper.exe target and associated mechanisms for building it. - * dumper.cc: New file. - * dumper.h: New file. - * module_info.cc: New file. - * parse_pe.cc: New file. - -Mon Jul 31 15:12:00 2000 Corinna Vinschen - - * passwd.c (main): Initialize oldpwd before beeing used. - -Sat Jul 29 00:44:46 2000 Christopher Faylor - - * kill.cc (main): Add '-f' option to force termination of a process. - (forcekill): New function. - * ps.cc (main): Add '-W' option to list Windows pids as well as Cygwin - pids. - (dummyprocessmodules): New function. - (GetModuleFileNameEx95): New function. - (init_win): New function. - (to_time_t): New function. - -Thu Jul 27 22:54:28 2000 Jason Tishler - - * utils/mount.cc (main): Add --show-cygdrive-prefixes option. - (show_cygdrive_prefixes): New function. - * utils/umount.cc (main): Add --remove-cygdrive-prefix option. - (error): Change signature from 'char *' to 'const char *'. - (remove_cygdrive_prefix): New function. - -Thu Jul 13 22:24:00 2000 Corinna Vinschen - - * mount.cc (mount_already_exists): Slightly rearrange. - Change message texts. - -Thu Jul 13 13:02:00 2000 Corinna Vinschen - - * mount.cc (mount_already_exists): Additional warning message - if mount point exists with another mount type. - -Sat Jul 1 00:19:27 2000 Christopher Faylor - - * Makefile.in: Find getopt.c in cygwin/lib subdirectory. - -Sat Jun 24 23:16:33 2000 Christopher Faylor - - * cygcheck.cc (cygwin_info): New function. Scans DLL for Cygwin - version info. - (dll_info): Add path parameter for checking "cygwin1.dll". - (track_down): Accomodate additional parameter for dll_info. - (ls): Ditto. - (dump_sys_info): Always print cygwin1.dll last. - -2000-06-07 Kazuhiro Fujieda - - * mount.cc (error): New function to report an error and exit. - * umount.cc (error): Ditto. - (remove_all_automounts): Check return status of cygwin_umount. - (remove_all_user_mounts): Ditto. - (remove_all_system_mounts): Ditto. - -2000-06-05 DJ Delorie - - * mount.cc: add stdlib.h for exit - * umount.cc: ditto - * strace.cc: add #define for alloca - -Fri May 20 0:01:00 2000 Corinna Vinschen - - * regtool.cc (find_key): Add parameter `access'. - Call `RegOpenKeyEx' with that desired access. - (cmd_add, cmd_remove, cmd_set, cmd_unset): Call - `find_key' with KEY_ALL_ACCESS access. - (cmd_list, cmd_check, cmd_get): Call `find_key' - with KEY_READ access. - -2000-05-19 DJ Delorie - - * cygpath.cc: add --windir/--sysdir options - * utils.sgml: and document them - -Thu May 18 14:38:26 2000 Christopher Faylor - - * Makefile.in: Eliminate WINSUP_DEPS. - * cygpath.cc: Reorganize includes to accomodate sys/cygwin.h changes. - * mkgroup.c: Ditto. - * mkpasswd.c: Ditto. - * mount.cc: Ditto. Eliminate use of cygwin source specific includes. - * ps.cc: Ditto. - * cygwin.cc: Eliminate obsolete file. - -Wed Apr 26 23:43:25 2000 Christopher Faylor - - * mount.cc (main): Add "-X" option to specify a "Cygwin executable". - -Sat Apr 15 23:34:00 2000 Corinna Vinschen - - * mkpasswd.c (main): Use GetDCName instead of GetAnyDCName. - Don't create extra passwd entry for administrators group - if local_groups is set. - (usage): Change usage text slightly. - (enum_users): Loop while ERROR_MORE_DATA is returned. - (enum_local_groups): Ditto. - * mkgroup.c (enum_local_groups): Ditto. - (enum_groups) Ditto. - (usage): Change usage text slightly. - -Thu Apr 13 01:22:35 2000 Christopher Faylor - - * cygpath.cc (main): Add -a -o and -c options. - (doit): Ditto. - -Mon Apr 10 22:56:07 2000 Christopher Faylor - - * cygpath.cc (main): Add -f option for processing a group of paths from - a file. - (doit): New function. - -Sat Mar 18 22:52:37 2000 Christopher Faylor - - Patch suggested by Mumit Khan : - * strace.cc (_impure_ptr): New global variable to make strace build - under Cygwin gcc. - -Sat Mar 18 12:45:10 2000 Christopher Faylor - - * Makefile.in: Make CXXFLAGS consistent with cygwin. - -Wed Mar 15 00:53:58 2000 Christopher Faylor - - * Makefile.in: Use MINGW_CXXFLAGS when compiling strace. - -Sun Mar 12 21:22:25 2000 Christopher Faylor - - * strace.cc: Throughout, track information like start_time, etc. on a - per-process basis. - -Sun Feb 27 23:37:32 2000 Christopher Faylor - - * strace.cc (handle_output_debug_string): Parse strace output to allow - various types of time output. - -Fri Jan 21 02:10:26 Corinna Vinschen - - * utils/regtool.cc (translate): Added unix like backslash - processing. - -2000-01-20 Corinna Vinschen - - * regtool.cc: allow forward slashes as key separators - -2000-01-19 DJ Delorie - - * regtool.cc: New file. - * Makefile.in: add regtool - * utils.sgml: add regtool - -Sat Jan 8 17:13:51 2000 Christopher Faylor - - * getfacl.c: New file. - * setfacl.c: New file. - * Makefile.in: Add getfacl.exe and setfacl.exe to list of PROGS. - Fix link flags in MINGW case. diff --git a/winsup/utils/ChangeLog.64bit b/winsup/utils/ChangeLog.64bit deleted file mode 100644 index 69c235672..000000000 --- a/winsup/utils/ChangeLog.64bit +++ /dev/null @@ -1,85 +0,0 @@ -2013-03-28 Peter Rosin - Corinna Vinschen - - * cygcheck.cc (dll_info): Fix crash due to sizeof(time_t) being not - equal to sizeof(int). Output timestamp RFC 3339 compatible. - -2013-03-26 Corinna Vinschen - - * tzset.c (main): Don't try to overwrite space with NUL. Explain why. - Rather, just print the string with computed precision value. - -2013-03-22 Corinna Vinschen - - * kill.cc (main): Chack pid against INT_MIN and (U)INT_MAX since pid_t - is 4 byte on all platforms. - * mkgroup.c (main): Check domlist[i].id_offset against UINT_MAX since - DWORD is 4 byte on all platforms. - * mkpasswd.c (main): Ditto. - -2013-02-19 Corinna Vinschen - - * cygcheck.cc (dll_info): Handle x86_64 binaries. Make sure to print - only architecture matching cygcheck build, otherwise suffer path - evaluation problems. - -2013-02-17 Yaakov Selkowitz - - Fix 64-bit type problems in dumper.exe - * dumper.cc: Througout, cast pid to unsigned int, change addresses - and sizes from DWORD to SIZE_T, and use %p for pointer addresses. - (dumper::add_mem_region): Change size type to SIZE_T. - (dumper::split_add_mem_region): Ditto. - * dumper.h (struct process_mem_region): Change size type to SIZE_T. - (class exclusion): Change last, size, and step types to size_t. - (exclusion::exclusion): Change argument type to size_t. - (exclusion::add): Change mem_size type to SIZE_T. - (dumper::add_mem_region): Change size type to SIZE_T. - (dumper::split_add_mem_region): Ditto. - (psapi_get_module_name): Change BaseAddress type to LPVOID. - * module_info.cc (psapi_get_module_name): Ditto. - * parse_pe.cc: Througout, change addresses and sizes from DWORD to - SIZE_T, and use %p for pointer addresses. - (exclusion::add): Change mem_size type to SIZE_T. - -2013-02-13 Corinna Vinschen - - * kill.cc (forcekill): Use unsigned int printf format specifier and - cast to avoid compiler warnings where DWORD value is used. - * regtool.cc: Ditto, throughout. - -2013-02-06 Corinna Vinschen - - * ldd.cc: Drop including inttypes.h. Use %u rather than PRIu32. - * mount.cc: Fix type problem with %* expression. - * cygcheck.cc: Ditto. - -2013-02-06 Corinna Vinschen - - Throughout, fix type problems on 32 and 64 bit. Except: - * ssp.c: Disable entire functionality on x86_64 for now. - -2012-11-22 Corinna Vinschen - - * dump_setup.cc: Drop temporary workaround to handle older Mingw header - files on Fedora 17. - * strace.cc: Ditto. - -2012-08-16 Corinna Vinschen - - * ps.cc (main): Define uid correctly as uid_t. - -2012-08-16 Corinna Vinschen - - * cygcheck.cc: Change include path to not depend on installed - cygwin/version.h. - (_NOMNTENT_MACROS): Define before including mntent.h. - * path.cc (_NOMNTENT_MACROS): Ditto. - * dump_setup.cc: Add temporary workaround to handle older Mingw header - files on Fedora 17. - * strace.cc: Ditto. - -2012-08-13 Corinna Vinschen - - * ps.cc (main): Drop unneeded cast. - diff --git a/winsup/utils/Makefile.in b/winsup/utils/Makefile.in deleted file mode 100644 index 80e074a4b..000000000 --- a/winsup/utils/Makefile.in +++ /dev/null @@ -1,186 +0,0 @@ -# Makefile for Cygwin utilities -# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc. - -# This file is part of Cygwin. - -# This software is a copyrighted work licensed under the terms of the -# Cygwin license. Please consult the file "CYGWIN_LICENSE" for -# details. - -srcdir:=@srcdir@ -target_builddir:=@target_builddir@ -winsup_srcdir:=@winsup_srcdir@ -configure_args=@configure_args@ - -export CC:=@CC@ -export CXX:=@CXX@ - -CFLAGS:=@CFLAGS@ -CXXFLAGS:=@CXXFLAGS@ -override CXXFLAGS+=-fno-exceptions -fno-rtti - -include ${srcdir}/../Makefile.common - -cygwin_build:=${target_builddir}/winsup/cygwin - -cygwin_headers:=@cygwin_headers@ - -# environment variables used by ccwrap -export CCWRAP_HEADERS:=. ${srcdir} $(call justdir,${cygwin_headers}) -export CCWRAP_SYSTEM_HEADERS:=${cygwin_headers} @newlib_headers@ -export CCWRAP_DIRAFTER_HEADERS:=@windows_headers@ - -WINDOWS_LIBDIR:=@windows_libdir@ - -prefix:=@prefix@ -exec_prefix:=@exec_prefix@ - -bindir:=@bindir@ -program_transform_name:=@program_transform_name@ - -override INSTALL:=@INSTALL@ -override INSTALL_PROGRAM:=@INSTALL_PROGRAM@ -override INSTALL_DATA:=@INSTALL_DATA@ - -EXEEXT:=@EXEEXT@ -EXEEXT_FOR_BUILD:=@EXEEXT_FOR_BUILD@ - -.PHONY: all install clean realclean warn_dumper warn_cygcheck_zlib - -LDLIBS := -lnetapi32 -ladvapi32 -lkernel32 -luser32 -CYGWIN_LDFLAGS := -static -Wl,--enable-auto-import -L${WINDOWS_LIBDIR} $(LDLIBS) -DEP_LDLIBS := $(cygwin_build)/libcygwin.a - -MINGW_CXX := @MINGW_CXX@ - -# List all binaries to be linked in Cygwin mode. Each binary on this list -# must have a corresponding .o of the same name. -CYGWIN_BINS := ${addsuffix .exe,cygpath getconf getfacl ldd locale kill minidumper mkgroup \ - mkpasswd mount passwd pldd ps regtool setfacl setmetamode ssp tzset umount} - -# List all binaries to be linked in MinGW mode. Each binary on this list -# must have a corresponding .o of the same name. -MINGW_BINS := ${addsuffix .exe,cygcheck cygwin-console-helper ldh strace} - -# List all objects to be compiled in MinGW mode. Any object not on this -# list will will be compiled in Cygwin mode implicitly, so there is no -# need for a CYGWIN_OBJS. -MINGW_OBJS := bloda.o cygcheck.o dump_setup.o ldh.o path.o strace.o -MINGW_LDFLAGS:=-static - -CYGCHECK_OBJS:=cygcheck.o bloda.o path.o dump_setup.o -ZLIB:=-lz - -.PHONY: all -all: - -# If a binary should link in any objects besides the .o with the same -# name as the binary, then list those here. -strace.exe: path.o -cygcheck.exe: cygcheck.o bloda.o path.o dump_setup.o - -path-mount.o: path.cc - ${COMPILE.cc} -c -DFSTAB_ONLY -o $@ $< -mount.exe: path-mount.o - -# Provide any necessary per-target variable overrides. - -cygcheck.exe: MINGW_LDFLAGS += ${ZLIB} -lwininet -lpsapi -lntdll -cygcheck.exe: ${CYGCHECK_OBJS} - -cygpath.o: CXXFLAGS += -fno-threadsafe-statics -cygpath.exe: CYGWIN_LDFLAGS += -lcygwin -luserenv -lntdll -ps.exe: CYGWIN_LDFLAGS += -lcygwin -lpsapi -lntdll -strace.exe: MINGW_LDFLAGS += -lntdll - -ldd.exe:CYGWIN_LDFLAGS += -lpsapi -pldd.exe: CYGWIN_LDFLAGS += -lpsapi - -ldh.exe: MINGW_LDFLAGS += -nostdlib -lkernel32 - -# Check for dumper's requirements and enable it if found. -libbfd := $(call libname,libbfd.a) -build_dumper := $(shell test -r "$(libbfd)" && echo 1) - -ifdef build_dumper -CYGWIN_BINS += dumper.exe -dumper.o module_info.o parse_pe.o: CXXFLAGS += -I$(top_srcdir)/include -dumper.o parse_pe.o: dumper.h -dumper.exe: module_info.o parse_pe.o -dumper.exe: CYGWIN_LDFLAGS += -lpsapi -lbfd -lintl -liconv -liberty ${ZLIB} -else -all: warn_dumper -endif - -all: Makefile $(CYGWIN_BINS) $(MINGW_BINS) - -# test harness support (note: the "MINGW_BINS +=" should come after the -# "all:" above so that the testsuite is not run for "make" but only -# "make check".) -MINGW_BINS += testsuite.exe -MINGW_OBJS += path-testsuite.o testsuite.o -testsuite.exe: path-testsuite.o -path-testsuite.cc: path.cc ; @test -L $@ || ln -sf ${filter %.cc,$^} $@ -path-testsuite.o: MINGW_CXXFLAGS += -DTESTSUITE -# this is necessary because this .c lives in the build dir instead of src -path-testsuite.o: MINGW_CXX := ${patsubst -I.,-I$(utils_source),$(MINGW_CXX)} -path-testsuite.cc path.cc testsuite.cc: testsuite.h -check: testsuite.exe ; $(&1 | sed -rn 's%^.*\s(\S+)/libntdll\..*succeeded%\1%p')) - if test -z "$windows_libdir"; then - AC_MSG_ERROR([cannot find windows library files]) - fi -fi -AC_SUBST(windows_libdir) -] -) - -AC_DEFUN([AC_CYGWIN_INCLUDES], [ -addto_CPPFLAGS -nostdinc -: ${ac_cv_prog_CXX:=$CXX} -: ${ac_cv_prog_CC:=$CC} - -cygwin_headers=$(realdirpath "$winsup_srcdir/cygwin/include") -if test -z "$cygwin_headers"; then - AC_MSG_ERROR([cannot find $winsup_srcdir/cygwin/include directory]) -fi - -newlib_headers=$(realdirpath $winsup_srcdir/../newlib/libc/include) -if test -z "$newlib_headers"; then - AC_MSG_ERROR([cannot find newlib source directory: $winsup_srcdir/../newlib/libc/include]) -fi -newlib_headers="$target_builddir/newlib/targ-include $newlib_headers" - -if test -n "$with_windows_headers"; then - if test -e "$with_windows_headers/windef.h"; then - windows_headers="$with_windows_headers" - else - AC_MSG_ERROR([cannot find windef.h in specified --with-windows-headers path: $saw_windows_headers]); - fi -elif test -d "$winsup_srcdir/w32api/include/windef.h"; then - windows_headers="$winsup_srcdir/w32api/include" -else - windows_headers=$(cd $($ac_cv_prog_CC -xc /dev/null -E -include windef.h 2>/dev/null | sed -n 's%^# 1 "\([^"]*\)/windef\.h".*$%\1%p' | head -n1) 2>/dev/null && pwd) - if test -z "$windows_headers" -o ! -d "$windows_headers"; then - AC_MSG_ERROR([cannot find windows header files]) - fi -fi -CC=$ac_cv_prog_CC -CXX=$ac_cv_prog_CXX -export CC -export CXX -AC_SUBST(windows_headers) -AC_SUBST(newlib_headers) -AC_SUBST(cygwin_headers) -]) - -AC_DEFUN([AC_CONFIGURE_ARGS], [ -configure_args=X -for f in $ac_configure_args; do - case "$f" in - *--srcdir*) ;; - *) configure_args="$configure_args $f" ;; - esac -done -configure_args=$(/usr/bin/expr "$configure_args" : 'X \(.*\)') -AC_SUBST(configure_args) -]) - -AC_SUBST(target_builddir) -AC_SUBST(winsup_srcdir) - diff --git a/winsup/utils/autogen.sh b/winsup/utils/autogen.sh deleted file mode 100755 index 87a0d9c06..000000000 --- a/winsup/utils/autogen.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -e -/usr/bin/aclocal --acdir=.. -/usr/bin/autoconf -f -exec /bin/rm -rf autom4te.cache diff --git a/winsup/utils/bloda.cc b/winsup/utils/bloda.cc deleted file mode 100644 index 6ff433fa9..000000000 --- a/winsup/utils/bloda.cc +++ /dev/null @@ -1,424 +0,0 @@ -/* bloda.cc - - Copyright 2007, 2008, 2011, 2012 Red Hat, Inc. - - This file is part of Cygwin. - - This software is a copyrighted work licensed under the terms of the - Cygwin license. Please consult the file "CYGWIN_LICENSE" for - details. */ - -#define cygwin_internal cygwin_internal_dontuse -#include -#include -#define WIN32_NO_STATUS /* Disable status codes in winnt.h since we include - ntstatus.h for extended status codes below. */ -#include -#undef WIN32_NO_STATUS -#include -#include -#include -#undef cygwin_internal - -#undef DEBUGGING -#ifdef DEBUGGING -#define dbg_printf(ARGS) printf ARGS ; fflush (NULL) -#else /* !DEBUGGING */ -#define dbg_printf(ARGS) do { } while (0) -#endif /* ?DEBUGGING */ - -/* This module detects applications from the Big List of Dodgy Apps, - a list of applications that have at some given time been shown to - interfere with the operation of cygwin. It detects the presence of - applications on the system by looking for any of four traces an - installation might leave: 1) registry keys, 2) files on disk - 3) running executables 4) loaded dlls or drivers. - - At the time of writing, the BLODA amounts to:- - - Sonic Solutions burning software containing DLA component - Norton/MacAffee/Symantec antivirus or antispyware - Logitech webcam software with "Logitech process monitor" service - Kerio, Agnitum or ZoneAlarm Personal Firewall - Iolo System Mechanic/AntiVirus/Firewall - LanDesk - Windows Defender - Embassy Trust Suite fingerprint reader software containing wxvault.dll - ByteMobile laptop optimization client - - A live version is now being maintained in the Cygwin FAQ, at - http://cygwin.com/faq/faq.using.html#faq.using.bloda - -*/ - -enum bad_app -{ - SONIC, NORTON, MACAFFEE, SYMANTEC, - LOGITECH, KERIO, AGNITUM, ZONEALARM, - IOLO, LANDESK, WINDEFENDER, EMBASSYTS, - BYTEMOBILE -}; - -struct bad_app_info -{ - enum bad_app app_id; - const char *details; - char found_it; -}; - -enum bad_app_det_method -{ - HKLMKEY, HKCUKEY, FILENAME, PROCESSNAME, HOOKDLLNAME -}; - -struct bad_app_det -{ - enum bad_app_det_method type; - const char *param; - enum bad_app app; -}; - -static const struct bad_app_det dodgy_app_detects[] = -{ - { PROCESSNAME, "dlactrlw.exe", SONIC }, - { HOOKDLLNAME, "wxvault.dll", EMBASSYTS }, - { HKLMKEY, "SYSTEM\\CurrentControlSet\\Services\\vsdatant", ZONEALARM }, - { FILENAME, "%windir%\\System32\\vsdatant.sys", ZONEALARM }, - { HKLMKEY, "SYSTEM\\CurrentControlSet\\Services\\lvprcsrv", LOGITECH }, - { PROCESSNAME, "LVPrcSrv.exe", LOGITECH }, - { FILENAME, "%programfiles%\\common files\\logitech\\lvmvfm\\LVPrcSrv.exe", LOGITECH }, - { FILENAME, "%windir%\\System32\\bmnet.dll", BYTEMOBILE }, -}; - -static const size_t num_of_detects = sizeof (dodgy_app_detects) / sizeof (dodgy_app_detects[0]); - -static struct bad_app_info big_list_of_dodgy_apps[] = -{ - { SONIC, "Sonic Solutions burning software containing DLA component" }, - { NORTON, "Norton antivirus or antispyware software" }, - { MACAFFEE, "Macaffee antivirus or antispyware software" }, - { SYMANTEC, "Symantec antivirus or antispyware software" }, - { LOGITECH, "Logitech Process Monitor service" }, - { KERIO, "Kerio Personal Firewall" }, - { AGNITUM, "Agnitum Personal Firewall" }, - { ZONEALARM, "ZoneAlarm Personal Firewall" }, - { IOLO, "Iolo System Mechanic/AntiVirus/Firewall software" }, - { LANDESK, "Landesk" }, - { WINDEFENDER, "Windows Defender" }, - { EMBASSYTS, "Embassy Trust Suite fingerprint reader software containing wxvault.dll" }, - { BYTEMOBILE, "ByteMobile laptop optimization client" }, -}; - -static const size_t num_of_dodgy_apps = sizeof (big_list_of_dodgy_apps) / sizeof (big_list_of_dodgy_apps[0]); - -struct system_module_list -{ - LONG count; - PVOID *pid; - PCHAR *name; -}; - -static PSYSTEM_PROCESS_INFORMATION -get_process_list (void) -{ - int n_procs = 0x100; - PSYSTEM_PROCESS_INFORMATION pslist = (PSYSTEM_PROCESS_INFORMATION) malloc (n_procs * sizeof *pslist); - - while (NtQuerySystemInformation (SystemProcessInformation, - pslist, n_procs * sizeof *pslist, 0) == STATUS_INFO_LENGTH_MISMATCH) - { - n_procs *= 2; - free (pslist); - pslist = (PSYSTEM_PROCESS_INFORMATION) malloc (n_procs * sizeof *pslist); - } - return pslist; -} - -static system_module_list * -get_module_list (void) -{ - DWORD modsize = 0; - system_module_list *modlist = (system_module_list *) - calloc (1, sizeof (system_module_list)); - while (!EnumDeviceDrivers (modlist->pid, modsize, &modsize)) - { - free (modlist->pid); - free (modlist->name); - modlist->count = modsize / sizeof (PVOID); - modlist->pid = (PVOID *) calloc (modlist->count, sizeof (PVOID)); - modlist->name = (PCHAR *) calloc (modlist->count, sizeof (PCHAR)); - } - for (int i = 0; i < modlist->count; ++i) - { - modlist->name[0] = (PCHAR) calloc (256, sizeof (CHAR)); - GetDeviceDriverBaseNameA (modlist->pid[i], modlist->name[i], 256); - } - return modlist; -} - -static bool -find_process_in_list (PSYSTEM_PROCESS_INFORMATION pslist, PUNICODE_STRING psname) -{ - while (1) - { - if (pslist->ImageName.Length && pslist->ImageName.Buffer) - { - dbg_printf (("%S\n", pslist->ImageName.Buffer)); - if (!_wcsicmp (pslist->ImageName.Buffer, psname->Buffer)) - return true; - } - if (!pslist->NextEntryOffset) - break; - pslist = (PSYSTEM_PROCESS_INFORMATION)(pslist->NextEntryOffset + (char *)pslist); - }; - return false; -} - -static bool -find_module_in_list (system_module_list * modlist, const char * const modname) -{ - for (int i = 0; i < modlist->count; ++i) - { - dbg_printf (("name '%s' ", modlist->name[i])); - if (!_stricmp (modlist->name[i], modname)) - return true; - } - return false; -} - -static bool -expand_path (const char *path, char *outbuf) -{ - char *dst = outbuf; - const char *end, *envval; - char envvar[MAX_PATH]; - size_t len; - - while ((dst - outbuf) < MAX_PATH) - { - if (*path != '%') - { - if ((*dst++ = *path++) != 0) - continue; - break; - } - /* Expand an environ var. */ - end = path + 1; - while (*end != '%') - { - /* Watch out for unterminated % */ - if (*end++ == 0) - { - end = NULL; - break; - } - } - /* If we didn't find the end, can't expand it. */ - if ((end == NULL) || (end == (path + 1))) - { - /* Unterminated % so copy verbatim. */ - *dst++ = *path++; - continue; - } - /* Expand the environment var into the new path. */ - if ((end - (path + 1)) >= MAX_PATH) - return -1; - memcpy (envvar, path + 1, end - (path + 1)); - envvar[end - (path + 1)] = 0; - envval = getenv (envvar); - /* If not found, copy env var name verbatim. */ - if (envval == NULL) - { - *dst++ = *path++; - continue; - } - /* Check enough room before copying. */ - len = strlen (envval); - if ((dst + len - outbuf) >= MAX_PATH) - return false; - memcpy (dst, envval, len); - dst += len; - /* And carry on past the end of env var name. */ - path = end + 1; - } - return (dst - outbuf) < MAX_PATH; -} - -static bool -detect_dodgy_app (const struct bad_app_det *det, PSYSTEM_PROCESS_INFORMATION pslist, system_module_list * modlist) -{ - HANDLE fh; - HKEY hk; - UNICODE_STRING unicodename; - ANSI_STRING ansiname; - NTSTATUS rv; - bool found; - char expandedname[MAX_PATH]; - - switch (det->type) - { - case HKLMKEY: - dbg_printf (("Detect reg key hklm '%s'... ", det->param)); - if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, det->param, 0, STANDARD_RIGHTS_READ, &hk) == ERROR_SUCCESS) - { - RegCloseKey (hk); - dbg_printf (("found!\n")); - return true; - } - break; - - case HKCUKEY: - dbg_printf (("Detect reg key hkcu '%s'... ", det->param)); - if (RegOpenKeyEx (HKEY_CURRENT_USER, det->param, 0, STANDARD_RIGHTS_READ, &hk) == ERROR_SUCCESS) - { - RegCloseKey (hk); - dbg_printf (("found!\n")); - return true; - } - break; - - case FILENAME: - dbg_printf (("Detect filename '%s'... ", det->param)); - if (!expand_path (det->param, expandedname)) - { - printf ("Expansion failure!\n"); - break; - } - dbg_printf (("('%s' after expansion)... ", expandedname)); - fh = CreateFile (expandedname, 0, FILE_SHARE_READ | FILE_SHARE_WRITE - | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, NULL); - if (fh != INVALID_HANDLE_VALUE) - { - CloseHandle (fh); - dbg_printf (("found!\n")); - return true; - } - break; - - case PROCESSNAME: - dbg_printf (("Detect proc name '%s'... ", det->param)); - /* Equivalent of RtlInitAnsiString. */ - ansiname.Length = ansiname.MaximumLength = strlen (det->param); - ansiname.Buffer = (CHAR *) det->param; - rv = RtlAnsiStringToUnicodeString (&unicodename, &ansiname, TRUE); - if (rv != STATUS_SUCCESS) - { - printf ("Ansi to unicode conversion failure $%08x\n", (unsigned int) rv); - break; - } - found = find_process_in_list (pslist, &unicodename); - RtlFreeUnicodeString (&unicodename); - if (found) - { - dbg_printf (("found!\n")); - return true; - } - break; - - case HOOKDLLNAME: - dbg_printf (("Detect hookdll '%s'... ", det->param)); - if (find_module_in_list (modlist, det->param)) - { - dbg_printf (("found!\n")); - return true; - } - break; - - } - dbg_printf (("not found.\n")); - return false; -} - -static struct bad_app_info * -find_dodgy_app_info (enum bad_app which_app) -{ - size_t i; - for (i = 0; i < num_of_dodgy_apps; i++) - { - if (big_list_of_dodgy_apps[i].app_id == which_app) - return &big_list_of_dodgy_apps[i]; - } - return NULL; -} - -/* External entrypoint called from cygcheck.cc/dump_sysinfo. */ -void -dump_dodgy_apps (int verbose) -{ - size_t i, n_det = 0; - PSYSTEM_PROCESS_INFORMATION pslist; - system_module_list * modlist; - - /* Read system info for detect testing. */ - pslist = get_process_list (); - modlist = get_module_list (); - - /* Go with builtin list for now; later may enhance to - read dodgy apps from a file or download from an URL. */ - for (i = 0; i < num_of_dodgy_apps; i++) - { - big_list_of_dodgy_apps[i].found_it = false; - } - - for (i = 0; i < num_of_detects; i++) - { - const struct bad_app_det *det = &dodgy_app_detects[i]; - struct bad_app_info *found = find_dodgy_app_info (det->app); - bool detected = detect_dodgy_app (det, pslist, modlist); - - /* Not found would mean we coded the lists bad. */ - assert (found); - if (detected) - { - ++n_det; - found->found_it |= (1 << det->type); - } - } - if (n_det) - { - printf ("\nPotential app conflicts:\n\n"); - for (i = 0; i < num_of_dodgy_apps; i++) - { - if (big_list_of_dodgy_apps[i].found_it) - { - printf ("%s%s", big_list_of_dodgy_apps[i].details, - verbose ? "\nDetected: " : ".\n"); - if (!verbose) - continue; - const char *sep = ""; - if (big_list_of_dodgy_apps[i].found_it & (1 << HKLMKEY)) - { - printf ("HKLM Registry Key"); - sep = ", "; - } - if (big_list_of_dodgy_apps[i].found_it & (1 << HKCUKEY)) - { - printf ("%sHKCU Registry Key", sep); - sep = ", "; - } - if (big_list_of_dodgy_apps[i].found_it & (1 << FILENAME)) - { - printf ("%sNamed file", sep); - sep = ", "; - } - if (big_list_of_dodgy_apps[i].found_it & (1 << PROCESSNAME)) - { - printf ("%sNamed process", sep); - sep = ", "; - } - if (big_list_of_dodgy_apps[i].found_it & (1 << HOOKDLLNAME)) - { - printf ("%sLoaded hook DLL", sep); - } - printf (".\n\n"); - } - } - } - /* Tidy up allocations. */ - free (pslist); - for (int i = 0; i < modlist->count; ++i) - free (modlist->name[i]); - free (modlist->name); - free (modlist->pid); -} - diff --git a/winsup/utils/configure b/winsup/utils/configure deleted file mode 100755 index 7e524e279..000000000 --- a/winsup/utils/configure +++ /dev/null @@ -1,4474 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69. -# -# -# Copyright (C) 1992-1996, 1998-2012 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 - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # 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 -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+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -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 -test -x / || 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" - 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 : - export CONFIG_SHELL - # 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 -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+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -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 about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a 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_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_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; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # 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 -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -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 - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# 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'" - - -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= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="mount.cc" -ac_no_link=no -ac_subst_vars='LTLIBOBJS -LIBOBJS -configure_args -MINGW_CXX -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -cygwin_headers -newlib_headers -windows_headers -ac_ct_CXX -CXXFLAGS -CXX -windows_libdir -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -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 -winsup_srcdir -target_builddir' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -with_windows_headers -with_windows_libs -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CXX -CXXFLAGS -CCC' - - -# 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}' -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 - 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 this package 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/PACKAGE] - --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] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-windows-headers=DIR - specify where the windows includes are located - --with-windows-libs=DIR specify where the windows libraries are located - -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 - CXX C++ compiler command - CXXFLAGS C++ compiler flags - -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 the package provider. -_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 -configure -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 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_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_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_cxx_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_cxx_try_compile -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 $as_me, which was -generated by GNU Autoconf 2.69. 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 - -# 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 - - -ac_aux_dir= -for ac_dir in ../.. "$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\"/../.." "$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. - - - - - -. ${srcdir}/../configure.cygwin - -# 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 - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if ${ac_cv_target+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - -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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 -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 - ac_no_link=no - 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 - -else - rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.o conftest.obj conftest.dSYM - ac_no_link=yes - # Setting cross_compile will disable run tests; it will - # also disable AC_CHECK_FILE but that's generally - # correct if we can't link. - cross_compiling=yes - EXEEXT= - # 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; } - -fi -{ $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 -struct stat; -/* 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 - - - - -# Check whether --with-windows-headers was given. -if test "${with_windows_headers+set}" = set; then : - withval=$with_windows_headers; test -z "$withval" && as_fn_error $? "must specify value for --with-windows-headers" "$LINENO" 5 - -fi - - - - -# Check whether --with-windows-libs was given. -if test "${with_windows_libs+set}" = set; then : - withval=$with_windows_libs; test -z "$withval" && as_fn_error $? "must specify value for --with-windows-libs" "$LINENO" 5 - -fi - -windows_libdir=$(realdirpath "$with_windows_libs") -if test -z "$windows_libdir"; then - windows_libdir=$(realdirpath $(${ac_cv_prog_CC:-$CC} -xc /dev/null -Wl,--verbose=1 -lntdll 2>&1 | sed -rn 's%^.*\s(\S+)/libntdll\..*succeeded%\1%p')) - if test -z "$windows_libdir"; then - as_fn_error $? "cannot find windows library files" "$LINENO" 5 - fi -fi - - - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - 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_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$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 -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -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_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$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_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - 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 - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# 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_cxx_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_cxx_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_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -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 - - - -addto_CPPFLAGS -nostdinc -: ${ac_cv_prog_CXX:=$CXX} -: ${ac_cv_prog_CC:=$CC} - -cygwin_headers=$(realdirpath "$winsup_srcdir/cygwin/include") -if test -z "$cygwin_headers"; then - as_fn_error $? "cannot find $winsup_srcdir/cygwin/include directory" "$LINENO" 5 -fi - -newlib_headers=$(realdirpath $winsup_srcdir/../newlib/libc/include) -if test -z "$newlib_headers"; then - as_fn_error $? "cannot find newlib source directory: $winsup_srcdir/../newlib/libc/include" "$LINENO" 5 -fi -newlib_headers="$target_builddir/newlib/targ-include $newlib_headers" - -if test -n "$with_windows_headers"; then - if test -e "$with_windows_headers/windef.h"; then - windows_headers="$with_windows_headers" - else - as_fn_error $? "cannot find windef.h in specified --with-windows-headers path: $saw_windows_headers" "$LINENO" 5; - fi -elif test -d "$winsup_srcdir/w32api/include/windef.h"; then - windows_headers="$winsup_srcdir/w32api/include" -else - windows_headers=$(cd $($ac_cv_prog_CC -xc /dev/null -E -include windef.h 2>/dev/null | sed -n 's%^# 1 "\([^"]*\)/windef\.h".*$%\1%p' | head -n1) 2>/dev/null && pwd) - if test -z "$windows_headers" -o ! -d "$windows_headers"; then - as_fn_error $? "cannot find windows header files" "$LINENO" 5 - fi -fi -CC=$ac_cv_prog_CC -CXX=$ac_cv_prog_CXX -export CC -export CXX - - - - - -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"` - - -# 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 as_fn_executable_p "$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' - - -for ac_prog in ${target_cpu}-w64-mingw32-g++ -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_MINGW_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MINGW_CXX"; then - ac_cv_prog_MINGW_CXX="$MINGW_CXX" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_MINGW_CXX="$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 -MINGW_CXX=$ac_cv_prog_MINGW_CXX -if test -n "$MINGW_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MINGW_CXX" >&5 -$as_echo "$MINGW_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$MINGW_CXX" && break -done - -test -n "$MINGW_CXX" || as_fn_error $? "no acceptable mingw g++ found in \$PATH" "$LINENO" 5 - - - -configure_args=X -for f in $ac_configure_args; do - case "$f" in - *--srcdir*) ;; - *) configure_args="$configure_args $f" ;; - esac -done -configure_args=$(/usr/bin/expr "$configure_args" : 'X \(.*\)') - - -ac_config_files="$ac_config_files 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}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.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 - - - -: "${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 -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -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 - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# 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 $as_me, which was -generated by GNU Autoconf 2.69. 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 - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_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 - -Configuration files: -$config_files - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 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' -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;; - --he | --h | --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 -_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 - "Makefile") CONFIG_FILES="$CONFIG_FILES 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 -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" - - -eval set X " :F $CONFIG_FILES " -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 -_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 -$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 - ;; - - - - 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 - diff --git a/winsup/utils/configure.ac b/winsup/utils/configure.ac deleted file mode 100644 index 5f517c0d0..000000000 --- a/winsup/utils/configure.ac +++ /dev/null @@ -1,40 +0,0 @@ -dnl Autoconf configure script for Cygwin utilities. -dnl Copyright 1996, 1997, 1998, 1999, 2000 Cygnus Solutions. -dnl -dnl This file is part of Cygwin. -dnl -dnl This software is a copyrighted work licensed under the terms of the -dnl Cygwin license. Please consult the file "CYGWIN_LICENSE" for -dnl details. - -dnl Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59) -AC_INIT(mount.cc) -AC_CONFIG_AUX_DIR(../..) - -AC_NO_EXECUTABLES - -. ${srcdir}/../configure.cygwin - -AC_CANONICAL_SYSTEM - -AC_PROG_CC - -AC_WINDOWS_HEADERS -AC_WINDOWS_LIBS - -AC_PROG_CXX - -AC_CYGWIN_INCLUDES - -AC_ARG_PROGRAM - -AC_PROG_INSTALL - -AC_CHECK_PROGS(MINGW_CXX, ${target_cpu}-w64-mingw32-g++) -test -n "$MINGW_CXX" || AC_MSG_ERROR([no acceptable mingw g++ found in \$PATH]) - -AC_EXEEXT -AC_CONFIGURE_ARGS -AC_OUTPUT(Makefile) diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc deleted file mode 100644 index 465bc7861..000000000 --- a/winsup/utils/cygcheck.cc +++ /dev/null @@ -1,2467 +0,0 @@ -/* cygcheck.cc - - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011, 2012, 2013 Red Hat, Inc. - - This file is part of Cygwin. - - This software is a copyrighted work licensed under the terms of the - Cygwin license. Please consult the file "CYGWIN_LICENSE" for - details. */ - -#define _WIN32_WINNT 0x0602 -#define cygwin_internal cygwin_internal_dontuse -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "path.h" -#include "wide_path.h" -#include -#include "../cygwin/include/cygwin/version.h" -#include "../cygwin/include/sys/cygwin.h" -#define _NOMNTENT_MACROS -#include "../cygwin/include/mntent.h" -#include "../cygwin/cygprops.h" -#undef cygwin_internal -#include "loadlib.h" - -#ifndef max -#define max __max -#endif - -#ifndef alloca -#define alloca __builtin_alloca -#endif - -int verbose = 0; -int registry = 0; -int sysinfo = 0; -int givehelp = 0; -int keycheck = 0; -int check_setup = 0; -int dump_only = 0; -int find_package = 0; -int list_package = 0; -int grep_packages = 0; -int del_orphaned_reg = 0; -int unique_object_name_opt = 0; - -static char emptystr[] = ""; - -#ifdef __GNUC__ -typedef long long longlong; -#else -typedef __int64 longlong; -#endif - -/* In dump_setup.cc */ -void dump_setup (int, char **, bool); -void package_find (int, char **); -void package_list (int, char **); -/* In bloda.cc */ -void dump_dodgy_apps (int verbose); -/* Forward declaration */ -static void usage (FILE *, int); - -static const char *known_env_vars[] = { - "c_include_path", - "compiler_path", - "cxx_include_path", - "cygwin", - "cygwin32", - "dejagnu", - "expect", - "gcc_default_options", - "gcc_exec_prefix", - "home", - "ld_library_path", - "library_path", - "login", - "lpath", - "make_mode", - "makeflags", - "path", - "pwd", - "strace", - "tcl_library", - "user", - 0 -}; - -struct -{ - const char *name; - int missing_is_good; -} -static common_apps[] = { - {"awk", 0}, - {"bash", 0}, - {"cat", 0}, - {"cp", 0}, - {"cpp", 1}, - {"crontab", 0}, - {"find", 0}, - {"gcc", 0}, - {"gdb", 0}, - {"grep", 0}, - {"kill", 0}, - {"ld", 0}, - {"ls", 0}, - {"make", 0}, - {"mv", 0}, - {"patch", 0}, - {"perl", 0}, - {"rm", 0}, - {"sed", 0}, - {"ssh", 0}, - {"sh", 0}, - {"tar", 0}, - {"test", 0}, - {"vi", 0}, - {"vim", 0}, - {0, 0} -}; - -/* Options without ASCII single char representation. */ -enum -{ - CO_DELETE_KEYS = 0x100, - CO_ENABLE_UON = 0x101, - CO_DISABLE_UON = 0x102, - CO_SHOW_UON = 0x103 -}; - -static int num_paths, max_paths; -struct pathlike -{ - char *dir; - bool issys; - void check_existence (const char *fn, int showall, int verbose, - char* first, const char *ext1 = "", - const char *ext2 = ""); -}; - -pathlike *paths; -int first_nonsys_path; - -void -eprintf (const char *format, ...) -{ - va_list ap; - va_start (ap, format); - vfprintf (stderr, format, ap); - va_end (ap); -} - -/* - * display_error() is used to report failure modes - */ -static int -display_error (const char *name, bool show_error, bool print_failed) -{ - fprintf (stderr, "cygcheck: %s", name); - if (show_error) - fprintf (stderr, "%s: %lu\n", - print_failed ? " failed" : "", GetLastError ()); - else - fprintf (stderr, "%s\n", - print_failed ? " failed" : ""); - return 1; -} - -static int -display_error (const char *name) -{ - return display_error (name, true, true); -} - -static int -display_error (const char *fmt, const char *x) -{ - char buf[4000]; - snprintf (buf, sizeof buf, fmt, x); - return display_error (buf, false, false); -} - -static int -display_error_fmt (const char *fmt, ...) -{ - char buf[4000]; - va_list va; - - va_start (va, fmt); - vsnprintf (buf, sizeof buf, fmt, va); - return display_error (buf, false, false); -} - -/* Display a WinInet error message, and close a variable number of handles. - (Passed a list of handles terminated by NULL.) */ -static int -display_internet_error (const char *message, ...) -{ - DWORD err = GetLastError (); - TCHAR err_buf[256]; - va_list hptr; - HINTERNET h; - - /* in the case of a successful connection but 404 response, there is no - win32 error message, but we still get passed a message to display. */ - if (err) - { - if (FormatMessage (FORMAT_MESSAGE_FROM_HMODULE, - GetModuleHandle ("wininet.dll"), err, 0, err_buf, - sizeof (err_buf), NULL) == 0) - strcpy (err_buf, "(Unknown error)"); - - fprintf (stderr, "cygcheck: %s: %s (win32 error %lu)\n", message, - err_buf, err); - } - else - fprintf (stderr, "cygcheck: %s\n", message); - - va_start (hptr, message); - while ((h = va_arg (hptr, HINTERNET)) != 0) - InternetCloseHandle (h); - va_end (hptr); - - return 1; -} - -static void -add_path (char *s, int maxlen, bool issys) -{ - if (num_paths >= max_paths) - { - max_paths += 10; - /* Extend path array */ - paths = (pathlike *) realloc (paths, (1 + max_paths) * sizeof (paths[0])); - } - - pathlike *pth = paths + num_paths; - - /* Allocate space for directory in path list */ - char *dir = (char *) calloc (maxlen + 2, sizeof (char)); - if (dir == NULL) - { - display_error ("add_path: calloc() failed"); - return; - } - - /* Copy input directory to path list */ - memcpy (dir, s, maxlen); - - /* Add a trailing slash by default */ - char *e = strchr (dir, '\0'); - if (e != dir && e[-1] != '\\') - strcpy (e, "\\"); - - /* Fill out this element */ - pth->dir = dir; - pth->issys = issys; - pth[1].dir = NULL; - num_paths++; -} - -static void -init_paths () -{ - char tmp[4000], *sl; - add_path ((char *) ".", 1, true); /* to be replaced later */ - - if (GetCurrentDirectory (4000, tmp)) - add_path (tmp, strlen (tmp), true); - else - display_error ("init_paths: GetCurrentDirectory()"); - - if (GetSystemDirectory (tmp, 4000)) - add_path (tmp, strlen (tmp), true); - else - display_error ("init_paths: GetSystemDirectory()"); - sl = strrchr (tmp, '\\'); - if (sl) - { - strcpy (sl, "\\SYSTEM"); - add_path (tmp, strlen (tmp), true); - } - GetWindowsDirectory (tmp, 4000); - add_path (tmp, strlen (tmp), true); - - char *wpath = getenv ("PATH"); - if (!wpath) - display_error ("WARNING: PATH is not set\n", ""); - else - { - char *b, *e; - b = wpath; - while (1) - { - for (e = b; *e && *e != ';'; e++) - continue; /* loop terminates at first ';' or EOS */ - if (strncmp(b, ".\\", 2) != 0) - add_path (b, e - b, false); - if (!*e) - break; - b = e + 1; - } - } -} - -#define LINK_EXTENSION ".lnk" - -void -pathlike::check_existence (const char *fn, int showall, int verbose, - char* first, const char *ext1, const char *ext2) -{ - char file[4000]; - strcpy (file, dir); - strcat (file, fn); - strcat (file, ext1); - strcat (file, ext2); - - wide_path wpath (file); - if (GetFileAttributesW (wpath) != (DWORD) - 1) - { - char *lastdot = strrchr (file, '.'); - bool is_link = lastdot && !strcmp (lastdot, LINK_EXTENSION); - // If file is a link, fix up the extension before printing - if (is_link) - *lastdot = '\0'; - if (showall) - printf ("Found: %s\n", file); - if (verbose && *first != '\0' && strcasecmp (first, file) != 0) - { - char *flastdot = strrchr (first, '.'); - bool f_is_link = flastdot && !strcmp (flastdot, LINK_EXTENSION); - // if first is a link, fix up the extension before printing - if (f_is_link) - *flastdot = '\0'; - printf ("Warning: %s hides %s\n", first, file); - if (f_is_link) - *flastdot = '.'; - } - if (is_link) - *lastdot = '.'; - if (!*first) - strcpy (first, file); - } -} - -static const char * -find_on_path (const char *in_file, const char *ext, bool showall = false, - bool search_sys = false, bool checklinks = false) -{ - static char rv[4000]; - - /* Sort of a kludge but we've already tested this once, so don't try it again */ - if (in_file == rv) - return in_file; - - static pathlike abspath[2] = - { - {emptystr, 0}, - {NULL, 0} - }; - - *rv = '\0'; - if (!in_file) - { - display_error ("internal error find_on_path: NULL pointer for file", false, false); - return 0; - } - - if (!ext) - { - display_error ("internal error find_on_path: NULL pointer for default_extension", false, false); - return 0; - } - - const char *file; - pathlike *search_paths; - if (!strpbrk (in_file, ":/\\")) - { - file = in_file; - search_paths = paths; - } - else - { - file = cygpath (in_file, NULL); - search_paths = abspath; - showall = false; - } - - if (!file) - { - display_error ("internal error find_on_path: cygpath conversion failed for %s\n", in_file); - return 0; - } - - char *hasext = strrchr (file, '.'); - if (hasext && !strpbrk (hasext, "/\\")) - ext = ""; - - for (pathlike *pth = search_paths; pth->dir; pth++) - if (!pth->issys || search_sys) - { - pth->check_existence (file, showall, verbose, rv, ext); - - if (checklinks) - pth->check_existence (file, showall, verbose, rv, ext, LINK_EXTENSION); - - if (!*ext) - continue; - - pth->check_existence (file, showall, verbose, rv); - if (checklinks) - pth->check_existence (file, showall, verbose, rv, LINK_EXTENSION); - } - - return *rv ? rv : NULL; -} - -#define DID_NEW 1 -#define DID_ACTIVE 2 -#define DID_INACTIVE 3 - -struct Did -{ - Did *next; - char *file; - int state; -}; -static Did *did = 0; - -static Did * -already_did (const char *file) -{ - Did *d; - for (d = did; d; d = d->next) - if (strcasecmp (d->file, file) == 0) - return d; - d = (Did *) malloc (sizeof (Did)); - d->file = strdup (file); - d->next = did; - d->state = DID_NEW; - did = d; - return d; -} - -struct Section -{ - char name[8]; - int virtual_size; - int virtual_address; - int size_of_raw_data; - int pointer_to_raw_data; -}; - -static int -rva_to_offset (int rva, char *sections, int nsections, int *sz) -{ - int i; - - if (sections == NULL) - { - display_error ("rva_to_offset: NULL passed for sections", true, false); - return 0; - } - - for (i = 0; i < nsections; i++) - { - Section *s = (Section *) (sections + i * 40); -#if 0 - printf ("%08x < %08x < %08x ? %08x\n", - s->virtual_address, rva, - s->virtual_address + s->virtual_size, s->pointer_to_raw_data); -#endif - if (rva >= s->virtual_address - && rva < s->virtual_address + s->virtual_size) - { - if (sz) - *sz = s->virtual_address + s->virtual_size - rva; - return rva - s->virtual_address + s->pointer_to_raw_data; - } - } - return 0; /* punt */ -} - -struct ExpDirectory -{ - int flags; - int timestamp; - short major_ver; - short minor_ver; - int name_rva; -}; - -struct ImpDirectory -{ - unsigned characteristics; - unsigned timestamp; - unsigned forwarder_chain; - unsigned name_rva; - unsigned iat_rva; -}; - -static bool track_down (const char *file, const char *suffix, int lvl); - -#define CYGPREFIX (sizeof ("%%% Cygwin ") - 1) -static void -cygwin_info (HANDLE h) -{ - char *buf, *bufend, *buf_start = NULL; - const char *hello = " Cygwin DLL version info:\n"; - DWORD size = GetFileSize (h, NULL); - DWORD n; - - if (size == 0xffffffff) - return; - - buf_start = buf = (char *) calloc (1, size + 1); - if (buf == NULL) - { - display_error ("cygwin_info: calloc()"); - return; - } - - (void) SetFilePointer (h, 0, NULL, FILE_BEGIN); - if (!ReadFile (h, buf, size, &n, NULL)) - { - free (buf_start); - return; - } - - static char dummy[] = "\0\0\0\0\0\0\0"; - char *dll_major = dummy; - bufend = buf + size; - while (buf < bufend) - if ((buf = (char *) memchr (buf, '%', bufend - buf)) == NULL) - break; - else if (strncmp ("%%% Cygwin ", buf, CYGPREFIX) != 0) - buf++; - else - { - char *p = strchr (buf += CYGPREFIX, '\n'); - if (!p) - break; - if (strncasecmp (buf, "dll major:", 10) == 0) - { - dll_major = buf + 11; - continue; - } - char *s, pbuf[80]; - int len; - len = 1 + p - buf; - if (strncasecmp (buf, "dll minor:", 10) != 0) - s = buf; - else - { - char c = dll_major[1]; - dll_major[1] = '\0'; - int maj = atoi (dll_major); - dll_major[1] = c; - int min = atoi (dll_major + 1); - sprintf (pbuf, "DLL version: %d.%d.%.*s", maj, min, len - 11, - buf + 11); - len = strlen (s = pbuf); - } - if (strncmp (s, "dll", 3) == 0) - memcpy (s, "DLL", 3); - else if (strncmp (s, "api", 3) == 0) - memcpy (s, "API", 3); - else if (islower (*s)) - *s = toupper (*s); - fprintf (stdout, "%s %.*s", hello, len, s); - hello = ""; - } - - if (!*hello) - puts (""); - - free (buf_start); - return; -} - -/* Special case. Don't complain about this one. */ -#define CYGLSA64_DLL "\\cyglsa64.dll" - -static void -dll_info (const char *path, HANDLE fh, int lvl, int recurse) -{ - DWORD junk; - int i; - if (is_symlink (fh)) - { - if (!verbose) - puts (""); - else - { - char buf[PATH_MAX + 1] = ""; - readlink (fh, buf, sizeof(buf) - 1); - printf (" (symlink to %s)\n", buf); - } - return; - } - int pe_header_offset = get_dword (fh, 0x3c); - if (GetLastError () != NO_ERROR) - display_error ("get_dword"); - WORD arch = get_word (fh, pe_header_offset + 4); - if (GetLastError () != NO_ERROR) - display_error ("get_word"); -#ifdef __x86_64__ - if (arch != IMAGE_FILE_MACHINE_AMD64) - { - puts (verbose ? " (not x86_64 dll)" : "\n"); - return; - } - int base_off = 108; -#else - if (arch != IMAGE_FILE_MACHINE_I386) - { - puts (verbose ? " (not x86 dll)" : "\n"); - return; - } - int base_off = 92; -#endif - int opthdr_ofs = pe_header_offset + 4 + 20; - unsigned short v[6]; - - if (path == NULL) - { - display_error ("dll_info: NULL passed for path", true, false); - return; - } - - if (SetFilePointer (fh, opthdr_ofs + 40, 0, FILE_BEGIN) == - INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR) - display_error ("dll_info: SetFilePointer()"); - - if (!ReadFile (fh, &v, sizeof (v), &junk, 0)) - display_error ("dll_info: Readfile()"); - - if (verbose) - printf (" - os=%d.%d img=%d.%d sys=%d.%d\n", - v[0], v[1], v[2], v[3], v[4], v[5]); - else - printf ("\n"); - - int num_entries = get_dword (fh, opthdr_ofs + base_off + 0); - if (GetLastError () != NO_ERROR) - display_error ("get_dword"); - int export_rva = get_dword (fh, opthdr_ofs + base_off + 4); - if (GetLastError () != NO_ERROR) - display_error ("get_dword"); - int export_size = get_dword (fh, opthdr_ofs + base_off + 8); - if (GetLastError () != NO_ERROR) - display_error ("get_dword"); - int import_rva = get_dword (fh, opthdr_ofs + base_off + 12); - if (GetLastError () != NO_ERROR) - display_error ("get_dword"); - int import_size = get_dword (fh, opthdr_ofs + base_off + 16); - if (GetLastError () != NO_ERROR) - display_error ("get_dword"); - - int nsections = get_word (fh, pe_header_offset + 4 + 2); - if (nsections == -1) - display_error ("get_word"); - char *sections = (char *) malloc (nsections * 40); - - if (SetFilePointer (fh, pe_header_offset + 4 + 20 + - get_word (fh, pe_header_offset + 4 + 16), 0, - FILE_BEGIN) == INVALID_SET_FILE_POINTER - && GetLastError () != NO_ERROR) - display_error ("dll_info: SetFilePointer()"); - - if (!ReadFile (fh, sections, nsections * 40, &junk, 0)) - display_error ("dll_info: Readfile()"); - - if (verbose && num_entries >= 1 && export_size > 0) - { - int expsz; - int expbase = rva_to_offset (export_rva, sections, nsections, &expsz); - - if (expbase) - { - if (SetFilePointer (fh, expbase, 0, FILE_BEGIN) == - INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR) - display_error ("dll_info: SetFilePointer()"); - - unsigned char *exp = (unsigned char *) malloc (expsz); - - if (!ReadFile (fh, exp, expsz, &junk, 0)) - display_error ("dll_info: Readfile()"); - - ExpDirectory *ed = (ExpDirectory *) exp; - int ofs = ed->name_rva - export_rva; - time_t ts = ed->timestamp; /* timestamp is only 4 bytes! */ - struct tm *tm = localtime (&ts); - if (tm && tm->tm_year < 60) - tm->tm_year += 2000; - if (tm && tm->tm_year < 200) - tm->tm_year += 1900; - printf ("%*c", lvl + 2, ' '); - printf ("\"%s\" v%d.%d", exp + ofs, - ed->major_ver, ed->minor_ver); - if (tm) - printf (" ts=%04d-%02d-%02d %02d:%02d", - tm->tm_year, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min); - putchar ('\n'); - } - } - - if (num_entries >= 2 && import_size > 0 && recurse) - { - int impsz; - int impbase = rva_to_offset (import_rva, sections, nsections, &impsz); - if (impbase) - { - if (SetFilePointer (fh, impbase, 0, FILE_BEGIN) == - INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR) - display_error ("dll_info: SetFilePointer()"); - - unsigned char *imp = (unsigned char *) malloc (impsz); - if (imp == NULL) - { - display_error ("dll_info: malloc()"); - return; - } - - if (!ReadFile (fh, imp, impsz, &junk, 0)) - display_error ("dll_info: Readfile()"); - - ImpDirectory *id = (ImpDirectory *) imp; - for (i = 0; id[i].name_rva; i++) - { - /* int ofs = id[i].name_rva - import_rva; */ - track_down ((char *) imp + id[i].name_rva - import_rva, - (char *) ".dll", lvl + 2); - } - } - } - if (strstr (path, "\\cygwin1.dll")) - cygwin_info (fh); -} - -// Return true on success, false if error printed -static bool -track_down (const char *file, const char *suffix, int lvl) -{ - if (file == NULL) - { - display_error ("track_down: NULL passed for file", true, false); - return false; - } - - if (suffix == NULL) - { - display_error ("track_down: NULL passed for suffix", false, false); - return false; - } - - const char *path = find_on_path (file, suffix, false, true); - if (!path) - { - display_error ("track_down: could not find %s\n", file); - return false; - } - - Did *d = already_did (file); - switch (d->state) - { - case DID_NEW: - break; - case DID_ACTIVE: - if (verbose) - { - if (lvl) - printf ("%*c", lvl, ' '); - printf ("%s", path); - printf (" (recursive)\n"); - } - return true; - case DID_INACTIVE: - if (verbose) - { - if (lvl) - printf ("%*c", lvl, ' '); - printf ("%s", path); - printf (" (already done)\n"); - } - return true; - default: - break; - } - - if (lvl) - printf ("%*c", lvl, ' '); - - if (!path) - { - display_error ("file not found - '%s'\n", file); - return false; - } - - printf ("%s", path); - - wide_path wpath (path); - HANDLE fh = - CreateFileW (wpath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (fh == INVALID_HANDLE_VALUE) - { - display_error ("cannot open - '%s'\n", path); - return false; - } - - d->state = DID_ACTIVE; - - if (is_exe (fh)) - dll_info (path, fh, lvl, 1); - else if (is_symlink (fh)) - display_error ("%s is a symlink instead of a DLL\n", path); - else - { - int magic = get_word (fh, 0x0); - if (magic == -1) - display_error ("get_word"); - magic &= 0x00FFFFFF; - display_error_fmt ("%s is not a DLL: magic number %x (%d) '%s'\n", - path, magic, magic, (char *)&magic); - } - - d->state = DID_INACTIVE; - if (!CloseHandle (fh)) - display_error ("track_down: CloseHandle()"); - return true; -} - -static void -ls (char *f) -{ - wide_path wpath (f); - HANDLE h = CreateFileW (wpath, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, - 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); - BY_HANDLE_FILE_INFORMATION info; - - if (!GetFileInformationByHandle (h, &info)) - display_error ("ls: GetFileInformationByHandle()"); - - SYSTEMTIME systime; - - if (!FileTimeToSystemTime (&info.ftLastWriteTime, &systime)) - display_error ("ls: FileTimeToSystemTime()"); - printf ("%5dk %04d/%02d/%02d %s", - (((int) info.nFileSizeLow) + 512) / 1024, - systime.wYear, systime.wMonth, systime.wDay, f); - dll_info (f, h, 16, 0); - if (!CloseHandle (h)) - display_error ("ls: CloseHandle()"); -} - -/* Remove filename from 's' and return directory name without trailing - backslash, or NULL if 's' doesn't seem to have a dirname. */ -static char * -dirname (const char *s) -{ - static char buf[PATH_MAX]; - - if (!s) - return NULL; - - strncpy (buf, s, PATH_MAX); - buf[PATH_MAX - 1] = '\0'; // in case strlen(s) > PATH_MAX - char *lastsep = strrchr (buf, '\\'); - if (!lastsep) - return NULL; // no backslash -> no dirname - else if (lastsep - buf <= 2 && buf[1] == ':') - lastsep[1] = '\0'; // can't remove backslash of "x:\" - else - *lastsep = '\0'; - return buf; -} - -// Find a real application on the path (possibly following symlinks) -static const char * -find_app_on_path (const char *app, bool showall = false) -{ - const char *papp = find_on_path (app, ".exe", showall, false, true); - - if (!papp) - return NULL; - - wide_path wpath (papp); - HANDLE fh = - CreateFileW (wpath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (fh == INVALID_HANDLE_VALUE) - return NULL; - - if (is_symlink (fh)) - { - static char tmp[SYMLINK_MAX + 1]; - if (!readlink (fh, tmp, SYMLINK_MAX)) - display_error("readlink failed"); - - /* Resolve the linkname relative to the directory of the link. */ - char *ptr = cygpath_rel (dirname (papp), tmp, NULL); - printf (" -> %s\n", ptr); - if (!strchr (ptr, '\\')) - { - char *lastsep; - strncpy (tmp, cygpath (papp, NULL), SYMLINK_MAX); - lastsep = strrchr (tmp, '\\'); - strncpy (lastsep+1, ptr, SYMLINK_MAX - (lastsep-tmp)); - ptr = tmp; - } - if (!CloseHandle (fh)) - display_error ("find_app_on_path: CloseHandle()"); - /* FIXME: We leak the ptr returned by cygpath() here which is a - malloc()d string. */ - return find_app_on_path (ptr, showall); - } - - if (!CloseHandle (fh)) - display_error ("find_app_on_path: CloseHandle()"); - return papp; -} - -// Return true on success, false if error printed -static bool -cygcheck (const char *app) -{ - const char *papp = find_app_on_path (app, 1); - if (!papp) - { - display_error ("could not find '%s'\n", app); - return false; - } - - char *s; - char *sep = strpbrk (papp, ":/\\"); - if (!sep) - { - static char dot[] = "."; - s = dot; - } - else - { - int n = sep - papp; - s = (char *) malloc (n + 2); - memcpy ((char *) s, papp, n); - strcpy (s + n, "\\"); - } - - paths[0].dir = s; - did = NULL; - return track_down (papp, ".exe", 0); -} - -struct RegInfo -{ - RegInfo *prev; - char *name; - HKEY key; -}; - -static void -show_reg (RegInfo * ri, int nest) -{ - if (!ri) - return; - show_reg (ri->prev, 1); - if (nest) - printf ("%s\\", ri->name); - else - printf ("%s\n", ri->name); -} - -static void -scan_registry (RegInfo * prev, HKEY hKey, char *name, int cygwin, bool wow64) -{ - RegInfo ri; - ri.prev = prev; - ri.name = name; - ri.key = hKey; - - char *cp; - for (cp = name; *cp; cp++) - if (strncasecmp (cp, "Cygwin", 6) == 0) - cygwin = 1; - - DWORD num_subkeys, max_subkey_len, num_values; - DWORD max_value_len, max_valdata_len, i; - if (RegQueryInfoKey (hKey, 0, 0, 0, &num_subkeys, &max_subkey_len, 0, - &num_values, &max_value_len, &max_valdata_len, 0, 0) - != ERROR_SUCCESS) - { -#if 0 - char tmp[400]; - FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError (), - MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), tmp, 400, 0); - printf ("RegQueryInfoKey: %s\n", tmp); -#endif - return; - } - - if (cygwin) - { - show_reg (&ri, 0); - - char *value_name = (char *) malloc (max_value_len + 1); - if (value_name == NULL) - { - display_error ("scan_registry: malloc()"); - return; - } - - char *value_data = (char *) malloc (max_valdata_len + 1); - if (value_data == NULL) - { - display_error ("scan_registry: malloc()"); - return; - } - - for (i = 0; i < num_values; i++) - { - DWORD dlen = max_valdata_len + 1; - DWORD nlen = max_value_len + 1; - DWORD type; - RegEnumValue (hKey, i, value_name, &nlen, 0, - &type, (BYTE *) value_data, &dlen); - { - printf (" %s = ", i ? value_name : "(default)"); - switch (type) - { - case REG_DWORD: - printf ("0x%08x\n", *(unsigned *) value_data); - break; - case REG_EXPAND_SZ: - case REG_SZ: - printf ("'%s'\n", value_data); - break; - default: - printf ("(unsupported type)\n"); - break; - } - } - } - free (value_name); - free (value_data); - } - - char *subkey_name = (char *) malloc (max_subkey_len + 1); - for (i = 0; i < num_subkeys; i++) - { - if (RegEnumKey (hKey, i, subkey_name, max_subkey_len + 1) == - ERROR_SUCCESS) - { - HKEY sKey; - /* Don't recurse more than one level into the WOW64 subkey since - that would lead to an endless recursion. */ - if (!strcasecmp (subkey_name, "Wow6432Node")) - { - if (wow64) - continue; - wow64 = true; - } - if (RegOpenKeyEx (hKey, subkey_name, 0, KEY_READ, &sKey) - == ERROR_SUCCESS) - { - scan_registry (&ri, sKey, subkey_name, cygwin, wow64); - if (RegCloseKey (sKey) != ERROR_SUCCESS) - display_error ("scan_registry: RegCloseKey()"); - } - } - } - free (subkey_name); -} - -void -pretty_id () -{ - char *groups[16384]; - - char *id = cygpath ("/bin/id.exe", NULL); - for (char *p = id; (p = strchr (p, '/')); p++) - *p = '\\'; - - if (access (id, X_OK)) - { - fprintf (stderr, "'id' program not found\n"); - return; - } - - char buf[16384]; - snprintf (buf, sizeof (buf), "\"%s\"", id); - FILE *f = popen (buf, "rt"); - - buf[0] = '\0'; - fgets (buf, sizeof (buf), f); - pclose (f); - char *uid = strtok (buf, ")"); - if (uid) - uid += strlen ("uid="); - else - { - fprintf (stderr, "garbled output from 'id' command - no uid= found\n"); - return; - } - char *gid = strtok (NULL, ")"); - if (gid) - gid += strlen ("gid=") + 1; - else - { - fprintf (stderr, "garbled output from 'id' command - no gid= found\n"); - return; - } - - char **ng = groups - 1; - size_t len_uid = strlen ("UID: )") + strlen (uid); - size_t len_gid = strlen ("GID: )") + strlen (gid); - *++ng = groups[0] = (char *) alloca (len_uid + 1); - *++ng = groups[1] = (char *) alloca (len_gid + 1); - sprintf (groups[0], "UID: %s)", uid); - sprintf (groups[1], "GID: %s)", gid); - size_t sz = max (len_uid, len_gid); - while ((*++ng = strtok (NULL, ","))) - { - char *p = strchr (*ng, '\n'); - if (p) - *p = '\0'; - if (ng == groups + 2) - *ng += strlen (" groups="); - size_t len = strlen (*ng); - if (sz < len) - sz = len; - } - ng--; - - printf ("\nOutput from %s\n", id); - int n = 80 / (int) ++sz; - int i = n > 2 ? n - 2 : 0; - sz = -sz; - for (char **g = groups; g <= ng; g++) - if ((g != ng) && (++i < n)) - printf ("%*s", (int) sz, *g); - else - { - puts (*g); - i = 0; - } -} - -/* This dumps information about each installed cygwin service, if cygrunsrv - is available. */ -void -dump_sysinfo_services () -{ - char buf[1024]; - char buf2[1024]; - FILE *f; - bool no_services = false; - - if (givehelp) - printf ("\nChecking for any Cygwin services... %s\n\n", - verbose ? "" : "(use -v for more detail)"); - else - fputc ('\n', stdout); - - /* find the location of cygrunsrv.exe */ - char *cygrunsrv = cygpath ("/bin/cygrunsrv.exe", NULL); - for (char *p = cygrunsrv; (p = strchr (p, '/')); p++) - *p = '\\'; - - if (access (cygrunsrv, X_OK)) - { - puts ("Can't find the cygrunsrv utility, skipping services check.\n"); - return; - } - - /* check for a recent cygrunsrv */ - snprintf (buf, sizeof (buf), "\"%s\" --version", cygrunsrv); - if ((f = popen (buf, "rt")) == NULL) - { - printf ("Failed to execute '%s', skipping services check.\n", buf); - return; - } - int maj, min; - int ret = fscanf (f, "cygrunsrv V%u.%u", &maj, &min); - if (ferror (f) || feof (f) || ret == EOF || maj < 1 || min < 10) - { - puts ("The version of cygrunsrv installed is too old to dump service info.\n"); - return; - } - fclose (f); - - /* For verbose mode, just run cygrunsrv --list --verbose and copy output - verbatim; otherwise run cygrunsrv --list and then cygrunsrv --query for - each service. */ - snprintf (buf, sizeof (buf), (verbose ? "\"%s\" --list --verbose" : "\"%s\" --list"), - cygrunsrv); - if ((f = popen (buf, "rt")) == NULL) - { - printf ("Failed to execute '%s', skipping services check.\n", buf); - return; - } - - if (verbose) - { - /* copy output to stdout */ - size_t nchars = 0; - while (!feof (f) && !ferror (f)) - nchars += fwrite ((void *) buf, 1, - fread ((void *) buf, 1, sizeof (buf), f), stdout); - - /* cygrunsrv outputs nothing if there are no cygwin services found */ - if (nchars < 1) - no_services = true; - pclose (f); - } - else - { - /* read the output of --list, and then run --query for each service */ - size_t nchars = fread ((void *) buf, 1, sizeof (buf) - 1, f); - buf[nchars] = 0; - pclose (f); - - if (nchars > 0) - for (char *srv = strtok (buf, "\n"); srv; srv = strtok (NULL, "\n")) - { - snprintf (buf2, sizeof (buf2), "\"%s\" --query %s", cygrunsrv, srv); - if ((f = popen (buf2, "rt")) == NULL) - { - printf ("Failed to execute '%s', skipping services check.\n", buf2); - return; - } - - /* copy output to stdout */ - while (!feof (f) && !ferror (f)) - fwrite ((void *) buf2, 1, - fread ((void *) buf2, 1, sizeof (buf2), f), stdout); - pclose (f); - } - else - no_services = true; - } - - /* inform the user if nothing found */ - if (no_services) - puts ("No Cygwin services found.\n"); -} - -enum handle_reg_t -{ - PRINT_KEY, - DELETE_KEY -}; - -void -handle_reg_installation (handle_reg_t what) -{ - HKEY key; - - if (what == PRINT_KEY) - printf ("Cygwin installations found in the registry:\n"); - for (int i = 0; i < 2; ++i) - if (RegOpenKeyEx (i ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE, - "SOFTWARE\\Cygwin\\Installations", 0, - what == DELETE_KEY ? KEY_READ | KEY_WRITE : KEY_READ, - &key) - == ERROR_SUCCESS) - { - char name[32], data[PATH_MAX]; - DWORD nsize, dsize, type; - LONG ret; - - for (DWORD index = 0; - (ret = RegEnumValue (key, index, name, (nsize = 32, &nsize), 0, - &type, (PBYTE) data, - (dsize = PATH_MAX, &dsize))) - != ERROR_NO_MORE_ITEMS; ++index) - if (ret == ERROR_SUCCESS && dsize > 5) - { - char *path = data + 4; - if (path[1] != ':') - *(path += 2) = '\\'; - if (what == PRINT_KEY) - printf (" %s Key: %s Path: %s", i ? "User: " : "System:", - name, path); - strcat (path, "\\bin\\cygwin1.dll"); - if (what == PRINT_KEY) - printf ("%s\n", access (path, F_OK) ? " (ORPHANED)" : ""); - else if (access (path, F_OK)) - { - RegDeleteValue (key, name); - /* Start over since index is not reliable anymore. */ - --i; - break; - } - } - RegCloseKey (key); - } - if (what == PRINT_KEY) - printf ("\n"); -} - -void -print_reg_installations () -{ - handle_reg_installation (PRINT_KEY); -} - -void -del_orphaned_reg_installations () -{ - handle_reg_installation (DELETE_KEY); -} - -/* Unfortunately neither mingw nor Windows know this function. */ -char * -memmem (char *haystack, size_t haystacklen, - const char *needle, size_t needlelen) -{ - if (needlelen == 0) - return haystack; - while (needlelen <= haystacklen) - { - if (!memcmp (haystack, needle, needlelen)) - return haystack; - haystack++; - haystacklen--; - } - return NULL; -} - -int -handle_unique_object_name (int opt, char *path) -{ - HANDLE fh, fm; - void *haystack = NULL; - - if (!path || !*path) - usage (stderr, 1); - - DWORD access, share, protect, mapping; - - if (opt == CO_SHOW_UON) - { - access = GENERIC_READ; - share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; - protect = PAGE_READONLY; - mapping = FILE_MAP_READ; - } - else - { - access = GENERIC_READ | GENERIC_WRITE; - share = 0; - protect = PAGE_READWRITE; - mapping = FILE_MAP_WRITE; - } - - fh = CreateFile (path, access, share, NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, NULL); - if (fh == INVALID_HANDLE_VALUE) - { - DWORD err = GetLastError (); - switch (err) - { - case ERROR_SHARING_VIOLATION: - display_error ("%s still used by other Cygwin processes.\n" - "Please stop all of them and retry.", path); - break; - case ERROR_ACCESS_DENIED: - display_error ( - "Your permissions are not sufficient to change the file \"%s\"", - path); - break; - case ERROR_FILE_NOT_FOUND: - display_error ("%s: No such file.", path); - break; - default: - display_error (path, true, false); - break; - } - return 1; - } - if (!(fm = CreateFileMapping (fh, NULL, protect, 0, 0, NULL))) - display_error ("CreateFileMapping"); - else if (!(haystack = MapViewOfFile (fm, mapping, 0, 0, 0))) - display_error ("MapViewOfFile"); - else - { - size_t haystacklen = GetFileSize (fh, NULL); - cygwin_props_t *cygwin_props = (cygwin_props_t *) - memmem ((char *) haystack, haystacklen, - CYGWIN_PROPS_MAGIC, sizeof (CYGWIN_PROPS_MAGIC)); - if (!cygwin_props) - display_error ("Can't find Cygwin properties in %s", path); - else - { - if (opt != CO_SHOW_UON) - cygwin_props->disable_key = opt - CO_ENABLE_UON; - printf ("Unique object names are %s\n", - cygwin_props->disable_key ? "disabled" : "enabled"); - UnmapViewOfFile (haystack); - CloseHandle (fm); - CloseHandle (fh); - return 0; - } - } - if (haystack) - UnmapViewOfFile (haystack); - if (fm) - CloseHandle (fm); - CloseHandle (fh); - return 1; -} - -extern "C" NTSTATUS NTAPI RtlGetVersion (PRTL_OSVERSIONINFOEXW); - -static void -dump_sysinfo () -{ - int i, j; - char tmp[4000]; - time_t now; - char *found_cygwin_dll; - bool is_nt = false; - char osname[128]; - DWORD obcaseinsensitive = 1; - HKEY key; - - printf ("\nCygwin Configuration Diagnostics\n"); - time (&now); - printf ("Current System Time: %s\n", ctime (&now)); - - RTL_OSVERSIONINFOEXW osversion; - osversion.dwOSVersionInfoSize = sizeof (RTL_OSVERSIONINFOEXW); - RtlGetVersion (&osversion); - - switch (osversion.dwPlatformId) - { - case VER_PLATFORM_WIN32_NT: - is_nt = true; - if (osversion.dwMajorVersion == 6) - { - HMODULE k32 = GetModuleHandleW (L"kernel32.dll"); - BOOL (WINAPI *GetProductInfo) (DWORD, DWORD, DWORD, DWORD, PDWORD) = - (BOOL (WINAPI *)(DWORD, DWORD, DWORD, DWORD, PDWORD)) - GetProcAddress (k32, "GetProductInfo"); - switch (osversion.dwMinorVersion) - { - case 0: - strcpy (osname, osversion.wProductType == VER_NT_WORKSTATION - ? "Vista" : "2008"); - break; - case 1: - strcpy (osname, osversion.wProductType == VER_NT_WORKSTATION - ? "7" : "2008 R2"); - break; - case 2: - strcpy (osname, osversion.wProductType == VER_NT_WORKSTATION - ? "8" : "2012"); - break; - case 3: - default: - osversion.dwMinorVersion = 3; - strcpy (osname, osversion.wProductType == VER_NT_WORKSTATION - ? "8.1" : "2012 R2"); - break; - } - DWORD prod; - if (GetProductInfo (osversion.dwMajorVersion, - osversion.dwMinorVersion, - osversion.wServicePackMajor, - osversion.wServicePackMinor, - &prod)) - { - const char *products[] = - { - /* 0x00000000 */ "", - /* 0x00000001 */ " Ultimate", - /* 0x00000002 */ " Home Basic", - /* 0x00000003 */ " Home Premium", - /* 0x00000004 */ " Enterprise", - /* 0x00000005 */ " Home Basic N", - /* 0x00000006 */ " Business", - /* 0x00000007 */ " Server Standard", - /* 0x00000008 */ " Server Datacenter", - /* 0x00000009 */ " Small Business Server", - /* 0x0000000a */ " Server Enterprise", - /* 0x0000000b */ " Starter", - /* 0x0000000c */ " Server Datacenter Core", - /* 0x0000000d */ " Server Standard Core", - /* 0x0000000e */ " Server Enterprise Core", - /* 0x0000000f */ " Server Enterprise for Itanium-based Systems", - /* 0x00000010 */ " Business N", - /* 0x00000011 */ " Web Server", - /* 0x00000012 */ " HPC Edition", - /* 0x00000013 */ " Home Server", - /* 0x00000014 */ " Storage Server Express", - /* 0x00000015 */ " Storage Server Standard", - /* 0x00000016 */ " Storage Server Workgroup", - /* 0x00000017 */ " Storage Server Enterprise", - /* 0x00000018 */ " for Windows Essential Server Solutions", - /* 0x00000019 */ " Small Business Server Premium", - /* 0x0000001a */ " Home Premium N", - /* 0x0000001b */ " Enterprise N", - /* 0x0000001c */ " Ultimate N", - /* 0x0000001d */ " Web Server Core", - /* 0x0000001e */ " Essential Business Server Management Server", - /* 0x0000001f */ " Essential Business Server Security Server", - /* 0x00000020 */ " Essential Business Server Messaging Server", - /* 0x00000021 */ " Server Foundation", - /* 0x00000022 */ " Home Server 2011", - /* 0x00000023 */ " without Hyper-V for Windows Essential Server Solutions", - /* 0x00000024 */ " Server Standard without Hyper-V", - /* 0x00000025 */ " Server Datacenter without Hyper-V", - /* 0x00000026 */ " Server Enterprise without Hyper-V", - /* 0x00000027 */ " Server Datacenter Core without Hyper-V", - /* 0x00000028 */ " Server Standard Core without Hyper-V", - /* 0x00000029 */ " Server Enterprise Core without Hyper-V", - /* 0x0000002a */ " Hyper-V Server", - /* 0x0000002b */ " Storage Server Express Core", - /* 0x0000002c */ " Storage Server Standard Core", - /* 0x0000002d */ " Storage Server Workgroup Core", - /* 0x0000002e */ " Storage Server Enterprise Core", - /* 0x0000002f */ " Starter N", - /* 0x00000030 */ " Professional", - /* 0x00000031 */ " Professional N", - /* 0x00000032 */ " Small Business Server 2011 Essentials", - /* 0x00000033 */ " Server For SB Solutions", - /* 0x00000034 */ " Server Solutions Premium", - /* 0x00000035 */ " Server Solutions Premium Core", - /* 0x00000036 */ " Server For SB Solutions EM", /* per MSDN, 2012-09-01 */ - /* 0x00000037 */ " Server For SB Solutions EM", /* per MSDN, 2012-09-01 */ - /* 0x00000038 */ " Multipoint Server", - /* 0x00000039 */ "", - /* 0x0000003a */ "", - /* 0x0000003b */ " Essential Server Solution Management", - /* 0x0000003c */ " Essential Server Solution Additional", - /* 0x0000003d */ " Essential Server Solution Management SVC", - /* 0x0000003e */ " Essential Server Solution Additional SVC", - /* 0x0000003f */ " Small Business Server Premium Core", - /* 0x00000040 */ " Server Hyper Core V", - /* 0x00000041 */ "", - /* 0x00000042 */ " Starter E", - /* 0x00000043 */ " Home Basic E", - /* 0x00000044 */ " Home Premium E", - /* 0x00000045 */ " Professional E", - /* 0x00000046 */ " Enterprise E", - /* 0x00000047 */ " Ultimate E", - /* 0x00000048 */ " Server Enterprise (Evaluation inst.)", - /* 0x00000049 */ "", - /* 0x0000004a */ "", - /* 0x0000004b */ "", - /* 0x0000004c */ " MultiPoint Server Standard", - /* 0x0000004d */ " MultiPoint Server Premium", - /* 0x0000004e */ "", - /* 0x0000004f */ " Server Standard (Evaluation inst.)", - /* 0x00000050 */ " Server Datacenter (Evaluation inst.)", - /* 0x00000051 */ "", - /* 0x00000052 */ "", - /* 0x00000053 */ "", - /* 0x00000054 */ " Enterprise N (Evaluation inst.)", - /* 0x00000055 */ "", - /* 0x00000056 */ "", - /* 0x00000057 */ "", - /* 0x00000058 */ "", - /* 0x00000059 */ "", - /* 0x0000005a */ "", - /* 0x0000005b */ "", - /* 0x0000005c */ "", - /* 0x0000005d */ "", - /* 0x0000005e */ "", - /* 0x0000005f */ " Storage Server Workgroup (Evaluation inst.)", - /* 0x00000060 */ " Storage Server Standard (Evaluation inst.)", - /* 0x00000061 */ "", - /* 0x00000062 */ " N", /* "8 N" */ - /* 0x00000063 */ " China", /* "8 China" */ - /* 0x00000064 */ " Single Language", /* "8 Single Language" */ - /* 0x00000065 */ "", /* "8" */ - /* 0x00000066 */ "", - /* 0x00000067 */ " Professional with Media Center" - }; - if (prod == PRODUCT_UNLICENSED) - strcat (osname, "Unlicensed"); - else if (prod > PRODUCT_PROFESSIONAL_WMC) - strcat (osname, ""); - else - strcat (osname, products[prod]); - } - else - { - } - } - else if (osversion.dwMajorVersion == 5) - { - /* cygcheck won't run on Windows 200 or earlier. */ - if (osversion.dwMinorVersion == 1) - { - strcpy (osname, "XP"); - if (GetSystemMetrics (SM_MEDIACENTER)) - strcat (osname, " Media Center Edition"); - else if (GetSystemMetrics (SM_TABLETPC)) - strcat (osname, " Tablet PC Edition"); - else if (GetSystemMetrics (SM_STARTER)) - strcat (osname, " Starter Edition"); - else if (osversion.wSuiteMask & VER_SUITE_PERSONAL) - strcat (osname, " Home Edition"); - else - strcat (osname, " Professional"); - } - else if (osversion.dwMinorVersion == 2) - { - strcpy (osname, "2003 Server"); - if (GetSystemMetrics (SM_SERVERR2)) - strcat (osname, " R2"); - if (osversion.wSuiteMask & VER_SUITE_BLADE) - strcat (osname, " Web Edition"); - else if (osversion.wSuiteMask & VER_SUITE_DATACENTER) - strcat (osname, " Datacenter Edition"); - else if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE) - strcat (osname, " Enterprise Edition"); - else if (osversion.wSuiteMask & VER_SUITE_COMPUTE_SERVER) - strcat (osname, " Compute Cluster Edition"); - } - } - else - strcpy (osname, "NT"); - break; - default: - strcpy (osname, "??"); - break; - } - printf ("Windows %s Ver %lu.%lu Build %lu %ls\n", osname, - osversion.dwMajorVersion, osversion.dwMinorVersion, - osversion.dwPlatformId == VER_PLATFORM_WIN32_NT ? - osversion.dwBuildNumber : (osversion.dwBuildNumber & 0xffff), - osversion.dwPlatformId == VER_PLATFORM_WIN32_NT ? - osversion.szCSDVersion : L""); - - if (osversion.dwPlatformId == VER_PLATFORM_WIN32s - || osversion.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) - exit (EXIT_FAILURE); - - BOOL is_wow64 = FALSE; - if (IsWow64Process (GetCurrentProcess (), &is_wow64) && is_wow64) - { - SYSTEM_INFO natinfo; - GetNativeSystemInfo (&natinfo); - fputs ("\nRunning under WOW64 on ", stdout); - switch (natinfo.wProcessorArchitecture) - { - case PROCESSOR_ARCHITECTURE_IA64: - puts ("IA64"); - break; - case PROCESSOR_ARCHITECTURE_AMD64: - puts ("AMD64"); - break; - default: - puts("??"); - break; - } - } - - if (GetSystemMetrics (SM_REMOTESESSION)) - printf ("\nRunning in Terminal Service session\n"); - - printf ("\nPath:"); - char *s = getenv ("PATH"), *e; - if (!s) - puts (""); - else - { - char sep = strchr (s, ';') ? ';' : ':'; - int count_path_items = 0; - while (1) - { - for (e = s; *e && *e != sep; e++); - if (e-s) - printf ("\t%.*s\n", (int) (e - s), s); - else - puts ("\t."); - count_path_items++; - if (!*e) - break; - s = e + 1; - } - } - - fflush (stdout); - - pretty_id (); - - if (!GetSystemDirectory (tmp, 4000)) - display_error ("dump_sysinfo: GetSystemDirectory()"); - printf ("\nSysDir: %s\n", tmp); - - GetWindowsDirectory (tmp, 4000); - printf ("WinDir: %s\n\n", tmp); - - - if (givehelp) - printf ("Here's some environment variables that may affect cygwin:\n"); - for (i = 0; environ[i]; i++) - { - char *eq = strchr (environ[i], '='); - if (!eq) - continue; - /* int len = eq - environ[i]; */ - for (j = 0; known_env_vars[j]; j++) - { - *eq = 0; - if (strcmp (environ[i], "PATH") == 0) - continue; /* we handle this one specially */ - if (strcasecmp (environ[i], known_env_vars[j]) == 0) - printf ("%s = '%s'\n", environ[i], eq + 1); - *eq = '='; - } - } - printf ("\n"); - - if (verbose) - { - if (givehelp) - printf ("Here's the rest of your environment variables:\n"); - for (i = 0; environ[i]; i++) - { - int found = 0; - char *eq = strchr (environ[i], '='); - if (!eq) - continue; - /* int len = eq - environ[i]; */ - for (j = 0; known_env_vars[j]; j++) - { - *eq = 0; - if (strcasecmp (environ[i], known_env_vars[j]) == 0) - found = 1; - *eq = '='; - } - if (!found) - { - *eq = 0; - printf ("%s = '%s'\n", environ[i], eq + 1); - *eq = '='; - } - } - printf ("\n"); - } - - if (registry) - { - if (givehelp) - printf ("Scanning registry for keys with 'Cygwin' in them...\n"); - scan_registry (0, HKEY_CURRENT_USER, - (char *) "HKEY_CURRENT_USER", 0, false); - scan_registry (0, HKEY_LOCAL_MACHINE, - (char *) "HKEY_LOCAL_MACHINE", 0, false); - printf ("\n"); - } - else - printf ("Use '-r' to scan registry\n\n"); - - if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\kernel", - 0, KEY_READ, &key) == ERROR_SUCCESS) - { - DWORD size; - RegQueryValueEx (key, "obcaseinsensitive", NULL, NULL, - (LPBYTE) &obcaseinsensitive, &size); - RegCloseKey (key); - } - printf ("obcaseinsensitive set to %lu\n\n", obcaseinsensitive); - - print_reg_installations (); - - if (givehelp) - { - printf ("Listing available drives...\n"); - printf ("Drv Type Size Used Flags Name\n"); - } - int prev_mode = - SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); - int drivemask = GetLogicalDrives (); - - for (i = 0; i < 26; i++) - { - if (!(drivemask & (1 << i))) - continue; - char drive[4], name[200], fsname[200]; - DWORD serno = 0, maxnamelen = 0, flags = 0; - name[0] = fsname[0] = 0; - sprintf (drive, "%c:\\", i + 'a'); - /* Report all errors, except if the Volume is ERROR_NOT_READY. - ERROR_NOT_READY is returned when removeable media drives are empty - (CD, floppy, etc.) */ - if (!GetVolumeInformation (drive, name, sizeof (name), &serno, - &maxnamelen, &flags, fsname, - sizeof (fsname)) - && GetLastError () != ERROR_NOT_READY) - { -# define FMT "dump_sysinfo: GetVolumeInformation() for drive %c:" - char buf[sizeof (FMT)]; - sprintf (buf, FMT, 'A' + i); - display_error (buf); -# undef FMT - } - - int dtype = GetDriveType (drive); - char drive_type[4] = "unk"; - switch (dtype) - { - case DRIVE_REMOVABLE: - strcpy (drive_type, "fd "); - break; - case DRIVE_FIXED: - strcpy (drive_type, "hd "); - break; - case DRIVE_REMOTE: - strcpy (drive_type, "net"); - break; - case DRIVE_CDROM: - strcpy (drive_type, "cd "); - break; - case DRIVE_RAMDISK: - strcpy (drive_type, "ram"); - break; - default: - strcpy (drive_type, "unk"); - } - - long capacity_mb = -1; - int percent_full = -1; - - ULARGE_INTEGER free_me, free_bytes, total_bytes; - free_me.QuadPart = free_bytes.QuadPart = 0ULL; - total_bytes.QuadPart = 1ULL; - if (GetDiskFreeSpaceEx (drive, &free_me, &total_bytes, &free_bytes)) - { - capacity_mb = total_bytes.QuadPart / (1024L * 1024L); - percent_full = 100 - (int) ((100.0 * free_me.QuadPart) - / total_bytes.QuadPart); - } - else - { - DWORD spc = 0, bps = 0, fc = 0, tc = 1; - if (GetDiskFreeSpace (drive, &spc, &bps, &fc, &tc)) - { - capacity_mb = (spc * bps * tc) / (1024 * 1024); - percent_full = 100 - (int) ((100.0 * fc) / tc); - } - } - - printf ("%.2s %s %-6s ", drive, drive_type, fsname); - if (capacity_mb >= 0) - printf ("%7dMb %3d%% ", (int) capacity_mb, (int) percent_full); - else - printf (" N/A N/A "); - printf ("%s %s %s %s %s %s %s\n", - flags & FS_CASE_IS_PRESERVED ? "CP" : " ", - flags & FS_CASE_SENSITIVE ? "CS" : " ", - flags & FS_UNICODE_STORED_ON_DISK ? "UN" : " ", - flags & FS_PERSISTENT_ACLS ? "PA" : " ", - flags & FS_FILE_COMPRESSION ? "FC" : " ", - flags & FS_VOL_IS_COMPRESSED ? "VC" : " ", -#if 0 - flags & FILE_SUPPORTS_ENCRYPTION ? "EN" : " ", - flags & FILE_SUPPORTS_OBJECT_IDS ? "OI" : " ", - flags & FILE_SUPPORTS_REPARSE_POINTS ? "RP" : " ", - flags & FILE_SUPPORTS_SPARSE_FILES ? "SP" : " ", - flags & FILE_VOLUME_QUOTAS ? "QU" : " ", -#endif - name); - } - - SetErrorMode (prev_mode); - if (givehelp) - { - puts ("\n" - "fd = floppy, hd = hard drive, cd = CD-ROM\n" - "net= Network Share, ram= RAM drive, unk= Unknown\n" - "CP = Case Preserving, CS = Case Sensitive, UN = Unicode\n" - "PA = Persistent ACLS, FC = File Compression, VC = Volume Compression"); - } - printf ("\n"); - - unsigned ml_fsname = 4, ml_dir = 7, ml_type = 6; - bool ml_trailing = false; - - struct mntent *mnt; - setmntent (0, 0); - while ((mnt = getmntent (0))) - { - unsigned n = (int) strlen (mnt->mnt_fsname); - ml_trailing |= (n > 1 && strchr ("\\/", mnt->mnt_fsname[n - 1])); - if (ml_fsname < n) - ml_fsname = n; - n = (int) strlen (mnt->mnt_dir); - ml_trailing |= (n > 1 && strchr ("\\/", mnt->mnt_dir[n - 1])); - if (ml_dir < n) - ml_dir = n; - } - - if (ml_trailing) - puts ("Warning: Mount entries should not have a trailing (back)slash\n"); - - if (givehelp) - { - printf - ("Mount entries: these map POSIX directories to your NT drives.\n"); - printf ("%-*s %-*s %-*s %s\n", ml_fsname, "-NT-", ml_dir, "-POSIX-", - ml_type, "-Type-", "-Flags-"); - } - - setmntent (0, 0); - while ((mnt = getmntent (0))) - { - printf ("%-*s %-*s %-*s %s\n", - ml_fsname, mnt->mnt_fsname, - ml_dir, mnt->mnt_dir, ml_type, mnt->mnt_type, mnt->mnt_opts); - } - printf ("\n"); - - if (givehelp) - printf - ("Looking to see where common programs can be found, if at all...\n"); - for (i = 0; common_apps[i].name; i++) - if (!find_app_on_path ((char *) common_apps[i].name, 1)) - { - if (common_apps[i].missing_is_good) - printf ("Not Found: %s (good!)\n", common_apps[i].name); - else - printf ("Not Found: %s\n", common_apps[i].name); - } - printf ("\n"); - - if (givehelp) - printf ("Looking for various Cygwin DLLs... (-v gives version info)\n"); - int cygwin_dll_count = 0; - char cygdll_path[32768]; - for (pathlike *pth = paths; pth->dir; pth++) - { - WIN32_FIND_DATAW ffinfo; - sprintf (tmp, "%s*.*", pth->dir); - wide_path wpath (tmp); - HANDLE ff = FindFirstFileW (wpath, &ffinfo); - int found = (ff != INVALID_HANDLE_VALUE); - found_cygwin_dll = NULL; - while (found) - { - char f[FILENAME_MAX + 1]; - wcstombs (f, ffinfo.cFileName, sizeof f); - if (strcasecmp (f + strlen (f) - 4, ".dll") == 0) - { - if (strncasecmp (f, "cyg", 3) == 0) - { - sprintf (tmp, "%s%s", pth->dir, f); - if (strcasecmp (f, "cygwin1.dll") == 0) - { - if (!cygwin_dll_count) - strcpy (cygdll_path, pth->dir); - if (!cygwin_dll_count - || strcasecmp (cygdll_path, pth->dir) != 0) - cygwin_dll_count++; - found_cygwin_dll = strdup (tmp); - } - else - ls (tmp); - } - } - found = FindNextFileW (ff, &ffinfo); - } - if (found_cygwin_dll) - { - ls (found_cygwin_dll); - free (found_cygwin_dll); - } - - FindClose (ff); - } - if (cygwin_dll_count > 1) - puts ("Warning: There are multiple cygwin1.dlls on your path"); - if (!cygwin_dll_count) - puts ("Warning: cygwin1.dll not found on your path"); - - dump_dodgy_apps (verbose); - - if (is_nt) - dump_sysinfo_services (); -} - -static int -check_keys () -{ - HANDLE h = CreateFileW (L"CONIN$", GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - - if (h == INVALID_HANDLE_VALUE || h == NULL) - return (display_error ("check_keys: Opening CONIN$")); - - DWORD mode; - - if (!GetConsoleMode (h, &mode)) - display_error ("check_keys: GetConsoleMode()"); - else - { - mode &= ~ENABLE_PROCESSED_INPUT; - if (!SetConsoleMode (h, mode)) - display_error ("check_keys: SetConsoleMode()"); - } - - fputs ("\nThis key check works only in a console window,", stderr); - fputs (" _NOT_ in a terminal session!\n", stderr); - fputs ("Abort with Ctrl+C if in a terminal session.\n\n", stderr); - fputs ("Press 'q' to exit.\n", stderr); - - INPUT_RECORD in, prev_in; - - // Drop first key - ReadConsoleInputW (h, &in, 1, &mode); - - memset (&in, 0, sizeof in); - - do - { - prev_in = in; - if (!ReadConsoleInputW (h, &in, 1, &mode)) - display_error ("check_keys: ReadConsoleInput()"); - - if (!memcmp (&in, &prev_in, sizeof in)) - continue; - - switch (in.EventType) - { - case KEY_EVENT: - printf ("%s %ux VK: 0x%04x VS: 0x%04x C: 0x%04x CTRL: ", - in.Event.KeyEvent.bKeyDown ? "Pressed " : "Released", - in.Event.KeyEvent.wRepeatCount, - in.Event.KeyEvent.wVirtualKeyCode, - in.Event.KeyEvent.wVirtualScanCode, - (unsigned char) in.Event.KeyEvent.uChar.UnicodeChar); - fputs (in.Event.KeyEvent.dwControlKeyState & CAPSLOCK_ON ? - "CL " : "-- ", stdout); - fputs (in.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY ? - "EK " : "-- ", stdout); - fputs (in.Event.KeyEvent.dwControlKeyState & LEFT_ALT_PRESSED ? - "LA " : "-- ", stdout); - fputs (in.Event.KeyEvent.dwControlKeyState & LEFT_CTRL_PRESSED ? - "LC " : "-- ", stdout); - fputs (in.Event.KeyEvent.dwControlKeyState & NUMLOCK_ON ? - "NL " : "-- ", stdout); - fputs (in.Event.KeyEvent.dwControlKeyState & RIGHT_ALT_PRESSED ? - "RA " : "-- ", stdout); - fputs (in.Event.KeyEvent.dwControlKeyState & RIGHT_CTRL_PRESSED ? - "RC " : "-- ", stdout); - fputs (in.Event.KeyEvent.dwControlKeyState & SCROLLLOCK_ON ? - "SL " : "-- ", stdout); - fputs (in.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED ? - "SH " : "-- ", stdout); - fputc ('\n', stdout); - break; - - default: - break; - } - } - while (in.EventType != KEY_EVENT || - in.Event.KeyEvent.bKeyDown != FALSE || - in.Event.KeyEvent.uChar.UnicodeChar != L'q'); - - CloseHandle (h); - return 0; -} - -/* RFC1738 says that these do not need to be escaped. */ -static const char safe_chars[] = "$-_.+!*'(),"; - -/* the URL to query. */ -static const char base_url[] = - "http://cygwin.com/cgi-bin2/package-grep.cgi?text=1&grep="; - -/* Queries Cygwin web site for packages containing files matching a regexp. - Return value is 1 if there was a problem, otherwise 0. */ -static int -package_grep (char *search) -{ - char buf[1024]; - - /* construct the actual URL by escaping */ - char *url = (char *) alloca (sizeof (base_url) + strlen ("&arch=x86_64") + strlen (search) * 3); - strcpy (url, base_url); - - char *dest; - for (dest = &url[sizeof (base_url) - 1]; *search; search++) - { - if (isalnum (*search) - || memchr (safe_chars, *search, sizeof (safe_chars) - 1)) - { - *dest++ = *search; - } - else - { - *dest++ = '%'; - sprintf (dest, "%02x", (unsigned char) *search); - dest += 2; - } - } -#ifdef __x86_64__ - strcpy (dest, "&arch=x86_64"); -#else - strcpy (dest, "&arch=x86"); -#endif - - /* Connect to the net and open the URL. */ - if (InternetAttemptConnect (0) != ERROR_SUCCESS) - { - fputs ("An internet connection is required for this function.\n", stderr); - return 1; - } - - /* Initialize WinInet and attempt to fetch our URL. */ - HINTERNET hi = NULL, hurl = NULL; - if (!(hi = InternetOpenA ("cygcheck", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0))) - return display_internet_error ("InternetOpen() failed", NULL); - - if (!(hurl = InternetOpenUrlA (hi, url, NULL, 0, 0, 0))) - return display_internet_error ("unable to contact cygwin.com site, " - "InternetOpenUrl() failed", hi, NULL); - - /* Check the HTTP response code. */ - DWORD rc = 0, rc_s = sizeof (DWORD); - if (!HttpQueryInfoA (hurl, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, - (void *) &rc, &rc_s, NULL)) - return display_internet_error ("HttpQueryInfo() failed", hurl, hi, NULL); - - if (rc != HTTP_STATUS_OK) - { - sprintf (buf, "error retrieving results from cygwin.com site, " - "HTTP status code %lu", rc); - return display_internet_error (buf, hurl, hi, NULL); - } - - /* Fetch result and print to stdout. */ - DWORD numread; - do - { - if (!InternetReadFile (hurl, (void *) buf, sizeof (buf), &numread)) - return display_internet_error ("InternetReadFile failed", hurl, hi, NULL); - if (numread) - fwrite ((void *) buf, (size_t) numread, 1, stdout); - } - while (numread); - - InternetCloseHandle (hurl); - InternetCloseHandle (hi); - return 0; -} - -static void -usage (FILE * stream, int status) -{ - fprintf (stream, "\ -Usage: cygcheck [-v] [-h] PROGRAM\n\ - cygcheck -c [-d] [PACKAGE]\n\ - cygcheck -s [-r] [-v] [-h]\n\ - cygcheck -k\n\ - cygcheck -f FILE [FILE]...\n\ - cygcheck -l [PACKAGE]...\n\ - cygcheck -p REGEXP\n\ - cygcheck --delete-orphaned-installation-keys\n\ - cygcheck --enable-unique-object-names Cygwin-DLL\n\ - cygcheck --disable-unique-object-names Cygwin-DLL\n\ - cygcheck --show-unique-object-names Cygwin-DLL\n\ - cygcheck -h\n\n\ -List system information, check installed packages, or query package database.\n\ -\n\ -At least one command option or a PROGRAM is required, as shown above.\n\ -\n\ - PROGRAM list library (DLL) dependencies of PROGRAM\n\ - -c, --check-setup show installed version of PACKAGE and verify integrity\n\ - (or for all installed packages if none specified)\n\ - -d, --dump-only just list packages, do not verify (with -c)\n\ - -s, --sysinfo produce diagnostic system information (implies -c)\n\ - -r, --registry also scan registry for Cygwin settings (with -s)\n\ - -k, --keycheck perform a keyboard check session (must be run from a\n\ - plain console only, not from a pty/rxvt/xterm)\n\ - -f, --find-package find the package to which FILE belongs\n\ - -l, --list-package list contents of PACKAGE (or all packages if none given)\n\ - -p, --package-query search for REGEXP in the entire cygwin.com package\n\ - repository (requires internet connectivity)\n\ - --delete-orphaned-installation-keys\n\ - Delete installation keys of old, now unused\n\ - installations from the registry. Requires the right\n\ - to change the registry.\n\ - --enable-unique-object-names Cygwin-DLL\n\ - --disable-unique-object-names Cygwin-DLL\n\ - --show-unique-object-names Cygwin-DLL\n\ - Enable, disable, or show the setting of the\n\ - \"unique object names\" setting in the Cygwin DLL\n\ - given as argument to this option. The DLL path must\n\ - be given as valid Windows(!) path.\n\ - See the users guide for more information.\n\ - If you don't know what this means, don't change it.\n\ - -v, --verbose produce more verbose output\n\ - -h, --help annotate output with explanatory comments when given\n\ - with another command, otherwise print this help\n\ - -V, --version print the version of cygcheck and exit\n\ -\n\ -Note: -c, -f, and -l only report on packages that are currently installed. To\n\ - search all official Cygwin packages use -p instead. The -p REGEXP matches\n\ - package names, descriptions, and names of files/paths within all packages.\n\ -\n"); - exit (status); -} - -struct option longopts[] = { - {"check-setup", no_argument, NULL, 'c'}, - {"dump-only", no_argument, NULL, 'd'}, - {"sysinfo", no_argument, NULL, 's'}, - {"registry", no_argument, NULL, 'r'}, - {"verbose", no_argument, NULL, 'v'}, - {"keycheck", no_argument, NULL, 'k'}, - {"find-package", no_argument, NULL, 'f'}, - {"list-package", no_argument, NULL, 'l'}, - {"package-query", no_argument, NULL, 'p'}, - {"delete-orphaned-installation-keys", no_argument, NULL, CO_DELETE_KEYS}, - {"enable-unique-object-names", no_argument, NULL, CO_ENABLE_UON}, - {"disable-unique-object-names", no_argument, NULL, CO_DISABLE_UON}, - {"show-unique-object-names", no_argument, NULL, CO_SHOW_UON}, - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, 0, 'V'}, - {0, no_argument, NULL, 0} -}; - -static char opts[] = "cdsrvkflphV"; - -static void -print_version () -{ - printf ("cygcheck (cygwin) %d.%d.%d\n" - "System Checker for Cygwin\n" - "Copyright (C) 1998 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -void -nuke (char *ev) -{ - int n = 1 + strchr (ev, '=') - ev; - char *s = (char *) malloc (n + 1); - memcpy (s, ev, n); - s[n] = '\0'; - putenv (s); -} - -extern "C" { -uintptr_t (*cygwin_internal) (int, ...); -WCHAR cygwin_dll_path[32768]; -}; - -static void -load_cygwin (int& argc, char **&argv) -{ - HMODULE h; - - if (!(h = LoadLibrary ("cygwin1.dll"))) - return; - GetModuleFileNameW (h, cygwin_dll_path, 32768); - if ((cygwin_internal = (uintptr_t (*) (int, ...)) - GetProcAddress (h, "cygwin_internal"))) - { - char **av = (char **) cygwin_internal (CW_ARGV); - if (av && ((uintptr_t) av != (uintptr_t) -1)) - { - /* Copy cygwin's idea of the argument list into this Window application. */ - for (argc = 0; av[argc]; argc++) - continue; - argv = (char **) calloc (argc + 1, sizeof (char *)); - for (char **argvp = argv; *av; av++) - *argvp++ = strdup (*av); - } - - - char **envp = (char **) cygwin_internal (CW_ENVP); - if (envp && ((uintptr_t) envp != (uintptr_t) -1)) - { - /* Store path and revert to this value, otherwise path gets overwritten - by the POSIXy Cygwin variation, which breaks cygcheck. - Another approach would be to use the Cygwin PATH and convert it to - Win32 again. */ - char *path = NULL; - char **env; - while (*(env = _environ)) - { - if (strncmp (*env, "PATH=", 5) == 0) - path = strdup (*env); - nuke (*env); - } - for (char **ev = envp; *ev; ev++) - if (strncmp (*ev, "PATH=", 5) != 0) - putenv (strdup (*ev)); - if (path) - putenv (path); - } - } - FreeLibrary (h); -} - -int -main (int argc, char **argv) -{ - int i; - bool ok = true; - load_cygwin (argc, argv); - - /* Need POSIX sorting while parsing args, but don't forget the - user's original environment. */ - char *posixly = getenv ("POSIXLY_CORRECT"); - if (posixly == NULL) - (void) putenv ("POSIXLY_CORRECT=1"); - while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (i) - { - case 's': - sysinfo = 1; - break; - case 'c': - check_setup = 1; - break; - case 'd': - dump_only = 1; - break; - case 'r': - registry = 1; - break; - case 'v': - verbose = 1; - break; - case 'k': - keycheck = 1; - break; - case 'f': - find_package = 1; - break; - case 'l': - list_package = 1; - break; - case 'p': - grep_packages = 1; - break; - case 'h': - givehelp = 1; - break; - case CO_DELETE_KEYS: - del_orphaned_reg = 1; - break; - case CO_ENABLE_UON: - case CO_DISABLE_UON: - case CO_SHOW_UON: - unique_object_name_opt = i; - break; - case 'V': - print_version (); - exit (0); - default: - fprintf (stderr, "Try `cygcheck --help' for more information.\n"); - exit (1); - /*NOTREACHED*/ - } - argc -= optind; - argv += optind; - if (posixly == NULL) - putenv ("POSIXLY_CORRECT="); - - if ((argc == 0) && !sysinfo && !keycheck && !check_setup && !list_package - && !del_orphaned_reg) - { - if (givehelp) - usage (stdout, 0); - else - usage (stderr, 1); - } - - if ((check_setup || sysinfo || find_package || list_package || grep_packages - || del_orphaned_reg || unique_object_name_opt) - && keycheck) - usage (stderr, 1); - - if ((find_package || list_package || grep_packages) - && (check_setup || del_orphaned_reg)) - usage (stderr, 1); - - if ((check_setup || sysinfo || find_package || list_package || grep_packages - || del_orphaned_reg) - && unique_object_name_opt) - usage (stderr, 1); - - if (dump_only && !check_setup && !sysinfo) - usage (stderr, 1); - - if (find_package + list_package + grep_packages > 1) - usage (stderr, 1); - - if (keycheck) - return check_keys (); - if (unique_object_name_opt) - return handle_unique_object_name (unique_object_name_opt, *argv); - if (del_orphaned_reg) - del_orphaned_reg_installations (); - if (grep_packages) - return package_grep (*argv); - - init_paths (); - - /* FIXME: Add help for check_setup and {list,find}_package */ - if (argc >= 1 && givehelp && !check_setup && !find_package && !list_package) - { - printf("Here is where the OS will find your program%s, and which dlls\n", - argc > 1 ? "s" : ""); - printf ("will be used for it. Use -v to see DLL version info\n"); - - if (!sysinfo) - printf ("\n"); - } - - if (check_setup) - dump_setup (verbose, argv, !dump_only); - else if (find_package) - package_find (verbose, argv); - else if (list_package) - package_list (verbose, argv); - else - for (i = 0; i < argc; i++) - { - if (i) - puts (""); - ok &= cygcheck (argv[i]); - } - - if (sysinfo) - { - dump_sysinfo (); - if (!check_setup) - { - puts (""); - dump_setup (verbose, NULL, !dump_only); - } - - if (!givehelp) - puts ("Use -h to see help about each section"); - } - - return ok ? EXIT_SUCCESS : EXIT_FAILURE; -} diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc deleted file mode 100644 index 6094eb7eb..000000000 --- a/winsup/utils/cygpath.cc +++ /dev/null @@ -1,1057 +0,0 @@ -/* cygpath.cc -- convert pathnames between Windows and Unix format - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011, 2012, 2013 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _WIN32_WINNT 0x0602 -#define WINVER 0x0602 -#define NOCOMATTRIBUTE -#include -#include -#include -#include -#include - -#include "wide_path.h" -#include "loadlib.h" - -static char *prog_name; -static char *file_arg, *output_arg; -static int path_flag, unix_flag, windows_flag, absolute_flag; -static int shortname_flag, longname_flag; -static int ignore_flag, allusers_flag, output_flag; -static int mixed_flag, options_from_file_flag, mode_flag; -static UINT codepage; - -static const char *format_type_arg; - -static struct option long_options[] = { - {(char *) "absolute", no_argument, NULL, 'a'}, - {(char *) "close", required_argument, NULL, 'c'}, - {(char *) "dos", no_argument, NULL, 'd'}, - {(char *) "file", required_argument, NULL, 'f'}, - {(char *) "help", no_argument, NULL, 'h'}, - {(char *) "ignore", no_argument, NULL, 'i'}, - {(char *) "long-name", no_argument, NULL, 'l'}, - {(char *) "mixed", no_argument, NULL, 'm'}, - {(char *) "mode", no_argument, NULL, 'M'}, - {(char *) "option", no_argument, NULL, 'o'}, - {(char *) "path", no_argument, NULL, 'p'}, - {(char *) "short-name", no_argument, NULL, 's'}, - {(char *) "type", required_argument, NULL, 't'}, - {(char *) "unix", no_argument, NULL, 'u'}, - {(char *) "version", no_argument, NULL, 'V'}, - {(char *) "windows", no_argument, NULL, 'w'}, - {(char *) "allusers", no_argument, NULL, 'A'}, - {(char *) "desktop", no_argument, NULL, 'D'}, - {(char *) "homeroot", no_argument, NULL, 'H'}, - {(char *) "mydocs", no_argument, NULL, 'O'}, - {(char *) "smprograms", no_argument, NULL, 'P'}, - {(char *) "sysdir", no_argument, NULL, 'S'}, - {(char *) "windir", no_argument, NULL, 'W'}, - {(char *) "folder", required_argument, NULL, 'F'}, - {(char *) "codepage", required_argument, NULL, 'C'}, - {0, no_argument, 0, 0} -}; - -static char options[] = "ac:df:hilmMopst:uVwAC:DHOPSWF:"; - -static void -usage (FILE * stream, int status) -{ - if (!ignore_flag || !status) - fprintf (stream, "\ -Usage: %1$s (-d|-m|-u|-w|-t TYPE) [-f FILE] [OPTION]... NAME...\n\ - %1$s [-c HANDLE] \n\ - %1$s [-ADHOPSW] \n\ - %1$s [-F ID] \n\ -\n\ -Convert Unix and Windows format paths, or output system path information\n\ -\n\ -Output type options:\n\ -\n\ - -d, --dos print DOS (short) form of NAMEs (C:\\PROGRA~1\\)\n\ - -m, --mixed like --windows, but with regular slashes (C:/WINNT)\n\ - -M, --mode report on mode of file (binmode or textmode)\n\ - -u, --unix (default) print Unix form of NAMEs (/cygdrive/c/winnt)\n\ - -w, --windows print Windows form of NAMEs (C:\\WINNT)\n\ - -t, --type TYPE print TYPE form: 'dos', 'mixed', 'unix', or 'windows'\n\ -\n\ -Path conversion options:\n\ -\n\ - -a, --absolute output absolute path\n\ - -l, --long-name print Windows long form of NAMEs (with -w, -m only)\n\ - -p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')\n\ - -s, --short-name print DOS (short) form of NAMEs (with -w, -m only)\n\ - -C, --codepage CP print DOS, Windows, or mixed pathname in Windows\n\ - codepage CP. CP can be a numeric codepage identifier,\n\ - or one of the reserved words ANSI, OEM, or UTF8.\n\ - If this option is missing, %1$s defaults to the\n\ - character set defined by the current locale.\n\ -\n\ -System information:\n\ -\n\ - -A, --allusers use `All Users' instead of current user for -D, -O, -P\n\ - -D, --desktop output `Desktop' directory and exit\n\ - -H, --homeroot output `Profiles' directory (home root) and exit\n\ - -O, --mydocs output `My Documents' directory and exit\n\ - -P, --smprograms output Start Menu `Programs' directory and exit\n\ - -S, --sysdir output system directory and exit\n\ - -W, --windir output `Windows' directory and exit\n\ - -F, --folder ID output special folder with numeric ID and exit\n\ -", prog_name); - if (ignore_flag) - /* nothing to do */; - else if (stream != stdout) - fprintf(stream, "Try `%s --help' for more information.\n", prog_name); - else - { - fprintf (stream, "\ -\n\ -Other options:\n\ -\n\ - -f, --file FILE read FILE for input; use - to read from STDIN\n\ - -o, --option read options from FILE as well (for use with --file)\n\ - -c, --close HANDLE close HANDLE (for use in captured process)\n\ - -i, --ignore ignore missing argument\n\ - -h, --help output usage information and exit\n\ - -V, --version output version information and exit\n\ -\n"); - } - exit (ignore_flag ? 0 : status); -} - -static inline BOOLEAN -RtlAllocateUnicodeString (PUNICODE_STRING uni, ULONG size) -{ - uni->Length = 0; - uni->MaximumLength = size / sizeof (WCHAR); - uni->Buffer = (WCHAR *) malloc (size); - return uni->Buffer != NULL; -} - -static size_t -my_wcstombs (char *dest, const wchar_t *src, size_t n) -{ - if (codepage) - return WideCharToMultiByte (codepage, 0, src, -1, dest, n, NULL, NULL); - else - return wcstombs (dest, src, n); -} - -#define HARDDISK_PREFIX L"\\Device\\Harddisk" -#define GLOBALROOT_PREFIX "\\\\.\\GLOBALROOT" - -static char * -get_device_name (char *path) -{ - UNICODE_STRING ntdev, tgtdev, ntdevdir; - ANSI_STRING ans; - OBJECT_ATTRIBUTES ntobj; - NTSTATUS status; - HANDLE lnk, dir; - bool got_one = false; - char *ret = strdup (path); - PDIRECTORY_BASIC_INFORMATION odi = (PDIRECTORY_BASIC_INFORMATION) - alloca (4096); - BOOLEAN restart; - ULONG cont; - - if (!strncasecmp (path, GLOBALROOT_PREFIX "\\", sizeof (GLOBALROOT_PREFIX))) - path += sizeof (GLOBALROOT_PREFIX) - 1; - if (strncasecmp (path, "\\Device\\", 8)) - return ret; - - if (!RtlAllocateUnicodeString (&ntdev, 65534)) - return ret; - if (!RtlAllocateUnicodeString (&tgtdev, 65534)) - return ret; - RtlInitAnsiString (&ans, path); - RtlAnsiStringToUnicodeString (&ntdev, &ans, FALSE); - - /* First check if the given device name is a symbolic link itself. If so, - query it and use the new name as actual device name to search for in the - DOS device name directory. If not, just use the incoming device name. */ - InitializeObjectAttributes (&ntobj, &ntdev, OBJ_CASE_INSENSITIVE, NULL, NULL); - status = NtOpenSymbolicLinkObject (&lnk, SYMBOLIC_LINK_QUERY, &ntobj); - if (NT_SUCCESS (status)) - { - status = NtQuerySymbolicLinkObject (lnk, &tgtdev, NULL); - NtClose (lnk); - if (!NT_SUCCESS (status)) - goto out; - RtlCopyUnicodeString (&ntdev, &tgtdev); - } - else if (status != STATUS_OBJECT_TYPE_MISMATCH - && status != STATUS_OBJECT_PATH_SYNTAX_BAD) - goto out; - - for (int i = 0; i < 2; ++i) - { - /* There are two DOS device directories, the local and the global dir. - Try both, local first. */ - RtlInitUnicodeString (&ntdevdir, i ? L"\\GLOBAL??" : L"\\??"); - - /* Open the directory... */ - InitializeObjectAttributes (&ntobj, &ntdevdir, OBJ_CASE_INSENSITIVE, - NULL, NULL); - status = NtOpenDirectoryObject (&dir, DIRECTORY_QUERY, &ntobj); - if (!NT_SUCCESS (status)) - break; - - /* ...and scan it. */ - for (restart = TRUE, cont = 0; - NT_SUCCESS (NtQueryDirectoryObject (dir, odi, 4096, TRUE, - restart, &cont, NULL)); - restart = FALSE) - { - /* For each entry check if it's a symbolic link. */ - InitializeObjectAttributes (&ntobj, &odi->ObjectName, - OBJ_CASE_INSENSITIVE, dir, NULL); - status = NtOpenSymbolicLinkObject (&lnk, SYMBOLIC_LINK_QUERY, &ntobj); - if (!NT_SUCCESS (status)) - continue; - tgtdev.Length = 0; - tgtdev.MaximumLength = 512; - /* If so, query it and compare the target of the symlink with the - incoming device name. */ - status = NtQuerySymbolicLinkObject (lnk, &tgtdev, NULL); - NtClose (lnk); - if (!NT_SUCCESS (status)) - continue; - if (tgtdev.Length /* There's actually a symlink pointing to an - empty string: \??\GLOBALROOT -> "" */ - && RtlEqualUnicodePathPrefix (&ntdev, &tgtdev, TRUE)) - { - /* If the comparison succeeds, the name of the directory entry is - a valid DOS device name, if prepended with "\\.\". Return that - valid DOS path. */ - wchar_t *trailing = NULL; - if (ntdev.Length > tgtdev.Length) - trailing = ntdev.Buffer + tgtdev.Length / sizeof (WCHAR); - ULONG len = RtlUnicodeStringToAnsiSize (&odi->ObjectName); - if (trailing) - len += my_wcstombs (NULL, trailing, 0); - free (ret); - ret = (char *) malloc (len + 4); - strcpy (ret, "\\\\.\\"); - ans.Length = 0; - ans.MaximumLength = len; - ans.Buffer = ret + 4; - RtlUnicodeStringToAnsiString (&ans, &odi->ObjectName, FALSE); - if (trailing) - my_wcstombs (ans.Buffer + ans.Length, trailing, - ans.MaximumLength - ans.Length); - ans.Buffer[ans.MaximumLength - 1] = '\0'; - got_one = true; - /* Special case for local disks: It's most feasible if the - DOS device name reflects the DOS drive, so we check for this - explicitly and only return prematurely if so. */ - if (ntdev.Length < wcslen (HARDDISK_PREFIX) - || wcsncasecmp (ntdev.Buffer, HARDDISK_PREFIX, 8) != 0 - || (odi->ObjectName.Length == 2 * sizeof (WCHAR) - && odi->ObjectName.Buffer[1] == L':')) - { - if (trailing) - { - /* If there's a trailing path, it's a perfectly valid - DOS pathname without the \\.\ prefix. Unless it's - longer than MAX_PATH - 1 in which case it needs - the \\?\ prefix. */ - if ((len = strlen (ret + 4)) >= MAX_PATH) - ret[2] = '?'; - else - memmove (ret, ret + 4, strlen (ret + 4) + 1); - } - NtClose (dir); - goto out; - } - } - } - NtClose (dir); - } - -out: - free (tgtdev.Buffer); - free (ntdev.Buffer); - if (!got_one) - { - free (ret); - ret = (char *) malloc (sizeof (GLOBALROOT_PREFIX) + strlen (path)); - if (ret) - stpcpy (stpcpy (ret, GLOBALROOT_PREFIX), path); - } - return ret; -} - -static char * -get_device_paths (char *path) -{ - char *sbuf; - char *ptr; - int n = 1; - - ptr = path; - while ((ptr = strchr (ptr, ';'))) - { - ptr++; - n++; - } - - char *paths[n]; - DWORD acc = 0; - int i; - if (!n) - return strdup (""); - - for (i = 0, ptr = path; ptr; i++) - { - char *next = ptr; - ptr = strchr (ptr, ';'); - if (ptr) - *ptr++ = 0; - paths[i] = get_device_name (next); - acc += strlen (paths[i]) + 1; - } - - sbuf = (char *) malloc (acc + 1); - if (sbuf == NULL) - { - fprintf (stderr, "%s: out of memory\n", prog_name); - exit (1); - } - - sbuf[0] = '\0'; - for (i = 0; i < n; i++) - { - strcat (strcat (sbuf, paths[i]), ";"); - free (paths[i]); - } - - strchr (sbuf, '\0')[-1] = '\0'; - return sbuf; -} - -static char * -get_short_paths (char *path) -{ - wchar_t *sbuf; - wchar_t *sptr; - char *next; - char *ptr = path; - char *end = strrchr (path, 0); - DWORD acc = 0; - DWORD len; - - while (ptr != NULL) - { - next = ptr; - ptr = strchr (ptr, ';'); - if (ptr) - *ptr++ = 0; - wide_path wpath (next); - len = GetShortPathNameW (wpath, NULL, 0); - if (!len) - { - fprintf (stderr, "%s: cannot create short name of %s\n", - prog_name, next); - exit (2); - } - acc += len + 1; - } - sptr = sbuf = (wchar_t *) malloc ((acc + 1) * sizeof (wchar_t)); - if (sbuf == NULL) - { - fprintf (stderr, "%s: out of memory\n", prog_name); - exit (1); - } - ptr = path; - for (;;) - { - wide_path wpath (ptr); - len = GetShortPathNameW (wpath, sptr, acc); - if (!len) - { - fprintf (stderr, "%s: cannot create short name of %s\n", - prog_name, ptr); - exit (2); - } - - ptr = strrchr (ptr, 0); - sptr = wcsrchr (sptr, 0); - if (ptr == end) - break; - *sptr = L';'; - ++ptr, ++sptr; - acc -= len + 1; - } - len = my_wcstombs (NULL, sbuf, 0) + 1; - ptr = (char *) malloc (len); - if (ptr == NULL) - { - fprintf (stderr, "%s: out of memory\n", prog_name); - exit (1); - } - my_wcstombs (ptr, sbuf, len); - return ptr; -} - -static char * -get_short_name (const char *filename) -{ - wchar_t buf[32768]; - char *sbuf; - wide_path wpath (filename); - DWORD len = GetShortPathNameW (wpath, buf, 32768); - if (!len) - { - fprintf (stderr, "%s: cannot create short name of %s\n", - prog_name, filename); - exit (2); - } - len = my_wcstombs (NULL, buf, 0) + 1; - sbuf = (char *) malloc (len); - if (sbuf == NULL) - { - fprintf (stderr, "%s: out of memory\n", prog_name); - exit (1); - } - my_wcstombs (sbuf, buf, len); - return sbuf; -} - -static char * -get_long_name (const char *filename, DWORD& len) -{ - char *sbuf; - wchar_t buf[32768]; - wide_path wpath (filename); - - if (!GetLongPathNameW (wpath, buf, 32768)) - wcscpy (buf, wpath); - len = my_wcstombs (NULL, buf, 0); - sbuf = (char *) malloc (len + 1); - if (!sbuf) - { - fprintf (stderr, "%s: out of memory\n", prog_name); - exit (1); - } - my_wcstombs (sbuf, buf, len + 1); - return sbuf; -} - -static char * -get_long_paths (char *path) -{ - char *sbuf; - char *ptr; - int n = 1; - - ptr = path; - while ((ptr = strchr (ptr, ';'))) - { - ptr++; - n++; - } - - char *paths[n]; - DWORD acc = 0; - int i; - if (!n) - return strdup (""); - - for (i = 0, ptr = path; ptr; i++) - { - DWORD len; - char *next = ptr; - ptr = strchr (ptr, ';'); - if (ptr) - *ptr++ = 0; - paths[i] = get_long_name (next, len); - acc += len + 1; - } - - sbuf = (char *) malloc (acc + 1); - if (sbuf == NULL) - { - fprintf (stderr, "%s: out of memory\n", prog_name); - exit (1); - } - - sbuf[0] = '\0'; - for (i = 0; i < n; i++) - { - strcat (strcat (sbuf, paths[i]), ";"); - free (paths[i]); - } - - strchr (sbuf, '\0')[-1] = '\0'; - return sbuf; -} - -static void -convert_slashes (char* name) -{ - while ((name = strchr (name, '\\')) != NULL) - { - if (*name == '\\') - *name = '/'; - name++; - } -} - -static bool -get_special_folder (PWCHAR wpath, int id) -{ - LPITEMIDLIST pidl = 0; - if (SHGetSpecialFolderLocation (NULL, id, &pidl) != S_OK) - return false; - if (!SHGetPathFromIDListW (pidl, wpath) || !wpath[0]) - return false; - return true; -} - -static void -do_sysfolders (char option) -{ - WCHAR wbuf[MAX_PATH]; - char buf[PATH_MAX]; - - wbuf[0] = L'\0'; - switch (option) - { - case 'D': - get_special_folder (wbuf, allusers_flag ? CSIDL_COMMON_DESKTOPDIRECTORY - : CSIDL_DESKTOPDIRECTORY); - break; - - case 'P': - get_special_folder (wbuf, allusers_flag ? CSIDL_COMMON_PROGRAMS - : CSIDL_PROGRAMS); - break; - - case 'O': - get_special_folder (wbuf, allusers_flag ? CSIDL_COMMON_DOCUMENTS - : CSIDL_PERSONAL); - break; - - case 'F': - { - int val = -1, len = -1; - if (!(sscanf (output_arg, "%i%n", &val, &len) == 1 - && len == (int) strlen (output_arg) && val >= 0)) - { - fprintf (stderr, "%s: syntax error in special folder ID %s\n", - prog_name, output_arg); - exit (1); - } - get_special_folder (wbuf, val); - } - break; - - case 'H': - { - DWORD len = MAX_PATH; - GetProfilesDirectoryW (wbuf, &len); - } - break; - - case 'S': - { - HANDLE fh; - WIN32_FIND_DATAW w32_fd; - - GetSystemDirectoryW (wbuf, MAX_PATH); - /* The path returned by GetSystemDirectoryW is not case preserving. - The below code is a trick to get the correct case of the system - directory from Windows. */ - if ((fh = FindFirstFileW (wbuf, &w32_fd)) != INVALID_HANDLE_VALUE) - { - FindClose (fh); - wcscpy (wcsrchr (wbuf, L'\\') + 1, w32_fd.cFileName); - } - } - break; - - case 'W': - GetSystemWindowsDirectoryW (wbuf, MAX_PATH); - break; - - default: - usage (stderr, 1); - } - - if (!wbuf[0]) - { - fprintf (stderr, "%s: failed to retrieve special folder path\n", - prog_name); - } - else if (!windows_flag) - { - if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, wbuf, buf, PATH_MAX)) - fprintf (stderr, "%s: error converting \"%ls\" - %s\n", - prog_name, wbuf, strerror (errno)); - } - else - { - if (shortname_flag) - /* System paths are never longer than MAX_PATH. The buffer pointers - in a call to GetShortPathNameW may point to the same buffer. */ - GetShortPathNameW (wbuf, wbuf, MAX_PATH); - my_wcstombs (buf, wbuf, MAX_PATH); - if (mixed_flag) - convert_slashes (buf); - } - printf ("%s\n", buf); -} - -static void -report_mode (char *filename) -{ - switch (cygwin_internal (CW_GET_BINMODE, filename)) - { - case O_BINARY: - printf ("%s: binary\n", filename); - break; - case O_TEXT: - printf ("%s: text\n", filename); - break; - default: - fprintf (stderr, "%s: file '%s' - %s\n", prog_name, - filename, strerror (errno)); - break; - } -} - -static void -do_pathconv (char *filename) -{ - char *buf = NULL, *tmp; - wchar_t *buf2 = NULL; - DWORD len = 32768; - ssize_t err; - bool print_tmp = false; - cygwin_conv_path_t conv_func = - (unix_flag ? CCP_WIN_W_TO_POSIX : CCP_POSIX_TO_WIN_W) - | (absolute_flag ? CCP_ABSOLUTE : CCP_RELATIVE); - - if (!filename || !filename[0]) - { - if (ignore_flag) - return; - fprintf (stderr, "%s: can't convert empty path\n", prog_name); - exit (1); - } - - buf = (char *) malloc (len); - if (!unix_flag) - buf2 = (wchar_t *) malloc (len * sizeof (wchar_t)); - if (buf == NULL) - { - fprintf (stderr, "%s: out of memory\n", prog_name); - exit (1); - } - - if (path_flag) - { - if (unix_flag) - { - wide_path wpath (filename, false); - err = cygwin_conv_path_list (conv_func, wpath, buf, len); - } - else - err = cygwin_conv_path_list (conv_func, filename, buf2, len); - if (err) - { - fprintf (stderr, "%s: error converting \"%s\" - %s\n", - prog_name, filename, strerror (errno)); - exit (1); - } - if (!unix_flag) - { - my_wcstombs (buf, buf2, 32768); - buf = get_device_paths (tmp = buf); - free (tmp); - if (shortname_flag) - { - buf = get_short_paths (tmp = buf); - free (tmp); - } - if (longname_flag) - { - buf = get_long_paths (tmp = buf); - free (tmp); - } - if (mixed_flag) - convert_slashes (buf); - } - } - else - { - if (unix_flag) - { - wide_path wpath (filename); - err = cygwin_conv_path (conv_func, wpath, (void *) buf, len); - } - else - err = cygwin_conv_path (conv_func, filename, (void *) buf2, len); - if (err) - { - fprintf (stderr, "%s: error converting \"%s\" - %s\n", - prog_name, filename, strerror (errno)); - exit (1); - } - if (!unix_flag) - { - my_wcstombs (buf, buf2, 32768); - buf = get_device_name (tmp = buf); - free (tmp); - if (shortname_flag) - { - buf = get_short_name (tmp = buf); - free (tmp); - } - if (longname_flag) - { - buf = get_long_name (tmp = buf, len); - free (tmp); - } - tmp = buf; - if (strncmp (buf, "\\\\?\\", 4) == 0) - { - len = 0; - if (buf[5] == ':') - len = 4; - else if (!strncmp (buf + 4, "UNC\\", 4)) - len = 6; - if (len && strlen (buf) < MAX_PATH + len) - { - tmp += len; - if (len == 6) - *tmp = '\\'; - print_tmp = true; - } - } - if (mixed_flag) - convert_slashes (tmp); - } - } - - puts (print_tmp ? tmp : buf); - if (buf2) - free (buf2); - if (buf) - free (buf); -} - -static void -print_version () -{ - printf ("cygpath (cygwin) %d.%d.%d\n" - "Path Conversion Utility\n" - "Copyright (C) 1998 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -static int -do_options (int argc, char **argv, int from_file) -{ - int c, o = 0; - path_flag = 0; - unix_flag = 0; - windows_flag = 0; - shortname_flag = 0; - longname_flag = 0; - mixed_flag = 0; - ignore_flag = 0; - allusers_flag = 0; - output_flag = 0; - mode_flag = 0; - codepage = 0; - if (!from_file) - options_from_file_flag = 0; - optind = 0; - while ((c = getopt_long (argc, argv, options, - long_options, (int *) NULL)) != EOF) - { - switch (c) - { - case 'a': - absolute_flag = 1; - break; - - case 'c': - if (!optarg) - usage (stderr, 1); - CloseHandle ((HANDLE) strtoul (optarg, NULL, 16)); - break; - - case 'd': - windows_flag = 1; - shortname_flag = 1; - break; - - case 'f': - if (from_file || !optarg) - usage (stderr, 1); - file_arg = optarg; - break; - - case 'M': - mode_flag = 1; - break; - - case 'o': - if (from_file) - usage (stderr, 1); - options_from_file_flag = 1; - break; - - case 'p': - path_flag = 1; - break; - - case 'u': - unix_flag = 1; - break; - - case 'w': - windows_flag = 1; - break; - - case 'm': - windows_flag = 1; - mixed_flag = 1; - break; - - case 'l': - longname_flag = 1; - break; - - case 's': - shortname_flag = 1; - break; - - case 't': - if (!optarg) - usage (stderr, 1); - - format_type_arg = (*optarg == '=') ? (optarg + 1) : (optarg); - if (strcasecmp (format_type_arg, "dos") == 0) - { - windows_flag = 1; - shortname_flag = 1; - } - else if (!strcasecmp (format_type_arg, "mixed")) - { - windows_flag = 1; - mixed_flag = 1; - } - else if (!strcasecmp (format_type_arg, "unix")) - unix_flag = 1; - else if (!strcasecmp (format_type_arg, "windows")) - windows_flag = 1; - else - usage (stderr, 1); - break; - - case 'A': - allusers_flag = 1; - break; - - case 'C': - if (!optarg) - usage (stderr, 1); - if (!strcasecmp (optarg, "ANSI")) - codepage = GetACP (); - else if (!strcasecmp (optarg, "OEM")) - codepage = GetOEMCP (); - else if (!strcasecmp (optarg, "UTF8") - || !strcasecmp (optarg, "UTF-8")) - codepage = CP_UTF8; - else - { - char *c; - codepage = (UINT) strtoul (optarg, &c, 10); - if (*c) - usage (stderr, 1); - } - break; - - case 'D': - case 'H': - case 'O': - case 'P': - case 'S': - case 'W': - ++output_flag; - o = c; - break; - - case 'F': - if (!optarg) - usage (stderr, 1); - ++output_flag; - output_arg = optarg; - o = c; - break; - - case 'i': - ignore_flag = 1; - break; - - case 'h': - usage (stdout, 0); - break; - - case 'V': - print_version (); - exit (0); - - default: - fprintf (stderr, "Try `%s --help' for more information.\n", - prog_name); - exit (1); - } - } - - /* If none of the "important" flags are set, -u is default. */ - if (!unix_flag && !windows_flag && !mode_flag - && (!from_file ? !options_from_file_flag : 1)) - unix_flag = 1; - - /* Only one of ... */ - if (unix_flag + windows_flag + mode_flag > 1 - + (!from_file ? options_from_file_flag : 0)) - usage (stderr, 1); - - /* options_from_file_flag requires a file. */ - if (!from_file && options_from_file_flag && !file_arg) - usage (stderr, 1); - - /* longname and shortname don't play well together. */ - if (longname_flag && shortname_flag) - usage (stderr, 1); - - /* longname and shortname only make sense with Windows paths. */ - if ((longname_flag || shortname_flag) && !windows_flag) - usage (stderr, 1); - - return o; -} - -static void -action (int argc, char **argv, int opt) -{ - if (output_flag) - { - if (argv[optind]) - usage (stderr, 1); - - do_sysfolders (opt); - } - else - { - if (optind > argc - 1) - usage (stderr, 1); - - for (int i = optind; argv[i]; i++) - if (mode_flag) - report_mode (argv[i]); - else - do_pathconv (argv[i]); - } -} - -int -main (int argc, char **argv) -{ - int o; - - setlocale (LC_CTYPE, ""); - prog_name = program_invocation_short_name; - - o = do_options (argc, argv, 0); - - if (!file_arg) - action (argc, argv, o); - else - { - FILE *fp; - char buf[PATH_MAX * 2 + 1]; - - if (argv[optind]) - usage (stderr, 1); - - if (strcmp (file_arg, "-")) - { - if (!(fp = fopen (file_arg, "rt"))) - { - perror ("cygpath"); - exit (1); - } - } - else - { - fp = stdin; - setmode (0, O_TEXT); - } - setbuf (stdout, NULL); - - while (fgets (buf, sizeof (buf), fp)) - { - int ac = 0; - char *av[4] = { NULL, NULL, NULL, NULL }; - char *p = strchr (buf, '\n'); - if (p) - *p = '\0'; - p = buf; - av[ac++] = prog_name; - av[ac++] = p; - if (options_from_file_flag && *p == '-') - { - while (*p && !isspace (*p)) - ++p; - if (*p) - { - *p++ = '\0'; - while (*p && isspace (*p)) - ++p; - av[ac++] = p; - } - o = do_options (ac, av, 1); - } - else - { - output_flag = 0; - optind = 1; - } - action (ac, av, o); - } - } - exit (0); -} diff --git a/winsup/utils/cygwin-console-helper.cc b/winsup/utils/cygwin-console-helper.cc deleted file mode 100644 index 8f62ed7e6..000000000 --- a/winsup/utils/cygwin-console-helper.cc +++ /dev/null @@ -1,13 +0,0 @@ -#include -int -main (int argc, char **argv) -{ - char *end; - if (argc != 3) - exit (1); - HANDLE h = (HANDLE) strtoul (argv[1], &end, 0); - SetEvent (h); - h = (HANDLE) strtoul (argv[2], &end, 0); - WaitForSingleObject (h, INFINITE); - exit (0); -} diff --git a/winsup/utils/dump_setup.cc b/winsup/utils/dump_setup.cc deleted file mode 100644 index 002c91d9f..000000000 --- a/winsup/utils/dump_setup.cc +++ /dev/null @@ -1,615 +0,0 @@ -/* dump_setup.cc - - Copyright 2001, 2002, 2003, 2004, 2005, 2008, 2010, 2011, 2012 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#define WIN32_NO_STATUS /* Disable status codes in winnt.h since we include - ntstatus.h for extended status codes below. */ -#include -#undef WIN32_NO_STATUS -#include -#include -#include "path.h" -#include - -static int package_len = 20; -static unsigned int version_len = 10; - - -typedef struct -{ - char pkgtar[MAX_PATH + 1]; - char pkg[MAX_PATH + 1]; - char ver[MAX_PATH + 1]; - char tail[MAX_PATH + 1]; - char what[16]; -} fileparse; - -static int -find_tar_ext (const char *path) -{ - char *p = strchr (path, '\0') - 9; - if (p <= path) - return 0; - if ((p = strstr (p, ".tar")) != NULL) - return p - path; - else - return 0; -} - -static char * -base (const char *s) -{ - if (!s) - return 0; - const char *rv = s; - while (*s) - { - if ((*s == '/' || *s == ':' || *s == '\\') && s[1]) - rv = s + 1; - s++; - } - return (char *) rv; -} - -/* Parse a filename into package, version, and extension components. */ -int -parse_filename (const char *in_fn, fileparse& f) -{ - char *p, *ver; - char fn[strlen (in_fn) + 1]; - - strcpy (fn, in_fn); - int n = find_tar_ext (fn); - - if (!n) - return 0; - - strcpy (f.tail, fn + n); - fn[n] = '\0'; - f.pkg[0] = f.what[0] = '\0'; - p = base (fn); - for (ver = p; *ver; ver++) - if (*ver != '-') - continue; - else if (isdigit (ver[1])) - { - *ver++ = '\0'; - strcpy (f.pkg, p); - break; - } - else if (strcasecmp (ver, "-src") == 0 || - strcasecmp (ver, "-patch") == 0) - { - *ver++ = '\0'; - strcpy (f.pkg, p); - strcpy (f.what, strlwr (ver)); - strcpy (f.pkgtar, p); - strcat (f.pkgtar, f.tail); - ver = strchr (ver, '\0'); - break; - } - - if (!f.pkg[0]) - strcpy (f.pkg, p); - - if (!f.what[0]) - { - int n; - p = strchr (ver, '\0'); - strcpy (f.pkgtar, in_fn); - if ((p -= 4) >= ver && strcasecmp (p, "-src") == 0) - n = 4; - else if ((p -= 2) >= ver && strcasecmp (p, "-patch") == 0) - n = 6; - else - n = 0; - if (n) - { - strcpy (f.what, p + 1); - *p = '\0'; - p = f.pkgtar + (p - fn) + n; - memmove (p - 4, p, strlen (p)); - } - } - - strcpy (f.ver, *ver ? ver : "0.0"); - return 1; -} - -static bool -dump_file (const char *msg, const char *fn) -{ - char buf[4096]; - bool printed = false; - bool found = false; - size_t len = strlen (fn); - char *path = cygpath ("/etc/setup/setup.rc", NULL); - FILE *fp = fopen (path, "rt"); - - if (fp) - { - while (fgets (buf, 4096, fp)) - { - if (found) - { - char *bufp = buf; - - if (*bufp == '\t') - ++bufp; - char *p = strchr (bufp, '\0'); - printf ("%s%s%s", msg, bufp, - (p == bufp) || p[-1] != '\n' ? "\n" : ""); - printed = true; - break; - } - if (!strncmp (buf, fn, len) && buf[len] == '\n') - found = true; - } - fclose (fp); - } - return printed; -} - -struct pkgver -{ - char *name; - char *ver; -}; - -extern "C" { -int -compar (const void *a, const void *b) -{ - const pkgver *pa = (const pkgver *) a; - const pkgver *pb = (const pkgver *) b; - return strcasecmp (pa->name, pb->name); -} -} - -int -match_argv (char **argv, const char *name) -{ - if (!argv || !*argv) - return -1; - for (char **a = argv; *a; a++) - if (strcasecmp (*a, name) == 0) - return a - argv + 1; - return 0; -} - -static bool -could_not_access (int verbose, char *filename, char *package, const char *type) -{ - switch (errno) - { - case ENOTDIR: - break; - case ENOENT: - if (verbose) - printf ("Missing %s: /%s from package %s\n", - type, filename, package); - return true; - case EACCES: - if (verbose) - printf ("Unable to access %s /%s from package %s\n", - type, filename, package); - return true; - } - return false; -} - -static const WCHAR tfx_chars[] = { - 0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3, - 0xf000 | 4, 0xf000 | 5, 0xf000 | 6, 0xf000 | 7, - 0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11, - 0xf000 | 12, 0xf000 | 13, 0xf000 | 14, 0xf000 | 15, - 0xf000 | 16, 0xf000 | 17, 0xf000 | 18, 0xf000 | 19, - 0xf000 | 20, 0xf000 | 21, 0xf000 | 22, 0xf000 | 23, - 0xf000 | 24, 0xf000 | 25, 0xf000 | 26, 0xf000 | 27, - 0xf000 | 28, 0xf000 | 29, 0xf000 | 30, 0xf000 | 31, - ' ', '!', 0xf000 | '"', '#', - '$', '%', '&', 39, - '(', ')', 0xf000 | '*', '+', - ',', '-', '.', '\\', - '0', '1', '2', '3', - '4', '5', '6', '7', - '8', '9', 0xf000 | ':', ';', - 0xf000 | '<', '=', 0xf000 | '>', 0xf000 | '?', - '@', 'A', 'B', 'C', - 'D', 'E', 'F', 'G', - 'H', 'I', 'J', 'K', - 'L', 'M', 'N', 'O', - 'P', 'Q', 'R', 'S', - 'T', 'U', 'V', 'W', - 'X', 'Y', 'Z', '[', - '\\', ']', '^', '_', - '`', 'a', 'b', 'c', - 'd', 'e', 'f', 'g', - 'h', 'i', 'j', 'k', - 'l', 'm', 'n', 'o', - 'p', 'q', 'r', 's', - 't', 'u', 'v', 'w', - 'x', 'y', 'z', '{', - 0xf000 | '|', '}', '~', 127 -}; - -static void -transform_chars (PWCHAR path, PWCHAR path_end) -{ - for (; path <= path_end; ++path) - if (*path < 128) - *path = tfx_chars[*path]; -} - -extern "C" NTAPI NTSTATUS NtQueryAttributesFile (POBJECT_ATTRIBUTES, - PFILE_BASIC_INFORMATION); - -/* This function checks for file existance and fills the stat structure - with only the required mode info. We're using a native NT function - here, otherwise we wouldn't be able to check for files with special - characters not valid in Win32, and espacially not valid using the - ANSI API. */ -static int -simple_nt_stat (const char *filename, struct stat *st) -{ - size_t len = mbstowcs (NULL, filename, 0) + 1; - WCHAR path[len + 8]; /* Enough space for the NT prefix */ - PWCHAR p = path; - UNICODE_STRING upath; - OBJECT_ATTRIBUTES attr; - FILE_BASIC_INFORMATION fbi; - NTSTATUS status; - - wcscpy (p, L"\\??\\"); - p += 4; - if (filename[0] == '\\' && filename[1] == '\\') - { - wcscpy (p, L"UNC"); - p += 3; - p += mbstowcs (p, filename + 1, len); - } - else - p += mbstowcs (p, filename, len); - /* Remove trailing backslashes. NT functions don't like them. */ - if (p[-1] == L'\\') - *--p = L'\0'; - /* Skip prefix and drive, otherwise question marks and colons are converted - as well. */ - transform_chars (path + 7, p); - RtlInitUnicodeString (&upath, path); - InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE, NULL, NULL); - status = NtQueryAttributesFile (&attr, &fbi); - if (NT_SUCCESS (status)) - { - st->st_mode = (fbi.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) - ? S_IFDIR : S_IFREG; - return 0; - } - if (status == STATUS_OBJECT_PATH_NOT_FOUND - || status == STATUS_OBJECT_NAME_INVALID - || status == STATUS_BAD_NETWORK_PATH - || status == STATUS_BAD_NETWORK_NAME - || status == STATUS_NO_MEDIA_IN_DEVICE - || status == STATUS_OBJECT_NAME_NOT_FOUND - || status == STATUS_NO_SUCH_FILE) - errno = ENOENT; - else - errno = EACCES; - return -1; -} - -static bool -directory_exists (int verbose, char *filename, char *package) -{ - struct stat status; - if (simple_nt_stat(cygpath("/", filename, NULL), &status)) - { - if (could_not_access (verbose, filename, package, "directory")) - return false; - } - else if (!S_ISDIR(status.st_mode)) - { - if (verbose) - printf ("Directory/file mismatch: /%s from package %s\n", filename, package); - return false; - } - return true; -} - -static bool -file_exists (int verbose, char *filename, const char *alt, char *package) -{ - struct stat status; - if (simple_nt_stat(cygpath("/", filename, NULL), &status) && - (!alt || simple_nt_stat(cygpath("/", filename, alt, NULL), &status))) - { - if (could_not_access (verbose, filename, package, "file")) - return false; - } - else if (!S_ISREG(status.st_mode)) - { - if (verbose) - printf ("File type mismatch: /%s from package %s\n", filename, package); - return false; - } - return true; -} - -static gzFile -open_package_list (char *package) -{ - char filelist[MAX_PATH + 1] = "/etc/setup/"; - strcat (strcat (filelist, package), ".lst.gz"); - if (!file_exists (false, filelist + 1, NULL, NULL)) - return NULL; - - gzFile fp; -#ifndef ZLIB_VERSION - fp = NULL; -#else - char *fn = cygpath (filelist, NULL); - fp = gzopen (fn, "rb9"); - free (fn); -#endif - - return fp; -} - -static bool -check_package_files (int verbose, char *package) -{ - gzFile fp = open_package_list (package); - if (!fp) - { - if (verbose) - printf ("Empty package %s\n", package); - return true; - } - - bool result = true; - char buf[MAX_PATH + 1]; - while (gzgets (fp, buf, MAX_PATH)) - { - char *filename = strtok(buf, "\n"); - - if (*filename == '/') - ++filename; - else if (!strncmp (filename, "./", 2)) - filename += 2; - - if (filename[strlen (filename) - 1] == '/') - { - if (!directory_exists (verbose, filename, package)) - result = false; - } - else if (!strncmp (filename, "etc/postinstall/", 16)) - { - if (!file_exists (verbose, filename, ".done", package)) - result = false; - } - else - { - if (!file_exists (verbose, filename, ".lnk", package)) - result = false; - } - } - - gzclose (fp); - return result; -} - -/** - * Returns a calloc'd sorted list of packages or NULL if no info. - * The last entry in the list is {NULL,NULL}. - */ -static pkgver * -get_packages (char **argv) -{ - char *setup = cygpath ("/etc/setup/installed.db", NULL); - FILE *fp = fopen (setup, "rt"); - - if (fp == NULL) - return NULL; - - int nlines; - nlines = 0; - char buf[4096]; - while (fgets (buf, 4096, fp)) - nlines += 2; /* potentially binary + source */ - if (!nlines) - { - fclose (fp); - return NULL; - } - rewind (fp); - - pkgver *packages; - - packages = (pkgver *) calloc (nlines + 1, sizeof(packages[0])); - int n; - for (n = 0; fgets (buf, 4096, fp) && n < nlines;) - { - char *package = strtok (buf, " "); - if (!package || !*package || !match_argv (argv, package)) - continue; - for (int i = 0; i < 2; i++) - { - fileparse f; - char *tar = strtok (NULL, " "); - if (!tar || !*tar || !parse_filename (tar, f)) - break; - - int len = strlen (package); - if (f.what[0]) - len += strlen (f.what) + 1; - if (len > package_len) - package_len = len; - packages[n].name = (char *) malloc (len + 1); - strcpy (packages[n].name, package); - if (f.what[0]) - strcat (strcat (packages[n].name, "-"), f.what); - packages[n].ver = strdup (f.ver); - if (strlen(f.ver) > version_len) - version_len = strlen(f.ver); - n++; - if (strtok (NULL, " ") == NULL) - break; - } - } - - packages[n].name = packages[n].ver = NULL; - - qsort (packages, n, sizeof (packages[0]), compar); - - fclose (fp); - - return packages; -} - -void -dump_setup (int verbose, char **argv, bool check_files) -{ - pkgver *packages = get_packages(argv); - - puts ("Cygwin Package Information"); - if (packages == NULL) - { - puts ("No setup information found"); - return; - } - - if (verbose) - { - bool need_nl = dump_file ("Last downloaded files to: ", "last-cache"); - if (dump_file ("Last downloaded files from: ", "last-mirror") || need_nl) - puts (""); - } - - printf ("%-*s %-*s%s\n", package_len, "Package", - check_files ? version_len : 7, "Version", - check_files ? " Status" : ""); - for (int i = 0; packages[i].name; i++) - { - if (check_files) - printf ("%-*s %-*s%s\n", package_len, packages[i].name, - version_len, packages[i].ver, - check_package_files (verbose, packages[i].name) - ? " OK" : " Incomplete"); - else - printf ("%-*s %s\n", package_len, packages[i].name, packages[i].ver); - fflush(stdout); - } - - free (packages); - - return; -} - -void -package_list (int verbose, char **argv) -{ - pkgver *packages = get_packages(argv); - if (packages == NULL) - { - puts ("No setup information found"); - return; - } - - for (int i = 0; packages[i].name; i++) - { - gzFile fp = open_package_list (packages[i].name); - if (!fp) - { - if (verbose) - printf ("Can't open file list /etc/setup/%s.lst.gz for package %s\n", - packages[i].name, packages[i].name); - continue; - } - - if (verbose) - printf ("Package: %s-%s\n", packages[i].name, packages[i].ver); - - char buf[MAX_PATH + 1]; - while (gzgets (fp, buf, MAX_PATH)) - { - char *lastchar = strchr(buf, '\n'); - if (lastchar[-1] != '/') - printf ("%s/%s", (verbose?" ":""), buf); - } - - gzclose (fp); - } - - free (packages); - - return; -} - -void -package_find (int verbose, char **argv) -{ - pkgver *packages = get_packages(NULL); - if (packages == NULL) - { - puts ("No setup information found"); - return; - } - - for (int i = 0; packages[i].name; i++) - { - gzFile fp = open_package_list (packages[i].name); - if (!fp) - continue; - - char buf[MAX_PATH + 2]; - buf[0] = '/'; - while (gzgets (fp, buf + 1, MAX_PATH)) - { - char *filename = strtok(buf, "\n"); - int flen = strlen (filename); - if (filename[flen - 1] != '/') - { - // FIXME: verify that /bin is mounted on /usr/bin; ditto for /lib - bool is_alias = !strncmp(filename, "/usr/bin/", 9) || - !strncmp(filename, "/usr/lib/", 9); - int a = match_argv (argv, filename); - if (!a && is_alias) - a = match_argv (argv, filename + 4); - if (!a && !strcmp(filename + flen - 4, ".exe")) - { - filename[flen - 4] = '\0'; - a = match_argv (argv, filename); - } - if (!a && is_alias) - a = match_argv (argv, filename + 4); - if (a > 0) - { - if (verbose) - printf ("%s: found in package ", filename); - printf ("%s-%s\n", packages[i].name, packages[i].ver); - } - } - } - - gzclose (fp); - } - - free (packages); - - return; -} - diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc deleted file mode 100644 index 50df44569..000000000 --- a/winsup/utils/dumper.cc +++ /dev/null @@ -1,950 +0,0 @@ -/* dumper.cc - - Copyright 1999, 2001, 2002, 2004, 2006, 2007, 2011, 2013 Red Hat Inc. - - Written by Egor Duda - - This file is part of Cygwin. - - 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 (file COPYING.dumper) 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 Street - Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include -#define PACKAGE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dumper.h" - -#define NOTE_NAME_SIZE 16 - -typedef struct _note_header - { - Elf_External_Note elf_note_header; - char name[NOTE_NAME_SIZE - 1]; /* external note contains first byte of data */ - } -#ifdef __GNUC__ -__attribute__ ((packed)) -#endif - note_header; - -BOOL verbose = FALSE; - -int deb_printf (const char *format,...) -{ - if (!verbose) - return 0; - va_list va; - va_start (va, format); - int ret_val = vprintf (format, va); - va_end (va); - return ret_val; -} - -dumper::dumper (DWORD pid, DWORD tid, const char *file_name) -{ - this->file_name = strdup (file_name); - - this->pid = pid; - this->tid = tid; - core_bfd = NULL; - excl_list = new exclusion (20); - - list = last = NULL; - - status_section = NULL; - - memory_num = module_num = thread_num = 0; - - hProcess = OpenProcess (PROCESS_ALL_ACCESS, - FALSE, /* no inheritance */ - pid); - if (!hProcess) - { - fprintf (stderr, "Failed to open process #%u, error %ld\n", - (unsigned int) pid, (long) GetLastError ()); - return; - } - - init_core_dump (); - - if (!sane ()) - dumper_abort (); -} - -dumper::~dumper () -{ - close (); - free (file_name); -} - -void -dumper::dumper_abort () -{ - close (); - unlink (file_name); -} - -void -dumper::close () -{ - if (core_bfd) - bfd_close (core_bfd); - if (excl_list) - delete excl_list; - if (hProcess) - CloseHandle (hProcess); - core_bfd = NULL; - hProcess = NULL; - excl_list = NULL; -} - -int -dumper::sane () -{ - if (hProcess == NULL || core_bfd == NULL || excl_list == NULL) - return 0; - return 1; -} - -void -print_section_name (bfd* abfd, asection* sect, PTR obj) -{ - deb_printf (" %s", bfd_get_section_name (abfd, sect)); -} - -void -dumper::print_core_section_list () -{ - deb_printf ("current sections:"); - bfd_map_over_sections (core_bfd, &print_section_name, NULL); - deb_printf ("\n"); -} - -process_entity * -dumper::add_process_entity_to_list (process_entity_type type) -{ - if (!sane ()) - return NULL; - - process_entity *new_entity = (process_entity *) malloc (sizeof (process_entity)); - if (new_entity == NULL) - return NULL; - new_entity->next = NULL; - new_entity->section = NULL; - if (last == NULL) - list = new_entity; - else - last->next = new_entity; - last = new_entity; - return new_entity; -} - -int -dumper::add_thread (DWORD tid, HANDLE hThread) -{ - if (!sane ()) - return 0; - - CONTEXT *pcontext; - - process_entity *new_entity = add_process_entity_to_list (pr_ent_thread); - if (new_entity == NULL) - return 0; - new_entity->type = pr_ent_thread; - thread_num++; - - new_entity->u.thread.tid = tid; - new_entity->u.thread.hThread = hThread; - - pcontext = &(new_entity->u.thread.context); - pcontext->ContextFlags = CONTEXT_FULL | CONTEXT_FLOATING_POINT; - if (!GetThreadContext (hThread, pcontext)) - { - deb_printf ("Failed to read thread context (tid=%x), error %ld\n", tid, GetLastError ()); - return 0; - } - - deb_printf ("added thread %u\n", tid); - return 1; -} - -int -dumper::add_mem_region (LPBYTE base, SIZE_T size) -{ - if (!sane ()) - return 0; - - if (base == NULL || size == 0) - return 1; // just ignore empty regions - - process_entity *new_entity = add_process_entity_to_list (pr_ent_memory); - if (new_entity == NULL) - return 0; - new_entity->type = pr_ent_memory; - memory_num++; - - new_entity->u.memory.base = base; - new_entity->u.memory.size = size; - - deb_printf ("added memory region %p-%p\n", base, base + size); - return 1; -} - -/* split_add_mem_region scans list of regions to be excluded from dumping process - (excl_list) and removes all "excluded" parts from given region. */ -int -dumper::split_add_mem_region (LPBYTE base, SIZE_T size) -{ - if (!sane ()) - return 0; - - if (base == NULL || size == 0) - return 1; // just ignore empty regions - - LPBYTE last_base = base; - - for (process_mem_region * p = excl_list->region; - p < excl_list->region + excl_list->last; - p++) - { - if (p->base >= base + size || p->base + p->size <= base) - continue; - - if (p->base <= base) - { - last_base = p->base + p->size; - continue; - } - - add_mem_region (last_base, p->base - last_base); - last_base = p->base + p->size; - } - - if (last_base < base + size) - add_mem_region (last_base, base + size - last_base); - - return 1; -} - -int -dumper::add_module (LPVOID base_address) -{ - if (!sane ()) - return 0; - - char *module_name = psapi_get_module_name (hProcess, base_address); - if (module_name == NULL) - return 1; - - process_entity *new_entity = add_process_entity_to_list (pr_ent_module); - if (new_entity == NULL) - return 0; - new_entity->type = pr_ent_module; - module_num++; - - new_entity->u.module.base_address = base_address; - new_entity->u.module.name = module_name; - - parse_pe (module_name, excl_list); - - deb_printf ("added module %p %s\n", base_address, module_name); - return 1; -} - -#define PAGE_BUFFER_SIZE 4096 - -int -dumper::collect_memory_sections () -{ - if (!sane ()) - return 0; - - LPBYTE current_page_address; - LPBYTE last_base = (LPBYTE) 0xFFFFFFFF; - SIZE_T last_size = (SIZE_T) 0; - SIZE_T done; - - char mem_buf[PAGE_BUFFER_SIZE]; - - MEMORY_BASIC_INFORMATION mbi; - - if (hProcess == NULL) - return 0; - - for (current_page_address = 0; current_page_address < (LPBYTE) 0xFFFF0000;) - { - if (!VirtualQueryEx (hProcess, current_page_address, &mbi, sizeof (mbi))) - break; - - int skip_region_p = 0; - - if (mbi.Protect & (PAGE_NOACCESS | PAGE_GUARD) || - mbi.State != MEM_COMMIT) - skip_region_p = 1; - - if (!skip_region_p) - { - /* just to make sure that later we'll be able to read it. - According to MS docs either region is all-readable or - all-nonreadable */ - if (!ReadProcessMemory (hProcess, current_page_address, mem_buf, sizeof (mem_buf), &done)) - { - DWORD err = GetLastError (); - const char *pt[10]; - pt[0] = (mbi.Protect & PAGE_READONLY) ? "RO " : ""; - pt[1] = (mbi.Protect & PAGE_READWRITE) ? "RW " : ""; - pt[2] = (mbi.Protect & PAGE_WRITECOPY) ? "WC " : ""; - pt[3] = (mbi.Protect & PAGE_EXECUTE) ? "EX " : ""; - pt[4] = (mbi.Protect & PAGE_EXECUTE_READ) ? "EXRO " : ""; - pt[5] = (mbi.Protect & PAGE_EXECUTE_READWRITE) ? "EXRW " : ""; - pt[6] = (mbi.Protect & PAGE_EXECUTE_WRITECOPY) ? "EXWC " : ""; - pt[7] = (mbi.Protect & PAGE_GUARD) ? "GRD " : ""; - pt[8] = (mbi.Protect & PAGE_NOACCESS) ? "NA " : ""; - pt[9] = (mbi.Protect & PAGE_NOCACHE) ? "NC " : ""; - char buf[10 * 6]; - buf[0] = '\0'; - for (int i = 0; i < 10; i++) - strcat (buf, pt[i]); - - deb_printf ("warning: failed to read memory at %p-%p (protect = %s), error %ld.\n", - current_page_address, - current_page_address + mbi.RegionSize, - buf, err); - skip_region_p = 1; - } - } - - if (!skip_region_p) - { - if (last_base + last_size == current_page_address) - last_size += mbi.RegionSize; - else - { - split_add_mem_region (last_base, last_size); - last_base = (LPBYTE) mbi.BaseAddress; - last_size = mbi.RegionSize; - } - } - else - { - split_add_mem_region (last_base, last_size); - last_base = NULL; - last_size = 0; - } - - current_page_address += mbi.RegionSize; - } - - /* dump last sections, if any */ - split_add_mem_region (last_base, last_size); - return 1; -}; - -int -dumper::dump_memory_region (asection * to, process_mem_region * memory) -{ - if (!sane ()) - return 0; - - SIZE_T size = memory->size; - SIZE_T todo; - SIZE_T done; - LPBYTE pos = memory->base; - DWORD sect_pos = 0; - - if (to == NULL || memory == NULL) - return 0; - - char mem_buf[PAGE_BUFFER_SIZE]; - - while (size > 0) - { - todo = MIN (size, PAGE_BUFFER_SIZE); - if (!ReadProcessMemory (hProcess, pos, mem_buf, todo, &done)) - { - deb_printf ("Failed to read process memory at %x(%x), error %ld\n", pos, todo, GetLastError ()); - return 0; - } - size -= done; - pos += done; - if (!bfd_set_section_contents (core_bfd, to, mem_buf, sect_pos, done)) - { - bfd_perror ("writing memory region to bfd"); - dumper_abort (); - return 0; - }; - sect_pos += done; - } - return 1; -} - -int -dumper::dump_thread (asection * to, process_thread * thread) -{ - if (!sane ()) - return 0; - - if (to == NULL || thread == NULL) - return 0; - - win32_pstatus thread_pstatus; - - note_header header; - bfd_putl32 (NOTE_NAME_SIZE, header.elf_note_header.namesz); - bfd_putl32 (sizeof (thread_pstatus), header.elf_note_header.descsz); - bfd_putl32 (NT_WIN32PSTATUS, header.elf_note_header.type); - strncpy ((char *) &header.elf_note_header.name, "win32thread", NOTE_NAME_SIZE); - - thread_pstatus.data_type = NOTE_INFO_THREAD; - thread_pstatus.data.thread_info.tid = thread->tid; - - if (tid == 0) - { - /* this is a special case. we don't know, which thread - was active when exception occured, so let's blame - the first one */ - thread_pstatus.data.thread_info.is_active_thread = TRUE; - tid = (DWORD) - 1; - } - else if (tid > 0 && thread->tid == tid) - thread_pstatus.data.thread_info.is_active_thread = TRUE; - else - thread_pstatus.data.thread_info.is_active_thread = FALSE; - - memcpy (&(thread_pstatus.data.thread_info.thread_context), - &(thread->context), - sizeof (thread->context)); - - if (!bfd_set_section_contents (core_bfd, to, &header, - 0, - sizeof (header)) || - !bfd_set_section_contents (core_bfd, to, &thread_pstatus, - sizeof (header), - sizeof (thread_pstatus))) - { - bfd_perror ("writing thread info to bfd"); - dumper_abort (); - return 0; - }; - return 1; -} - -int -dumper::dump_module (asection * to, process_module * module) -{ - if (!sane ()) - return 0; - - if (to == NULL || module == NULL) - return 0; - - struct win32_pstatus *module_pstatus_ptr; - - int note_length = sizeof (struct win32_pstatus) + strlen (module->name); - - char *buf = (char *) malloc (note_length); - - if (!buf) - { - fprintf (stderr, "Error alloating memory. Dumping aborted.\n"); - goto out; - }; - - module_pstatus_ptr = (struct win32_pstatus *) buf; - - note_header header; - bfd_putl32 (NOTE_NAME_SIZE, header.elf_note_header.namesz); - bfd_putl32 (note_length, header.elf_note_header.descsz); - bfd_putl32 (NT_WIN32PSTATUS, header.elf_note_header.type); - strncpy ((char *) &header.elf_note_header.name, "win32module", NOTE_NAME_SIZE); - - module_pstatus_ptr->data_type = NOTE_INFO_MODULE; - module_pstatus_ptr->data.module_info.base_address = module->base_address; - module_pstatus_ptr->data.module_info.module_name_size = strlen (module->name) + 1; - strcpy (module_pstatus_ptr->data.module_info.module_name, module->name); - - if (!bfd_set_section_contents (core_bfd, to, &header, - 0, - sizeof (header)) || - !bfd_set_section_contents (core_bfd, to, module_pstatus_ptr, - sizeof (header), - note_length)) - { - bfd_perror ("writing module info to bfd"); - goto out; - }; - return 1; - -out: - if (buf) - free (buf); - dumper_abort (); - return 0; - -} - -int -dumper::collect_process_information () -{ - int exception_level = 0; - - if (!sane ()) - return 0; - - if (!DebugActiveProcess (pid)) - { - fprintf (stderr, "Cannot attach to process #%u, error %ld", - (unsigned int) pid, (long) GetLastError ()); - return 0; - } - - char event_name[sizeof ("cygwin_error_start_event") + 20]; - sprintf (event_name, "cygwin_error_start_event%16x", (unsigned int) pid); - HANDLE sync_with_debugee = OpenEvent (EVENT_MODIFY_STATE, FALSE, event_name); - - DEBUG_EVENT current_event; - - while (1) - { - if (!WaitForDebugEvent (¤t_event, 20000)) - return 0; - - deb_printf ("got debug event %d\n", current_event.dwDebugEventCode); - - switch (current_event.dwDebugEventCode) - { - case CREATE_THREAD_DEBUG_EVENT: - - if (!add_thread (current_event.dwThreadId, - current_event.u.CreateThread.hThread)) - goto failed; - - break; - - case CREATE_PROCESS_DEBUG_EVENT: - - if (!add_module (current_event.u.CreateProcessInfo.lpBaseOfImage) || - !add_thread (current_event.dwThreadId, - current_event.u.CreateProcessInfo.hThread)) - goto failed; - - break; - - case EXIT_PROCESS_DEBUG_EVENT: - - deb_printf ("debugee quits"); - ContinueDebugEvent (current_event.dwProcessId, - current_event.dwThreadId, - DBG_CONTINUE); - - return 1; - - break; - - case LOAD_DLL_DEBUG_EVENT: - - if (!add_module (current_event.u.LoadDll.lpBaseOfDll)) - goto failed; - - break; - - case EXCEPTION_DEBUG_EVENT: - - exception_level++; - if (exception_level == 2) - break; - else if (exception_level > 2) - return 0; - - collect_memory_sections (); - - /* got all info. time to dump */ - - if (!prepare_core_dump ()) - { - fprintf (stderr, "Failed to prepare core dump\n"); - goto failed; - }; - - if (!write_core_dump ()) - { - fprintf (stderr, "Failed to write core dump\n"); - goto failed; - }; - - /* signal a debugee that we've finished */ - if (sync_with_debugee) - SetEvent (sync_with_debugee); - - break; - - default: - - break; - - } - - ContinueDebugEvent (current_event.dwProcessId, - current_event.dwThreadId, - DBG_CONTINUE); - } -failed: - /* set debugee free */ - if (sync_with_debugee) - SetEvent (sync_with_debugee); - - return 0; -} - -int -dumper::init_core_dump () -{ - bfd_init (); - - core_bfd = bfd_openw (file_name, "elf32-i386"); - if (core_bfd == NULL) - { - bfd_perror ("opening bfd"); - goto failed; - } - - if (!bfd_set_format (core_bfd, bfd_core)) - { - bfd_perror ("setting bfd format"); - goto failed; - } - - if (!bfd_set_arch_mach (core_bfd, bfd_arch_i386, 0)) - { - bfd_perror ("setting bfd architecture"); - goto failed; - } - - return 1; - -failed: - dumper_abort (); - return 0; - -} - -int -dumper::prepare_core_dump () -{ - if (!sane ()) - return 0; - - int sect_no = 0; - char sect_name[50]; - - flagword sect_flags; - SIZE_T sect_size; - bfd_vma sect_vma; - - asection *new_section; - - for (process_entity * p = list; p != NULL; p = p->next) - { - sect_no++; - - unsigned long phdr_type = PT_LOAD; - - switch (p->type) - { - case pr_ent_memory: - sprintf (sect_name, ".mem/%u", sect_no); - sect_flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD; - sect_size = p->u.memory.size; - sect_vma = (bfd_vma) (p->u.memory.base); - phdr_type = PT_LOAD; - break; - - case pr_ent_thread: - sprintf (sect_name, ".note/%u", sect_no); - sect_flags = SEC_HAS_CONTENTS | SEC_LOAD; - sect_size = sizeof (note_header) + sizeof (struct win32_pstatus); - sect_vma = 0; - phdr_type = PT_NOTE; - break; - - case pr_ent_module: - sprintf (sect_name, ".note/%u", sect_no); - sect_flags = SEC_HAS_CONTENTS | SEC_LOAD; - sect_size = sizeof (note_header) + sizeof (struct win32_pstatus) + - (bfd_size_type) (strlen (p->u.module.name)); - sect_vma = 0; - phdr_type = PT_NOTE; - break; - - default: - continue; - } - - if (p->type == pr_ent_module && status_section != NULL) - { - if (!bfd_set_section_size (core_bfd, - status_section, - (bfd_get_section_size (status_section) - + sect_size))) - { - bfd_perror ("resizing status section"); - goto failed; - }; - continue; - } - - deb_printf ("creating section (type%u) %s(%u), flags=%08x\n", - p->type, sect_name, sect_size, sect_flags); - - bfd_set_error (bfd_error_no_error); - char *buf = strdup (sect_name); - new_section = bfd_make_section (core_bfd, buf); - if (new_section == NULL) - { - if (bfd_get_error () == bfd_error_no_error) - fprintf (stderr, "error creating new section (%s), section already exists.\n", buf); - else - bfd_perror ("creating section"); - goto failed; - } - - if (!bfd_set_section_flags (core_bfd, new_section, sect_flags) || - !bfd_set_section_size (core_bfd, new_section, sect_size)) - { - bfd_perror ("setting section attributes"); - goto failed; - }; - - new_section->vma = sect_vma; - new_section->lma = 0; - new_section->output_section = new_section; - new_section->output_offset = 0; - p->section = new_section; - int section_count = 1; - - bfd_boolean filehdr = 0; - bfd_boolean phdrs = 0; - - bfd_vma at = 0; - bfd_boolean valid_at = 0; - - flagword flags = 0; - bfd_boolean valid_flags = 1; - - if (p->type == pr_ent_memory) - { - MEMORY_BASIC_INFORMATION mbi; - if (!VirtualQueryEx (hProcess, (LPVOID)sect_vma, &mbi, sizeof (mbi))) - { - bfd_perror ("getting mem region flags"); - goto failed; - } - - static const struct - { - DWORD protect; - flagword flags; - } mappings[] = - { - { PAGE_READONLY, PF_R }, - { PAGE_READWRITE, PF_R | PF_W }, - { PAGE_WRITECOPY, PF_W }, - { PAGE_EXECUTE, PF_X }, - { PAGE_EXECUTE_READ, PF_X | PF_R }, - { PAGE_EXECUTE_READWRITE, PF_X | PF_R | PF_W }, - { PAGE_EXECUTE_WRITECOPY, PF_X | PF_W } - }; - - for (size_t i = 0; - i < sizeof (mappings) / sizeof (mappings[0]); - i++) - if ((mbi.Protect & mappings[i].protect) != 0) - flags |= mappings[i].flags; - } - - if (!bfd_record_phdr (core_bfd, phdr_type, - valid_flags, flags, - valid_at, at, - filehdr, phdrs, - section_count, &new_section)) - { - bfd_perror ("recording program headers"); - goto failed; - } - } - return 1; - -failed: - dumper_abort (); - return 0; -} - -int -dumper::write_core_dump () -{ - if (!sane ()) - return 0; - - for (process_entity * p = list; p != NULL; p = p->next) - { - if (p->section == NULL) - continue; - - deb_printf ("writing section type=%u base=%p size=%p flags=%08x\n", - p->type, - p->section->vma, - bfd_get_section_size (p->section), - p->section->flags); - - switch (p->type) - { - case pr_ent_memory: - dump_memory_region (p->section, &(p->u.memory)); - break; - - case pr_ent_thread: - dump_thread (p->section, &(p->u.thread)); - break; - - case pr_ent_module: - dump_module (p->section, &(p->u.module)); - break; - - default: - continue; - - } - } - return 1; -} - -static void -usage (FILE *stream, int status) -{ - fprintf (stream, "\ -Usage: %s [OPTION] FILENAME WIN32PID\n\ -\n\ -Dump core from WIN32PID to FILENAME.core\n\ -\n\ - -d, --verbose be verbose while dumping\n\ - -h, --help output help information and exit\n\ - -q, --quiet be quiet while dumping (default)\n\ - -V, --version output version information and exit\n\ -\n", program_invocation_short_name); - exit (status); -} - -struct option longopts[] = { - {"verbose", no_argument, NULL, 'd'}, - {"help", no_argument, NULL, 'h'}, - {"quiet", no_argument, NULL, 'q'}, - {"version", no_argument, 0, 'V'}, - {0, no_argument, NULL, 0} -}; -const char *opts = "dhqV"; - -static void -print_version () -{ - printf ("dumper (cygwin) %d.%d.%d\n" - "Core Dumper for Cygwin\n" - "Copyright (C) 1999 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -int -main (int argc, char **argv) -{ - int opt; - const char *p = ""; - DWORD pid; - - while ((opt = getopt_long (argc, argv, opts, longopts, NULL) ) != EOF) - switch (opt) - { - case 'd': - verbose = TRUE; - break; - case 'q': - verbose = FALSE; - break; - case 'h': - usage (stdout, 0); - case 'V': - print_version (); - exit (0); - default: - fprintf (stderr, "Try `%s --help' for more information.\n", - program_invocation_short_name); - exit (1); - } - - if (argv && *(argv + optind) && *(argv + optind +1)) - { - ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE, - *(argv + optind), NULL, 0); - char *win32_name = (char *) alloca (len); - cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE, *(argv + optind), - win32_name, len); - if ((p = strrchr (win32_name, '\\'))) - p++; - else - p = win32_name; - pid = strtoul (*(argv + optind + 1), NULL, 10); - } - else - { - usage (stderr, 1); - return -1; - } - - char *core_file = (char *) malloc (strlen (p) + sizeof (".core")); - if (!core_file) - { - fprintf (stderr, "error allocating memory\n"); - return -1; - } - sprintf (core_file, "%s.core", p); - - DWORD tid = 0; - - if (verbose) - printf ("dumping process #%u to %s\n", (unsigned int) pid, core_file); - - dumper d (pid, tid, core_file); - if (!d.sane ()) - return -1; - d.collect_process_information (); - free (core_file); - - return 0; -}; diff --git a/winsup/utils/dumper.h b/winsup/utils/dumper.h deleted file mode 100644 index b6c70308c..000000000 --- a/winsup/utils/dumper.h +++ /dev/null @@ -1,142 +0,0 @@ -/* dumper.h - - Copyright 1999, 2001, 2013 Red Hat Inc. - - Written by Egor Duda - - This file is part of Cygwin. - - 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 (file COPYING.dumper) 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 Street - Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _DUMPER_H_ -#define _DUMPER_H_ - -#include - -typedef struct -{ - LPBYTE base; - SIZE_T size; -} process_mem_region; - -typedef struct -{ - DWORD tid; - HANDLE hThread; - CONTEXT context; -} process_thread; - -typedef struct -{ - LPVOID base_address; - char* name; -} process_module; - -enum process_entity_type -{ - pr_ent_memory, - pr_ent_thread, - pr_ent_module -}; - -typedef struct _process_entity -{ - process_entity_type type; - union - { - process_thread thread; - process_mem_region memory; - process_module module; - } u; - asection* section; - struct _process_entity* next; -} process_entity; - -class exclusion -{ -public: - size_t last; - size_t size; - size_t step; - process_mem_region* region; - - exclusion ( size_t step ) { last = size = 0; - this->step = step; - region = NULL; } - ~exclusion () { free ( region ); } - int add ( LPBYTE mem_base, SIZE_T mem_size ); - int sort_and_check (); -}; - -#define PAGE_BUFFER_SIZE 4096 - -class dumper -{ - DWORD pid; - DWORD tid; /* thread id of active thread */ - HANDLE hProcess; - process_entity* list; - process_entity* last; - exclusion* excl_list; - - char* file_name; - bfd* core_bfd; - - asection* status_section; - - int memory_num; - int module_num; - int thread_num; - - void close (); - void dumper_abort (); - - process_entity* add_process_entity_to_list ( process_entity_type type ); - int add_thread ( DWORD tid, HANDLE hThread ); - int add_mem_region ( LPBYTE base, SIZE_T size ); - - /* break mem_region by excl_list and add add all subregions */ - int split_add_mem_region ( LPBYTE base, SIZE_T size ); - - int add_module ( LPVOID base_address ); - - int collect_memory_sections (); - int dump_memory_region ( asection* to, process_mem_region* memory ); - int dump_thread ( asection* to, process_thread* thread ); - int dump_module ( asection* to, process_module* module ); - -public: - int sane (); - - int collect_process_information (); - void print_core_section_list (); - - dumper ( DWORD pid, DWORD tid, const char* name ); - ~dumper (); - - int init_core_dump (); - int prepare_core_dump (); - int write_core_dump (); -}; - -extern int deb_printf ( const char* format, ... ); - -extern char* psapi_get_module_name ( HANDLE hProcess, LPVOID BaseAddress ); - -extern int parse_pe ( const char* file_name, exclusion* excl_list ); - -extern BOOL verbose; - -#endif diff --git a/winsup/utils/getconf.c b/winsup/utils/getconf.c deleted file mode 100644 index 7e0b5f595..000000000 --- a/winsup/utils/getconf.c +++ /dev/null @@ -1,605 +0,0 @@ -/*- - * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc. - * Copyright (c) 2011 Red Hat, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by J.T. Conklin. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct conf_variable -{ - const char *name; - enum { SYSCONF, CONFSTR, PATHCONF, CONSTANT } type; - long long value; -}; - -static const struct conf_variable conf_table[] = -{ - /* Symbolic constants from confstr() */ - { "PATH", CONFSTR, _CS_PATH }, - { "POSIX_V7_ILP32_OFF32_CFLAGS", CONFSTR, _CS_POSIX_V7_ILP32_OFF32_CFLAGS }, - { "POSIX_V7_ILP32_OFF32_LDFLAGS", CONFSTR, _CS_POSIX_V7_ILP32_OFF32_LDFLAGS }, - { "POSIX_V7_ILP32_OFF32_LIBS", CONFSTR, _CS_POSIX_V7_ILP32_OFF32_LIBS }, - { "POSIX_V7_ILP32_OFFBIG_CFLAGS", CONFSTR, _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS }, - { "POSIX_V7_ILP32_OFFBIG_LDFLAGS", CONFSTR, _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS }, - { "POSIX_V7_ILP32_OFFBIG_LIBS", CONFSTR, _CS_POSIX_V7_ILP32_OFFBIG_LIBS }, - { "POSIX_V7_LP64_OFF64_CFLAGS", CONFSTR, _CS_POSIX_V7_LP64_OFF64_CFLAGS }, - { "POSIX_V7_LP64_OFF64_LDFLAGS", CONFSTR, _CS_POSIX_V7_LP64_OFF64_LDFLAGS }, - { "POSIX_V7_LP64_OFF64_LIBS", CONFSTR, _CS_POSIX_V7_LP64_OFF64_LIBS }, - { "POSIX_V7_LPBIG_OFFBIG_CFLAGS", CONFSTR, _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS }, - { "POSIX_V7_LPBIG_OFFBIG_LDFLAGS", CONFSTR, _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS }, - { "POSIX_V7_LPBIG_OFFBIG_LIBS", CONFSTR, _CS_POSIX_V7_LPBIG_OFFBIG_LIBS }, - { "POSIX_V7_THREADS_CFLAGS", CONFSTR, _CS_POSIX_V7_THREADS_CFLAGS }, - { "POSIX_V7_THREADS_LDFLAGS", CONFSTR, _CS_POSIX_V7_THREADS_LDFLAGS }, - { "POSIX_V7_WIDTH_RESTRICTED_ENVS", CONFSTR, _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS }, - { "POSIX_V6_ILP32_OFF32_CFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFF32_CFLAGS }, - { "POSIX_V6_ILP32_OFF32_LDFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS }, - { "POSIX_V6_ILP32_OFF32_LIBS", CONFSTR, _CS_POSIX_V6_ILP32_OFF32_LIBS }, - { "POSIX_V6_ILP32_OFFBIG_CFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS }, - { "POSIX_V6_ILP32_OFFBIG_LDFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS }, - { "POSIX_V6_ILP32_OFFBIG_LIBS", CONFSTR, _CS_POSIX_V6_ILP32_OFFBIG_LIBS }, - { "POSIX_V6_LP64_OFF64_CFLAGS", CONFSTR, _CS_POSIX_V6_LP64_OFF64_CFLAGS }, - { "POSIX_V6_LP64_OFF64_LDFLAGS", CONFSTR, _CS_POSIX_V6_LP64_OFF64_LDFLAGS }, - { "POSIX_V6_LP64_OFF64_LIBS", CONFSTR, _CS_POSIX_V6_LP64_OFF64_LIBS }, - { "POSIX_V6_LPBIG_OFFBIG_CFLAGS", CONFSTR, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS }, - { "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", CONFSTR, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS }, - { "POSIX_V6_LPBIG_OFFBIG_LIBS", CONFSTR, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS }, - { "POSIX_V6_WIDTH_RESTRICTED_ENVS", CONFSTR, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS }, - { "XBS5_ILP32_OFF32_CFLAGS", CONFSTR, _CS_XBS5_ILP32_OFF32_CFLAGS }, - { "XBS5_ILP32_OFF32_LDFLAGS", CONFSTR, _CS_XBS5_ILP32_OFF32_LDFLAGS }, - { "XBS5_ILP32_OFF32_LIBS", CONFSTR, _CS_XBS5_ILP32_OFF32_LIBS }, - { "XBS5_ILP32_OFF32_LINTFLAGS", CONFSTR, _CS_XBS5_ILP32_OFF32_LINTFLAGS }, - { "XBS5_ILP32_OFFBIG_CFLAGS", CONFSTR, _CS_XBS5_ILP32_OFFBIG_CFLAGS }, - { "XBS5_ILP32_OFFBIG_LDFLAGS", CONFSTR, _CS_XBS5_ILP32_OFFBIG_LDFLAGS }, - { "XBS5_ILP32_OFFBIG_LIBS", CONFSTR, _CS_XBS5_ILP32_OFFBIG_LIBS }, - { "XBS5_ILP32_OFFBIG_LINTFLAGS", CONFSTR, _CS_XBS5_ILP32_OFFBIG_LINTFLAGS }, - { "XBS5_LP64_OFF64_CFLAGS", CONFSTR, _CS_XBS5_LP64_OFF64_CFLAGS }, - { "XBS5_LP64_OFF64_LDFLAGS", CONFSTR, _CS_XBS5_LP64_OFF64_LDFLAGS }, - { "XBS5_LP64_OFF64_LIBS", CONFSTR, _CS_XBS5_LP64_OFF64_LIBS }, - { "XBS5_LP64_OFF64_LINTFLAGS", CONFSTR, _CS_XBS5_LP64_OFF64_LINTFLAGS }, - { "XBS5_LPBIG_OFFBIG_CFLAGS", CONFSTR, _CS_XBS5_LPBIG_OFFBIG_CFLAGS }, - { "XBS5_LPBIG_OFFBIG_LDFLAGS", CONFSTR, _CS_XBS5_LPBIG_OFFBIG_LDFLAGS }, - { "XBS5_LPBIG_OFFBIG_LIBS", CONFSTR, _CS_XBS5_LPBIG_OFFBIG_LIBS }, - { "XBS5_LPBIG_OFFBIG_LINTFLAGS", CONFSTR, _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS }, - { "XBS5_WIDTH_RESTRICTED_ENVS", CONFSTR, _CS_XBS5_WIDTH_RESTRICTED_ENVS }, - { "V7_ENV", CONFSTR, _CS_V7_ENV }, - { "V6_ENV", CONFSTR, _CS_V6_ENV }, - - /* Symbolic constants from */ - { "_POSIX_AIO_LISTIO_MAX", CONSTANT, _POSIX_AIO_LISTIO_MAX }, - { "_POSIX_AIO_MAX", CONSTANT, _POSIX_AIO_MAX }, - { "_POSIX_ARG_MAX", CONSTANT, _POSIX_ARG_MAX }, - { "_POSIX_CHILD_MAX", CONSTANT, _POSIX_CHILD_MAX }, - { "_POSIX_CLOCKRES_MIN", CONSTANT, _POSIX_CLOCKRES_MIN }, - { "_POSIX_DELAYTIMER_MAX", CONSTANT, _POSIX_DELAYTIMER_MAX }, - { "_POSIX_HOST_NAME_MAX", CONSTANT, _POSIX_HOST_NAME_MAX }, - { "_POSIX_LINK_MAX", CONSTANT, _POSIX_LINK_MAX }, - { "_POSIX_LOGIN_NAME_MAX", CONSTANT, _POSIX_LOGIN_NAME_MAX }, - { "_POSIX_MAX_CANON", CONSTANT, _POSIX_MAX_CANON }, - { "_POSIX_MAX_INPUT", CONSTANT, _POSIX_MAX_INPUT }, - { "_POSIX_MQ_OPEN_MAX", CONSTANT, _POSIX_MQ_OPEN_MAX }, - { "_POSIX_MQ_PRIO_MAX", CONSTANT, _POSIX_MQ_PRIO_MAX }, - { "_POSIX_NAME_MAX", CONSTANT, _POSIX_NAME_MAX }, - { "_POSIX_NGROUPS_MAX", CONSTANT, _POSIX_NGROUPS_MAX }, - { "_POSIX_OPEN_MAX", CONSTANT, _POSIX_OPEN_MAX }, - { "_POSIX_PATH_MAX", CONSTANT, _POSIX_PATH_MAX }, - { "_POSIX_PIPE_BUF", CONSTANT, _POSIX_PIPE_BUF }, - { "_POSIX_RE_DUP_MAX", CONSTANT, _POSIX_RE_DUP_MAX }, - { "_POSIX_RTSIG_MAX", CONSTANT, _POSIX_RTSIG_MAX }, - { "_POSIX_SEM_NSEMS_MAX", CONSTANT, _POSIX_SEM_NSEMS_MAX }, - { "_POSIX_SEM_VALUE_MAX", CONSTANT, _POSIX_SEM_VALUE_MAX }, - { "_POSIX_SIGQUEUE_MAX", CONSTANT, _POSIX_SIGQUEUE_MAX }, - { "_POSIX_SSIZE_MAX", CONSTANT, _POSIX_SSIZE_MAX }, - { "_POSIX_SS_REPL_MAX", CONSTANT, _POSIX_SS_REPL_MAX }, - { "_POSIX_STREAM_MAX", CONSTANT, _POSIX_STREAM_MAX }, - { "_POSIX_SYMLINK_MAX", CONSTANT, _POSIX_SYMLINK_MAX }, - { "_POSIX_SYMLOOP_MAX", CONSTANT, _POSIX_SYMLOOP_MAX }, - { "_POSIX_THREAD_DESTRUCTOR_ITERATIONS", CONSTANT, _POSIX_THREAD_DESTRUCTOR_ITERATIONS }, - { "_POSIX_THREAD_KEYS_MAX", CONSTANT, _POSIX_THREAD_KEYS_MAX }, - { "_POSIX_THREAD_THREADS_MAX", CONSTANT, _POSIX_THREAD_THREADS_MAX }, - { "_POSIX_TIMER_MAX", CONSTANT, _POSIX_TIMER_MAX }, - { "_POSIX_TRACE_EVENT_NAME_MAX", CONSTANT, _POSIX_TRACE_EVENT_NAME_MAX }, - { "_POSIX_TRACE_NAME_MAX", CONSTANT, _POSIX_TRACE_NAME_MAX }, - { "_POSIX_TRACE_SYS_MAX", CONSTANT, _POSIX_TRACE_SYS_MAX }, - { "_POSIX_TRACE_USER_EVENT_MAX", CONSTANT, _POSIX_TRACE_USER_EVENT_MAX }, - { "_POSIX_TTY_NAME_MAX", CONSTANT, _POSIX_TTY_NAME_MAX }, - { "_POSIX_TZNAME_MAX", CONSTANT, _POSIX_TZNAME_MAX }, - { "_POSIX2_BC_BASE_MAX", CONSTANT, _POSIX2_BC_BASE_MAX }, - { "_POSIX2_BC_DIM_MAX", CONSTANT, _POSIX2_BC_DIM_MAX }, - { "_POSIX2_BC_SCALE_MAX", CONSTANT, _POSIX2_BC_SCALE_MAX }, - { "_POSIX2_BC_STRING_MAX", CONSTANT, _POSIX2_BC_STRING_MAX }, - { "_POSIX2_COLL_WEIGHTS_MAX", CONSTANT, _POSIX2_COLL_WEIGHTS_MAX }, - { "_POSIX2_EXPR_NEXT_MAX", CONSTANT, _POSIX2_EXPR_NEST_MAX }, - { "_POSIX2_LINE_MAX", CONSTANT, _POSIX2_LINE_MAX }, - { "_POSIX2_RE_DUP_MAX", CONSTANT, _POSIX2_RE_DUP_MAX }, - { "_XOPEN_IOV_MAX", CONSTANT, _XOPEN_IOV_MAX }, - { "_XOPEN_NAME_MAX", CONSTANT, _XOPEN_NAME_MAX }, - { "_XOPEN_PATH_MAX", CONSTANT, _XOPEN_PATH_MAX }, - { "CHAR_BIT", CONSTANT, CHAR_BIT }, - { "CHAR_MAX", CONSTANT, CHAR_MAX }, - { "CHAR_MIN", CONSTANT, CHAR_MIN }, - { "INT_MAX", CONSTANT, INT_MAX }, - { "INT_MIN", CONSTANT, INT_MIN }, - { "LLONG_MIN", CONSTANT, LLONG_MIN }, - { "LLONG_MAX", CONSTANT, LLONG_MAX }, - { "LONG_BIT", CONSTANT, LONG_BIT }, - { "LONG_MAX", CONSTANT, LONG_MAX }, - { "LONG_MIN", CONSTANT, LONG_MIN }, - { "MB_LEN_MAX", CONSTANT, MB_LEN_MAX }, - { "SCHAR_MAX", CONSTANT, SCHAR_MAX }, - { "SCHAR_MIN", CONSTANT, SCHAR_MIN }, - { "SHRT_MAX", CONSTANT, SHRT_MAX }, - { "SHRT_MIN", CONSTANT, SHRT_MIN }, - { "SSIZE_MAX", CONSTANT, SSIZE_MAX }, - { "UCHAR_MAX", CONSTANT, UCHAR_MAX }, - { "UINT_MAX", CONSTANT, UINT_MAX }, - { "ULLONG_MAX", CONSTANT, ULLONG_MAX }, - { "ULONG_MAX", CONSTANT, ULONG_MAX }, - { "USHRT_MAX", CONSTANT, USHRT_MAX }, - { "WORD_BIT", CONSTANT, WORD_BIT }, - { "NL_ARGMAX", CONSTANT, NL_ARGMAX }, - { "ML_LANGMAX", CONSTANT, NL_LANGMAX }, - { "NL_MSGMAX", CONSTANT, NL_MSGMAX }, - { "NL_SETMAX", CONSTANT, NL_SETMAX }, - { "NL_TEXTMAX", CONSTANT, NL_TEXTMAX }, - { "NZERO", CONSTANT, NZERO }, - /* required by POSIX.1-2008 for compatibility with earlier versions */ - { "POSIX2_BC_BASE_MAX", CONSTANT, _POSIX2_BC_BASE_MAX }, - { "POSIX2_BC_DIM_MAX", CONSTANT, _POSIX2_BC_DIM_MAX }, - { "POSIX2_BC_SCALE_MAX", CONSTANT, _POSIX2_BC_SCALE_MAX }, - { "POSIX2_BC_STRING_MAX", CONSTANT, _POSIX2_BC_STRING_MAX }, - { "POSIX2_COLL_WEIGHTS_MAX", CONSTANT, _POSIX2_COLL_WEIGHTS_MAX }, - { "POSIX2_EXPR_NEXT_MAX", CONSTANT, _POSIX2_EXPR_NEST_MAX }, - { "POSIX2_LINE_MAX", CONSTANT, _POSIX2_LINE_MAX }, - { "POSIX2_RE_DUP_MAX", CONSTANT, _POSIX2_RE_DUP_MAX }, - - /* Variables from fpathconf() */ - { "FILESIZEBITS", PATHCONF, _PC_FILESIZEBITS }, - { "LINK_MAX", PATHCONF, _PC_LINK_MAX }, - { "MAX_CANON", PATHCONF, _PC_MAX_CANON }, - { "MAX_INPUT", PATHCONF, _PC_MAX_INPUT }, - { "NAME_MAX", PATHCONF, _PC_NAME_MAX }, - { "PATH_MAX", PATHCONF, _PC_PATH_MAX }, - { "PIPE_BUF", PATHCONF, _PC_PIPE_BUF }, - { "POSIX2_SYMLINKS", PATHCONF, _PC_2_SYMLINKS }, - { "POSIX_ALLOC_SIZE_MIN", PATHCONF, _PC_ALLOC_SIZE_MIN }, - { "POSIX_REC_INCR_XFER_SIZE", PATHCONF, _PC_REC_INCR_XFER_SIZE }, - { "POSIX_REC_MAX_XFER_SIZE", PATHCONF, _PC_REC_MAX_XFER_SIZE }, - { "POSIX_REC_MIN_XFER_SIZE", PATHCONF, _PC_REC_MIN_XFER_SIZE }, - { "POSIX_REC_XFER_ALIGN", PATHCONF, _PC_REC_XFER_ALIGN }, - { "SYMLINK_MAX", PATHCONF, _PC_SYMLINK_MAX }, - { "_POSIX_CHOWN_RESTRICTED", PATHCONF, _PC_CHOWN_RESTRICTED }, - { "_POSIX_NO_TRUNC", PATHCONF, _PC_NO_TRUNC }, - { "_POSIX_VDISABLE", PATHCONF, _PC_VDISABLE }, - { "_POSIX_ASYNC_IO", PATHCONF, _PC_ASYNC_IO }, - { "_POSIX_PRIO_IO", PATHCONF, _PC_PRIO_IO }, - { "_POSIX_SYNC_IO", PATHCONF, _PC_SYNC_IO }, - { "_POSIX_TIMESTAMP_RESOLUTION", PATHCONF, _PC_TIMESTAMP_RESOLUTION }, - - /* Variables from sysconf() */ - { "AIO_LISTIO_MAX", SYSCONF, _SC_AIO_LISTIO_MAX }, - { "AIO_MAX", SYSCONF, _SC_AIO_MAX }, - { "AIO_PRIO_DELTA_MAX", SYSCONF, _SC_AIO_PRIO_DELTA_MAX }, - { "ARG_MAX", SYSCONF, _SC_ARG_MAX }, - { "ATEXIT_MAX", SYSCONF, _SC_ATEXIT_MAX }, - { "BC_BASE_MAX", SYSCONF, _SC_BC_BASE_MAX }, - { "BC_DIM_MAX", SYSCONF, _SC_BC_DIM_MAX }, - { "BC_SCALE_MAX", SYSCONF, _SC_BC_SCALE_MAX }, - { "BC_STRING_MAX", SYSCONF, _SC_BC_STRING_MAX }, - { "CHILD_MAX", SYSCONF, _SC_CHILD_MAX }, - { "CLK_TCK", SYSCONF, _SC_CLK_TCK }, - { "COLL_WEIGHTS_MAX", SYSCONF, _SC_COLL_WEIGHTS_MAX }, - { "DELAYTIMER_MAX", SYSCONF, _SC_DELAYTIMER_MAX }, - { "EXPR_NEST_MAX", SYSCONF, _SC_EXPR_NEST_MAX }, - { "GETGR_R_SIZE_MAX", SYSCONF, _SC_GETGR_R_SIZE_MAX }, - { "GETPW_R_SIZE_MAX", SYSCONF, _SC_GETPW_R_SIZE_MAX }, - { "HOST_NAME_MAX", SYSCONF, _SC_HOST_NAME_MAX }, - { "IOV_MAX", SYSCONF, _SC_IOV_MAX }, - { "LINE_MAX", SYSCONF, _SC_LINE_MAX }, - { "LOGIN_NAME_MAX", SYSCONF, _SC_LOGIN_NAME_MAX }, - { "MQ_OPEN_MAX", SYSCONF, _SC_MQ_OPEN_MAX }, - { "MQ_PRIO_MAX", SYSCONF, _SC_MQ_PRIO_MAX }, - { "NGROUPS_MAX", SYSCONF, _SC_NGROUPS_MAX }, - { "OPEN_MAX", SYSCONF, _SC_OPEN_MAX }, - { "PAGE_SIZE", SYSCONF, _SC_PAGESIZE }, - { "PAGESIZE", SYSCONF, _SC_PAGESIZE }, - { "PTHREAD_DESTRUCTOR_ITERATIONS", SYSCONF, _SC_THREAD_DESTRUCTOR_ITERATIONS }, - { "PTHREAD_KEYS_MAX", SYSCONF, _SC_THREAD_KEYS_MAX }, - { "PTHREAD_STACK_MIN", SYSCONF, _SC_THREAD_STACK_MIN }, - { "PTHREAD_THREADS_MAX", SYSCONF, _SC_THREAD_THREADS_MAX }, - { "RE_DUP_MAX", SYSCONF, _SC_RE_DUP_MAX }, - { "RTSIG_MAX", SYSCONF, _SC_RTSIG_MAX }, - { "SEM_NSEMS_MAX", SYSCONF, _SC_SEM_NSEMS_MAX }, - { "SEM_VALUE_MAX", SYSCONF, _SC_SEM_VALUE_MAX }, - { "SIGQUEUE_MAX", SYSCONF, _SC_SIGQUEUE_MAX }, - { "STREAM_MAX", SYSCONF, _SC_STREAM_MAX }, - { "SYMLOOP_MAX", SYSCONF, _SC_SYMLOOP_MAX }, - { "TIMER_MAX", SYSCONF, _SC_TIMER_MAX }, - { "TTY_NAME_MAX", SYSCONF, _SC_TTY_NAME_MAX }, - { "TZNAME_MAX", SYSCONF, _SC_TZNAME_MAX }, - { "_POSIX_ADVISORY_INFO", SYSCONF, _SC_ADVISORY_INFO }, - { "_POSIX_ASYNCHRONOUS_IO", SYSCONF, _SC_ASYNCHRONOUS_IO }, - { "_POSIX_BARRIERS", SYSCONF, _SC_BARRIERS }, - { "_POSIX_CLOCK_SELECTION", SYSCONF, _SC_CLOCK_SELECTION }, - { "_POSIX_CPUTIME", SYSCONF, _SC_CPUTIME }, - { "_POSIX_FSYNC", SYSCONF, _SC_FSYNC }, - { "_POSIX_IPV6", SYSCONF, _SC_IPV6 }, - { "_POSIX_JOB_CONTROL", SYSCONF, _SC_JOB_CONTROL }, - { "_POSIX_MAPPED_FILES", SYSCONF, _SC_MAPPED_FILES }, - { "_POSIX_MEMLOCK", SYSCONF, _SC_MEMLOCK }, - { "_POSIX_MEMLOCK_RANGE", SYSCONF, _SC_MEMLOCK_RANGE }, - { "_POSIX_MEMORY_PROTECTION", SYSCONF, _SC_MEMORY_PROTECTION }, - { "_POSIX_MESSAGE_PASSING", SYSCONF, _SC_MESSAGE_PASSING }, - { "_POSIX_MONOTONIC_CLOCK", SYSCONF, _SC_MONOTONIC_CLOCK }, - { "_POSIX_PRIORITIZED_IO", SYSCONF, _SC_PRIORITIZED_IO }, - { "_POSIX_PRIORITY_SCHEDULING", SYSCONF, _SC_PRIORITY_SCHEDULING }, - { "_POSIX_RAW_SOCKETS", SYSCONF, _SC_RAW_SOCKETS }, - { "_POSIX_READER_WRITER_LOCKS", SYSCONF, _SC_READER_WRITER_LOCKS }, - { "_POSIX_REALTIME_SIGNALS", SYSCONF, _SC_REALTIME_SIGNALS }, - { "_POSIX_REGEXP", SYSCONF, _SC_REGEXP }, - { "_POSIX_SAVED_IDS", SYSCONF, _SC_SAVED_IDS }, - { "_POSIX_SEMAPHORES", SYSCONF, _SC_SEMAPHORES }, - { "_POSIX_SHARED_MEMORY_OBJECTS", SYSCONF, _SC_SHARED_MEMORY_OBJECTS }, - { "_POSIX_SHELL", SYSCONF, _SC_SHELL }, - { "_POSIX_SPAWN", SYSCONF, _SC_SPAWN }, - { "_POSIX_SPIN_LOCKS", SYSCONF, _SC_SPIN_LOCKS }, - { "_POSIX_SPORADIC_SERVER", SYSCONF, _SC_SPORADIC_SERVER }, - { "_POSIX_SS_REPL_MAX", SYSCONF, _SC_SS_REPL_MAX }, - { "_POSIX_SYNCHRONIZED_IO", SYSCONF, _SC_SYNCHRONIZED_IO }, - { "_POSIX_THREAD_ATTR_STACKADDR", SYSCONF, _SC_THREAD_ATTR_STACKADDR }, - { "_POSIX_THREAD_ATTR_STACKSIZE", SYSCONF, _SC_THREAD_ATTR_STACKSIZE }, - { "_POSIX_THREAD_CPUTIME", SYSCONF, _SC_THREAD_CPUTIME }, - { "_POSIX_THREAD_PRIO_INHERIT", SYSCONF, _SC_THREAD_PRIO_INHERIT }, - { "_POSIX_THREAD_PRIO_PROTECT", SYSCONF, _SC_THREAD_PRIO_PROTECT }, - { "_POSIX_THREAD_PRIORITY_SCHEDULING",SYSCONF, _SC_THREAD_PRIORITY_SCHEDULING }, - { "_POSIX_THREAD_PROCESS_SHARED", SYSCONF, _SC_THREAD_PROCESS_SHARED }, - { "_POSIX_THREAD_ROBUST_PRIO_INHERIT",SYSCONF, _SC_THREAD_ROBUST_PRIO_INHERIT }, - { "_POSIX_THREAD_ROBUST_PRIO_PROTECT",SYSCONF, _SC_THREAD_ROBUST_PRIO_PROTECT }, - { "_POSIX_THREAD_SAFE_FUNCTIONS", SYSCONF, _SC_THREAD_SAFE_FUNCTIONS }, - { "_POSIX_THREAD_SPORADIC_SERVER", SYSCONF, _SC_THREAD_SPORADIC_SERVER }, - { "_POSIX_THREADS", SYSCONF, _SC_THREADS }, - { "_POSIX_TIMEOUTS", SYSCONF, _SC_TIMEOUTS }, - { "_POSIX_TIMERS", SYSCONF, _SC_TIMERS }, - { "_POSIX_TRACE", SYSCONF, _SC_TRACE }, - { "_POSIX_TRACE_EVENT_FILTER", SYSCONF, _SC_TRACE_EVENT_FILTER }, - { "_POSIX_TRACE_EVENT_NAME_MAX", SYSCONF, _SC_TRACE_EVENT_NAME_MAX }, - { "_POSIX_TRACE_INHERIT", SYSCONF, _SC_TRACE_INHERIT }, - { "_POSIX_TRACE_LOG", SYSCONF, _SC_TRACE_LOG }, - { "_POSIX_TRACE_NAME_MAX", SYSCONF, _SC_TRACE_NAME_MAX }, - { "_POSIX_TRACE_SYS_MAX", SYSCONF, _SC_TRACE_SYS_MAX }, - { "_POSIX_TRACE_USER_EVENT_MAX", SYSCONF, _SC_TRACE_USER_EVENT_MAX }, - { "_POSIX_TYPED_MEMORY_OBJECTS", SYSCONF, _SC_TYPED_MEMORY_OBJECTS }, - { "_POSIX_VERSION", SYSCONF, _SC_VERSION }, - { "_POSIX_V7_ILP32_OFF32", SYSCONF, _SC_V7_ILP32_OFF32 }, - { "_POSIX_V7_ILP32_OFFBIG", SYSCONF, _SC_V7_ILP32_OFFBIG }, - { "_POSIX_V7_LP64_OFF64", SYSCONF, _SC_V7_LP64_OFF64 }, - { "_POSIX_V7_LPBIG_OFFBIG", SYSCONF, _SC_V7_LPBIG_OFFBIG }, - { "_POSIX_V6_ILP32_OFF32", SYSCONF, _SC_V6_ILP32_OFF32 }, - { "_POSIX_V6_ILP32_OFFBIG", SYSCONF, _SC_V6_ILP32_OFFBIG }, - { "_POSIX_V6_LP64_OFF64", SYSCONF, _SC_V6_LP64_OFF64 }, - { "_POSIX_V6_LPBIG_OFFBIG", SYSCONF, _SC_V6_LPBIG_OFFBIG }, - { "_POSIX2_C_BIND", SYSCONF, _SC_2_C_BIND }, - { "_POSIX2_C_DEV", SYSCONF, _SC_2_C_DEV }, - { "_POSIX2_CHAR_TERM", SYSCONF, _SC_2_CHAR_TERM }, - { "_POSIX2_FORT_DEV", SYSCONF, _SC_2_FORT_DEV }, - { "_POSIX2_FORT_RUN", SYSCONF, _SC_2_FORT_RUN }, - { "_POSIX2_LOCALEDEF", SYSCONF, _SC_2_LOCALEDEF }, - { "_POSIX2_PBS", SYSCONF, _SC_2_PBS }, - { "_POSIX2_PBS_ACCOUNTING", SYSCONF, _SC_2_PBS_ACCOUNTING }, - { "_POSIX2_PBS_CHECKPOINT", SYSCONF, _SC_2_PBS_CHECKPOINT }, - { "_POSIX2_PBS_LOCATE", SYSCONF, _SC_2_PBS_LOCATE }, - { "_POSIX2_PBS_MESSAGE", SYSCONF, _SC_2_PBS_MESSAGE }, - { "_POSIX2_PBS_TRACK", SYSCONF, _SC_2_PBS_TRACK }, - { "_POSIX2_SW_DEV", SYSCONF, _SC_2_SW_DEV }, - { "_POSIX2_UPE", SYSCONF, _SC_2_UPE }, - { "_POSIX2_VERSION", SYSCONF, _SC_2_VERSION }, - { "_XBS5_ILP32_OFF32", SYSCONF, _SC_XBS5_ILP32_OFF32 }, - { "_XBS5_ILP32_OFFBIG", SYSCONF, _SC_XBS5_ILP32_OFFBIG }, - { "_XBS5_LP64_OFF64", SYSCONF, _SC_XBS5_LP64_OFF64 }, - { "_XBS5_LPBIG_OFFBIG", SYSCONF, _SC_XBS5_LPBIG_OFFBIG }, - { "_XOPEN_CRYPT", SYSCONF, _SC_XOPEN_CRYPT }, - { "_XOPEN_ENH_I18N", SYSCONF, _SC_XOPEN_ENH_I18N }, - { "_XOPEN_LEGACY", SYSCONF, _SC_XOPEN_LEGACY }, - { "_XOPEN_REALTIME", SYSCONF, _SC_XOPEN_REALTIME }, - { "_XOPEN_REALTIME_THREADS", SYSCONF, _SC_XOPEN_REALTIME_THREADS }, - { "_XOPEN_SHM", SYSCONF, _SC_XOPEN_SHM }, - { "_XOPEN_STREAMS", SYSCONF, _SC_XOPEN_STREAMS }, - { "_XOPEN_UNIX", SYSCONF, _SC_XOPEN_UNIX }, - { "_XOPEN_UUCP", SYSCONF, _SC_XOPEN_UUCP }, - { "_XOPEN_VERSION", SYSCONF, _SC_XOPEN_VERSION }, - /* for compatibility with earlier versions */ - { "POSIX2_C_BIND", SYSCONF, _SC_2_C_BIND }, - { "POSIX2_C_DEV", SYSCONF, _SC_2_C_DEV }, - { "POSIX2_CHAR_TERM", SYSCONF, _SC_2_CHAR_TERM }, - { "POSIX2_FORT_DEV", SYSCONF, _SC_2_FORT_DEV }, - { "POSIX2_FORT_RUN", SYSCONF, _SC_2_FORT_RUN }, - { "POSIX2_LOCALEDEF", SYSCONF, _SC_2_LOCALEDEF }, - { "POSIX2_PBS", SYSCONF, _SC_2_PBS }, - { "POSIX2_PBS_ACCOUNTING", SYSCONF, _SC_2_PBS_ACCOUNTING }, - { "POSIX2_PBS_CHECKPOINT", SYSCONF, _SC_2_PBS_CHECKPOINT }, - { "POSIX2_PBS_LOCATE", SYSCONF, _SC_2_PBS_LOCATE }, - { "POSIX2_PBS_MESSAGE", SYSCONF, _SC_2_PBS_MESSAGE }, - { "POSIX2_PBS_TRACK", SYSCONF, _SC_2_PBS_TRACK }, - { "POSIX2_SW_DEV", SYSCONF, _SC_2_SW_DEV }, - { "POSIX2_UPE", SYSCONF, _SC_2_UPE }, - { "POSIX2_VERSION", SYSCONF, _SC_2_VERSION }, - /* implementation-specific values */ - { "_NPROCESSORS_CONF", SYSCONF, _SC_NPROCESSORS_CONF }, - { "_NPROCESSORS_ONLN", SYSCONF, _SC_NPROCESSORS_ONLN }, - { "_AVPHYS_PAGES", SYSCONF, _SC_AVPHYS_PAGES }, - { "_PHYS_PAGES", SYSCONF, _SC_PHYS_PAGES }, - - { NULL, CONSTANT, 0L } -}; - -struct spec_variable { - const char *name; - int valid; -}; - -static const struct spec_variable spec_table[] = { - { "POSIX_V7_ILP32_OFF32", 0 }, - { "POSIX_V7_ILP32_OFFBIG", 1 }, - { "POSIX_V7_LP64_OFF64", 0 }, - { "POSIX_V7_LPBIG_OFFBIG", 0 }, - { "POSIX_V6_ILP32_OFF32", 0 }, - { "POSIX_V6_ILP32_OFFBIG", 1 }, - { "POSIX_V6_LP64_OFF64", 0 }, - { "POSIX_V6_LPBIG_OFFBIG", 0 }, - { "XBS5_ILP32_OFF32", 0 }, - { "XBS5_ILP32_OFFBIG", 1 }, - { "XBS5_LP64_OFF64", 0 }, - { "XBS5_LPBIG_OFFBIG", 0 }, - { NULL, 0 }, -}; - -static int a_flag = 0; /* list all variables */ -static int v_flag = 0; /* follow given specification */ - -static void -print_longvar (const char *name, long long value) -{ - if (a_flag) - printf ("%-35s %lld\n", name, value); - else - printf ("%lld\n", value); -} - -static void -print_strvar (const char *name, const char *sval) -{ - if (a_flag) - printf ("%-35s %s\n", name, sval); - else - printf ("%s\n", sval); -} - -static void -printvar (const struct conf_variable *cp, const char *pathname) -{ - size_t slen; - char *sval; - long val; - - switch (cp->type) - { - case CONSTANT: - print_longvar (cp->name, cp->value); - break; - - case CONFSTR: - errno = 0; - slen = confstr ((int) cp->value, NULL, 0); - if (slen == 0) - { - if (errno == 0) - print_strvar (cp->name, "undefined"); - return; - } - - if ((sval = malloc (slen)) == NULL) - error (EXIT_FAILURE, 0, "Can't allocate %zu bytes", slen); - - errno = 0; - if (confstr ((int) cp->value, sval, slen) == 0) - print_strvar (cp->name, "undefined"); - else - print_strvar (cp->name, sval); - - free (sval); - break; - - case SYSCONF: - errno = 0; - if ((val = sysconf ((int) cp->value)) == -1) - { - if (a_flag && errno != 0) - return; /* Just skip invalid variables */ - print_strvar (cp->name, "undefined"); - } - else - print_longvar (cp->name, val); - break; - - case PATHCONF: - errno = 0; - if ((val = pathconf (pathname, (int) cp->value)) == -1) - { - if (a_flag && errno != 0) - return; /* Just skip invalid variables */ - print_strvar (cp->name, "undefined"); - } - else - print_longvar (cp->name, val); - break; - } -} - -static void -usage (int ret) -{ - fprintf (ret ? stderr : stdout, -"Usage: %1$s [-v specification] variable_name [pathname]\n" -" %1$s -a [pathname]\n" -"\n" -"Get configuration values\n" -"\n" -" -v specification Indicate specific version for which configuration\n" -" values shall be fetched.\n" -" -a, --all Print all known configuration values\n" -"\n" -"Other options:\n" -"\n" -" -h, --help This text\n" -" -V, --version Print program version and exit\n" -"\n", program_invocation_short_name); - exit (ret); -} - -static void -print_version () -{ - printf ("getconf (cygwin) %d.%d.%d\n" - "Get configuration values\n" - "Copyright (C) 2011 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -struct option longopts[] = { - {"all", no_argument, NULL, 'a'}, - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'V'}, - {0, no_argument, NULL, 0} -}; -const char *opts = "ahvV"; - -int -main (int argc, char **argv) -{ - int ch; - const struct conf_variable *cp; - const struct spec_variable *sp; - const char *varname, *pathname; - int found; - - setlocale (LC_ALL, ""); - - while ((ch = getopt_long (argc, argv, opts, longopts, NULL)) != -1) - { - switch (ch) - { - case 'a': - a_flag = 1; - break; - case 'v': - v_flag = 1; - break; - case 'h': - usage (0); - case 'V': - print_version (); - return 0; - default: - fprintf (stderr, "Try `%s --help' for more information.\n", - program_invocation_short_name); - return 1; - } - } - argc -= optind; - argv += optind; - - if (v_flag) - { - if (a_flag || argc < 2) - usage (1); - for (sp = spec_table; sp->name != NULL; sp++) - { - if (strcmp (argv[0], sp->name) == 0) - { - if (sp->valid != 1) - error (EXIT_FAILURE, 0, "unsupported specification \"%s\"", argv[0]); - break; - } - } - if (sp->name == NULL) - error (EXIT_FAILURE, 0, "unknown specification \"%s\"", argv[0]); - argc--; - argv++; - } - - if (!a_flag) - { - if (argc == 0) - usage (1); - varname = argv[0]; - argc--; - argv++; - } - else - varname = NULL; - - if (argc > 1) - usage (1); - pathname = argv[0]; /* may be NULL */ - - found = 0; - for (cp = conf_table; cp->name != NULL; cp++) - { - if (a_flag || strcmp (varname, cp->name) == 0) - { - /* LINTED weird expression */ - if ((cp->type == PATHCONF) == (pathname != NULL)) - { - printvar (cp, pathname); - found = 1; - } - else if (!a_flag) - usage (1); - } - } - - if (!a_flag && !found) - error (EXIT_FAILURE, 0, "Unrecognized variable `%s'", varname); - - fflush (stdout); - return ferror (stdout) ? EXIT_FAILURE : EXIT_SUCCESS; -} - diff --git a/winsup/utils/getfacl.c b/winsup/utils/getfacl.c deleted file mode 100644 index cbde4668a..000000000 --- a/winsup/utils/getfacl.c +++ /dev/null @@ -1,241 +0,0 @@ -/* getfacl.c - - Copyright 2000, 2001, 2002, 2003, 2004, 2009, 2011 Red Hat Inc. - - Written by Corinna Vinschen - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static char *prog_name; - -char * -permstr (mode_t perm) -{ - static char pbuf[4]; - - pbuf[0] = (perm & S_IROTH) ? 'r' : '-'; - pbuf[1] = (perm & S_IWOTH) ? 'w' : '-'; - pbuf[2] = (perm & S_IXOTH) ? 'x' : '-'; - pbuf[3] = '\0'; - return pbuf; -} - -const char * -username (uid_t uid) -{ - static char ubuf[256]; - struct passwd *pw; - - if ((pw = getpwuid (uid))) - strcpy (ubuf, pw->pw_name); - else - sprintf (ubuf, "%lu ", (unsigned long)uid); - return ubuf; -} - -const char * -groupname (gid_t gid) -{ - static char gbuf[256]; - struct group *gr; - - if ((gr = getgrgid (gid))) - strcpy (gbuf, gr->gr_name); - else - sprintf (gbuf, "%lu ", (unsigned long)gid); - return gbuf; -} - -static void -usage (FILE * stream) -{ - fprintf (stream, "Usage: %s [-adn] FILE [FILE2...]\n" - "\n" - "Display file and directory access control lists (ACLs).\n" - "\n" - " -a, --all display the filename, the owner, the group, and\n" - " the ACL of the file\n" - " -d, --dir display the filename, the owner, the group, and\n" - " the default ACL of the directory, if it exists\n" - " -h, --help output usage information and exit\n" - " -n, --noname display user and group IDs instead of names\n" - " -V, --version output version information and exit\n" - "\n" - "When multiple files are specified on the command line, a blank\n" - "line separates the ACLs for each file.\n", prog_name); - if (stream == stdout) - { - fprintf (stream, "" - "For each argument that is a regular file, special file or\n" - "directory, getfacl displays the owner, the group, and the ACL.\n" - "For directories getfacl displays additionally the default ACL.\n" - "\n" - "With no options specified, getfacl displays the filename, the\n" - "owner, the group, and both the ACL and the default ACL, if it\n" - "exists.\n" - "\n" - "The format for ACL output is as follows:\n" - " # file: filename\n" - " # owner: name or uid\n" - " # group: name or uid\n" - " user::perm\n" - " user:name or uid:perm\n" - " group::perm\n" - " group:name or gid:perm\n" - " mask:perm\n" - " other:perm\n" - " default:user::perm\n" - " default:user:name or uid:perm\n" - " default:group::perm\n" - " default:group:name or gid:perm\n" - " default:mask:perm\n" - " default:other:perm\n" - "\n"); - } -} - -struct option longopts[] = { - {"all", no_argument, NULL, 'a'}, - {"dir", no_argument, NULL, 'd'}, - {"help", no_argument, NULL, 'h'}, - {"noname", no_argument, NULL, 'n'}, - {"version", no_argument, NULL, 'V'}, - {0, no_argument, NULL, 0} -}; -const char *opts = "adhnV"; - -static void -print_version () -{ - printf ("getfacl (cygwin) %d.%d.%d\n" - "Get POSIX ACL information\n" - "Copyright (C) 2000 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -int -main (int argc, char **argv) -{ - int c; - int ret = 0; - int aopt = 0; - int dopt = 0; - int nopt = 0; - struct stat st; - aclent_t acls[MAX_ACL_ENTRIES]; - - prog_name = program_invocation_short_name; - - while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (c) - { - case 'a': - aopt = 1; - break; - case 'd': - dopt = 1; - break; - case 'h': - usage (stdout); - return 0; - case 'n': - nopt = 1; - break; - case 'V': - print_version (); - return 0; - default: - fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); - return 1; - } - if (optind > argc - 1) - { - usage (stderr); - return 1; - } - for (; optind < argc; ++optind) - { - int i, num_acls; - if (stat (argv[optind], &st) - || (num_acls = acl (argv[optind], GETACL, MAX_ACL_ENTRIES, acls)) < 0) - { - fprintf (stderr, "%s: %s: %s\n", - prog_name, argv[optind], strerror (errno)); - ret = 2; - continue; - } - printf ("# file: %s\n", argv[optind]); - if (nopt) - { - printf ("# owner: %lu\n", (unsigned long)st.st_uid); - printf ("# group: %lu\n", (unsigned long)st.st_gid); - } - else - { - printf ("# owner: %s\n", username (st.st_uid)); - printf ("# group: %s\n", groupname (st.st_gid)); - } - for (i = 0; i < num_acls; ++i) - { - if (acls[i].a_type & ACL_DEFAULT) - { - if (aopt) - continue; - printf ("default:"); - } - else if (dopt) - continue; - switch (acls[i].a_type & ~ACL_DEFAULT) - { - case USER_OBJ: - printf ("user::"); - break; - case USER: - if (nopt) - printf ("user:%lu:", (unsigned long)acls[i].a_id); - else - printf ("user:%s:", username (acls[i].a_id)); - break; - case GROUP_OBJ: - printf ("group::"); - break; - case GROUP: - if (nopt) - printf ("group:%lu:", (unsigned long)acls[i].a_id); - else - printf ("group:%s:", groupname (acls[i].a_id)); - break; - case CLASS_OBJ: - printf ("mask:"); - break; - case OTHER_OBJ: - printf ("other:"); - break; - } - printf ("%s\n", permstr (acls[i].a_perm)); - } - putchar ('\n'); - } - return ret; -} diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc deleted file mode 100644 index edabff321..000000000 --- a/winsup/utils/kill.cc +++ /dev/null @@ -1,288 +0,0 @@ -/* kill.cc - - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, - 2009, 2011 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static char *prog_name; - -static struct option longopts[] = -{ - {"help", no_argument, NULL, 'h' }, - {"list", optional_argument, NULL, 'l'}, - {"force", no_argument, NULL, 'f'}, - {"signal", required_argument, NULL, 's'}, - {"version", no_argument, NULL, 'V'}, - {NULL, 0, NULL, 0} -}; - -static char opts[] = "hl::fs:V"; - -static void -usage (FILE *where = stderr) -{ - fprintf (where , "" - "Usage: %1$s [-f] [-signal] [-s signal] pid1 [pid2 ...]\n" - " %1$s -l [signal]\n" - "\n" - "Send signals to processes\n" - "\n" - " -f, --force force, using win32 interface if necessary\n" - " -l, --list print a list of signal names\n" - " -s, --signal send signal (use %1$s --list for a list)\n" - " -h, --help output usage information and exit\n" - " -V, --version output version information and exit\n" - "\n", prog_name); - exit (where == stderr ? 1 : 0); -} - -static void -print_version () -{ - printf ("kill (cygwin) %d.%d.%d\n" - "Process Signaller\n" - "Copyright (C) 1996 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -static const char * -strsigno (int signo) -{ - if (signo >= 0 && signo < NSIG) - return sys_sigabbrev[signo]; - static char buf[sizeof ("Unknown signal") + 32]; - sprintf (buf, "Unknown signal %d", signo); - return buf; -} - -static int -getsig (const char *in_sig) -{ - const char *sig; - char buf[80]; - int intsig; - - if (strncmp (in_sig, "SIG", 3) == 0) - sig = in_sig; - else - { - sprintf (buf, "SIG%-.20s", in_sig); - sig = buf; - } - intsig = strtosigno (sig) ?: atoi (in_sig); - char *p; - if (!intsig && (strcmp (buf, "SIG0") != 0 && (strtol (in_sig, &p, 10) != 0 || *p))) - intsig = -1; - return intsig; -} - -static void -test_for_unknown_sig (int sig, const char *sigstr) -{ - if (sig < 0 || sig > NSIG) - { - fprintf (stderr, "%1$s: unknown signal: %2$s\n" - "Try `%1$s --help' for more information.\n", - prog_name, sigstr); - exit (1); - } -} - -static void -listsig (const char *in_sig) -{ - int sig; - if (!in_sig) - for (sig = 1; sig < NSIG - 1; sig++) - printf ("%s%c", strsigno (sig) + 3, (sig < NSIG - 1) ? ' ' : '\n'); - else - { - sig = getsig (in_sig); - test_for_unknown_sig (sig, in_sig); - if (atoi (in_sig) == sig) - puts (strsigno (sig) + 3); - else - printf ("%d\n", sig); - } -} - -static void -get_debug_priv (void) -{ - HANDLE tok; - LUID luid; - TOKEN_PRIVILEGES tkp; - - if (!OpenProcessToken (GetCurrentProcess (), - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tok)) - return; - - if (!LookupPrivilegeValue (NULL, SE_DEBUG_NAME, &luid)) - { - CloseHandle (tok); - return; - } - - tkp.PrivilegeCount = 1; - tkp.Privileges[0].Luid = luid; - tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - - AdjustTokenPrivileges (tok, FALSE, &tkp, sizeof tkp, NULL, NULL); - - CloseHandle (tok); -} - -static void __stdcall -forcekill (int pid, int sig, int wait) -{ - // try to acquire SeDebugPrivilege - get_debug_priv(); - - external_pinfo *p = NULL; - /* cygwin_internal misinterprets negative pids (Win9x pids) */ - if (pid > 0) - p = (external_pinfo *) cygwin_internal (CW_GETPINFO_FULL, pid); - DWORD dwpid = p ? p->dwProcessId : (DWORD) pid; - HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) dwpid); - if (!h) - { - if (!wait || GetLastError () != ERROR_INVALID_PARAMETER) - fprintf (stderr, "%s: couldn't open pid %u\n", - prog_name, (unsigned) dwpid); - return; - } - if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0) - if (sig && !TerminateProcess (h, sig << 8) - && WaitForSingleObject (h, 200) != WAIT_OBJECT_0) - fprintf (stderr, "%s: couldn't kill pid %u, %u\n", - prog_name, (unsigned) dwpid, (unsigned int) GetLastError ()); - CloseHandle (h); -} - -int -main (int argc, char **argv) -{ - int sig = SIGTERM; - int force = 0; - int ret = 0; - char *gotasig = NULL; - - prog_name = program_invocation_short_name; - - if (argc == 1) - usage (); - - opterr = 0; - - char *p; - long long int pid = 0; - - for (;;) - { - int ch; - char **av = argv + optind; - if ((ch = getopt_long (argc, argv, opts, longopts, NULL)) == EOF) - break; - switch (ch) - { - case 's': - gotasig = optarg; - sig = getsig (gotasig); - break; - case 'l': - if (!optarg) - { - optarg = argv[optind]; - if (optarg) - { - optind++; - optreset = 1; - } - } - if (argv[optind]) - usage (); - listsig (optarg); - break; - case 'f': - force = 1; - break; - case 'h': - usage (stdout); - break; - case 'V': - print_version (); - break; - case '?': - if (gotasig) - { - --optind; - goto out; - } - optreset = 1; - optind = 1 + av - argv; - gotasig = *av + 1; - sig = getsig (gotasig); - break; - default: - usage (); - break; - } - } - -out: - test_for_unknown_sig (sig, gotasig); - - argv += optind; - while (*argv != NULL) - { - if (!pid) - pid = strtoll (*argv, &p, 10); - if (*p != '\0' - || (!force && (pid < INT_MIN || pid > INT_MAX)) - || (force && (pid <= 0 || pid > UINT_MAX))) - { - fprintf (stderr, "%s: illegal pid: %s\n", prog_name, *argv); - ret = 1; - } - else if (pid <= INT_MAX && kill ((pid_t) pid, sig) == 0) - { - if (force) - forcekill ((pid_t) pid, sig, 1); - } - else if (force) - forcekill ((pid_t) pid, sig, 0); - else - { - char buf[1000]; - sprintf (buf, "%s: %lld", prog_name, pid); - perror (buf); - ret = 1; - } - argv++; - pid = 0; - } - return ret; -} - diff --git a/winsup/utils/ldd.cc b/winsup/utils/ldd.cc deleted file mode 100644 index de98658bc..000000000 --- a/winsup/utils/ldd.cc +++ /dev/null @@ -1,672 +0,0 @@ -/* Copyright (c) 2009, 2010, 2011, 2013 Chris Faylor - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Neither the name of the owner 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 COPYRIGHT HOLDER 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 COPYRIGHT - OWNER 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. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _WIN32_WINNT 0x0501 -#include -#include -#include - -#ifndef STATUS_DLL_NOT_FOUND -#define STATUS_DLL_NOT_FOUND (0xC0000135L) -#endif - -struct option longopts[] = -{ - {"help", no_argument, NULL, 'h'}, - {"verbose", no_argument, NULL, 'v'}, - {"version", no_argument, NULL, 'V'}, - {"data-relocs", no_argument, NULL, 'd'}, - {"function-relocs", no_argument, NULL, 'r'}, - {"unused", no_argument, NULL, 'u'}, - {0, no_argument, NULL, 0} -}; -const char *opts = "dhruvV"; - -static int process_file (const wchar_t *); - -static int -error (const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); - fprintf (stderr, "ldd: "); - vfprintf (stderr, fmt, ap); - fprintf (stderr, "\nTry `ldd --help' for more information.\n"); - exit (1); -} - -static void -usage () -{ - printf ("Usage: %s [OPTION]... FILE...\n\ -\n\ -Print shared library dependencies\n\ -\n\ - -h, --help print this help and exit\n\ - -V, --version print version information and exit\n\ - -r, --function-relocs process data and function relocations\n\ - (currently unimplemented)\n\ - -u, --unused print unused direct dependencies\n\ - (currently unimplemented)\n\ - -v, --verbose print all information\n\ - (currently unimplemented)\n", - program_invocation_short_name); -} - -static void -print_version () -{ - printf ("ldd (cygwin) %d.%d.%d\n" - "Print shared library dependencies\n" - "Copyright (C) 2009 - %s Chris Faylor\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -#define print_errno_error_and_return(__fn) \ - do {\ - fprintf (stderr, "ldd: %s: %s\n", (__fn), strerror (errno));\ - return 1;\ - } while (0) - -#define set_errno_and_return(x) \ - do {\ - cygwin_internal (CW_SETERRNO, __FILE__, __LINE__ - 2);\ - return (x);\ - } while (0) - - -static HANDLE hProcess; - -static struct filelist -{ - struct filelist *next; - char *name; -} *head; - -static bool -saw_file (char *name) -{ - filelist *p; - - for (p = head; p; p = p->next) - if (strcasecmp (name, p->name) == 0) - return true; - - p = (filelist *) malloc(sizeof (struct filelist)); - p->next = head; - p->name = strdup (name); - head = p; - return false; -} - -static wchar_t * -get_module_filename (HANDLE hp, HMODULE hm) -{ - size_t len; - wchar_t *buf = NULL; - DWORD res; - for (len = 1024; (res = GetModuleFileNameExW (hp, hm, (buf = (wchar_t *) realloc (buf, len * sizeof (wchar_t))), len)) == len; len += 1024) - continue; - if (!res) - { - free (buf); - buf = NULL; - } - return buf; -} - -static wchar_t * -load_dll (const wchar_t *fn) -{ - wchar_t *buf = get_module_filename (GetCurrentProcess (), NULL); - if (!buf) - { - printf ("ldd: GetModuleFileName returned an error %u\n", - (unsigned int) GetLastError ()); - exit (1); /* FIXME */ - } - - wchar_t *newbuf = (wchar_t *) malloc ((sizeof (L"\"\" -- ") + wcslen (buf) + wcslen (fn)) * sizeof (wchar_t)); - newbuf[0] = L'"'; - wcscpy (newbuf + 1, buf); - wchar_t *p = wcsstr (newbuf, L"\\ldd"); - if (!p) - { - printf ("ldd: can't parse my own filename \"%ls\"\n", buf); - exit (1); - } - p[3] = L'h'; - wcscat (newbuf, L"\" -- "); - wcscat (newbuf, fn); - free (buf); - return newbuf; -} - -static int -start_process (const wchar_t *fn, bool& isdll) -{ - STARTUPINFOW si = {}; - PROCESS_INFORMATION pi; - si.cb = sizeof (si); - wchar_t *cmd; - /* OCaml natdynlink plugins (.cmxs) cannot be handled by ldd because they - can only be loaded by flexdll_dlopen() */ - if (wcslen (fn) < 4 || (wcscasecmp (wcschr (fn, L'\0') - 4, L".dll") != 0 - && wcscasecmp (wcschr (fn, L'\0') - 4, L".oct") != 0 - && wcscasecmp (wcschr (fn, L'\0') - 3, L".so") != 0)) - { - cmd = wcsdup (fn); - isdll = false; - } - else - { - cmd = load_dll (fn); - isdll = true; - } - if (CreateProcessW (NULL, cmd, NULL, NULL, FALSE, DEBUG_ONLY_THIS_PROCESS, NULL, NULL, &si, &pi)) - { - free (cmd); - hProcess = pi.hProcess; - DebugSetProcessKillOnExit (true); - return 0; - } - - free (cmd); - set_errno_and_return (1); -} - -static int -set_entry_point_break () -{ - HMODULE hm; - DWORD cbe; - SIZE_T cbw; - if (!EnumProcessModules (hProcess, &hm, sizeof (hm), &cbe) || !cbe) - set_errno_and_return (1); - - MODULEINFO mi = {}; - if (!GetModuleInformation (hProcess, hm, &mi, sizeof (mi)) || !mi.EntryPoint) - set_errno_and_return (1); - - static const unsigned char int3 = 0xcc; - if (!WriteProcessMemory (hProcess, mi.EntryPoint, &int3, 1, &cbw) || cbw != 1) - set_errno_and_return (1); - return 0; -} - -struct dlls - { - LPVOID lpBaseOfDll; - struct dlls *next; - }; - -#define SLOP strlen (" (?)") -char * -tocyg (wchar_t *win_fn) -{ - ssize_t cwlen = cygwin_conv_path (CCP_WIN_W_TO_POSIX, win_fn, NULL, 0); - char *fn; - if (cwlen <= 0) - { - int len = wcstombs (NULL, win_fn, 0) + 1; - if ((fn = (char *) malloc (len))) - wcstombs (fn, win_fn, len); - } - else - { - char *fn_cyg = (char *) malloc (cwlen + SLOP + 1); - if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, win_fn, fn_cyg, cwlen) == 0) - fn = fn_cyg; - else - { - free (fn_cyg); - int len = wcstombs (NULL, win_fn, 0); - fn = (char *) malloc (len + SLOP + 1); - wcstombs (fn, win_fn, len + SLOP + 1); - } - } - return fn; -} - -#define CYGWIN_DLL_LEN (wcslen (L"\\cygwin1.dll")) -static int -print_dlls (dlls *dll, const wchar_t *dllfn, const wchar_t *process_fn) -{ - head = NULL; /* FIXME: memory leak */ - while ((dll = dll->next)) - { - char *fn; - wchar_t *fullpath = get_module_filename (hProcess, (HMODULE) dll->lpBaseOfDll); - if (!fullpath) - fn = strdup ("???"); - else if (dllfn && wcscmp (fullpath, dllfn) == 0) - { - free (fullpath); - continue; - } - else - { - fn = tocyg (fullpath); - saw_file (basename (fn)); - free (fullpath); - } - printf ("\t%s => %s (%p)\n", basename (fn), fn, dll->lpBaseOfDll); - free (fn); - } - if (process_fn) - return process_file (process_fn); - return 0; -} - -static int -report (const char *in_fn, bool multiple) -{ - if (multiple) - printf ("%s:\n", in_fn); - char *fn = realpath (in_fn, NULL); - if (!fn) - print_errno_error_and_return (in_fn); - - ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_W, fn, NULL, 0); - if (len <= 0) - print_errno_error_and_return (fn); - - bool isdll; - wchar_t fn_win[len + 1]; - if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, fn, fn_win, len)) - print_errno_error_and_return (fn); - - if (!fn || start_process (fn_win, isdll)) - print_errno_error_and_return (in_fn); - - DEBUG_EVENT ev; - - unsigned dll_count = 0; - - dlls dll_list = {}; - dlls *dll_last = &dll_list; - const wchar_t *process_fn = NULL; - while (1) - { - bool exitnow = false; - DWORD cont = DBG_CONTINUE; - if (!WaitForDebugEvent (&ev, INFINITE)) - break; - switch (ev.dwDebugEventCode) - { - case LOAD_DLL_DEBUG_EVENT: - if (!isdll && ++dll_count == 2) - set_entry_point_break (); - dll_last->next = (dlls *) malloc (sizeof (dlls)); - dll_last->next->lpBaseOfDll = ev.u.LoadDll.lpBaseOfDll; - dll_last->next->next = NULL; - dll_last = dll_last->next; - break; - case EXCEPTION_DEBUG_EVENT: - switch (ev.u.Exception.ExceptionRecord.ExceptionCode) - { - case STATUS_DLL_NOT_FOUND: - process_fn = fn_win; - break; - case STATUS_BREAKPOINT: - if (!isdll) - cont = DBG_EXCEPTION_NOT_HANDLED; - break; - } - break; - case CREATE_THREAD_DEBUG_EVENT: - TerminateProcess (hProcess, 0); - break; - case EXIT_PROCESS_DEBUG_EVENT: - print_dlls (&dll_list, isdll ? fn_win : NULL, process_fn); - exitnow = true; - break; - default: - break; - } - if (!ContinueDebugEvent (ev.dwProcessId, ev.dwThreadId, cont)) - { - cygwin_internal (CW_SETERRNO, __FILE__, __LINE__ - 2); - print_errno_error_and_return (in_fn); - } - if (exitnow) - break; - } - - return 0; -} - -int -main (int argc, char **argv) -{ - int optch; - - /* Use locale from environment. If not set or set to "C", use UTF-8. */ - setlocale (LC_CTYPE, ""); - if (!strcmp (setlocale (LC_CTYPE, NULL), "C")) - setlocale (LC_CTYPE, "en_US.UTF-8"); - while ((optch = getopt_long (argc, argv, opts, longopts, NULL)) != -1) - switch (optch) - { - case 'd': - case 'r': - case 'u': - error ("option not implemented `-%c'", optch); - exit (1); - case 'h': - usage (); - exit (0); - case 'V': - print_version (); - return 0; - default: - fprintf (stderr, "Try `%s --help' for more information.\n", - program_invocation_short_name); - return 1; - } - argv += optind; - if (!*argv) - error ("missing file arguments"); - - int ret = 0; - bool multiple = !!argv[1]; - char *fn; - while ((fn = *argv++)) - if (report (fn, multiple)) - ret = 1; - exit (ret); -} - -static bool printing = false; - - -/* dump of import directory - section begins at pointer 'section base' - section RVA is 'section_rva' - import directory begins at pointer 'imp' */ -static int -dump_import_directory (const void *const section_base, - const DWORD section_rva, - const IMAGE_IMPORT_DESCRIPTOR *imp) -{ - /* get memory address given the RVA */ - #define adr(rva) ((const void*) ((char*) section_base+((DWORD) (rva))-section_rva)) - - /* continue until address inaccessible or there's no DLL name */ - for (; !IsBadReadPtr (imp, sizeof (*imp)) && imp->Name; imp++) - { - wchar_t full_path[PATH_MAX]; - wchar_t *dummy; - char *fn = (char *) adr (imp->Name); - - if (saw_file (fn)) - continue; - - int len = mbstowcs (NULL, fn, 0); - if (len <= 0) - continue; - wchar_t fnw[len + 1]; - mbstowcs (fnw, fn, len + 1); - /* output DLL's name */ - char *print_fn; - if (!SearchPathW (NULL, fnw, NULL, PATH_MAX, full_path, &dummy)) - { - print_fn = strdup ("not found"); - printing = true; - } - else if (!printing) - continue; - else - { - print_fn = tocyg (full_path); - strcat (print_fn, " (?)"); - } - - printf ("\t%s => %s\n", (char *) fn, print_fn); - free (print_fn); - } - #undef adr - - return 0; -} - -/* load a file in RAM (memory-mapped) - return pointer to loaded file - 0 if no success */ -static void * -map_file (const wchar_t *filename) -{ - HANDLE hFile, hMapping; - void *basepointer; - if ((hFile = CreateFileW (filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, - 0, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0)) == INVALID_HANDLE_VALUE) - { - fprintf (stderr, "couldn't open %ls\n", filename); - return 0; - } - if (!(hMapping = CreateFileMapping (hFile, 0, PAGE_READONLY | SEC_COMMIT, 0, 0, 0))) - { - fprintf (stderr, "CreateFileMapping failed with windows error %u\n", - (unsigned int) GetLastError ()); - CloseHandle (hFile); - return 0; - } - if (!(basepointer = MapViewOfFile (hMapping, FILE_MAP_READ, 0, 0, 0))) - { - fprintf (stderr, "MapViewOfFile failed with windows error %u\n", - (unsigned int) GetLastError ()); - CloseHandle (hMapping); - CloseHandle (hFile); - return 0; - } - - CloseHandle (hMapping); - CloseHandle (hFile); - - return basepointer; -} - - -/* this will return a pointer immediatly behind the DOS-header - 0 if error */ -static void * -skip_dos_stub (const IMAGE_DOS_HEADER *dos_ptr) -{ - /* look there's enough space for a DOS-header */ - if (IsBadReadPtr (dos_ptr, sizeof (*dos_ptr))) - { - fprintf (stderr, "not enough space for DOS-header\n"); - return 0; - } - - /* validate MZ */ - if (dos_ptr->e_magic != IMAGE_DOS_SIGNATURE) - { - fprintf (stderr, "not a DOS-stub\n"); - return 0; - } - - /* ok, then, go get it */ - return (char*) dos_ptr + dos_ptr->e_lfanew; -} - - -/* find the directory's section index given the RVA - Returns -1 if impossible */ -static int -get_directory_index (const unsigned dir_rva, - const unsigned dir_length, - const int number_of_sections, - const IMAGE_SECTION_HEADER *sections) -{ - int sect; - for (sect = 0; sect < number_of_sections; sect++) - { - /* compare directory RVA to section RVA */ - if (sections[sect].VirtualAddress <= dir_rva - && dir_rva < sections[sect].VirtualAddress+sections[sect].SizeOfRawData) - return sect; - } - - return -1; -} - -/* dump imports of a single file - Returns 0 if successful, !=0 else */ -static int -process_file (const wchar_t *filename) -{ - void *basepointer; /* Points to loaded PE file - * This is memory mapped stuff - */ - int number_of_sections; - DWORD import_rva; /* RVA of import directory */ - DWORD import_length; /* length of import directory */ - int import_index; /* index of section with import directory */ - - /* ensure byte-alignment for struct tag_header */ - #include - - const struct tag_header - { - DWORD signature; - IMAGE_FILE_HEADER file_head; - IMAGE_OPTIONAL_HEADER opt_head; - IMAGE_SECTION_HEADER section_header[1]; /* an array of unknown length */ - } *header; - - /* revert to regular alignment */ - #include - - printing = false; - - /* first, load file */ - basepointer = map_file (filename); - if (!basepointer) - { - puts ("cannot load file"); - return 1; - } - - /* get header pointer; validate a little bit */ - header = (tag_header *) skip_dos_stub ((IMAGE_DOS_HEADER *) basepointer); - if (!header) - { - puts ("cannot skip DOS stub"); - UnmapViewOfFile (basepointer); - return 2; - } - - /* look there's enough space for PE headers */ - if (IsBadReadPtr (header, sizeof (*header))) - { - puts ("not enough space for PE headers"); - UnmapViewOfFile (basepointer); - return 3; - } - - /* validate PE signature */ - if (header->signature != IMAGE_NT_SIGNATURE) - { - puts ("not a PE file"); - UnmapViewOfFile (basepointer); - return 4; - } - - /* get number of sections */ - number_of_sections = header->file_head.NumberOfSections; - - /* check there are sections... */ - if (number_of_sections < 1) - { - UnmapViewOfFile (basepointer); - return 5; - } - - /* validate there's enough space for section headers */ - if (IsBadReadPtr (header->section_header, number_of_sections*sizeof (IMAGE_SECTION_HEADER))) - { - puts ("not enough space for section headers"); - UnmapViewOfFile (basepointer); - return 6; - } - - /* get RVA and length of import directory */ - import_rva = header->opt_head.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress; - import_length = header->opt_head.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size; - - /* check there's stuff to care about */ - if (!import_rva || !import_length) - { - UnmapViewOfFile (basepointer); - return 0; /* success! */ - } - - /* get import directory pointer */ - import_index = get_directory_index (import_rva,import_length,number_of_sections,header->section_header); - - /* check directory was found */ - if (import_index < 0) - { - puts ("couldn't find import directory in sections"); - UnmapViewOfFile (basepointer); - return 7; - } - - /* The pointer to the start of the import directory's section */ - const void *section_address = (char*) basepointer + header->section_header[import_index].PointerToRawData; - if (dump_import_directory (section_address, - header->section_header[import_index].VirtualAddress, - /* the last parameter is the pointer to the import directory: - section address + (import RVA - section RVA) - The difference is the offset of the import directory in the section */ - (const IMAGE_IMPORT_DESCRIPTOR *) ((char *) section_address+import_rva-header->section_header[import_index].VirtualAddress))) - { - UnmapViewOfFile (basepointer); - return 8; - } - - UnmapViewOfFile (basepointer); - return 0; -} diff --git a/winsup/utils/ldh.cc b/winsup/utils/ldh.cc deleted file mode 100644 index 13655ed23..000000000 --- a/winsup/utils/ldh.cc +++ /dev/null @@ -1,17 +0,0 @@ -#include -int APIENTRY -WinMain(HINSTANCE, HINSTANCE, LPSTR, int) -{ - LPWSTR cmd = GetCommandLineW (); - while (*cmd) - if (*cmd != ' ' || cmd[1] != L'-' || cmd[2] != '-' || cmd[3] != ' ') - cmd++; - else - { - cmd += 4; - break; - } - if (!*cmd || !LoadLibraryExW (cmd, NULL, LOAD_WITH_ALTERED_SEARCH_PATH )) - ExitProcess (0x0100); - ExitProcess (0x0000); -} diff --git a/winsup/utils/loadlib.h b/winsup/utils/loadlib.h deleted file mode 100644 index 34ed1277d..000000000 --- a/winsup/utils/loadlib.h +++ /dev/null @@ -1,61 +0,0 @@ -/* loadlib.h - - Copyright 2010, 2011, 2012 Red Hat, Inc. - - This file is part of Cygwin. - - This software is a copyrighted work licensed under the terms of the - Cygwin license. Please consult the file "CYGWIN_LICENSE" for - details. */ - -#ifndef _LOADLIB_H -#define _LOADLIB_H - -#include -#include - -/* Load all system libs from the windows system directory by prepending the - full path. This doesn't work for loadling cygwin1.dll. For this case, - instead of prepending the path, make sure that the CWD is removed from - the DLL search path, if possible (XP SP1++, Vista++). */ -static HMODULE _load_sys_library (const wchar_t *dll) __attribute__ ((used)); - -static HMODULE -_load_sys_library (const wchar_t *dll) -{ - static BOOL WINAPI (*set_dll_directory)(LPCWSTR); - static WCHAR sysdir[MAX_PATH]; - static UINT sysdir_len; - - WCHAR dllpath[MAX_PATH]; - - if (!sysdir_len) - { - sysdir_len = GetSystemDirectoryW (sysdir, MAX_PATH); - sysdir[sysdir_len++] = L'\\'; - sysdir[sysdir_len] = L'\0'; - } - if (!set_dll_directory) - { - HMODULE k32 = GetModuleHandleW (L"kernel32.dll"); - if (k32) - set_dll_directory = (BOOL WINAPI (*)(LPCWSTR)) - GetProcAddress (k32, "SetDllDirectoryW"); - if (!set_dll_directory) - set_dll_directory = (BOOL WINAPI (*)(LPCWSTR)) -1; - else - set_dll_directory (L""); - } - - if (wcscmp (dll, L"cygwin1.dll") == 0) - return LoadLibraryExW (L"cygwin1.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - - wcscpy (dllpath, sysdir); - wcscpy (dllpath + sysdir_len, dll); - return LoadLibraryExW (dllpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); -} - -#define LoadLibraryW(d) _load_sys_library(d) -#define LoadLibraryA(d) _load_sys_library(L##d) - -#endif /* _LOADLIB_H */ diff --git a/winsup/utils/locale.cc b/winsup/utils/locale.cc deleted file mode 100644 index fadf3f3da..000000000 --- a/winsup/utils/locale.cc +++ /dev/null @@ -1,849 +0,0 @@ -/* - * Copyright (c) 2010, 2011, 2012, 2013 Corinna Vinschen - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define _WIN32_WINNT 0x0602 -#define WINVER 0x0602 -#include - -#define LOCALE_ALIAS "/usr/share/locale/locale.alias" -#define LOCALE_ALIAS_LINE_LEN 255 - -void -usage () -{ - printf ( -"Usage: %1$s [-amvhV]\n" -" or: %1$s [-ck] NAME\n" -" or: %1$s [-usfnU]\n" -"\n" -"Get locale-specific information.\n" -"\n" -"System information:\n" -"\n" -" -a, --all-locales List all available supported locales\n" -" -m, --charmaps List all available character maps\n" -" -v, --verbose More verbose output\n" -"\n" -"Modify output format:\n" -"\n" -" -c, --category-name List information about given category NAME\n" -" -k, --keyword-name Print information about given keyword NAME\n" -"\n" -"Default locale information:\n" -"\n" -" -u, --user Print locale of user's default UI language\n" -" -s, --system Print locale of system default UI language\n" -" -f, --format Print locale of user's regional format settings\n" -" (time, numeric & monetary)\n" -" -n, --no-unicode Print system default locale for non-Unicode programs\n" -" -U, --utf Attach \".UTF-8\" to the result\n" -"\n" -"Other options:\n" -"\n" -" -h, --help This text\n" -" -V, --version Print program version and exit\n\n", - program_invocation_short_name); -} - -void -print_version () -{ - printf ("locale (cygwin) %d.%d.%d\n" - "Get locale-specific information\n" - "Copyright (C) 2010 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -struct option longopts[] = { - {"all-locales", no_argument, NULL, 'a'}, - {"category-name", no_argument, NULL, 'c'}, - {"format", no_argument, NULL, 'f'}, - {"help", no_argument, NULL, 'h'}, - {"keyword-name", no_argument, NULL, 'k'}, - {"charmaps", no_argument, NULL, 'm'}, - {"no-unicode", no_argument, NULL, 'n'}, - {"system", no_argument, NULL, 's'}, - {"user", no_argument, NULL, 'u'}, - {"utf", no_argument, NULL, 'U'}, - {"verbose", no_argument, NULL, 'v'}, - {"version", no_argument, NULL, 'V'}, - {0, no_argument, NULL, 0} -}; -const char *opts = "acfhkmnsuUvV"; - -int -getlocale (LCID lcid, char *name) -{ - char iso639[10]; - char iso3166[10]; - - iso3166[0] = '\0'; - if (!GetLocaleInfo (lcid, LOCALE_SISO639LANGNAME, iso639, 10)) - return 0; - GetLocaleInfo (lcid, LOCALE_SISO3166CTRYNAME, iso3166, 10); - sprintf (name, "%s%s%s", iso639, lcid > 0x3ff ? "_" : "", - lcid > 0x3ff ? iso3166 : ""); - return 1; -} - -typedef struct { - const char *name; - const wchar_t *language; - const wchar_t *territory; - const char *codeset; - bool alias; -} loc_t; -loc_t *locale; -size_t loc_max; -size_t loc_num; - -void -print_codeset (const char *codeset) -{ - for (; *codeset; ++codeset) - if (*codeset != '-') - putc (tolower ((int)(unsigned char) *codeset), stdout); -} - -void -print_locale_with_codeset (int verbose, loc_t *locale, bool utf8, - const char *modifier) -{ - static const char *sysroot; - char locname[32]; - - if (verbose - && (!strcmp (locale->name, "C") || !strcmp (locale->name, "POSIX"))) - return; - if (!sysroot) - { - WCHAR sysbuf[PATH_MAX]; - HMODULE k32 = GetModuleHandleW (L"kernel32.dll"); - if (GetModuleFileNameW (k32, sysbuf, PATH_MAX)) - sysroot = (const char *) cygwin_create_path (CCP_WIN_W_TO_POSIX, - sysbuf); - if (!sysroot) - sysroot = "kernel32.dll"; - } - snprintf (locname, 32, "%s%s%s%s", locale->name, utf8 ? ".utf8" : "", - modifier ? "@" : "", modifier ?: ""); - if (verbose) - fputs ("locale: ", stdout); - if (verbose) - { - printf ("%-15s ", locname); - printf ("archive: %s\n", - locale->alias ? LOCALE_ALIAS : sysroot); - puts ("-------------------------------------------------------------------------------"); - printf (" language | %ls\n", locale->language); - printf ("territory | %ls\n", locale->territory); - printf (" codeset | %s\n\n", utf8 ? "UTF-8" : locale->codeset); - } - else - printf ("%s\n", locname); -} - -void -print_locale (int verbose, loc_t *locale) -{ - print_locale_with_codeset (verbose, locale, false, NULL); - char *modifier = strchr (locale->name, '@'); - if (!locale->alias) - { - if (!modifier) - print_locale_with_codeset (verbose, locale, true, NULL); - else if (!strcmp (modifier, "@cjknarrow")) - { - *modifier++ = '\0'; - print_locale_with_codeset (verbose, locale, true, modifier); - } - } -} - -int -compare_locales (const void *a, const void *b) -{ - const loc_t *la = (const loc_t *) a; - const loc_t *lb = (const loc_t *) b; - return strcmp (la->name, lb->name); -} - -void -add_locale (const char *name, const wchar_t *language, const wchar_t *territory, - bool alias = false) -{ - char orig_locale[32]; - - if (loc_num >= loc_max) - { - loc_t *tmp = (loc_t *) realloc (locale, (loc_max + 32) * sizeof (loc_t)); - if (!tmp) - { - fprintf (stderr, "Out of memory!\n"); - exit (1); - } - locale = tmp; - loc_max += 32; - } - locale[loc_num].name = strdup (name); - locale[loc_num].language = wcsdup (language); - locale[loc_num].territory = wcsdup (territory); - strcpy (orig_locale, setlocale (LC_CTYPE, NULL)); - setlocale (LC_CTYPE, name); - locale[loc_num].codeset = strdup (nl_langinfo (CODESET)); - setlocale (LC_CTYPE, orig_locale); - locale[loc_num].alias = alias; - ++loc_num; -} - -void -add_locale_alias_locales () -{ - char alias_buf[LOCALE_ALIAS_LINE_LEN + 1], *c; - const char *alias, *replace; - char orig_locale[32]; - loc_t search, *loc; - size_t orig_loc_num = loc_num; - - FILE *fp = fopen (LOCALE_ALIAS, "rt"); - if (!fp) - return; - strcpy (orig_locale, setlocale (LC_CTYPE, NULL)); - while (fgets (alias_buf, LOCALE_ALIAS_LINE_LEN + 1, fp)) - { - alias_buf[LOCALE_ALIAS_LINE_LEN] = '\0'; - c = strrchr (alias_buf, '\n'); - if (c) - *c = '\0'; - c = alias_buf; - c += strspn (c, " \t"); - if (!*c || *c == '#') - continue; - alias = c; - c += strcspn (c, " \t"); - *c++ = '\0'; - c += strspn (c, " \t"); - if (*c == '#') - continue; - replace = c; - c += strcspn (c, " \t"); - *c++ = '\0'; - c = strchr (replace, '.'); - if (c) - *c = '\0'; - search.name = replace; - loc = (loc_t *) bsearch (&search, locale, orig_loc_num, sizeof (loc_t), - compare_locales); - add_locale (alias, loc ? loc->language : L"", loc ? loc->territory : L"", - true); - } - fclose (fp); -} - -void -print_all_locales (int verbose) -{ - LCID lcid = 0; - char name[32]; - DWORD cp; - - unsigned lang, sublang; - - add_locale ("C", L"C", L"POSIX"); - add_locale ("POSIX", L"C", L"POSIX", true); - for (lang = 1; lang <= 0xff; ++lang) - { - struct { - wchar_t language[256]; - wchar_t country[256]; - char loc[32]; - } loc_list[32]; - int lcnt = 0; - - for (sublang = 1; sublang <= 0x3f; ++sublang) - { - lcid = (sublang << 10) | lang; - if (getlocale (lcid, name)) - { - wchar_t language[256]; - wchar_t country[256]; - int i; - char *c, loc[32]; - wchar_t wbuf[9]; - - /* Go figure. Even the English name of a language or - locale might contain native characters. */ - GetLocaleInfoW (lcid, LOCALE_SENGLANGUAGE, language, 256); - GetLocaleInfoW (lcid, LOCALE_SENGCOUNTRY, country, 256); - /* Avoid dups */ - for (i = 0; i < lcnt; ++ i) - if (!wcscmp (loc_list[i].language, language) - && !wcscmp (loc_list[i].country, country)) - break; - if (i < lcnt) - continue; - if (lcnt < 32) - { - wcscpy (loc_list[lcnt].language, language); - wcscpy (loc_list[lcnt].country, country); - } - c = stpcpy (loc, name); - /* Convert old sr_SP silently to sr_CS on old systems. - Make sure sr_CS country is in recent shape. */ - if (lang == LANG_SERBIAN - && (sublang == SUBLANG_SERBIAN_LATIN - || sublang == SUBLANG_SERBIAN_CYRILLIC)) - { - c = stpcpy (loc, "sr_CS"); - wcscpy (country, L"Serbia and Montenegro (Former)"); - } - /* Now check certain conditions to figure out if that - locale requires a modifier. */ - if (lang == LANG_SERBIAN && !strncmp (loc, "sr_", 3) - && wcsstr (language, L"(Latin)")) - stpcpy (c, "@latin"); - else if (lang == LANG_UZBEK - && sublang == SUBLANG_UZBEK_CYRILLIC) - stpcpy (c, "@cyrillic"); - /* Avoid more dups */ - for (i = 0; i < lcnt; ++ i) - if (!strcmp (loc_list[i].loc, loc)) - { - lcnt++; - break; - } - if (i < lcnt) - continue; - if (lcnt < 32) - strcpy (loc_list[lcnt++].loc, loc); - /* Print */ - add_locale (loc, language, country); - /* Check for locales which sport a modifier for - changing the codeset and other stuff. */ - if (lang == LANG_BELARUSIAN - && sublang == SUBLANG_BELARUSIAN_BELARUS) - stpcpy (c, "@latin"); - else if (lang == LANG_TATAR - && sublang == SUBLANG_TATAR_RUSSIA) - stpcpy (c, "@iqtelif"); - else if (GetLocaleInfoW (lcid, - LOCALE_IDEFAULTANSICODEPAGE - | LOCALE_RETURN_NUMBER, - (PWCHAR) &cp, sizeof cp) - && cp == 1252 /* Latin1*/ - && GetLocaleInfoW (lcid, LOCALE_SINTLSYMBOL, wbuf, 9) - && !wcsncmp (wbuf, L"EUR", 3)) - stpcpy (c, "@euro"); - else if (lang == LANG_JAPANESE - || lang == LANG_KOREAN - || lang == LANG_CHINESE) - stpcpy (c, "@cjknarrow"); - else - continue; - add_locale (loc, language, country); - } - } - /* Check Serbian language for the available territories. Up to - Server 2003 we only had sr_SP (silently converted to sr_CS - above), in Vista we had only sr_CS. First starting with W7 we - have the actual sr_RS and sr_ME. However, all of them are - supported on all systems in Cygwin. So we fake them here, if - they are missing. */ - if (lang == LANG_SERBIAN) - { - int sr_CS_idx = -1; - int sr_RS_idx = -1; - int i; - - for (i = 0; i < lcnt; ++ i) - if (!strcmp (loc_list[i].loc, "sr_CS")) - sr_CS_idx = i; - else if (!strcmp (loc_list[i].loc, "sr_RS")) - sr_RS_idx = i; - if (sr_CS_idx > 0 && sr_RS_idx == -1) - { - add_locale ("sr_RS@latin", L"Serbian (Latin)", L"Serbia"); - add_locale ("sr_RS", L"Serbian (Cyrillic)", L"Serbia"); - add_locale ("sr_ME@latin", L"Serbian (Latin)", L"Montenegro"); - add_locale ("sr_ME", L"Serbian (Cyrillic)", L"Montenegro"); - } - } - } - /* First sort allows add_locale_alias_locales to bsearch in locales. */ - qsort (locale, loc_num, sizeof (loc_t), compare_locales); - add_locale_alias_locales (); - qsort (locale, loc_num, sizeof (loc_t), compare_locales); - for (size_t i = 0; i < loc_num; ++i) - print_locale (verbose, &locale[i]); -} - -void -print_charmaps () -{ - /* FIXME: We need a method to fetch the available charsets from Cygwin, */ - const char *charmaps[] = - { - "ASCII", - "BIG5", - "CP1125", - "CP1250", - "CP1251", - "CP1252", - "CP1253", - "CP1254", - "CP1255", - "CP1256", - "CP1257", - "CP1258", - "CP437", - "CP720", - "CP737", - "CP775", - "CP850", - "CP852", - "CP855", - "CP857", - "CP858", - "CP862", - "CP866", - "CP874", - "CP932", - "EUC-CN", - "EUC-JP", - "EUC-KR", - "GB2312", - "GBK", - "GEORGIAN-PS", - "ISO-8859-1", - "ISO-8859-10", - "ISO-8859-11", - "ISO-8859-13", - "ISO-8859-14", - "ISO-8859-15", - "ISO-8859-16", - "ISO-8859-2", - "ISO-8859-3", - "ISO-8859-4", - "ISO-8859-5", - "ISO-8859-6", - "ISO-8859-7", - "ISO-8859-8", - "ISO-8859-9", - "KOI8-R", - "KOI8-U", - "PT154", - "SJIS", - "TIS-620", - "UTF-8", - NULL - }; - const char **charmap = charmaps; - while (*charmap) - printf ("%s\n", *charmap++); -} - -void -print_lc_ivalue (int key, const char *name, int value) -{ - if (key) - printf ("%s=", name); - printf ("%d", value == CHAR_MAX ? -1 : value); - fputc ('\n', stdout); -} - -void -print_lc_svalue (int key, const char *name, const char *value) -{ - if (key) - printf ("%s=\"", name); - fputs (value, stdout); - if (key) - fputc ('"', stdout); - fputc ('\n', stdout); -} - -void -print_lc_sepstrings (int key, const char *name, const char *value) -{ - char *c; - - if (key) - printf ("%s=", name); - while (value && *value) - { - if (key) - fputc ('"', stdout); - c = strchr (value, ';'); - if (!c) - { - fputs (value, stdout); - value = NULL; - } - else - { - printf ("%.*s", (int) (c - value), value); - value = c + 1; - } - if (key) - fputc ('"', stdout); - if (value && *value) - fputc (';', stdout); - } - fputc ('\n', stdout); -} - -void -print_lc_strings (int key, const char *name, int from, int to) -{ - if (key) - printf ("%s=\"", name); - for (int i = from; i <= to; ++i) - printf ("%s%s", i > from ? ";" : "", nl_langinfo (i)); - if (key) - fputc ('"', stdout); - fputc ('\n', stdout); -} - -void -print_lc_grouping (int key, const char *name, const char *grouping) -{ - if (key) - printf ("%s=", name); - for (const char *g = grouping; *g; ++g) - printf ("%s%d", g > grouping ? ";" : "", *g == CHAR_MAX ? -1 : *g); - fputc ('\n', stdout); -} - -enum type_t -{ - is_string_fake, - is_grouping, - is_string, - is_mstrings, - is_sepstrings, - is_int, - is_wchar, - is_end -}; - -struct lc_names_t -{ - const char *name; - type_t type; - size_t fromval; - size_t toval; -}; - -const char *fake_string[] = { - "upper;lower;alpha;digit;xdigit;space;print;graph;blank;cntrl;punct;alnum", - "upper\";\"lower\";\"alpha\";\"digit\";\"xdigit\";\"space\";\"print\";\"graph\";\"blank\";\"cntrl\";\"punct\";\"alnum", - "toupper;tolower", - "toupper\";\"tolower" -}; - -lc_names_t lc_ctype_names[] = -{ - { "ctype-class-names", is_string_fake, 0, 0 }, - { "ctype-map-names", is_string_fake, 2, 0 }, - { "ctype-outdigit0_mb", is_string, _NL_CTYPE_OUTDIGITS0_MB, 0 }, - { "ctype-outdigit1_mb", is_string, _NL_CTYPE_OUTDIGITS1_MB, 0 }, - { "ctype-outdigit2_mb", is_string, _NL_CTYPE_OUTDIGITS2_MB, 0 }, - { "ctype-outdigit3_mb", is_string, _NL_CTYPE_OUTDIGITS3_MB, 0 }, - { "ctype-outdigit4_mb", is_string, _NL_CTYPE_OUTDIGITS4_MB, 0 }, - { "ctype-outdigit5_mb", is_string, _NL_CTYPE_OUTDIGITS5_MB, 0 }, - { "ctype-outdigit6_mb", is_string, _NL_CTYPE_OUTDIGITS6_MB, 0 }, - { "ctype-outdigit7_mb", is_string, _NL_CTYPE_OUTDIGITS7_MB, 0 }, - { "ctype-outdigit8_mb", is_string, _NL_CTYPE_OUTDIGITS8_MB, 0 }, - { "ctype-outdigit9_mb", is_string, _NL_CTYPE_OUTDIGITS9_MB, 0 }, - { "ctype-outdigit0_wc", is_wchar, _NL_CTYPE_OUTDIGITS0_WC, 0 }, - { "ctype-outdigit1_wc", is_wchar, _NL_CTYPE_OUTDIGITS1_WC, 0 }, - { "ctype-outdigit2_wc", is_wchar, _NL_CTYPE_OUTDIGITS2_WC, 0 }, - { "ctype-outdigit3_wc", is_wchar, _NL_CTYPE_OUTDIGITS3_WC, 0 }, - { "ctype-outdigit4_wc", is_wchar, _NL_CTYPE_OUTDIGITS4_WC, 0 }, - { "ctype-outdigit5_wc", is_wchar, _NL_CTYPE_OUTDIGITS5_WC, 0 }, - { "ctype-outdigit6_wc", is_wchar, _NL_CTYPE_OUTDIGITS6_WC, 0 }, - { "ctype-outdigit7_wc", is_wchar, _NL_CTYPE_OUTDIGITS7_WC, 0 }, - { "ctype-outdigit8_wc", is_wchar, _NL_CTYPE_OUTDIGITS8_WC, 0 }, - { "ctype-outdigit9_wc", is_wchar, _NL_CTYPE_OUTDIGITS9_WC, 0 }, - { "charmap", is_string, CODESET, 0 }, - { "ctype-mb-cur-max", is_int, _NL_CTYPE_MB_CUR_MAX, 0 }, - { NULL, is_end, 0, 0 } -}; - -lc_names_t lc_numeric_names[] = -{ - { "decimal_point", is_string, RADIXCHAR, 0 }, - { "thousands_sep", is_string, THOUSEP, 0 }, - { "grouping", is_grouping, _NL_NUMERIC_GROUPING, 0 }, - { "numeric-decimal-point-wc", is_wchar, _NL_NUMERIC_DECIMAL_POINT_WC, 0 }, - { "numeric-thousands-sep-wc", is_wchar, _NL_NUMERIC_THOUSANDS_SEP_WC, 0 }, - { "numeric-codeset", is_string, _NL_NUMERIC_CODESET, 0 }, - { NULL, is_end, 0, 0 } -}; - -lc_names_t lc_time_names[] = -{ - { "abday", is_mstrings, ABDAY_1, ABDAY_7 }, - { "day", is_mstrings, DAY_1, DAY_7 }, - { "abmon", is_mstrings, ABMON_1, ABMON_12 }, - { "mon", is_mstrings, MON_1, MON_12 }, - { "am_pm", is_mstrings, AM_STR, PM_STR }, - { "d_t_fmt", is_string, D_T_FMT, 0 }, - { "d_fmt", is_string, D_FMT, 0 }, - { "t_fmt", is_string, T_FMT, 0 }, - { "t_fmt_ampm", is_string, T_FMT_AMPM, 0 }, - { "era", is_sepstrings, ERA, 0 }, - { "era_d_fmt", is_string, ERA_D_FMT, 0 }, - { "alt_digits", is_sepstrings,ALT_DIGITS, 0 }, - { "era_d_t_fmt", is_string, ERA_D_T_FMT, 0 }, - { "era_t_fmt", is_string, ERA_T_FMT, 0 }, - { "date_fmt", is_string, _DATE_FMT, 0 }, - { "time-codeset", is_string, _NL_TIME_CODESET, 0 }, - { NULL, is_end, 0, 0 } -}; - -lc_names_t lc_collate_names[] = -{ - { "collate-codeset", is_string, _NL_COLLATE_CODESET, 0 }, - { NULL, is_end, 0, 0 } -}; - -lc_names_t lc_monetary_names[] = -{ - { "int_curr_symbol", is_string, _NL_MONETARY_INT_CURR_SYMBOL, 0 }, - { "currency_symbol", is_string, _NL_MONETARY_CURRENCY_SYMBOL, 0 }, - { "mon_decimal_point", is_string, _NL_MONETARY_MON_DECIMAL_POINT, 0 }, - { "mon_thousands_sep", is_string, _NL_MONETARY_MON_THOUSANDS_SEP, 0 }, - { "mon_grouping", is_grouping, _NL_MONETARY_MON_GROUPING, 0 }, - { "positive_sign", is_string, _NL_MONETARY_POSITIVE_SIGN, 0 }, - { "negative_sign", is_string, _NL_MONETARY_NEGATIVE_SIGN, 0 }, - { "int_frac_digits", is_int, _NL_MONETARY_INT_FRAC_DIGITS, 0 }, - { "frac_digits", is_int, _NL_MONETARY_FRAC_DIGITS, 0 }, - { "p_cs_precedes", is_int, _NL_MONETARY_P_CS_PRECEDES, 0 }, - { "p_sep_by_space", is_int, _NL_MONETARY_P_SEP_BY_SPACE, 0 }, - { "n_cs_precedes", is_int, _NL_MONETARY_N_CS_PRECEDES, 0 }, - { "n_sep_by_space", is_int, _NL_MONETARY_N_SEP_BY_SPACE, 0 }, - { "p_sign_posn", is_int, _NL_MONETARY_P_SIGN_POSN, 0 }, - { "n_sign_posn", is_int, _NL_MONETARY_N_SIGN_POSN, 0 }, - { "int_p_cs_precedes", is_int, _NL_MONETARY_INT_P_CS_PRECEDES, 0 }, - { "int_p_sep_by_space", is_int, _NL_MONETARY_INT_P_SEP_BY_SPACE,0 }, - { "int_n_cs_precedes", is_int, _NL_MONETARY_INT_N_CS_PRECEDES, 0 }, - { "int_n_sep_by_space", is_int, _NL_MONETARY_INT_N_SEP_BY_SPACE,0 }, - { "int_p_sign_posn", is_int, _NL_MONETARY_INT_P_SIGN_POSN, 0 }, - { "int_n_sign_posn", is_int, _NL_MONETARY_INT_N_SIGN_POSN, 0 }, - { "monetary-decimal-point-wc", is_wchar, _NL_MONETARY_WMON_DECIMAL_POINT, 0 }, - { "monetary-thousands-sep-wc", is_wchar, _NL_MONETARY_WMON_THOUSANDS_SEP, 0 }, - { "monetary-codeset", is_string, _NL_MONETARY_CODESET, 0 }, - { NULL, is_end, 0, 0 } -}; - -lc_names_t lc_messages_names[] = -{ - { "yesexpr", is_string, YESEXPR, 0 }, - { "noexpr", is_string, NOEXPR, 0 }, - { "yesstr", is_string, YESSTR, 0 }, - { "nostr", is_string, NOSTR, 0 }, - { "messages-codeset", is_string, _NL_MESSAGES_CODESET, 0 }, - { NULL, is_end, 0, 0 } -}; - -void -print_lc (int cat, int key, const char *category, const char *name, - lc_names_t *lc_name) -{ - if (cat) - printf ("%s\n", category); - for (lc_names_t *lc = lc_name; lc->type != is_end; ++lc) - if (!name || !strcmp (name, lc->name)) - switch (lc->type) - { - case is_string_fake: - print_lc_svalue (key, lc->name, fake_string[lc->fromval + key]); - break; - case is_grouping: - print_lc_grouping (key, lc->name, nl_langinfo (lc->fromval)); - break; - case is_string: - print_lc_svalue (key, lc->name, nl_langinfo (lc->fromval)); - break; - case is_sepstrings: - print_lc_sepstrings (key, lc->name, nl_langinfo (lc->fromval)); - break; - case is_mstrings: - print_lc_strings (key, lc->name, lc->fromval, lc->toval); - break; - case is_int: - print_lc_ivalue (key, lc->name, (int) *nl_langinfo (lc->fromval)); - break; - case is_wchar: - print_lc_ivalue (key, lc->name, - *(wchar_t *) nl_langinfo (lc->fromval)); - break; - default: - break; - } -} - -struct cat_t -{ - const char *category; - int lc_cat; - lc_names_t *lc_names; -} categories[] = -{ - { "LC_CTYPE", LC_CTYPE, lc_ctype_names }, - { "LC_NUMERIC", LC_NUMERIC, lc_numeric_names }, - { "LC_TIME", LC_TIME, lc_time_names }, - { "LC_COLLATE", LC_COLLATE, lc_collate_names }, - { "LC_MONETARY", LC_MONETARY, lc_monetary_names }, - { "LC_MESSAGES", LC_MESSAGES, lc_messages_names }, - { NULL, 0, NULL } -}; - -void -print_names (int cat, int key, const char *name) -{ - struct cat_t *c; - lc_names_t *lc; - - for (c = categories; c->category; ++c) - if (!strcmp (name, c->category)) - { - print_lc (cat, key, c->category, NULL, c->lc_names); - return; - } - for (c = categories; c->category; ++c) - for (lc = c->lc_names; lc->type != is_end; ++lc) - if (!strcmp (name, lc->name)) - { - print_lc (cat, key, c->category, lc->name, lc); - return; - } -} - -void -print_lc () -{ - printf ("LANG=%s\n", getenv ("LANG") ?: ""); - printf ("LC_CTYPE=\"%s\"\n", setlocale (LC_CTYPE, NULL)); - printf ("LC_NUMERIC=\"%s\"\n", setlocale (LC_NUMERIC, NULL)); - printf ("LC_TIME=\"%s\"\n", setlocale (LC_TIME, NULL)); - printf ("LC_COLLATE=\"%s\"\n", setlocale (LC_COLLATE, NULL)); - printf ("LC_MONETARY=\"%s\"\n", setlocale (LC_MONETARY, NULL)); - printf ("LC_MESSAGES=\"%s\"\n", setlocale (LC_MESSAGES, NULL)); - printf ("LC_ALL=%s\n", getenv ("LC_ALL") ?: ""); -} - -int -main (int argc, char **argv) -{ - int opt; - LCID lcid = 0; - int all = 0; - int cat = 0; - int key = 0; - int maps = 0; - int verbose = 0; - const char *utf = ""; - char name[32]; - - setlocale (LC_ALL, ""); - while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != -1) - switch (opt) - { - case 'a': - all = 1; - break; - case 'c': - cat = 1; - break; - case 'k': - key = 1; - break; - case 'm': - maps = 1; - break; - case 's': - lcid = GetSystemDefaultUILanguage (); - break; - case 'u': - lcid = GetUserDefaultUILanguage (); - break; - case 'f': - lcid = GetUserDefaultLCID (); - break; - case 'n': - lcid = GetSystemDefaultLCID (); - break; - case 'U': - utf = ".UTF-8"; - break; - case 'v': - verbose = 1; - break; - case 'h': - usage (); - return 0; - case 'V': - print_version (); - return 0; - default: - fprintf (stderr, "Try `%s --help' for more information.\n", - program_invocation_short_name); - return 1; - } - if (all) - print_all_locales (verbose); - else if (maps) - print_charmaps (); - else if (lcid) - { - if (getlocale (lcid, name)) - printf ("%s%s\n", name, utf); - } - else if (optind < argc) - while (optind < argc) - print_names (cat, key, argv[optind++]); - else - print_lc (); - return 0; -} diff --git a/winsup/utils/minidumper.cc b/winsup/utils/minidumper.cc deleted file mode 100644 index ffbc7a33e..000000000 --- a/winsup/utils/minidumper.cc +++ /dev/null @@ -1,237 +0,0 @@ -/* minidumper.cc - - Copyright 2014 Red Hat Inc. - - This file is part of Cygwin. - - 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 (file COPYING.dumper) 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 Street - Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include - -BOOL verbose = FALSE; -BOOL nokill = FALSE; - -typedef DWORD MINIDUMP_TYPE; - -typedef BOOL (WINAPI *MiniDumpWriteDump_type)( - HANDLE hProcess, - DWORD dwPid, - HANDLE hFile, - MINIDUMP_TYPE DumpType, - CONST void *ExceptionParam, - CONST void *UserStreamParam, - CONST void *allbackParam); - -static void -minidump(DWORD pid, MINIDUMP_TYPE dump_type, const char *minidump_file) -{ - HANDLE dump_file; - HANDLE process; - MiniDumpWriteDump_type MiniDumpWriteDump_fp; - HMODULE module; - - module = LoadLibrary("dbghelp.dll"); - if (!module) - { - fprintf (stderr, "error loading DbgHelp\n"); - return; - } - - MiniDumpWriteDump_fp = (MiniDumpWriteDump_type)GetProcAddress(module, "MiniDumpWriteDump"); - if (!MiniDumpWriteDump_fp) - { - fprintf (stderr, "error getting the address of MiniDumpWriteDump\n"); - return; - } - - dump_file = CreateFile(minidump_file, - GENERIC_READ | GENERIC_WRITE, - 0, - NULL, - CREATE_ALWAYS, - FILE_FLAG_BACKUP_SEMANTICS, - NULL); - if (dump_file == INVALID_HANDLE_VALUE) - { - fprintf (stderr, "error opening file\n"); - return; - } - - process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE, - FALSE, - pid); - if (dump_file == INVALID_HANDLE_VALUE) - { - fprintf (stderr, "error opening process\n"); - return; - } - - BOOL success = (*MiniDumpWriteDump_fp)(process, - pid, - dump_file, - dump_type, - NULL, - NULL, - NULL); - if (success) - { - if (verbose) - printf ("minidump created successfully\n"); - } - else - { - fprintf (stderr, "error creating minidump\n"); - } - - /* Unless nokill is given, behave like dumper and terminate the dumped - process */ - if (!nokill) - { - TerminateProcess(process, 128 + 9); - WaitForSingleObject(process, INFINITE); - } - - CloseHandle(process); - CloseHandle(dump_file); - FreeLibrary(module); -} - -static void -usage (FILE *stream, int status) -{ - fprintf (stream, "\ -Usage: %s [OPTION] FILENAME WIN32PID\n\ -\n\ -Write minidump from WIN32PID to FILENAME.dmp\n\ -\n\ - -t, --type minidump type flags\n\ - -n, --nokill don't terminate the dumped process\n\ - -d, --verbose be verbose while dumping\n\ - -h, --help output help information and exit\n\ - -q, --quiet be quiet while dumping (default)\n\ - -V, --version output version information and exit\n\ -\n", program_invocation_short_name); - exit (status); -} - -struct option longopts[] = { - {"type", required_argument, NULL, 't'}, - {"nokill", no_argument, NULL, 'n'}, - {"verbose", no_argument, NULL, 'd'}, - {"help", no_argument, NULL, 'h'}, - {"quiet", no_argument, NULL, 'q'}, - {"version", no_argument, 0, 'V'}, - {0, no_argument, NULL, 0} -}; -const char *opts = "tndhqV"; - -static void -print_version () -{ - printf ("minidumper (cygwin) %d.%d.%d\n" - "Minidump write for Cygwin\n" - "Copyright (C) 1999 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -int -main (int argc, char **argv) -{ - int opt; - const char *p = ""; - DWORD pid; - MINIDUMP_TYPE dump_type = 0; // MINIDUMP_NORMAL - - while ((opt = getopt_long (argc, argv, opts, longopts, NULL) ) != EOF) - switch (opt) - { - case 't': - { - char *endptr; - dump_type = strtoul(optarg, &endptr, 0); - if (*endptr != '\0') - { - fprintf (stderr, "syntax error in minidump type \"%s\" near character #%d.\n", optarg, (int) (endptr - optarg)); - exit(1); - } - } - break; - case 'n': - nokill = TRUE; - break; - case 'd': - verbose = TRUE; - break; - case 'q': - verbose = FALSE; - break; - case 'h': - usage (stdout, 0); - case 'V': - print_version (); - exit (0); - default: - fprintf (stderr, "Try `%s --help' for more information.\n", - program_invocation_short_name); - exit (1); - } - - if (argv && *(argv + optind) && *(argv + optind +1)) - { - ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE, - *(argv + optind), NULL, 0); - char *win32_name = (char *) alloca (len); - cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE, *(argv + optind), - win32_name, len); - if ((p = strrchr (win32_name, '\\'))) - p++; - else - p = win32_name; - - pid = strtoul (*(argv + optind + 1), NULL, 10); - } - else - { - usage (stderr, 1); - return -1; - } - - char *minidump_file = (char *) malloc (strlen (p) + sizeof (".dmp")); - if (!minidump_file) - { - fprintf (stderr, "error allocating memory\n"); - return -1; - } - sprintf (minidump_file, "%s.dmp", p); - - if (verbose) - printf ("dumping process %u to %s using dump type flags 0x%x\n", (unsigned int)pid, minidump_file, (unsigned int)dump_type); - - minidump(pid, dump_type, minidump_file); - - free (minidump_file); -}; diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c deleted file mode 100644 index 05f5910b0..000000000 --- a/winsup/utils/mkgroup.c +++ /dev/null @@ -1,909 +0,0 @@ -/* mkgroup.c: - - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc. - - This file is part of Cygwin. - - This software is a copyrighted work licensed under the terms of the - Cygwin license. Please consult the file "CYGWIN_LICENSE" for - details. */ - -#define _WIN32_WINNT 0x0600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "loadlib.h" - -#define print_win_error(x) _print_win_error(x, __LINE__) - -#define MAX_SID_LEN 40 - -SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY}; -SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY}; - -#ifndef min -#define min(a,b) (((a)<(b))?(a):(b)) -#endif - -typedef struct -{ - char *str; - DWORD id_offset; - BOOL domain; - BOOL with_dom; -} domlist_t; - -static void -_print_win_error (DWORD code, int line) -{ - char buf[4096]; - - if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - code, - MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) buf, sizeof (buf), NULL)) - fprintf (stderr, "mkgroup (%d): [%" PRIu32 "] %s", - line, (unsigned int) code, buf); - else - fprintf (stderr, "mkgroup (%d): error %" PRIu32 , - line, (unsigned int) code); -} - -static PWCHAR -get_dcname (char *domain) -{ - static WCHAR server[INTERNET_MAX_HOST_NAME_LENGTH + 1]; - DWORD rc; - WCHAR domain_name[MAX_DOMAIN_NAME_LEN + 1]; - PDOMAIN_CONTROLLER_INFOW pdci = NULL; - - if (domain) - { - mbstowcs (domain_name, domain, strlen (domain) + 1); - rc = DsGetDcNameW (NULL, domain_name, NULL, NULL, 0, &pdci); - } - else - rc = DsGetDcNameW (NULL, NULL, NULL, NULL, 0, &pdci); - if (rc != ERROR_SUCCESS) - { - print_win_error (rc); - return (PWCHAR) -1; - } - wcscpy (server, pdci->DomainControllerName); - NetApiBufferFree (pdci); - return server; -} - -static char * -put_sid (PSID psid) -{ - static char s[512]; - char t[32]; - DWORD i; - - strcpy (s, "S-1-"); - sprintf(t, "%u", GetSidIdentifierAuthority (psid)->Value[5]); - strcat (s, t); - for (i = 0; i < *GetSidSubAuthorityCount (psid); ++i) - { - sprintf(t, "-%" PRIu32 , (unsigned int) *GetSidSubAuthority (psid, i)); - strcat (s, t); - } - return s; -} - -typedef struct { - BYTE Revision; - BYTE SubAuthorityCount; - SID_IDENTIFIER_AUTHORITY IdentifierAuthority; - DWORD SubAuthority[8]; -} DBGSID, *PDBGSID; - -#define MAX_BUILTIN_SIDS 100 /* Should be enough for the forseable future. */ -DBGSID builtin_sid_list[MAX_BUILTIN_SIDS]; -DWORD builtin_sid_cnt; - -typedef struct { - PSID psid; - int buffer[10]; -} sidbuf; - -static sidbuf curr_pgrp; -static BOOL got_curr_pgrp = FALSE; - -static void -fetch_current_pgrp_sid () -{ - DWORD len; - HANDLE ptok; - - if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &ptok) - || !GetTokenInformation (ptok, TokenPrimaryGroup, &curr_pgrp, - sizeof curr_pgrp, &len) - || !CloseHandle (ptok)) - { - print_win_error (GetLastError ()); - return; - } -} - -static void -current_group (const char *sep, DWORD id_offset) -{ - WCHAR grp[GNLEN + 1]; - WCHAR dom[MAX_DOMAIN_NAME_LEN + 1]; - DWORD glen = GNLEN + 1; - DWORD dlen = MAX_DOMAIN_NAME_LEN + 1; - int gid; - SID_NAME_USE acc_type; - - if (!curr_pgrp.psid - || !LookupAccountSidW (NULL, curr_pgrp.psid, grp, &glen, dom, &dlen, - &acc_type)) - { - print_win_error (GetLastError ()); - return; - } - gid = *GetSidSubAuthority (curr_pgrp.psid, - *GetSidSubAuthorityCount(curr_pgrp.psid) - 1); - printf ("%ls%s%ls:%s:%" PRIu32 ":\n", - sep ? dom : L"", - sep ?: "", - grp, - put_sid (curr_pgrp.psid), - (unsigned int) (id_offset + gid)); -} - -static void -enum_unix_groups (domlist_t *dom_or_machine, const char *sep, DWORD id_offset, - char *unix_grp_list) -{ - WCHAR machine[INTERNET_MAX_HOST_NAME_LENGTH + 1]; - PWCHAR servername = NULL; - char *d_or_m = dom_or_machine ? dom_or_machine->str : NULL; - BOOL with_dom = dom_or_machine ? dom_or_machine->with_dom : FALSE; - SID_IDENTIFIER_AUTHORITY auth = { { 0, 0, 0, 0, 0, 22 } }; - char *gstr, *grp_list; - WCHAR grp[GNLEN + sizeof ("Unix Group\\") + 1]; - WCHAR dom[MAX_DOMAIN_NAME_LEN + 1]; - DWORD glen, dlen, sidlen; - PSID psid; - char psid_buffer[MAX_SID_LEN]; - SID_NAME_USE acc_type; - - if (!d_or_m) - return; - - int ret = mbstowcs (machine, d_or_m, INTERNET_MAX_HOST_NAME_LENGTH + 1); - if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1) - { - fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n", - program_invocation_short_name, d_or_m); - return; - } - servername = machine; - - if (!AllocateAndInitializeSid (&auth, 2, 2, 0, 0, 0, 0, 0, 0, 0, &psid)) - return; - - if (!(grp_list = strdup (unix_grp_list))) - { - FreeSid (psid); - return; - } - - for (gstr = strtok (grp_list, ","); gstr; gstr = strtok (NULL, ",")) - { - if (!isdigit ((unsigned char) gstr[0]) && gstr[0] != '-') - { - PWCHAR p = wcpcpy (grp, L"Unix Group\\"); - ret = mbstowcs (p, gstr, GNLEN + 1); - if (ret < 1 || ret >= GNLEN + 1) - fprintf (stderr, "%s: Invalid group name '%s'. Skipping...\n", - program_invocation_short_name, gstr); - else if (LookupAccountNameW (servername, grp, - psid = (PSID) psid_buffer, - (sidlen = MAX_SID_LEN, &sidlen), - dom, - (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen), - &acc_type)) - printf ("%s%s%ls:%s:%" PRIu32 ":\n", - with_dom ? "Unix Group" : "", - with_dom ? sep : "", - p, - put_sid (psid), - (unsigned int) (id_offset + - *GetSidSubAuthority (psid, - *GetSidSubAuthorityCount(psid) - 1))); - } - else - { - DWORD start, stop; - char *p = gstr; - if (*p == '-') - start = 0; - else - start = strtol (p, &p, 10); - if (!*p) - stop = start; - else if (*p++ != '-' || !isdigit ((unsigned char) *p) - || (stop = strtol (p, &p, 10)) < start || *p) - { - fprintf (stderr, "%s: Malformed unix group list entry '%s'. " - "Skipping...\n", - program_invocation_short_name, gstr); - continue; - } - for (; start <= stop; ++ start) - { - *GetSidSubAuthority (psid, *GetSidSubAuthorityCount(psid) - 1) - = start; - if (LookupAccountSidW (servername, psid, - grp, (glen = GNLEN + 1, &glen), - dom, - (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen), - &acc_type) - && !iswdigit (grp[0])) - printf ("%s%s%ls:%s:%" PRIu32 ":\n", - with_dom ? "Unix Group" : "", - with_dom ? sep : "", - grp, - put_sid (psid), - (unsigned int) (id_offset + start)); - } - } - } - - free (grp_list); - FreeSid (psid); -} - -static int -enum_local_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep, - DWORD id_offset, char *disp_groupname, int print_builtin, - int print_current) -{ - WCHAR machine[INTERNET_MAX_HOST_NAME_LENGTH + 1]; - PWCHAR servername = NULL; - char *d_or_m = dom_or_machine ? dom_or_machine->str : NULL; - BOOL with_dom = dom_or_machine ? dom_or_machine->with_dom : FALSE; - LOCALGROUP_INFO_0 *buffer; - DWORD entriesread = 0; - DWORD totalentries = 0; - DWORD_PTR resume_handle = 0; - WCHAR gname[GNLEN + 1]; - DWORD rc; - - if (domain) - { - servername = get_dcname (d_or_m); - if (servername == (PWCHAR) -1) - return 1; - } - else if (d_or_m) - { - int ret = mbstowcs (machine, d_or_m, INTERNET_MAX_HOST_NAME_LENGTH + 1); - if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1) - { - fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n", - program_invocation_short_name, d_or_m); - return 1; - } - servername = machine; - } - - do - { - DWORD i; - - if (disp_groupname) - { - mbstowcs (gname, disp_groupname, GNLEN + 1); - rc = NetLocalGroupGetInfo (servername, gname, 0, (void *) &buffer); - if (rc == ERROR_SUCCESS) - entriesread = 1; - /* Allow further searching for the group and avoid annoying - error messages just because the group is not a local group or - the group hasn't been found. */ - else if (rc == ERROR_NO_SUCH_ALIAS || rc == NERR_GroupNotFound) - return 0; - } - else - rc = NetLocalGroupEnum (servername, 0, (void *) &buffer, - MAX_PREFERRED_LENGTH, &entriesread, - &totalentries, &resume_handle); - switch (rc) - { - case ERROR_ACCESS_DENIED: - print_win_error (rc); - return 1; - - case ERROR_MORE_DATA: - case ERROR_SUCCESS: - break; - - default: - print_win_error (rc); - return 1; - } - - for (i = 0; i < entriesread; i++) - { - WCHAR domain_name[MAX_DOMAIN_NAME_LEN + 1]; - DWORD domname_len = MAX_DOMAIN_NAME_LEN + 1; - char psid_buffer[MAX_SID_LEN]; - PSID psid = (PSID) psid_buffer; - DWORD sid_length = MAX_SID_LEN; - DWORD gid; - SID_NAME_USE acc_type; - PDBGSID pdsid; - BOOL is_builtin = FALSE; - - if (!LookupAccountNameW (servername, buffer[i].lgrpi0_name, psid, - &sid_length, domain_name, &domname_len, - &acc_type)) - { - print_win_error (GetLastError ()); - fprintf (stderr, " (%ls)\n", buffer[i].lgrpi0_name); - continue; - } - else if (acc_type == SidTypeDomain) - { - WCHAR domname[MAX_DOMAIN_NAME_LEN + GNLEN + 2]; - - wcscpy (domname, domain_name); - wcscat (domname, L"\\"); - wcscat (domname, buffer[i].lgrpi0_name); - sid_length = MAX_SID_LEN; - domname_len = MAX_DOMAIN_NAME_LEN + 1; - if (!LookupAccountNameW (servername, domname, - psid, &sid_length, - domain_name, &domname_len, - &acc_type)) - { - print_win_error (GetLastError ()); - fprintf(stderr, " (%ls)\n", domname); - continue; - } - } - - /* Store all local SIDs with prefix "S-1-5-32-" and check if it - has been printed already. This allows to get all builtin - groups exactly once and not once per domain. */ - pdsid = (PDBGSID) psid; - if (pdsid->IdentifierAuthority.Value[5] == sid_nt_auth.Value[5] - && pdsid->SubAuthority[0] == SECURITY_BUILTIN_DOMAIN_RID) - { - int b; - - if (!print_builtin) - goto skip_group; - is_builtin = TRUE; - if (builtin_sid_cnt) - for (b = 0; b < builtin_sid_cnt; b++) - if (EqualSid (&builtin_sid_list[b], psid)) - goto skip_group; - if (builtin_sid_cnt < MAX_BUILTIN_SIDS) - CopySid (sizeof (DBGSID), &builtin_sid_list[builtin_sid_cnt++], - psid); - } - if (!print_current) - /* fall through */; - else if (EqualSid (curr_pgrp.psid, psid)) - got_curr_pgrp = TRUE; - - gid = *GetSidSubAuthority (psid, *GetSidSubAuthorityCount(psid) - 1); - printf ("%ls%s%ls:%s:%" PRIu32 ":\n", - with_dom && !is_builtin ? domain_name : L"", - with_dom && !is_builtin ? sep : "", - buffer[i].lgrpi0_name, - put_sid (psid), - (unsigned int) (gid + (is_builtin ? 0 : id_offset))); -skip_group: - ; - } - - NetApiBufferFree (buffer); - - } - while (rc == ERROR_MORE_DATA); - - /* Return 1 if the single group we're looking for has been found here to - avoid calling enum_groups for the same group, thus avoiding a spurious - error message "group name could not be found" in enum_groups. */ - return disp_groupname && entriesread ? 1 : 0; -} - -static void -enum_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep, - DWORD id_offset, char *disp_groupname, int print_current) -{ - WCHAR machine[INTERNET_MAX_HOST_NAME_LENGTH + 1]; - PWCHAR servername = NULL; - char *d_or_m = dom_or_machine ? dom_or_machine->str : NULL; - BOOL with_dom = dom_or_machine ? dom_or_machine->with_dom : FALSE; - GROUP_INFO_2 *buffer; - DWORD entriesread = 0; - DWORD totalentries = 0; - DWORD_PTR resume_handle = 0; - WCHAR gname[GNLEN + 1]; - DWORD rc; - - if (domain) - { - servername = get_dcname (d_or_m); - if (servername == (PWCHAR) -1) - return; - } - else if (d_or_m) - { - int ret = mbstowcs (machine, d_or_m, INTERNET_MAX_HOST_NAME_LENGTH + 1); - if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1) - { - fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n", - program_invocation_short_name, d_or_m); - return; - } - servername = machine; - } - - do - { - DWORD i; - - if (disp_groupname != NULL) - { - mbstowcs (gname, disp_groupname, GNLEN + 1); - rc = NetGroupGetInfo (servername, (LPWSTR) & gname, 2, - (void *) &buffer); - entriesread=1; - /* Avoid annoying error messages just because the group hasn't been - found. */ - if (rc == NERR_GroupNotFound) - return; - } - else - rc = NetGroupEnum (servername, 2, (void *) & buffer, - MAX_PREFERRED_LENGTH, &entriesread, &totalentries, - &resume_handle); - switch (rc) - { - case ERROR_ACCESS_DENIED: - print_win_error (rc); - return; - - case ERROR_MORE_DATA: - case ERROR_SUCCESS: - break; - - default: - print_win_error (rc); - return; - } - - for (i = 0; i < entriesread; i++) - { - WCHAR domain_name[MAX_DOMAIN_NAME_LEN + 1]; - DWORD domname_len = MAX_DOMAIN_NAME_LEN + 1; - char psid_buffer[MAX_SID_LEN]; - PSID psid = (PSID) psid_buffer; - DWORD sid_length = MAX_SID_LEN; - SID_NAME_USE acc_type; - - int gid = buffer[i].grpi2_group_id; - if (!LookupAccountNameW (servername, buffer[i].grpi2_name, - psid, &sid_length, - domain_name, &domname_len, - &acc_type)) - { - print_win_error (GetLastError ()); - fprintf(stderr, " (%ls)\n", buffer[i].grpi2_name); - continue; - } - else if (acc_type == SidTypeDomain) - { - WCHAR domname[MAX_DOMAIN_NAME_LEN + GNLEN + 2]; - - wcscpy (domname, domain || !servername - ? domain_name : servername); - wcscat (domname, L"\\"); - wcscat (domname, buffer[i].grpi2_name); - sid_length = MAX_SID_LEN; - domname_len = MAX_DOMAIN_NAME_LEN + 1; - if (!LookupAccountNameW (servername, domname, - psid, &sid_length, - domain_name, &domname_len, - &acc_type)) - { - print_win_error (GetLastError ()); - fprintf(stderr, " (%ls)\n", domname); - continue; - } - } - if (!print_current) - /* fall through */; - else if (EqualSid (curr_pgrp.psid, psid)) - got_curr_pgrp = TRUE; - - printf ("%ls%s%ls:%s:%" PRIu32 ":\n", - with_dom ? domain_name : L"", - with_dom ? sep : "", - buffer[i].grpi2_name, - put_sid (psid), - (unsigned int) (id_offset + gid)); - } - - NetApiBufferFree (buffer); - - } - while (rc == ERROR_MORE_DATA); -} - -static void -print_special_by_sid (PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt, - DWORD sub1, DWORD sub2, DWORD sub3, DWORD sub4, - DWORD sub5, DWORD sub6, DWORD sub7, DWORD sub8) -{ - WCHAR grp[GNLEN + 1], dom[MAX_DOMAIN_NAME_LEN + 1]; - DWORD glen, dlen, rid; - PSID psid; - SID_NAME_USE acc_type; - - if (AllocateAndInitializeSid (auth, cnt, sub1, sub2, sub3, sub4, - sub5, sub6, sub7, sub8, &psid)) - { - if (LookupAccountSidW (NULL, psid, - grp, (glen = GNLEN + 1, &glen), - dom, (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen), - &acc_type)) - { - if (sub8) - rid = sub8; - else if (sub7) - rid = sub7; - else if (sub6) - rid = sub6; - else if (sub5) - rid = sub5; - else if (sub4) - rid = sub4; - else if (sub3) - rid = sub3; - else if (sub2) - rid = sub2; - else - rid = sub1; - printf ("%ls:%s:%" PRIu32 ":\n", grp, put_sid (psid), - (unsigned int) rid); - } - FreeSid (psid); - } -} - -static void -print_special_by_name (PCWSTR name, gid_t gid) -{ - DWORD size = 256, dom_size = 256; - PSID sid = (PSID) alloca (size); - WCHAR dom[dom_size]; - SID_NAME_USE use; - - PWCHAR name_only = wcschr (name, L'\\'); - if (name_only) - ++name_only; - - if (LookupAccountNameW (NULL, name, sid, &size, dom, &dom_size, &use)) - printf ("%ls:%s:%lu:\n", - name_only ?: name, put_sid (sid), (unsigned long) gid); -} - -static int -usage (FILE * stream) -{ - fprintf (stream, -"Usage: %s [OPTION]...\n" -"\n" -"Print /etc/group file to stdout\n" -"\n" -"Options:\n" -"\n" -" -l,--local [machine[,offset]]\n" -" print local groups with gid offset offset\n" -" (from local machine if no machine specified)\n" -" -L,--Local [machine[,offset]]\n" -" ditto, but generate groupname with machine prefix\n" -" -d,--domain [domain[,offset]]\n" -" print domain groups with gid offset offset\n" -" (from current domain if no domain specified)\n" -" -D,--Domain [domain[,offset]]\n" -" ditto, but generate groupname with machine prefix\n" -" -c,--current print current group\n" -" -C,--Current ditto, but generate groupname with machine or\n" -" domain prefix\n" -" -S,--separator char for -L, -D, -C use character char as domain\\group\n" -" separator in groupname instead of the default '\\'\n" -" -o,--id-offset offset change the default offset (10000) added to gids\n" -" in domain or foreign server accounts.\n" -" -g,--group groupname only return information for the specified group\n" -" one of -l, -L, -d, -D must be specified, too\n" -" -b,--no-builtin don't print BUILTIN groups\n" -" -U,--unix grouplist additionally print UNIX groups when using -l or -L\n" -" on a UNIX Samba server\n" -" grouplist is a comma-separated list of groupnames\n" -" or gid ranges (root,-25,50-100).\n" -" (enumerating large ranges can take a long time!)\n" -" -s,--no-sids (ignored)\n" -" -u,--users (ignored)\n" -" -h,--help print this message\n" -" -v,--version print version information and exit\n" -"\n" -"Default is to print local groups on stand-alone machines, plus domain\n" -"groups on domain controllers and domain member machines.\n" -"\n", program_invocation_short_name); - return 1; -} - -struct option longopts[] = { - {"no-builtin", no_argument, NULL, 'b'}, - {"current", no_argument, NULL, 'c'}, - {"Current", no_argument, NULL, 'C'}, - {"domain", optional_argument, NULL, 'd'}, - {"Domain", optional_argument, NULL, 'D'}, - {"group", required_argument, NULL, 'g'}, - {"help", no_argument, NULL, 'h'}, - {"local", optional_argument, NULL, 'l'}, - {"Local", optional_argument, NULL, 'L'}, - {"id-offset", required_argument, NULL, 'o'}, - {"no-sids", no_argument, NULL, 's'}, - {"separator", required_argument, NULL, 'S'}, - {"users", no_argument, NULL, 'u'}, - {"unix", required_argument, NULL, 'U'}, - {"version", no_argument, NULL, 'V'}, - {0, no_argument, NULL, 0} -}; - -static char opts[] = "bcCd::D::g:hl::L::o:sS:uU:V"; - -static void -print_version () -{ - printf ("mkgroup (cygwin) %d.%d.%d\n" - "Group File Generator\n" - "Copyright (C) 1997 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -static PPOLICY_PRIMARY_DOMAIN_INFO p_dom; - -static BOOL -fetch_primary_domain () -{ - NTSTATUS status; - LSA_OBJECT_ATTRIBUTES oa = { 0, 0, 0, 0, 0, 0 }; - LSA_HANDLE lsa; - - if (!p_dom) - { - status = LsaOpenPolicy (NULL, &oa, POLICY_EXECUTE, &lsa); - if (!NT_SUCCESS (status)) - return FALSE; - status = LsaQueryInformationPolicy (lsa, PolicyPrimaryDomainInformation, - (PVOID *) ((void *) &p_dom)); - LsaClose (lsa); - if (!NT_SUCCESS (status)) - return FALSE; - } - return !!p_dom->Sid; -} - -int -main (int argc, char **argv) -{ - int print_domlist = 0; - domlist_t domlist[32]; - char *opt, *p, *ep; - int print_current = 0; - int print_system = 0; - int print_builtin = 1; - char *print_unix = NULL; - const char *sep_char = "\\"; - DWORD id_offset = 10000, off; - int c, i; - char *disp_groupname = NULL; - BOOL in_domain; - int optional_args = 0; - - if (!isatty (1)) - setmode (1, O_BINARY); - - /* Use locale from environment. If not set or set to "C", use UTF-8. */ - setlocale (LC_CTYPE, ""); - if (!strcmp (setlocale (LC_CTYPE, NULL), "C")) - setlocale (LC_CTYPE, "en_US.UTF-8"); - in_domain = fetch_primary_domain (); - fetch_current_pgrp_sid (); - - if (argc == 1) - { - print_special_by_sid (&sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID, - 0, 0, 0, 0, 0, 0, 0); - if (in_domain) - { - if (!enum_local_groups (TRUE, NULL, sep_char, id_offset, - disp_groupname, print_builtin, 0)) - enum_groups (TRUE, NULL, sep_char, id_offset, disp_groupname, 0); - } - else if (!enum_local_groups (FALSE, NULL, sep_char, 0, disp_groupname, - print_builtin, 0)) - enum_groups (FALSE, NULL, sep_char, 0, disp_groupname, 0); - return 0; - } - - unsetenv ("POSIXLY_CORRECT"); /* To get optional arg processing right. */ - while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (c) - { - case 'd': - case 'D': - case 'l': - case 'L': - if (print_domlist >= 32) - { - fprintf (stderr, "%s: Can not enumerate from more than 32 " - "domains and machines.\n", - program_invocation_short_name); - return 1; - } - domlist[print_domlist].domain = (c == 'd' || c == 'D'); - opt = optarg ?: - argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL; - if (argv[optind] && opt == argv[optind]) - ++optional_args; - for (i = 0; i < print_domlist; ++i) - if (domlist[i].domain == domlist[print_domlist].domain - && ((!domlist[i].str && !opt) - || (domlist[i].str && opt - && (off = strlen (domlist[i].str)) - && !strncmp (domlist[i].str, opt, off) - && (!opt[off] || opt[off] == ',')))) - { - fprintf (stderr, "%s: Duplicate %s '%s'. Skipping...\n", - program_invocation_short_name, - domlist[i].domain ? "domain" : "machine", - domlist[i].str); - goto skip; - } - if (!(domlist[print_domlist].str = opt)) - print_system = 1; - domlist[print_domlist].id_offset = UINT32_MAX; - if (opt && (p = strchr (opt, ','))) - { - if (p == opt - || !isdigit ((unsigned char) p[1]) - || (domlist[print_domlist].id_offset = strtol (p + 1, &ep, 10) - , *ep)) - { - fprintf (stderr, "%s: Malformed machine,offset string '%s'. " - "Skipping...\n", program_invocation_short_name, opt); - break; - } - *p = '\0'; - } - domlist[print_domlist++].with_dom = (c == 'D' || c == 'L'); -skip: - break; - case 'S': - sep_char = optarg; - if (strlen (sep_char) > 1) - { - fprintf (stderr, "%s: Only one character allowed as domain\\user " - "separator character.\n", - program_invocation_short_name); - return 1; - } - if (*sep_char == ':') - { - fprintf (stderr, "%s: Colon not allowed as domain\\user separator " - "character.\n", program_invocation_short_name); - return 1; - } - break; - case 'U': - print_unix = optarg; - break; - case 'c': - sep_char = NULL; - /*FALLTHRU*/ - case 'C': - print_current = 1; - break; - case 'o': - id_offset = strtol (optarg, NULL, 10); - break; - case 'b': - print_builtin = 0; - break; - case 's': - break; - case 'u': - break; - case 'g': - disp_groupname = optarg; - break; - case 'h': - usage (stdout); - return 0; - case 'V': - print_version (); - return 0; - default: - fprintf (stderr, "Try `%s --help' for more information.\n", argv[0]); - return 1; - } - - optind += optional_args; - if (argv[optind]) - { - fprintf (stderr, - "mkgroup: non-option command line argument `%s' is not allowed.\n" - "Try `mkgroup --help' for more information.\n", argv[optind]); - exit (1); - } - - /* Get 'system' group */ - if (!disp_groupname && print_system && print_builtin && print_domlist) - { - print_special_by_sid (&sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID, - 0, 0, 0, 0, 0, 0, 0); - print_special_by_name (L"NT SERVICE\\TrustedInstaller", -2); - } - - off = id_offset; - for (i = 0; i < print_domlist; ++i) - { - DWORD my_off = (domlist[i].domain || domlist[i].str) - ? domlist[i].id_offset != UINT_MAX - ? domlist[i].id_offset : off : 0; - if (!enum_local_groups (domlist[i].domain, domlist + i, sep_char, - my_off, disp_groupname, print_builtin, print_current)) - { - if (!domlist[i].domain && domlist[i].str && print_unix) - enum_unix_groups (domlist + i, sep_char, my_off, print_unix); - enum_groups (domlist[i].domain, domlist + i, sep_char, my_off, - disp_groupname, print_current); - if (my_off) - off += id_offset; - } - } - - if (print_current && !got_curr_pgrp) - current_group (sep_char, off); - - return 0; -} diff --git a/winsup/utils/mkpasswd.c b/winsup/utils/mkpasswd.c deleted file mode 100644 index d080dbd70..000000000 --- a/winsup/utils/mkpasswd.c +++ /dev/null @@ -1,837 +0,0 @@ -/* mkpasswd.c: - - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2009, - 2010, 2011, 2012, 2013 Red Hat, Inc. - - This file is part of Cygwin. - - This software is a copyrighted work licensed under the terms of the - Cygwin license. Please consult the file "CYGWIN_LICENSE" for - details. */ - -#define _WIN32_WINNT 0x0600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "loadlib.h" - -#define print_win_error(x) _print_win_error(x, __LINE__) - -#define MAX_SID_LEN 40 - -SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY}; -SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY}; - -#ifndef min -#define min(a,b) (((a)<(b))?(a):(b)) -#endif - -typedef struct -{ - char *str; - DWORD id_offset; - BOOL domain; - BOOL with_dom; -} domlist_t; - -static void -_print_win_error(DWORD code, int line) -{ - char buf[4096]; - - if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - code, - MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) buf, sizeof (buf), NULL)) - fprintf (stderr, "mkpasswd (%d): [%" PRIu32 "] %s", - line, (unsigned int) code, buf); - else - fprintf (stderr, "mkpasswd (%d): error %" PRIu32, - line, (unsigned int) code); -} - -static PWCHAR -get_dcname (char *domain) -{ - static WCHAR server[INTERNET_MAX_HOST_NAME_LENGTH + 1]; - DWORD rc; - WCHAR domain_name[MAX_DOMAIN_NAME_LEN + 1]; - PDOMAIN_CONTROLLER_INFOW pdci = NULL; - - if (domain) - { - mbstowcs (domain_name, domain, strlen (domain) + 1); - rc = DsGetDcNameW (NULL, domain_name, NULL, NULL, 0, &pdci); - } - else - rc = DsGetDcNameW (NULL, NULL, NULL, NULL, 0, &pdci); - if (rc != ERROR_SUCCESS) - { - print_win_error (rc); - return (PWCHAR) -1; - } - wcscpy (server, pdci->DomainControllerName); - NetApiBufferFree (pdci); - return server; -} - -static char * -put_sid (PSID sid) -{ - static char s[512]; - char t[32]; - DWORD i; - - strcpy (s, "S-1-"); - sprintf(t, "%u", GetSidIdentifierAuthority (sid)->Value[5]); - strcat (s, t); - for (i = 0; i < *GetSidSubAuthorityCount (sid); ++i) - { - sprintf(t, "-%" PRIu32, (unsigned int) *GetSidSubAuthority (sid, i)); - strcat (s, t); - } - return s; -} - -static void -uni2ansi (LPWSTR wcs, char *mbs, int size) -{ - if (wcs) - wcstombs (mbs, wcs, size); - else - *mbs = '\0'; -} - -typedef struct { - PSID psid; - int buffer[10]; -} sidbuf; - -static sidbuf curr_user; -static sidbuf curr_pgrp; -static BOOL got_curr_user = FALSE; - -static void -fetch_current_user_sid () -{ - DWORD len; - HANDLE ptok; - - if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &ptok) - || !GetTokenInformation (ptok, TokenUser, &curr_user, sizeof curr_user, - &len) - || !GetTokenInformation (ptok, TokenPrimaryGroup, &curr_pgrp, - sizeof curr_pgrp, &len) - || !CloseHandle (ptok)) - { - print_win_error (GetLastError ()); - return; - } -} - -static void -current_user (const char *sep, const char *passed_home_path, DWORD id_offset, - const char *disp_username) -{ - WCHAR user[UNLEN + 1]; - WCHAR dom[MAX_DOMAIN_NAME_LEN + 1]; - DWORD ulen = UNLEN + 1; - DWORD dlen = MAX_DOMAIN_NAME_LEN + 1; - SID_NAME_USE acc_type; - int uid, gid; - char homedir_psx[PATH_MAX] = {0}; - - if (!curr_user.psid || !curr_pgrp.psid - || !LookupAccountSidW (NULL, curr_user.psid, user, &ulen, dom, &dlen, - &acc_type)) - { - print_win_error (GetLastError ()); - return; - } - - uid = *GetSidSubAuthority (curr_user.psid, - *GetSidSubAuthorityCount(curr_user.psid) - 1); - gid = *GetSidSubAuthority (curr_pgrp.psid, - *GetSidSubAuthorityCount(curr_pgrp.psid) - 1); - if (passed_home_path[0] == '\0') - { - char *envhome = getenv ("HOME"); - - /* If $HOME exists and is non-empty, just copy it over to homedir_psx. - Otherwise, generate a new path of the form "/home/$USER". */ - if (envhome && envhome[0] != '\0') - strncat (homedir_psx, envhome, sizeof (homedir_psx) - 1); - else - { - wcstombs (stpncpy (homedir_psx, "/home/", sizeof (homedir_psx)), - user, sizeof (homedir_psx) - 6); - homedir_psx[PATH_MAX - 1] = '\0'; - } - } - else - { - char *p = stpncpy (homedir_psx, passed_home_path, sizeof (homedir_psx)); - wcstombs (p, user, sizeof (homedir_psx) - (p - homedir_psx)); - homedir_psx[PATH_MAX - 1] = '\0'; - } - - printf ("%ls%s%ls:unused:%" PRIu32 ":%" PRIu32 - ":U-%ls\\%ls,%s:%s:/bin/bash\n", - sep ? dom : L"", - sep ?: "", - user, - (unsigned int) (id_offset + uid), - (unsigned int) (id_offset + gid), - dom, - user, - put_sid (curr_user.psid), - homedir_psx); -} - -static void -enum_unix_users (domlist_t *dom_or_machine, const char *sep, DWORD id_offset, - char *unix_user_list) -{ - WCHAR machine[INTERNET_MAX_HOST_NAME_LENGTH + 1]; - PWCHAR servername = NULL; - char *d_or_m = dom_or_machine ? dom_or_machine->str : NULL; - BOOL with_dom = dom_or_machine ? dom_or_machine->with_dom : FALSE; - SID_IDENTIFIER_AUTHORITY auth = { { 0, 0, 0, 0, 0, 22 } }; - char *ustr, *user_list; - WCHAR user[UNLEN + sizeof ("Unix User\\") + 1]; - WCHAR dom[MAX_DOMAIN_NAME_LEN + 1]; - DWORD ulen, dlen, sidlen; - PSID psid; - char psid_buffer[MAX_SID_LEN]; - SID_NAME_USE acc_type; - - if (!d_or_m) - return; - - int ret = mbstowcs (machine, d_or_m, INTERNET_MAX_HOST_NAME_LENGTH + 1); - if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1) - { - fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n", - program_invocation_short_name, d_or_m); - return; - } - servername = machine; - - if (!AllocateAndInitializeSid (&auth, 2, 1, 0, 0, 0, 0, 0, 0, 0, &psid)) - return; - - if (!(user_list = strdup (unix_user_list))) - { - FreeSid (psid); - return; - } - - for (ustr = strtok (user_list, ","); ustr; ustr = strtok (NULL, ",")) - { - if (!isdigit ((unsigned char) ustr[0]) && ustr[0] != '-') - { - PWCHAR p = wcpcpy (user, L"Unix User\\"); - ret = mbstowcs (p, ustr, UNLEN + 1); - if (ret < 1 || ret >= UNLEN + 1) - fprintf (stderr, "%s: Invalid user name '%s'. Skipping...\n", - program_invocation_short_name, ustr); - else if (LookupAccountNameW (servername, user, - psid = (PSID) psid_buffer, - (sidlen = MAX_SID_LEN, &sidlen), - dom, - (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen), - &acc_type)) - printf ("%s%s%ls:unused:%" PRIu32 ":99999:,%s::\n", - with_dom ? "Unix User" : "", - with_dom ? sep : "", - user + 10, - (unsigned int) (id_offset + - *GetSidSubAuthority (psid, - *GetSidSubAuthorityCount(psid) - 1)), - put_sid (psid)); - } - else - { - DWORD start, stop; - char *p = ustr; - if (*p == '-') - start = 0; - else - start = strtol (p, &p, 10); - if (!*p) - stop = start; - else if (*p++ != '-' || !isdigit ((unsigned char) *p) - || (stop = strtol (p, &p, 10)) < start || *p) - { - fprintf (stderr, "%s: Malformed unix user list entry '%s'. " - "Skipping...\n", - program_invocation_short_name, ustr); - continue; - } - for (; start <= stop; ++ start) - { - *GetSidSubAuthority (psid, *GetSidSubAuthorityCount(psid) - 1) - = start; - if (LookupAccountSidW (servername, psid, - user, (ulen = GNLEN + 1, &ulen), - dom, - (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen), - &acc_type) - && !iswdigit (user[0])) - printf ("%s%s%ls:unused:%" PRIu32 ":99999:,%s::\n", - with_dom ? "Unix User" : "", - with_dom ? sep : "", - user, - (unsigned int) (id_offset + start), - put_sid (psid)); - } - } - } - - free (user_list); - FreeSid (psid); -} - -static int -enum_users (BOOL domain, domlist_t *dom_or_machine, const char *sep, - const char *passed_home_path, DWORD id_offset, char *disp_username, - int print_current) -{ - WCHAR machine[INTERNET_MAX_HOST_NAME_LENGTH + 1]; - PWCHAR servername = NULL; - char *d_or_m = dom_or_machine ? dom_or_machine->str : NULL; - BOOL with_dom = dom_or_machine ? dom_or_machine->with_dom : FALSE; - USER_INFO_3 *buffer; - DWORD entriesread = 0; - DWORD totalentries = 0; - DWORD resume_handle = 0; - DWORD rc; - WCHAR uni_name[UNLEN + 1]; - if (domain) - { - servername = get_dcname (d_or_m); - if (servername == (PWCHAR) -1) - return 1; - } - else if (d_or_m) - { - int ret = mbstowcs (machine, d_or_m, INTERNET_MAX_HOST_NAME_LENGTH + 1); - if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1) - { - fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n", - program_invocation_short_name, d_or_m); - return 1; - } - servername = machine; - } - - do - { - DWORD i; - - if (disp_username != NULL) - { - mbstowcs (uni_name, disp_username, UNLEN + 1); - rc = NetUserGetInfo (servername, (LPWSTR) &uni_name, 3, - (void *) &buffer); - entriesread = 1; - /* Avoid annoying error messages just because the user hasn't been - found. */ - if (rc == NERR_UserNotFound) - return 0; - } - else - rc = NetUserEnum (servername, 3, FILTER_NORMAL_ACCOUNT, - (void *) &buffer, MAX_PREFERRED_LENGTH, - &entriesread, &totalentries, &resume_handle); - switch (rc) - { - case ERROR_ACCESS_DENIED: - print_win_error(rc); - return 1; - - case ERROR_MORE_DATA: - case ERROR_SUCCESS: - break; - - default: - print_win_error(rc); - return 1; - } - - for (i = 0; i < entriesread; i++) - { - char homedir_psx[PATH_MAX]; - WCHAR domain_name[MAX_DOMAIN_NAME_LEN + 1]; - DWORD domname_len = MAX_DOMAIN_NAME_LEN + 1; - char psid_buffer[MAX_SID_LEN]; - PSID psid = (PSID) psid_buffer; - DWORD sid_length = MAX_SID_LEN; - SID_NAME_USE acc_type; - - int uid = buffer[i].usri3_user_id; - int gid = buffer[i].usri3_primary_group_id; - homedir_psx[0] = '\0'; - if (passed_home_path[0] == '\0') - { - if (buffer[i].usri3_home_dir[0] != L'\0') - cygwin_conv_path (CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, - buffer[i].usri3_home_dir, homedir_psx, - PATH_MAX); - else - uni2ansi (buffer[i].usri3_name, - stpcpy (homedir_psx, "/home/"), PATH_MAX - 6); - } - else - uni2ansi (buffer[i].usri3_name, - stpcpy (homedir_psx, passed_home_path), - PATH_MAX - strlen (passed_home_path)); - - if (!LookupAccountNameW (servername, buffer[i].usri3_name, - psid, &sid_length, domain_name, - &domname_len, &acc_type)) - { - print_win_error(GetLastError ()); - fprintf(stderr, " (%ls)\n", buffer[i].usri3_name); - continue; - } - else if (acc_type == SidTypeDomain) - { - WCHAR domname[MAX_DOMAIN_NAME_LEN + UNLEN + 2]; - - wcscpy (domname, domain || !servername - ? domain_name : servername); - wcscat (domname, L"\\"); - wcscat (domname, buffer[i].usri3_name); - sid_length = MAX_SID_LEN; - domname_len = sizeof (domname); - if (!LookupAccountNameW (servername, domname, psid, - &sid_length, domain_name, - &domname_len, &acc_type)) - { - print_win_error(GetLastError ()); - fprintf(stderr, " (%ls)\n", domname); - continue; - } - } - if (!print_current) - /* fall through */; - else if (EqualSid (curr_user.psid, psid)) - got_curr_user = TRUE; - - printf ("%ls%s%ls:unused:%" PRIu32 ":%" PRIu32 - ":%ls%sU-%ls\\%ls,%s:%s:/bin/bash\n", - with_dom ? domain_name : L"", - with_dom ? sep : "", - buffer[i].usri3_name, - (unsigned int) (id_offset + uid), - (unsigned int) (id_offset + gid), - buffer[i].usri3_full_name ?: L"", - buffer[i].usri3_full_name - && buffer[i].usri3_full_name[0] ? "," : "", - domain_name, - buffer[i].usri3_name, - put_sid (psid), - homedir_psx); - } - - NetApiBufferFree (buffer); - - } - while (rc == ERROR_MORE_DATA); - - return 0; -} - -static void -print_special_by_sid (PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt, - DWORD sub1, DWORD sub2, DWORD sub3, DWORD sub4, - DWORD sub5, DWORD sub6, DWORD sub7, DWORD sub8) -{ - WCHAR user[UNLEN + 1], dom[MAX_DOMAIN_NAME_LEN + 1]; - DWORD len, len2, rid; - PSID sid; - SID_NAME_USE acc_type; - - if (AllocateAndInitializeSid (auth, cnt, sub1, sub2, sub3, sub4, - sub5, sub6, sub7, sub8, &sid)) - { - if (LookupAccountSidW (NULL, sid, - user, (len = UNLEN + 1, &len), - dom, (len2 = MAX_DOMAIN_NAME_LEN + 1, &len2), - &acc_type)) - { - if (sub8) - rid = sub8; - else if (sub7) - rid = sub7; - else if (sub6) - rid = sub6; - else if (sub5) - rid = sub5; - else if (sub4) - rid = sub4; - else if (sub3) - rid = sub3; - else if (sub2) - rid = sub2; - else - rid = sub1; - printf ("%ls:*:%" PRIu32 ":%" PRIu32 ":,%s::\n", - user, (unsigned int) rid, - (unsigned int) (rid == 18 ? 544 : rid), /* SYSTEM hack */ - put_sid (sid)); - } - FreeSid (sid); - } -} - -static int -usage (FILE * stream) -{ - fprintf (stream, -"Usage: %s [OPTIONS]...\n" -"\n" -"Print /etc/passwd file to stdout\n" -"\n" -"Options:\n" -"\n" -" -l,--local [machine[,offset]]\n" -" print local user accounts with uid offset offset\n" -" (from local machine if no machine specified)\n" -" -L,--Local [machine[,offset]]\n" -" ditto, but generate username with machine prefix\n" -" -d,--domain [domain[,offset]]\n" -" print domain accounts with uid offset offset\n" -" (from current domain if no domain specified)\n" -" -D,--Domain [domain[,offset]]\n" -" ditto, but generate username with domain prefix\n" -" -c,--current print current user\n" -" -C,--Current ditto, but generate username with machine or\n" -" domain prefix\n" -" -S,--separator char for -L, -D, -C use character char as domain\\user\n" -" separator in username instead of the default '\\'\n" -" -o,--id-offset offset change the default offset (10000) added to uids\n" -" in domain or foreign server accounts.\n" -" -u,--username username only return information for the specified user\n" -" one of -l, -L, -d, -D must be specified, too\n" -" -p,--path-to-home path use specified path instead of user account home dir\n" -" or /home prefix\n" -" -U,--unix userlist additionally print UNIX users when using -l or -L\n" -" on a UNIX Samba server\n" -" userlist is a comma-separated list of usernames\n" -" or uid ranges (root,-25,50-100).\n" -" (enumerating large ranges can take a long time!)\n" -" -s,--no-sids (ignored)\n" -" -m,--no-mount (ignored)\n" -" -g,--local-groups (ignored)\n" -" -h,--help displays this message\n" -" -V,--version version information and exit\n" -"\n" -"Default is to print local accounts on stand-alone machines, domain accounts\n" -"on domain controllers and domain member machines.\n" -"\n", program_invocation_short_name); - return 1; -} - -static struct option longopts[] = { - {"current", no_argument, NULL, 'c'}, - {"Current", no_argument, NULL, 'C'}, - {"domain", optional_argument, NULL, 'd'}, - {"Domain", optional_argument, NULL, 'D'}, - {"local-groups", no_argument, NULL, 'g'}, - {"help", no_argument, NULL, 'h'}, - {"local", optional_argument, NULL, 'l'}, - {"Local", optional_argument, NULL, 'L'}, - {"no-mount", no_argument, NULL, 'm'}, - {"id-offset", required_argument, NULL, 'o'}, - {"path-to-home", required_argument, NULL, 'p'}, - {"no-sids", no_argument, NULL, 's'}, - {"separator", required_argument, NULL, 'S'}, - {"username", required_argument, NULL, 'u'}, - {"unix", required_argument, NULL, 'U'}, - {"version", no_argument, NULL, 'V'}, - {0, no_argument, NULL, 0} -}; - -static char opts[] = "cCd::D::ghl::L::mo:sS:p:u:U:V"; - -static void -print_version () -{ - printf ("mkpasswd (cygwin) %d.%d.%d\n" - "Passwd File Generator\n" - "Copyright (C) 1997 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -static void -print_special_by_name (PCWSTR name, uid_t uid, gid_t gid) -{ - DWORD size = 256, dom_size = 256; - PSID sid = (PSID) alloca (size); - WCHAR dom[dom_size]; - SID_NAME_USE use; - - PWCHAR name_only = wcschr (name, L'\\'); - if (name_only) - ++name_only; - - if (LookupAccountNameW (NULL, name, sid, &size, dom, &dom_size, &use)) - printf ("%ls:*:%lu:%lu:U-%ls%s%ls,%s::\n", - name_only ?: name, - (unsigned long) uid, - (unsigned long) gid, - name_only ? dom : L"", - name_only ? "\\" : "", - name_only ?: name, - put_sid (sid)); -} - -static void -enum_std_accounts () -{ - /* Generate service starter account entries. */ - printf ("SYSTEM:*:18:544:,S-1-5-18::\n"); - printf ("LocalService:*:19:544:U-NT AUTHORITY\\LocalService,S-1-5-19::\n"); - printf ("NetworkService:*:20:544:U-NT AUTHORITY\\NetworkService,S-1-5-20::\n"); - /* Get 'administrators' group (has localized name). */ - print_special_by_sid (&sid_nt_auth, 2, SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0); - /* Fetch "TrustedInstaller" account starting with Vista. */ - print_special_by_name (L"NT SERVICE\\TrustedInstaller", -2, -2); -} - -static PPOLICY_PRIMARY_DOMAIN_INFO p_dom; - -static BOOL -fetch_primary_domain () -{ - NTSTATUS status; - LSA_OBJECT_ATTRIBUTES oa = { 0, 0, 0, 0, 0, 0 }; - LSA_HANDLE lsa; - - if (!p_dom) - { - status = LsaOpenPolicy (NULL, &oa, POLICY_VIEW_LOCAL_INFORMATION, &lsa); - if (!NT_SUCCESS (status)) - return FALSE; - status = LsaQueryInformationPolicy (lsa, PolicyPrimaryDomainInformation, - (PVOID *) ((void *) &p_dom)); - LsaClose (lsa); - if (!NT_SUCCESS (status)) - return FALSE; - } - return !!p_dom->Sid; -} - -int -main (int argc, char **argv) -{ - int print_domlist = 0; - domlist_t domlist[32]; - char *opt, *p, *ep; - int print_current = 0; - char *print_unix = NULL; - const char *sep_char = "\\"; - DWORD id_offset = 10000, off; - int c, i; - char *disp_username = NULL; - char passed_home_path[PATH_MAX]; - BOOL in_domain; - int optional_args = 0; - - passed_home_path[0] = '\0'; - if (!isatty (1)) - setmode (1, O_BINARY); - - /* Use locale from environment. If not set or set to "C", use UTF-8. */ - setlocale (LC_CTYPE, ""); - if (!strcmp (setlocale (LC_CTYPE, NULL), "C")) - setlocale (LC_CTYPE, "en_US.UTF-8"); - in_domain = fetch_primary_domain (); - fetch_current_user_sid (); - - if (argc == 1) - { - enum_std_accounts (); - if (in_domain) - enum_users (TRUE, NULL, sep_char, passed_home_path, 10000, - disp_username, 0); - else - enum_users (FALSE, NULL, sep_char, passed_home_path, 0, - disp_username, 0); - return 0; - } - - unsetenv ("POSIXLY_CORRECT"); /* To get optional arg processing right. */ - while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (c) - { - case 'd': - case 'D': - case 'l': - case 'L': - if (print_domlist >= 32) - { - fprintf (stderr, "%s: Can not enumerate from more than 32 " - "domains and machines.\n", - program_invocation_short_name); - return 1; - } - domlist[print_domlist].domain = (c == 'd' || c == 'D'); - opt = optarg ?: - argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL; - if (argv[optind] && opt == argv[optind]) - ++optional_args; - for (i = 0; i < print_domlist; ++i) - if (domlist[i].domain == domlist[print_domlist].domain - && ((!domlist[i].str && !opt) - || (domlist[i].str && opt - && (off = strlen (domlist[i].str)) - && !strncmp (domlist[i].str, opt, off) - && (!opt[off] || opt[off] == ',')))) - { - fprintf (stderr, "%s: Duplicate %s '%s'. Skipping...\n", - program_invocation_short_name, - domlist[i].domain ? "domain" : "machine", - domlist[i].str); - goto skip; - } - domlist[print_domlist].str = opt; - domlist[print_domlist].id_offset = UINT32_MAX; - if (opt && (p = strchr (opt, ','))) - { - if (p == opt - || !isdigit ((unsigned char) p[1]) - || (domlist[print_domlist].id_offset = strtol (p + 1, &ep, 10) - , *ep)) - { - fprintf (stderr, "%s: Malformed domain,offset string '%s'. " - "Skipping...\n", program_invocation_short_name, opt); - break; - } - *p = '\0'; - } - domlist[print_domlist++].with_dom = (c == 'D' || c == 'L'); -skip: - break; - case 'S': - sep_char = optarg; - if (strlen (sep_char) > 1) - { - fprintf (stderr, "%s: Only one character allowed as domain\\user " - "separator character.\n", - program_invocation_short_name); - return 1; - } - if (*sep_char == ':') - { - fprintf (stderr, "%s: Colon not allowed as domain\\user separator " - "character.\n", program_invocation_short_name); - return 1; - } - break; - case 'U': - print_unix = optarg; - break; - case 'c': - sep_char = NULL; - /*FALLTHRU*/ - case 'C': - print_current = 1; - break; - case 'o': - id_offset = strtoul (optarg, &ep, 10); - if (*ep) - { - fprintf (stderr, "%s: Malformed offset '%s'. " - "Skipping...\n", program_invocation_short_name, optarg); - return 1; - } - break; - case 'p': - if (optarg[0] != '/') - { - fprintf (stderr, "%s: '%s' is not a fully qualified path.\n", - program_invocation_short_name, optarg); - return 1; - } - strcpy (passed_home_path, optarg); - if (optarg[strlen (optarg)-1] != '/') - strcat (passed_home_path, "/"); - break; - case 'u': - disp_username = optarg; - break; - case 'h': - usage (stdout); - return 0; - case 'V': - print_version (); - return 0; - case 'g': /* deprecated */ - case 's': /* deprecated */ - case 'm': /* deprecated */ - break; - default: - fprintf (stderr, "Try `%s --help' for more information.\n", - program_invocation_short_name); - return 1; - } - - optind += optional_args; - if (argv[optind]) - { - fprintf (stderr, - "mkpasswd: non-option command line argument `%s' is not allowed.\n" - "Try `mkpasswd --help' for more information.\n", argv[optind]); - exit (1); - } - - off = id_offset; - for (i = 0; i < print_domlist; ++i) - { - DWORD my_off = (domlist[i].domain || domlist[i].str) - ? domlist[i].id_offset != UINT_MAX - ? domlist[i].id_offset : off : 0; - if (!domlist[i].domain && domlist[i].str && print_unix) - enum_unix_users (domlist + i, sep_char, my_off, print_unix); - if (!my_off && !disp_username) - enum_std_accounts (); - enum_users (domlist[i].domain, domlist + i, sep_char, passed_home_path, - my_off, disp_username, print_current); - if (my_off) - off += id_offset; - } - - if (print_current && !got_curr_user) - current_user (sep_char, passed_home_path, off, disp_username); - - return 0; -} diff --git a/winsup/utils/module_info.cc b/winsup/utils/module_info.cc deleted file mode 100644 index 1437da421..000000000 --- a/winsup/utils/module_info.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* module_info.cc - - Copyright 1999, 2000, 2001, 2010, 2013 Red Hat, Inc. - - Written by Egor Duda - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include "loadlib.h" - -/* Returns full name of Dll, which is loaded by hProcess at BaseAddress. - Uses psapi.dll. */ - -char * -psapi_get_module_name (HANDLE hProcess, LPVOID BaseAddress) -{ - DWORD len; - MODULEINFO mi; - unsigned int i; - HMODULE dh_buf[1]; - HMODULE *DllHandle = dh_buf; - DWORD cbNeeded; - BOOL ok; - - char name_buf[MAX_PATH + 1]; - - ok = EnumProcessModules (hProcess, DllHandle, sizeof (HMODULE), &cbNeeded); - - if (!ok || !cbNeeded) - goto failed; - DllHandle = (HMODULE *) malloc (cbNeeded); - if (!DllHandle) - goto failed; - ok = EnumProcessModules (hProcess, DllHandle, cbNeeded, &cbNeeded); - if (!ok) - { - free (DllHandle); - goto failed; - } - - for (i = 0; i < cbNeeded / sizeof (HMODULE); i++) - { - if (!GetModuleInformation (hProcess, DllHandle[i], &mi, sizeof (mi))) - { - free (DllHandle); - goto failed; - } - - len = GetModuleFileNameExA (hProcess, DllHandle[i], name_buf, MAX_PATH); - if (len == 0) - { - free (DllHandle); - goto failed; - } - - if (mi.lpBaseOfDll == BaseAddress) - { - free (DllHandle); - return strdup (name_buf); - } - } - -failed: - return NULL; -} diff --git a/winsup/utils/mount.cc b/winsup/utils/mount.cc deleted file mode 100644 index 650266d3f..000000000 --- a/winsup/utils/mount.cc +++ /dev/null @@ -1,557 +0,0 @@ -/* mount.cc - - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2013 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "path.h" - -#include - -#define NT_MAX_PATH 32768 - -#define EXEC_FLAGS (MOUNT_EXEC | MOUNT_NOTEXEC | MOUNT_CYGWIN_EXEC) - -static void mount_entries (void); -static void show_mounts (void); -static void show_cygdrive_info (void); -static void change_cygdrive_prefix (const char *new_prefix, int flags); -static int mount_already_exists (const char *posix_path, int flags); - -// static short create_missing_dirs = FALSE; -static bool force = false; - -static const char *progname; - -static void -error (const char *path) -{ - fprintf (stderr, "%s: %s: %s\n", progname, path, - (errno == EMFILE) ? "Too many mount entries" : strerror (errno)); - exit (1); -} - -/* FIXME: do_mount should also print a warning message if the dev arg - is a non-existent Win32 path. */ - -static void -do_mount (const char *dev, const char *where, int flags) -{ - struct stat statbuf; - int statres; - - statres = stat (where, &statbuf); - -#if 0 - if (statres == -1) - { - /* FIXME: this'll fail if mount dir is missing any parent dirs */ - if (create_missing_dirs == TRUE) - { - if (mkdir (where, 0755) == -1) - fprintf (stderr, "Warning: unable to create %s!\n", where); - else - statres = 0; /* Pretend stat succeeded if we could mkdir. */ - } - } -#endif - - if (statres == -1) - { - if (!force) - fprintf (stderr, "%s: warning - %s does not exist.\n", progname, where); - } - else if (!(statbuf.st_mode & S_IFDIR)) - { - if (!force) - fprintf (stderr, "%s: warning: %s is not a directory.\n", - progname, where); - } - - if (!force && !(flags & (EXEC_FLAGS | MOUNT_BIND)) && strlen (dev)) - { - char devtmp[1 + 2 * strlen (dev)]; - strcpy (devtmp, dev); - char c = strchr (devtmp, '\0')[-1]; - if (c == '/' || c == '\\') - strcat (devtmp, "."); - /* Use a curious property of Windows which allows the use of \.. even - on non-directory paths. */ - for (const char *p = dev; (p = strpbrk (p, "/\\")); p++) - strcat (devtmp, "\\.."); - strcat (devtmp, "\\"); - if (GetDriveType (devtmp) == DRIVE_REMOTE) - { - fprintf (stderr, - "%s: defaulting to 'notexec' mount option for speed since native path\n" - "%*creferences a remote share. Use '-f' option to override.\n", - progname, (int) strlen(progname) + 2, ' '); - flags |= MOUNT_NOTEXEC; - } - } - - if (mount (dev, where, flags)) - error (where); -} - -static void -from_fstab (bool user) -{ - char path[PATH_MAX]; - char buf[65536]; - mnt_t *m = mount_table + max_mount_entry; - - strcpy (path, "/etc/fstab"); - if (user) - { - strcat (path, ".d/"); - strcat (path, getlogin ()); - } - FILE *fh = fopen (path, "rt"); - if (!fh) - return; - while (fgets (buf, 65536, fh)) - { - char *c = strrchr (buf, '\n'); - if (c) - *c = '\0'; - if (from_fstab_line (m, buf, user)) - ++m; - } - max_mount_entry = m - mount_table; - fclose (fh); -} - -static void -do_mount_from_fstab (const char *where) -{ - force = true; - /* Read fstab entries. */ - from_fstab (false); - from_fstab (true); - /* Loop through fstab entries and see if it matches `where'. If `where' - is NULL, all entries match. */ - bool exists = false; - for (mnt_t *m = mount_table; m - mount_table < max_mount_entry; ++m) - if (!where || !strcmp (where, m->posix)) - { - if (m->flags & MOUNT_CYGDRIVE) - { - /* Get the cygdrive info */ - char user[MAX_PATH]; - char system[MAX_PATH]; - char user_flags[MAX_PATH]; - char system_flags[MAX_PATH]; - - exists = true; - cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system, user_flags, - system_flags); - if ((*user && strcmp (user, m->posix) != 0) - || (*system && strcmp (system, m->posix) != 0)) - if (mount (NULL, m->posix, m->flags)) - error (m->posix); - } - else - { - exists = true; - /* Compare with existing mount table. If the entry doesn't exist, - mount it. */ - FILE *mt = setmntent ("/-not-used-", "r"); - struct mntent *p; - - while ((p = getmntent (mt)) != NULL) - if (!strcmp (m->posix, p->mnt_dir)) - break; - if (!p) - do_mount (m->native, m->posix, m->flags); - endmntent (mt); - if (where) - break; - } - } - if (!exists && where) - fprintf (stderr, - "%s: can't find %s in /etc/fstab or in /etc/fstab.d/$USER\n", - progname, where); -} - -static struct option longopts[] = -{ - {"all", no_argument, NULL, 'a'}, - {"change-cygdrive-prefix", no_argument, NULL, 'c'}, - {"force", no_argument, NULL, 'f'}, - {"help", no_argument, NULL, 'h' }, - {"mount-entries", no_argument, NULL, 'm'}, - {"options", required_argument, NULL, 'o'}, - {"show-cygdrive-prefix", no_argument, NULL, 'p'}, - {"version", no_argument, NULL, 'V'}, - {NULL, 0, NULL, 0} -}; - -static char opts[] = "acfhmpVo:"; - -static void -usage (FILE *where = stderr) -{ - char *options; - - fprintf (where, "Usage: %1$s [OPTION] [ ]\n\ - %1$s -a\n\ - %1$s \n\ -\n\ -Display information about mounted filesystems, or mount a filesystem\n\ -\n\ - -a, --all mount all filesystems mentioned in fstab\n\ - -c, --change-cygdrive-prefix change the cygdrive path prefix to \n\ - -f, --force force mount, don't warn about missing mount\n\ - point directories\n\ - -h, --help output usage information and exit\n\ - -m, --mount-entries write fstab entries to replicate mount points\n\ - and cygdrive prefixes\n\ - -o, --options X[,X...] specify mount options\n\ - -p, --show-cygdrive-prefix show user and/or system cygdrive path prefix\n\ - -V, --version output version information and exit\n\n", - progname); - if (!cygwin_internal (CW_LST_MNT_OPTS, &options)) - fprintf (where, "Valid options are: %s\n\n", options); - exit (where == stderr ? 1 : 0); -} - -static void -print_version () -{ - printf ("mount (cygwin) %d.%d.%d\n" - "Mount filesystem utility\n" - "Copyright (C) 1996 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -static char * -concat3 (char *a, const char *b, const char *c) -{ - size_t totlen = strlen (a) + strlen (b) + strlen (c) + 1; - a = (char *) realloc (a, totlen); - return strcat (strcat (a, b), c); -} - -int -main (int argc, char **argv) -{ - int i; - int flags = MOUNT_BINARY; - char *options = strdup (""); - enum do_what - { - nada, - saw_change_cygdrive_prefix, - saw_show_cygdrive_prefix, - saw_mount_commands, - saw_mount_all, - } do_what = nada; - - progname = program_invocation_short_name; - - if (argc == 1) - { - show_mounts (); - exit (0); - } - - while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (i) - { - case 'a': - if (do_what == nada) - do_what = saw_mount_all; - else - usage (); - break; - case 'c': - if (do_what == nada) - do_what = saw_change_cygdrive_prefix; - else - usage (); - break; - case 'f': - force = true; - break; - case 'h': - usage (stdout); - break; - case 'm': - if (do_what == nada) - do_what = saw_mount_commands; - else - usage (); - break; - case 'o': - if (do_what == saw_mount_all) - usage (); - else if (*options) - options = concat3 (options, ",", optarg); - else - options = strdup (optarg); - break; - case 'p': - if (do_what == nada) - do_what = saw_show_cygdrive_prefix; - else - usage (); - break; - case 'V': - print_version (); - return 0; - break; - default: - fprintf (stderr, "Try `%s --help' for more information.\n", progname); - return 1; - } - - if (cygwin_internal (CW_CVT_MNT_OPTS, &options, &flags)) - { - fprintf (stderr, "%s: invalid option - '%s'\n", progname, options); - exit (1); - } - - if (flags & MOUNT_NOTEXEC && flags & (MOUNT_EXEC | MOUNT_CYGWIN_EXEC)) - { - fprintf (stderr, "%s: invalid combination of executable options\n", - progname); - exit (1); - } - - cygwin_internal (CW_SET_DOS_FILE_WARNING, false); - - argc--; - switch (do_what) - { - case saw_change_cygdrive_prefix: - if (optind != argc) - usage (); - change_cygdrive_prefix (argv[optind], flags); - break; - case saw_show_cygdrive_prefix: - if (optind <= argc) - usage (); - show_cygdrive_info (); - break; - case saw_mount_commands: - if (optind <= argc) - usage (); - mount_entries (); - break; - case saw_mount_all: - if (optind <= argc) - usage (); - do_mount_from_fstab (NULL); - break; - default: - if (optind == argc) - do_mount_from_fstab (argv[optind]); - else if (optind != (argc - 1)) - { - fprintf (stderr, "%s: too many arguments\n", progname); - usage (); - } - else if (force || !mount_already_exists (argv[optind + 1], flags)) - do_mount (argv[optind], argv[optind + 1], flags); - else - { - errno = EBUSY; - error (argv[optind + 1]); - } - } - - /* NOTREACHED */ - return 0; -} - -static char * -convert_spaces (char *tgt, const char *src) -{ - char *tp, *spacep; - const char *sp; - - tp = tgt; - for (sp = src; (spacep = strchr (sp, ' ')); sp = spacep + 1) - { - tp = stpncpy (tp, sp, spacep - sp); - tp = stpcpy (tp, "\\040"); - } - stpcpy (tp, sp); - return tgt; -} - -static void -mount_entries (void) -{ - FILE *m = setmntent ("/-not-used-", "r"); - struct mntent *p; - const char *format_mnt = "%s %s %s %s 0 0\n"; - const char *format_cyg = "none %s cygdrive %s 0 0\n"; - - // write fstab entries for normal mount points - while ((p = getmntent (m)) != NULL) - // Only list non-cygdrives and non-automounts - if (!strstr (p->mnt_opts, ",noumount") && !strstr (p->mnt_opts, ",auto")) - { - char fsname[NT_MAX_PATH], dirname[NT_MAX_PATH]; - /* Drop the "bind" option since it can't be reverted. */ - char *c = strstr (p->mnt_opts, ",bind"); - if (c) - memmove (c, c + 5, strlen (c + 5) + 1); - printf (format_mnt, convert_spaces (fsname, p->mnt_fsname), - convert_spaces (dirname, p->mnt_dir), - p->mnt_type, p->mnt_opts); - } - endmntent (m); - - // write fstab entry for cygdrive prefix - m = setmntent ("/-not-used-", "r"); - while ((p = getmntent (m)) != NULL) - { - char *noumount; - if ((noumount = strstr (p->mnt_opts, ",noumount"))) - { - char dirname[NT_MAX_PATH]; - char opts[strlen (p->mnt_opts) + 1]; - - convert_spaces (dirname, p->mnt_dir); - // remove trailing slash - char *ls = strrchr (dirname, '/'); - if (ls) - { - // last slash == leading slash? cygdrive prefix == "/" - if (ls == dirname) - ++ls; - *ls = '\0'; - } - *stpncpy (opts, p->mnt_opts, noumount - p->mnt_opts) = '\0'; - printf (format_cyg, dirname, opts); - break; - } - } - endmntent (m); - - exit(0); -} - -static void -show_mounts (void) -{ - FILE *m = setmntent ("/-not-used-", "r"); - struct mntent *p; - const char *format = "%s on %s type %s (%s)\n"; - - // printf (format, "Device", "Directory", "Type", "Flags"); - while ((p = getmntent (m)) != NULL) - printf (format, p->mnt_fsname, p->mnt_dir, p->mnt_type, p->mnt_opts); - endmntent (m); -} - -/* Return 1 if mountpoint from the same registry area is already in - mount table. Otherwise return 0. */ -static int -mount_already_exists (const char *posix_path, int flags) -{ - int found_matching = 0; - - FILE *m = setmntent ("/-not-used-", "r"); - struct mntent *p; - - while ((p = getmntent (m)) != NULL) - { - /* if the paths match, and they're both the same type of mount. */ - if (strcmp (p->mnt_dir, posix_path) == 0) - { - if (p->mnt_type[0] == 'u') - { - if (!(flags & MOUNT_SYSTEM)) /* both current_user */ - found_matching = 1; - else - fprintf (stderr, - "%s: warning: system mount point of '%s' " - "will always be masked by user mount.\n", - progname, posix_path); - break; - } - else if (p->mnt_type[0] == 's') - { - if (flags & MOUNT_SYSTEM) /* both system */ - found_matching = 1; - else - fprintf (stderr, - "%s: warning: user mount point of '%s' " - "masks system mount.\n", progname, posix_path); - break; - } - else - { - fprintf (stderr, "%s: warning: couldn't determine mount type.\n", - progname); - break; - } - } - } - endmntent (m); - - return found_matching; -} - -/* change_cygdrive_prefix: Change the cygdrive prefix */ -static void -change_cygdrive_prefix (const char *new_prefix, int flags) -{ - flags |= MOUNT_CYGDRIVE; - - if (mount (NULL, new_prefix, flags)) - error (new_prefix); - - exit (0); -} - -/* show_cygdrive_info: Show the user and/or cygdrive info, i.e., prefix and - flags.*/ -static void -show_cygdrive_info () -{ - /* Get the cygdrive info */ - char user[MAX_PATH]; - char system[MAX_PATH]; - char user_flags[MAX_PATH]; - char system_flags[MAX_PATH]; - cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system, user_flags, - system_flags); - - /* Display the user and system cygdrive path prefix, if necessary - (ie, not empty) */ - const char *format = "%-18s %-11s %s\n"; - printf (format, "Prefix", "Type", "Flags"); - if (strlen (user) > 0) - printf (format, user, "user", user_flags); - if (strlen (system) > 0) - printf (format, system, "nouser", system_flags); - - exit (0); -} diff --git a/winsup/utils/parse_pe.cc b/winsup/utils/parse_pe.cc deleted file mode 100644 index c3ae7bb11..000000000 --- a/winsup/utils/parse_pe.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* parse_pe.cc - - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2012, 2013 Red Hat, Inc. - - Written by Egor Duda - - This file is part of Cygwin. - - 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 (file COPYING.dumper) 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 Street - Fifth Floor, Boston, MA 02110-1301, USA. */ - -#define PACKAGE -#include -#include -#include - -#include "dumper.h" - -int -exclusion::add (LPBYTE mem_base, SIZE_T mem_size) -{ - while (last >= size) - size += step; - region = (process_mem_region *) realloc (region, size * sizeof (process_mem_region)); - if (region == NULL) - return 0; - region[last].base = mem_base; - region[last].size = mem_size; - last++; - return 1; -}; - -int -cmp_regions (const void *r1, const void *r2) -{ - if (((process_mem_region *) r1)->base < ((process_mem_region *) r2)->base) - return -1; - if (((process_mem_region *) r1)->base > ((process_mem_region *) r2)->base) - return 1; - return 0; -} - -int -exclusion::sort_and_check () -{ - qsort (region, last, sizeof (process_mem_region), &cmp_regions); - for (process_mem_region * p = region; p < region + last - 1; p++) - { - process_mem_region *q = p + 1; - if (q == p + 1) - continue; - if (p->base + size > q->base) - { - fprintf (stderr, "region error @ (%p + %zd) > %p\n", p->base, size, q->base); - return 0; - } - } - return 1; -} - -static void -select_data_section (bfd * abfd, asection * sect, PTR obj) -{ - exclusion *excl_list = (exclusion *) obj; - - if ((sect->flags & (SEC_CODE | SEC_DEBUGGING)) && - sect->vma && bfd_get_section_size (sect)) - { - excl_list->add ((LPBYTE) sect->vma, (SIZE_T) bfd_get_section_size (sect)); - deb_printf ("excluding section: %20s %08lx\n", sect->name, - bfd_get_section_size (sect)); - } -} - -int -parse_pe (const char *file_name, exclusion * excl_list) -{ - if (file_name == NULL || excl_list == NULL) - return 0; - - bfd *abfd = bfd_openr (file_name, "pei-i386"); - if (abfd == NULL) - { - bfd_perror ("failed to open file"); - return 0; - } - - bfd_check_format (abfd, bfd_object); - bfd_map_over_sections (abfd, &select_data_section, (PTR) excl_list); - excl_list->sort_and_check (); - - bfd_close (abfd); - return 1; -} diff --git a/winsup/utils/passwd.c b/winsup/utils/passwd.c deleted file mode 100644 index ea3e2d159..000000000 --- a/winsup/utils/passwd.c +++ /dev/null @@ -1,661 +0,0 @@ -/* passwd.c: Changing passwords and managing account information - - Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2008, 2009, 2011, 2012, - 2013 Red Hat, Inc. - - Written by Corinna Vinschen - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define USER_PRIV_ADMIN 2 - -static char *prog_name; - -static struct option longopts[] = -{ - {"cannot-change", no_argument, NULL, 'c'}, - {"can-change", no_argument, NULL, 'C'}, - {"logonserver", required_argument, NULL, 'd'}, - {"never-expires", no_argument, NULL, 'e'}, - {"expires", no_argument, NULL, 'E'}, - {"help", no_argument, NULL, 'h' }, - {"inactive", required_argument, NULL, 'i'}, - {"lock", no_argument, NULL, 'l'}, - {"minage", required_argument, NULL, 'n'}, - {"pwd-not-required", no_argument, NULL, 'p'}, - {"pwd-required", no_argument, NULL, 'P'}, - {"unlock", no_argument, NULL, 'u'}, - {"version", no_argument, NULL, 'V'}, - {"maxage", required_argument, NULL, 'x'}, - {"length", required_argument, NULL, 'L'}, - {"status", no_argument, NULL, 'S'}, - { "reg-store-pwd", no_argument, NULL, 'R'}, - {NULL, 0, NULL, 0} -}; - -static char opts[] = "cCd:eEhi:ln:pPuvVx:L:SR"; - -int -eprint (int with_name, const char *fmt, ...) -{ - va_list ap; - - if (with_name) - fprintf(stderr, "%s: ", prog_name); - va_start (ap, fmt); - vfprintf (stderr, fmt, ap); - va_end (ap); - fprintf(stderr, "\n"); - return 1; -} - -int -EvalRet (int ret, const char *user) -{ - switch (ret) - { - case NERR_Success: - return 0; - - case ERROR_ACCESS_DENIED: - if (! user) - eprint (0, "You may not change password expiry information."); - else - eprint (0, "You may not change the password for %s.", user); - break; - - eprint (0, "Bad password: Invalid."); - break; - - case NERR_PasswordTooShort: - eprint (0, "Bad password: Too short."); - break; - - case NERR_UserNotFound: - eprint (1, "unknown user %s", user); - break; - - case ERROR_INVALID_PASSWORD: - case NERR_BadPassword: - eprint (0, "Incorrect password for %s.", user); - eprint (0, "The password for %s is unchanged.", user); - break; - - default: - eprint (1, "unrecoverable error %d", ret); - break; - } - return 1; -} - -PUSER_INFO_3 -GetPW (char *user, int print_win_name, LPCWSTR server) -{ - char usr_buf[UNLEN + 1]; - WCHAR name[UNLEN + 1]; - DWORD ret; - PUSER_INFO_3 ui; - struct passwd *pw; - char *domain = (char *) alloca (INTERNET_MAX_HOST_NAME_LENGTH + 1); - - /* Try getting a Win32 username in case the user edited /etc/passwd */ - if ((pw = getpwnam (user))) - { - cygwin_internal (CW_EXTRACT_DOMAIN_AND_USER, pw, domain, usr_buf); - if (strcasecmp (pw->pw_name, usr_buf)) - { - /* Hack to avoid problem with LookupAccountSid after impersonation */ - if (strcasecmp (usr_buf, "SYSTEM")) - { - user = usr_buf; - if (print_win_name) - printf ("Windows username : %s\n", user); - } - } - } - mbstowcs (name, user, UNLEN + 1); - ret = NetUserGetInfo (server, name, 3, (void *) &ui); - return EvalRet (ret, user) ? NULL : ui; -} - -int -ChangePW (const char *user, const char *oldpwd, const char *pwd, int justcheck, - LPCWSTR server) -{ - WCHAR name[UNLEN + 1], oldpass[512], pass[512]; - DWORD ret; - - mbstowcs (name, user, UNLEN + 1); - mbstowcs (pass, pwd, 512); - if (! oldpwd) - { - USER_INFO_1003 ui; - - ui.usri1003_password = pass; - ret = NetUserSetInfo (server, name, 1003, (LPBYTE) &ui, NULL); - } - else - { - mbstowcs (oldpass, oldpwd, 512); - ret = NetUserChangePassword (server, name, oldpass, pass); - } - if (justcheck && ret != ERROR_INVALID_PASSWORD) - return 0; - if (! EvalRet (ret, user) && ! justcheck) - { - eprint (0, "Password changed."); - } - return ret; -} - -void -PrintPW (PUSER_INFO_3 ui, LPCWSTR server) -{ - time_t t = time (NULL) - ui->usri3_password_age; - int ret; - PUSER_MODALS_INFO_0 mi; - - printf ("Account disabled : %s", - (ui->usri3_flags & UF_ACCOUNTDISABLE) ? "yes\n" : "no\n"); - printf ("Password not required : %s", - (ui->usri3_flags & UF_PASSWD_NOTREQD) ? "yes\n" : "no\n"); - printf ("User can't change password : %s", - (ui->usri3_flags & UF_PASSWD_CANT_CHANGE) ? "yes\n" : "no\n"); - printf ("Password never expires : %s", - (ui->usri3_flags & UF_DONT_EXPIRE_PASSWD) ? "yes\n" : "no\n"); - printf ("Password expired : %s", - (ui->usri3_password_expired) ? "yes\n" : "no\n"); - printf ("Latest password change : %s", ctime(&t)); - ret = NetUserModalsGet (server, 0, (void *) &mi); - if (! ret) - { - if (mi->usrmod0_max_passwd_age == TIMEQ_FOREVER) - mi->usrmod0_max_passwd_age = 0; - if (mi->usrmod0_min_passwd_age == TIMEQ_FOREVER) - mi->usrmod0_min_passwd_age = 0; - if (mi->usrmod0_force_logoff == TIMEQ_FOREVER) - mi->usrmod0_force_logoff = 0; - if (ui->usri3_priv == USER_PRIV_ADMIN) - mi->usrmod0_min_passwd_len = 0; - printf ("\nSystem password settings:\n"); - printf ("Max. password age %" PRIu32 " days\n", - (unsigned int) (mi->usrmod0_max_passwd_age / ONE_DAY)); - printf ("Min. password age %" PRIu32 " days\n", - (unsigned int) (mi->usrmod0_min_passwd_age / ONE_DAY)); - printf ("Force logout after %" PRIu32 " days\n", - (unsigned int) (mi->usrmod0_force_logoff / ONE_DAY)); - printf ("Min. password length: %" PRIu32 "\n", - (unsigned int) mi->usrmod0_min_passwd_len); - } -} - -int -SetModals (int xarg, int narg, int iarg, int Larg, LPCWSTR server) -{ - int ret; - PUSER_MODALS_INFO_0 mi; - - ret = NetUserModalsGet (server, 0, (void *) &mi); - if (! ret) - { - if (xarg == 0) - mi->usrmod0_max_passwd_age = TIMEQ_FOREVER; - else if (xarg > 0) - mi->usrmod0_max_passwd_age = xarg * ONE_DAY; - - if (narg == 0) - { - mi->usrmod0_min_passwd_age = TIMEQ_FOREVER; - mi->usrmod0_password_hist_len = 0; - } - else if (narg > 0) - mi->usrmod0_min_passwd_age = narg * ONE_DAY; - - if (iarg == 0) - mi->usrmod0_force_logoff = TIMEQ_FOREVER; - else if (iarg > 0) - mi->usrmod0_force_logoff = iarg * ONE_DAY; - - if (Larg >= 0) - mi->usrmod0_min_passwd_len = Larg; - - ret = NetUserModalsSet (server, 0, (LPBYTE) mi, NULL); - NetApiBufferFree (mi); - } - return EvalRet (ret, NULL); -} - -static void usage (FILE * stream, int status) __attribute__ ((noreturn)); -static void -usage (FILE * stream, int status) -{ - fprintf (stream, "" - "Usage: %s [OPTION] [USER]\n" - "\n" - "Change USER's password or password attributes.\n" - "\n" - "User operations:\n" - " -l, --lock lock USER's account.\n" - " -u, --unlock unlock USER's account.\n" - " -c, --cannot-change USER can't change password.\n" - " -C, --can-change USER can change password.\n" - " -e, --never-expires USER's password never expires.\n" - " -E, --expires USER's password expires according to system's\n" - " password aging rule.\n" - " -p, --pwd-not-required no password required for USER.\n" - " -P, --pwd-required password is required for USER.\n" - " -R, --reg-store-pwd enter password to store it in the registry for\n" - " later usage by services to be able to switch\n" - " to this user context with network credentials.\n" - "\n" - "System operations:\n" - " -i, --inactive NUM set NUM of days before inactive accounts are disabled\n" - " (inactive accounts are those with expired passwords).\n" - " -n, --minage DAYS set system minimum password age to DAYS days.\n" - " -x, --maxage DAYS set system maximum password age to DAYS days.\n" - " -L, --length LEN set system minimum password length to LEN.\n" - "\n" - "Other options:\n" - " -d, --logonserver SERVER connect to SERVER (e.g. domain controller).\n" - " Default server is the local system, unless\n" - " changing the current user, in which case the\n" - " default is the content of $LOGONSERVER.\n" - " -S, --status display password status for USER (locked, expired,\n" - " etc.) plus global system password settings.\n" - " -h, --help output usage information and exit.\n" - " -V, --version output version information and exit.\n" - "\n" - "If no option is given, change USER's password. If no user name is given,\n" - "operate on current user. System operations must not be mixed with user\n" - "operations. Don't specify a USER when triggering a system operation.\n" - "\n" - "Don't specify a user or any other option together with the -R option.\n" - "Non-Admin users can only store their password if cygserver is running\n" - "as service under the SYSTEM account.\n" - "Note that storing even obfuscated passwords in the registry is not overly\n" - "secure. Use this feature only if the machine is adequately locked down.\n" - "Don't use this feature if you don't need network access within a remote\n" - "session. You can delete your stored password by using `passwd -R' and\n" - "specifying an empty password.\n\n", prog_name); - exit (status); -} - -static int -caller_is_admin () -{ - static int is_admin = -1; - HANDLE token; - DWORD size; - PTOKEN_GROUPS grps; - SID_IDENTIFIER_AUTHORITY nt_auth = {SECURITY_NT_AUTHORITY}; - PSID admin_grp; - DWORD i; - - if (is_admin == -1) - { - is_admin = 0; - if (OpenProcessToken (GetCurrentProcess (), TOKEN_READ, &token)) - { - GetTokenInformation (token, TokenGroups, NULL, 0, &size); - grps = (PTOKEN_GROUPS) alloca (size); - if (!GetTokenInformation(token, TokenGroups, grps, size, &size) - || !AllocateAndInitializeSid (&nt_auth, 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, - 0, 0, 0, 0, 0, 0, &admin_grp)) - is_admin = 0; - else - { - for (i = 0; i < grps->GroupCount; ++i) - if (EqualSid (admin_grp, grps->Groups[i].Sid) - && (grps->Groups[i].Attributes - & (SE_GROUP_ENABLED | SE_GROUP_USE_FOR_DENY_ONLY)) - == SE_GROUP_ENABLED) - { - is_admin = 1; - break; - } - FreeSid (admin_grp); - } - CloseHandle (token); - } - } - return is_admin; -} - -static void -print_version () -{ - printf ("passwd (cygwin) %d.%d.%d\n" - "Password Utility\n" - "Copyright (C) 1999 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -int -main (int argc, char **argv) -{ - char *logonserver; - char user[UNLEN + 1], oldpwd[_PASSWORD_LEN + 1], newpwd[_PASSWORD_LEN + 1]; - int ret = 0; - int cnt = 0; - int opt; - int Larg = -1; - int xarg = -1; - int narg = -1; - int iarg = -1; - int lopt = 0; - int uopt = 0; - int copt = 0; - int Copt = 0; - int eopt = 0; - int Eopt = 0; - int popt = 0; - int Popt = 0; - int Sopt = 0; - int Ropt = 0; - PUSER_INFO_3 ui; - int myself = 0; - LPWSTR server = NULL; - - prog_name = program_invocation_short_name; - - /* Use locale from environment. If not set or set to "C", use UTF-8. */ - setlocale (LC_CTYPE, ""); - if (!strcmp (setlocale (LC_CTYPE, NULL), "C")) - setlocale (LC_CTYPE, "en_US.UTF-8"); - while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (opt) - { - case 'h': - usage (stdout, 0); - break; - - case 'i': - if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt) - usage (stderr, 1); - if ((iarg = atoi (optarg)) < 0 || iarg > 999) - return eprint (1, "Force logout time must be between 0 and 999."); - break; - - case 'l': - if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || uopt || Sopt || Ropt) - usage (stderr, 1); - lopt = 1; - break; - - case 'n': - if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt) - usage (stderr, 1); - if ((narg = atoi (optarg)) < 0 || narg > 999) - return eprint (1, "Minimum password age must be between 0 and 999."); - if (xarg >= 0 && narg > xarg) - return eprint (1, "Minimum password age must be less than " - "maximum password age."); - break; - - case 'u': - if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || Sopt || Ropt) - usage (stderr, 1); - uopt = 1; - break; - - case 'c': - if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) - usage (stderr, 1); - copt = 1; - break; - - case 'C': - if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) - usage (stderr, 1); - Copt = 1; - break; - - case 'd': - { - if (Ropt) - usage (stderr, 1); - char *tmpbuf = alloca (strlen (optarg) + 3); - tmpbuf[0] = '\0'; - if (*optarg != '\\') - strcpy (tmpbuf, "\\\\"); - strcat (tmpbuf, optarg); - size_t len = mbstowcs (NULL, tmpbuf, 0); - if (len > 0 && len != (size_t) -1) - mbstowcs (server = alloca ((len + 1) * sizeof (wchar_t)), - tmpbuf, len + 1); - } - break; - - case 'e': - if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) - usage (stderr, 1); - eopt = 1; - break; - - case 'E': - if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) - usage (stderr, 1); - Eopt = 1; - break; - - case 'p': - if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) - usage (stderr, 1); - popt = 1; - break; - - case 'P': - if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt) - usage (stderr, 1); - Popt = 1; - break; - - case 'V': - case 'v': /* Keep this option for historrical reasons, - but don't advertize it. */ - print_version (); - exit (0); - break; - - case 'x': - if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt) - usage (stderr, 1); - if ((xarg = atoi (optarg)) < 0 || xarg > 999) - return eprint (1, "Maximum password age must be between 0 and 999."); - if (narg >= 0 && xarg < narg) - return eprint (1, "Maximum password age must be greater than " - "minimum password age."); - break; - - case 'L': - if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt) - usage (stderr, 1); - if ((Larg = atoi (optarg)) < 0 || Larg > LM20_PWLEN) - return eprint (1, "Minimum password length must be between " - "0 and %d.", LM20_PWLEN); - break; - - case 'S': - if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || uopt - || copt || Copt || eopt || Eopt || popt || Popt || Ropt) - usage (stderr, 1); - Sopt = 1; - break; - - case 'R': - if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || uopt - || copt || Copt || eopt || Eopt || popt || Popt || Sopt - || server) - usage (stderr, 1); - Ropt = 1; - break; - - default: - fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); - return 1; - } - - if (Ropt) - { - const char *username = NULL; - if (optind < argc) - { - username = argv[optind++]; - if (!strcmp (username, getlogin ())) - username = NULL; - else if (!caller_is_admin ()) - return eprint (0, "You may not change the password for %s.", user); - - if (optind < argc) - usage (stderr, 1); - } - char *text1 = (char *) alloca ((username ? strlen (username) + 2 : 4) - + sizeof ("Enter current password: ")); - char *text2 = (char *) alloca ((username ? strlen (username) + 2 : 4) - + sizeof ("Re-enter current password: ")); - sprintf (text1, "Enter %s%s current password: ", - username ?: "your", username ? "'s" : ""); - sprintf (text2, "Re-enter %s%s current password: ", - username ?: "your", username ? "'s" : ""); - printf ( -"This functionality stores a password in the registry for usage by services\n" -"which need to change the user context and require network access. Typical\n" -"applications are interactive remote logons using sshd, cron task, etc.\n" -"This password will always tried first when any privileged application is\n" -"about to switch the user context.\n\n" -"Note that storing even obfuscated passwords in the registry is not overly\n" -"secure. Use this feature only if the machine is adequately locked down.\n" -"Don't use this feature if you don't need network access within a remote\n" -"session.\n\n" -"You can delete the stored password by specifying an empty password.\n\n"); - strcpy (newpwd, getpass (text1)); - if (strcmp (newpwd, getpass (text2))) - eprint (0, "Password is not identical."); - else if (cygwin_internal (CW_SET_PRIV_KEY, newpwd, username)) - return eprint (0, "Storing password failed: %s", strerror (errno)); - return 0; - } - - if (Larg >= 0 || xarg >= 0 || narg >= 0 || iarg >= 0) - { - if (optind < argc) - usage (stderr, 1); - return SetModals (xarg, narg, iarg, Larg, server); - } - - strcpy (user, optind >= argc ? getlogin () : argv[optind]); - - /* Changing password for calling user? Use logonserver for user as well. */ - if (!server && optind >= argc) - { - myself = 1; - if ((logonserver = getenv ("LOGONSERVER"))) - { - size_t len = mbstowcs (NULL, logonserver, 0); - if (len > 0 && len != (size_t) -1) - mbstowcs (server = alloca ((len + 1) * sizeof (wchar_t)), - logonserver, len + 1); - } - } - - ui = GetPW (user, 1, server); - if (! ui) - return 1; - - if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt) - { - USER_INFO_1008 uif; - - uif.usri1008_flags = ui->usri3_flags; - if (lopt) - { - if (ui->usri3_priv == USER_PRIV_ADMIN) - return eprint (0, "Locking an admin account is disallowed."); - uif.usri1008_flags |= UF_ACCOUNTDISABLE; - } - if (uopt) - uif.usri1008_flags &= ~UF_ACCOUNTDISABLE; - if (copt) - uif.usri1008_flags |= UF_PASSWD_CANT_CHANGE; - if (Copt) - uif.usri1008_flags &= ~UF_PASSWD_CANT_CHANGE; - if (eopt) - uif.usri1008_flags |= UF_DONT_EXPIRE_PASSWD; - if (Eopt) - uif.usri1008_flags &= ~UF_DONT_EXPIRE_PASSWD; - if (popt) - uif.usri1008_flags |= UF_PASSWD_NOTREQD; - if (Popt) - uif.usri1008_flags &= ~UF_PASSWD_NOTREQD; - - if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt) - { - ret = NetUserSetInfo (server, ui->usri3_name, 1008, (LPBYTE) &uif, - NULL); - return EvalRet (ret, NULL); - } - // Sopt - PrintPW (ui, server); - return 0; - } - - if (!caller_is_admin () && !myself) - return eprint (0, "You may not change the password for %s.", user); - - eprint (0, "Enter the new password (minimum of 5, maximum of 8 characters)."); - eprint (0, "Please use a combination of upper and lower case letters and numbers."); - - oldpwd[0] = '\0'; - if (!caller_is_admin ()) - { - strcpy (oldpwd, getpass ("Old password: ")); - if (ChangePW (user, oldpwd, oldpwd, 1, server)) - return 1; - } - - do - { - strcpy (newpwd, getpass ("New password: ")); - if (strcmp (newpwd, getpass ("Re-enter new password: "))) - eprint (0, "Password is not identical."); - else if (! ChangePW (user, *oldpwd ? oldpwd : NULL, newpwd, 0, server)) - ret = 1; - if (! ret && cnt < 2) - eprint (0, "Try again."); - } - while (! ret && ++cnt < 3); - return ! ret; -} diff --git a/winsup/utils/path.cc b/winsup/utils/path.cc deleted file mode 100644 index d1d01e92b..000000000 --- a/winsup/utils/path.cc +++ /dev/null @@ -1,954 +0,0 @@ -/* path.cc - - Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, - 2013 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -/* The purpose of this file is to hide all the details about accessing - Cygwin's mount table, shortcuts, etc. If the format or location of - the mount table, or the shortcut format changes, this is the file to - change to match it. */ - -#define str(a) #a -#define scat(a,b) str(a##b) -#include -#include -#include -#include -#include -#include -#include "path.h" -#include "../cygwin/include/cygwin/version.h" -#include "../cygwin/include/sys/mount.h" -#define _NOMNTENT_MACROS -#include "../cygwin/include/mntent.h" -#include "testsuite.h" -#ifdef FSTAB_ONLY -#include -#endif -#include "loadlib.h" - -#ifndef FSTAB_ONLY -/* Used when treating / and \ as equivalent. */ -#define isslash(ch) \ - ({ \ - char __c = (ch); \ - ((__c) == '/' || (__c) == '\\'); \ - }) - - -static const GUID GUID_shortcut = - {0x00021401L, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}}; - -enum { - WSH_FLAG_IDLIST = 0x01, /* Contains an ITEMIDLIST. */ - WSH_FLAG_FILE = 0x02, /* Contains a file locator element. */ - WSH_FLAG_DESC = 0x04, /* Contains a description. */ - WSH_FLAG_RELPATH = 0x08, /* Contains a relative path. */ - WSH_FLAG_WD = 0x10, /* Contains a working dir. */ - WSH_FLAG_CMDLINE = 0x20, /* Contains command line args. */ - WSH_FLAG_ICON = 0x40 /* Contains a custom icon. */ -}; - -struct win_shortcut_hdr - { - DWORD size; /* Header size in bytes. Must contain 0x4c. */ - GUID magic; /* GUID of shortcut files. */ - DWORD flags; /* Content flags. See above. */ - - /* The next fields from attr to icon_no are always set to 0 in Cygwin - and U/Win shortcuts. */ - DWORD attr; /* Target file attributes. */ - FILETIME ctime; /* These filetime items are never touched by the */ - FILETIME mtime; /* system, apparently. Values don't matter. */ - FILETIME atime; - DWORD filesize; /* Target filesize. */ - DWORD icon_no; /* Icon number. */ - - DWORD run; /* Values defined in winuser.h. Use SW_NORMAL. */ - DWORD hotkey; /* Hotkey value. Set to 0. */ - DWORD dummy[2]; /* Future extension probably. Always 0. */ - }; - -static bool -cmp_shortcut_header (win_shortcut_hdr *file_header) -{ - /* A Cygwin or U/Win shortcut only contains a description and a relpath. - Cygwin shortcuts also might contain an ITEMIDLIST. The run type is - always set to SW_NORMAL. */ - return file_header->size == sizeof (win_shortcut_hdr) - && !memcmp (&file_header->magic, &GUID_shortcut, sizeof GUID_shortcut) - && (file_header->flags & ~WSH_FLAG_IDLIST) - == (WSH_FLAG_DESC | WSH_FLAG_RELPATH) - && file_header->run == SW_NORMAL; -} - -int -get_word (HANDLE fh, int offset) -{ - unsigned short rv; - unsigned r; - - SetLastError(NO_ERROR); - if (SetFilePointer (fh, offset, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER - && GetLastError () != NO_ERROR) - return -1; - - if (!ReadFile (fh, &rv, 2, (DWORD *) &r, 0)) - return -1; - - return rv; -} - -/* - * Check the value of GetLastError() to find out whether there was an error. - */ -int -get_dword (HANDLE fh, int offset) -{ - int rv; - unsigned r; - - SetLastError(NO_ERROR); - if (SetFilePointer (fh, offset, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER - && GetLastError () != NO_ERROR) - return -1; - - if (!ReadFile (fh, &rv, 4, (DWORD *) &r, 0)) - return -1; - - return rv; -} - -#define EXE_MAGIC ((int)*(unsigned short *)"MZ") -#define SHORTCUT_MAGIC ((int)*(unsigned short *)"L\0") -#define SYMLINK_COOKIE "!" -#define SYMLINK_MAGIC ((int)*(unsigned short *)SYMLINK_COOKIE) - -bool -is_exe (HANDLE fh) -{ - int magic = get_word (fh, 0x0); - return magic == EXE_MAGIC; -} - -bool -is_symlink (HANDLE fh) -{ - bool ret = false; - int magic = get_word (fh, 0x0); - if (magic != SHORTCUT_MAGIC && magic != SYMLINK_MAGIC) - goto out; - DWORD got; - BY_HANDLE_FILE_INFORMATION local; - if (!GetFileInformationByHandle (fh, &local)) - return false; - if (magic == SHORTCUT_MAGIC) - { - DWORD size; - if (!local.dwFileAttributes & FILE_ATTRIBUTE_READONLY) - goto out; /* Not a Cygwin symlink. */ - if ((size = GetFileSize (fh, NULL)) > 8192) - goto out; /* Not a Cygwin symlink. */ - char buf[size]; - SetFilePointer (fh, 0, 0, FILE_BEGIN); - if (!ReadFile (fh, buf, size, &got, 0)) - goto out; - if (got != size || !cmp_shortcut_header ((win_shortcut_hdr *) buf)) - goto out; /* Not a Cygwin symlink. */ - /* TODO: check for invalid path contents - (see symlink_info::check() in ../cygwin/path.cc) */ - } - else /* magic == SYMLINK_MAGIC */ - { - if (!local.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) - goto out; /* Not a Cygwin symlink. */ - char buf[sizeof (SYMLINK_COOKIE) - 1]; - SetFilePointer (fh, 0, 0, FILE_BEGIN); - if (!ReadFile (fh, buf, sizeof (buf), &got, 0)) - goto out; - if (got != sizeof (buf) || - memcmp (buf, SYMLINK_COOKIE, sizeof (buf)) != 0) - goto out; /* Not a Cygwin symlink. */ - } - ret = true; -out: - SetFilePointer (fh, 0, 0, FILE_BEGIN); - return ret; -} - -/* Assumes is_symlink(fh) is true */ -bool -readlink (HANDLE fh, char *path, int maxlen) -{ - DWORD rv; - char *buf, *cp; - unsigned short len; - win_shortcut_hdr *file_header; - BY_HANDLE_FILE_INFORMATION fi; - - if (!GetFileInformationByHandle (fh, &fi) - || fi.nFileSizeHigh != 0 - || fi.nFileSizeLow > 4 * 65536) - return false; - - buf = (char *) alloca (fi.nFileSizeLow + 1); - file_header = (win_shortcut_hdr *) buf; - - if (!ReadFile (fh, buf, fi.nFileSizeLow, &rv, NULL) - || rv != fi.nFileSizeLow) - return false; - - if (fi.nFileSizeLow > sizeof (file_header) - && cmp_shortcut_header (file_header)) - { - cp = buf + sizeof (win_shortcut_hdr); - if (file_header->flags & WSH_FLAG_IDLIST) /* Skip ITEMIDLIST */ - cp += *(unsigned short *) cp + 2; - if (!(len = *(unsigned short *) cp)) - return false; - cp += 2; - /* Has appended full path? If so, use it instead of description. */ - unsigned short relpath_len = *(unsigned short *) (cp + len); - if (cp + len + 2 + relpath_len < buf + fi.nFileSizeLow) - { - cp += len + 2 + relpath_len; - len = *(unsigned short *) cp; - cp += 2; - } - if (*(PWCHAR) cp == 0xfeff) /* BOM */ - { - len = wcstombs (NULL, (wchar_t *) (cp + 2), 0); - if (len == (size_t) -1 || len + 1 > maxlen) - return false; - wcstombs (path, (wchar_t *) (cp + 2), len + 1); - } - else if (len + 1 > maxlen) - return false; - else - memcpy (path, cp, len); - path[len] = '\0'; - return true; - } - else if (strncmp (buf, SYMLINK_COOKIE, strlen (SYMLINK_COOKIE)) == 0 - && buf[fi.nFileSizeLow - 1] == '\0') - { - cp = buf + strlen (SYMLINK_COOKIE); - if (*(PWCHAR) cp == 0xfeff) /* BOM */ - { - len = wcstombs (NULL, (wchar_t *) (cp + 2), 0); - if (len == (size_t) -1 || len + 1 > maxlen) - return false; - wcstombs (path, (wchar_t *) (cp + 2), len + 1); - } - else if (fi.nFileSizeLow - strlen (SYMLINK_COOKIE) > (unsigned) maxlen) - return false; - else - strcpy (path, cp); - return true; - } - else - return false; -} -#endif /* !FSTAB_ONLY */ - -#ifndef TESTSUITE -mnt_t mount_table[255]; -int max_mount_entry; -#else -# define TESTSUITE_MOUNT_TABLE -# include "testsuite.h" -# undef TESTSUITE_MOUNT_TABLE -#endif - -inline void -unconvert_slashes (char* name) -{ - while ((name = strchr (name, '/')) != NULL) - *name++ = '\\'; -} - -/* These functions aren't called when defined(TESTSUITE) which results - in a compiler warning. */ -#ifndef TESTSUITE -inline char * -skip_ws (char *in) -{ - while (*in == ' ' || *in == '\t') - ++in; - return in; -} - -inline char * -find_ws (char *in) -{ - while (*in && *in != ' ' && *in != '\t') - ++in; - return in; -} - -inline char * -conv_fstab_spaces (char *field) -{ - register char *sp = field; - while ((sp = strstr (sp, "\\040")) != NULL) - { - *sp++ = ' '; - memmove (sp, sp + 3, strlen (sp + 3) + 1); - } - return field; -} - -#ifndef FSTAB_ONLY -static struct opt -{ - const char *name; - unsigned val; - bool clear; -} oopts[] = -{ - {"acl", MOUNT_NOACL, 1}, - {"auto", 0, 0}, - {"binary", MOUNT_BINARY, 0}, - {"cygexec", MOUNT_CYGWIN_EXEC, 0}, - {"dos", MOUNT_DOS, 0}, - {"exec", MOUNT_EXEC, 0}, - {"ihash", MOUNT_IHASH, 0}, - {"noacl", MOUNT_NOACL, 0}, - {"nosuid", 0, 0}, - {"notexec", MOUNT_NOTEXEC, 0}, - {"nouser", MOUNT_SYSTEM, 0}, - {"override", MOUNT_OVERRIDE, 0}, - {"posix=0", MOUNT_NOPOSIX, 0}, - {"posix=1", MOUNT_NOPOSIX, 1}, - {"text", MOUNT_BINARY, 1}, - {"user", MOUNT_SYSTEM, 1} -}; - -static bool -read_flags (char *options, unsigned &flags) -{ - while (*options) - { - char *p = strchr (options, ','); - if (p) - *p++ = '\0'; - else - p = strchr (options, '\0'); - - for (opt *o = oopts; - o < (oopts + (sizeof (oopts) / sizeof (oopts[0]))); - o++) - if (strcmp (options, o->name) == 0) - { - if (o->clear) - flags &= ~o->val; - else - flags |= o->val; - goto gotit; - } - return false; - - gotit: - options = p; - } - return true; -} -#endif - -bool -from_fstab_line (mnt_t *m, char *line, bool user) -{ - char *native_path, *posix_path, *fs_type; - - /* First field: Native path. */ - char *c = skip_ws (line); - if (!*c || *c == '#') - return false; - char *cend = find_ws (c); - *cend = '\0'; - native_path = conv_fstab_spaces (c); - /* Second field: POSIX path. */ - c = skip_ws (cend + 1); - if (!*c) - return false; - cend = find_ws (c); - *cend = '\0'; - posix_path = conv_fstab_spaces (c); - /* Third field: FS type. */ - c = skip_ws (cend + 1); - if (!*c) - return false; - cend = find_ws (c); - *cend = '\0'; - fs_type = c; - /* Forth field: Flags. */ - c = skip_ws (cend + 1); - if (!*c) - return false; - cend = find_ws (c); - *cend = '\0'; - unsigned mount_flags = MOUNT_SYSTEM; -#ifndef FSTAB_ONLY - if (!read_flags (c, mount_flags)) -#else - if (cygwin_internal (CW_CVT_MNT_OPTS, &c, &mount_flags)) -#endif - return false; - if (user) - mount_flags &= ~MOUNT_SYSTEM; - if (!strcmp (fs_type, "cygdrive")) - { - for (mnt_t *sm = mount_table; sm < m; ++sm) - if (sm->flags & MOUNT_CYGDRIVE) - { - if ((mount_flags & MOUNT_SYSTEM) || !(sm->flags & MOUNT_SYSTEM)) - { - if (sm->posix) - free (sm->posix); - sm->posix = strdup (posix_path); - sm->flags = mount_flags | MOUNT_CYGDRIVE; - } - return false; - } - m->posix = strdup (posix_path); - m->native = strdup ("cygdrive prefix"); - m->flags = mount_flags | MOUNT_CYGDRIVE; - } - else - { - for (mnt_t *sm = mount_table; sm < m; ++sm) - if (!strcmp (sm->posix, posix_path)) - { - /* Don't allow overriding of a system mount with a user mount. */ - if ((sm->flags & MOUNT_SYSTEM) && !(mount_flags & MOUNT_SYSTEM)) - return false; - if ((sm->flags & MOUNT_SYSTEM) != (mount_flags & MOUNT_SYSTEM)) - continue; - /* Changing immutable mount points require the override flag. */ - if ((sm->flags & MOUNT_IMMUTABLE) - && !(mount_flags & MOUNT_OVERRIDE)) - return false; - if (mount_flags & MOUNT_OVERRIDE) - mount_flags |= MOUNT_IMMUTABLE; - if (sm->native) - free (sm->native); - sm->native = strdup (native_path); - sm->flags = mount_flags; - return false; - } - m->posix = strdup (posix_path); - unconvert_slashes (native_path); - m->native = strdup (native_path); - m->flags = mount_flags; - } - return true; -} - -#ifndef FSTAB_ONLY - -#define BUFSIZE 65536 - -static char * -get_user () -{ - static char user[UNLEN + 1]; - char *userenv; - - user[0] = '\0'; - if ((userenv = getenv ("USER")) || (userenv = getenv ("USERNAME"))) - strncat (user, userenv, UNLEN); - return user; -} - -void -from_fstab (bool user, PWCHAR path, PWCHAR path_end) -{ - mnt_t *m = mount_table + max_mount_entry; - char buf[BUFSIZE]; - - if (!user) - { - /* Create a default root dir from path. */ - wcstombs (buf, path, BUFSIZE); - unconvert_slashes (buf); - char *native_path = buf; - if (!strncmp (native_path, "\\\\?\\", 4)) - native_path += 4; - if (!strncmp (native_path, "UNC\\", 4)) - *(native_path += 2) = '\\'; - m->posix = strdup ("/"); - m->native = strdup (native_path); - m->flags = MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_IMMUTABLE - | MOUNT_AUTOMATIC; - ++m; - /* Create default /usr/bin and /usr/lib entries. */ - char *trail = strchr (native_path, '\0'); - strcpy (trail, "\\bin"); - m->posix = strdup ("/usr/bin"); - m->native = strdup (native_path); - m->flags = MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC; - ++m; - strcpy (trail, "\\lib"); - m->posix = strdup ("/usr/lib"); - m->native = strdup (native_path); - m->flags = MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC; - ++m; - /* Create a default cygdrive entry. Note that this is a user entry. - This allows to override it with mount, unless the sysadmin created - a cygdrive entry in /etc/fstab. */ - m->posix = strdup (CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX); - m->native = strdup ("cygdrive prefix"); - m->flags = MOUNT_BINARY | MOUNT_CYGDRIVE; - ++m; - max_mount_entry = m - mount_table; - } - - PWCHAR u = wcscpy (path_end, L"\\etc\\fstab") + 10; - if (user) - mbstowcs (wcscpy (u, L".d\\") + 3, get_user (), BUFSIZE - (u - path)); - HANDLE h = CreateFileW (path, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (h == INVALID_HANDLE_VALUE) - return; - char *got = buf; - DWORD len = 0; - /* Using BUFSIZE-1 leaves space to append two \0. */ - while (ReadFile (h, got, BUFSIZE - 1 - (got - buf), - &len, NULL)) - { - char *end; - - /* Set end marker. */ - got[len] = got[len + 1] = '\0'; - /* Set len to the absolute len of bytes in buf. */ - len += got - buf; - /* Reset got to start reading at the start of the buffer again. */ - got = buf; - while (got < buf + len && (end = strchr (got, '\n'))) - { - end[end[-1] == '\r' ? -1 : 0] = '\0'; - if (from_fstab_line (m, got, user)) - ++m; - got = end + 1; - } - if (len < BUFSIZE - 1) - break; - /* We have to read once more. Move remaining bytes to the start of - the buffer and reposition got so that it points to the end of - the remaining bytes. */ - len = buf + len - got; - memmove (buf, got, len); - got = buf + len; - buf[len] = buf[len + 1] = '\0'; - } - if (got > buf && from_fstab_line (m, got, user)) - ++m; - max_mount_entry = m - mount_table; - CloseHandle (h); -} -#endif /* !FSTAB_ONLY */ -#endif /* !TESTSUITE */ - -#ifndef FSTAB_ONLY - -static int -mnt_sort (const void *a, const void *b) -{ - const mnt_t *ma = (const mnt_t *) a; - const mnt_t *mb = (const mnt_t *) b; - int ret; - - ret = (ma->flags & MOUNT_CYGDRIVE) - (mb->flags & MOUNT_CYGDRIVE); - if (ret) - return ret; - ret = (ma->flags & MOUNT_SYSTEM) - (mb->flags & MOUNT_SYSTEM); - if (ret) - return ret; - return strcmp (ma->posix, mb->posix); -} - -extern "C" WCHAR cygwin_dll_path[]; - -static void -read_mounts () -{ -/* If TESTSUITE is defined, bypass this whole function as a harness - mount table will be provided. */ -#ifndef TESTSUITE - HKEY setup_key; - LONG ret; - DWORD len; - WCHAR path[32768]; - PWCHAR path_end; - - for (mnt_t *m1 = mount_table; m1->posix; m1++) - { - free (m1->posix); - if (m1->native) - free ((char *) m1->native); - m1->posix = NULL; - } - max_mount_entry = 0; - - /* First fetch the cygwin1.dll path from the LoadLibrary call in load_cygwin. - This utilizes the DLL search order to find a matching cygwin1.dll and to - compute the installation path from that DLL's path. */ - if (cygwin_dll_path[0]) - wcscpy (path, cygwin_dll_path); - /* If we can't load cygwin1.dll, check where cygcheck is living itself and - try to fetch installation path from here. Does cygwin1.dll exist in the - same path? This should only kick in if the cygwin1.dll in the same path - has been made non-executable for the current user accidentally. */ - else if (!GetModuleFileNameW (NULL, path, 32768)) - return; - path_end = wcsrchr (path, L'\\'); - if (path_end) - { - if (!cygwin_dll_path[0]) - { - wcscpy (path_end, L"\\cygwin1.dll"); - DWORD attr = GetFileAttributesW (path); - if (attr == (DWORD) -1 - || (attr & (FILE_ATTRIBUTE_DIRECTORY - | FILE_ATTRIBUTE_REPARSE_POINT))) - path_end = NULL; - } - if (path_end) - { - *path_end = L'\0'; - path_end = wcsrchr (path, L'\\'); - } - } - /* If we can't create a valid installation dir from that, try to fetch - the installation dir from the setup registry key. */ - if (!path_end) - { - for (int i = 0; i < 2; ++i) - if ((ret = RegOpenKeyExW (i ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, - L"Software\\Cygwin\\setup", 0, - KEY_READ, &setup_key)) == ERROR_SUCCESS) - { - len = 32768 * sizeof (WCHAR); - ret = RegQueryValueExW (setup_key, L"rootdir", NULL, NULL, - (PBYTE) path, &len); - RegCloseKey (setup_key); - if (ret == ERROR_SUCCESS) - break; - } - if (ret == ERROR_SUCCESS) - path_end = wcschr (path, L'\0'); - } - /* If we can't fetch an installation dir, bail out. */ - if (!path_end) - return; - *path_end = L'\0'; - - from_fstab (false, path, path_end); - from_fstab (true, path, path_end); - qsort (mount_table, max_mount_entry, sizeof (mnt_t), mnt_sort); -#endif /* !defined(TESTSUITE) */ -} - -/* Return non-zero if PATH1 is a prefix of PATH2. - Both are assumed to be of the same path style and / vs \ usage. - Neither may be "". - LEN1 = strlen (PATH1). It's passed because often it's already known. - - Examples: - /foo/ is a prefix of /foo <-- may seem odd, but desired - /foo is a prefix of /foo/ - / is a prefix of /foo/bar - / is not a prefix of foo/bar - foo/ is a prefix foo/bar - /foo is not a prefix of /foobar -*/ - -static int -path_prefix_p (const char *path1, const char *path2, int len1) -{ - /* Handle case where PATH1 has trailing '/' and when it doesn't. */ - if (len1 > 0 && isslash (path1[len1 - 1])) - len1--; - - if (len1 == 0) - return isslash (path2[0]) && !isslash (path2[1]); - - if (strncasecmp (path1, path2, len1) != 0) - return 0; - - return isslash (path2[len1]) || path2[len1] == 0 || path1[len1 - 1] == ':'; -} - -static char * -vconcat (const char *s, va_list v) -{ - int len; - char *rv, *arg; - va_list save_v = v; - int unc; - - if (!s) - return 0; - - len = strlen (s); - - unc = isslash (*s) && isslash (s[1]); - - while (1) - { - arg = va_arg (v, char *); - if (arg == 0) - break; - len += strlen (arg); - } - va_end (v); - - rv = (char *) malloc (len + 1); - strcpy (rv, s); - v = save_v; - while (1) - { - arg = va_arg (v, char *); - if (arg == 0) - break; - strcat (rv, arg); - } - va_end (v); - - char *d, *p; - - /* concat is only used for urls and files, so we can safely - canonicalize the results */ - for (p = d = rv; *p; p++) - { - *d++ = *p; - /* special case for URLs */ - if (*p == ':' && p[1] == '/' && p[2] == '/' && p > rv + 1) - { - *d++ = *++p; - *d++ = *++p; - } - else if (isslash (*p)) - { - if (p == rv && unc) - *d++ = *p++; - while (p[1] == '/') - p++; - } - } - *d = 0; - - return rv; -} - -static char * -concat (const char *s, ...) -{ - va_list v; - - va_start (v, s); - - return vconcat (s, v); -} - -/* This is a helper function for when vcygpath is passed what appears - to be a relative POSIX path. We take a Win32 CWD (either as specified - in 'cwd' or as retrieved with GetCurrentDirectory() if 'cwd' is NULL) - and find the mount table entry with the longest match. We replace the - matching portion with the corresponding POSIX prefix, and to that append - 's' and anything in 'v'. The returned result is a mostly-POSIX - absolute path -- 'mostly' because the portions of CWD that didn't - match the mount prefix will still have '\\' separators. */ -static char * -rel_vconcat (const char *cwd, const char *s, va_list v) -{ - char pathbuf[MAX_PATH]; - if (!cwd || *cwd == '\0') - { - if (!GetCurrentDirectory (MAX_PATH, pathbuf)) - return NULL; - cwd = pathbuf; - } - - int max_len = -1; - mnt_t *m, *match = NULL; - - for (m = mount_table; m->posix; m++) - { - if (m->flags & MOUNT_CYGDRIVE) - continue; - - int n = strlen (m->native); - if (n < max_len || !path_prefix_p (m->native, cwd, n)) - continue; - max_len = n; - match = m; - } - - char *temppath; - if (!match) - // No prefix matched - best effort to return meaningful value. - temppath = concat (cwd, "/", s, NULL); - else if (strcmp (match->posix, "/") != 0) - // Matched on non-root. Copy matching prefix + remaining 'path'. - temppath = concat (match->posix, cwd + max_len, "/", s, NULL); - else if (cwd[max_len] == '\0') - // Matched on root and there's no remaining 'path'. - temppath = concat ("/", s, NULL); - else if (isslash (cwd[max_len])) - // Matched on root but remaining 'path' starts with a slash anyway. - temppath = concat (cwd + max_len, "/", s, NULL); - else - temppath = concat ("/", cwd + max_len, "/", s, NULL); - - char *res = vconcat (temppath, v); - free (temppath); - return res; -} - -/* Convert a POSIX path in 's' to an absolute Win32 path, and append - anything in 'v' to the end, returning the result. If 's' is a - relative path then 'cwd' is used as the working directory to make - it absolute. Pass NULL in 'cwd' to use GetCurrentDirectory. */ -static char * -vcygpath (const char *cwd, const char *s, va_list v) -{ - int max_len = -1; - mnt_t *m, *match = NULL; - - if (!max_mount_entry) - read_mounts (); - char *path; - if (s[0] == '.' && isslash (s[1])) - s += 2; - - if (s[0] == '/' || s[1] == ':') /* FIXME: too crude? */ - path = vconcat (s, v); - else - path = rel_vconcat (cwd, s, v); - - if (!path) - return NULL; - - if (strncmp (path, "/./", 3) == 0) - memmove (path + 1, path + 3, strlen (path + 3) + 1); - - for (m = mount_table; m->posix; m++) - { - int n = strlen (m->posix); - if (n < max_len || !path_prefix_p (m->posix, path, n)) - continue; - if ((m->flags & MOUNT_CYGDRIVE) - && ((int) strlen (path) < n + 2 - || path[n] != '/' - || !isalpha (path[n + 1]) - || path[n + 2] != '/')) - continue; - max_len = n; - match = m; - } - - char *native; - if (match == NULL) - native = strdup (path); - else if (max_len == (int) strlen (path)) - native = strdup (match->native); - else if (match->flags & MOUNT_CYGDRIVE) - { - char drive[3] = { path[max_len + 1], ':', '\0' }; - native = concat (drive, path + max_len + 2, NULL); - } - else if (isslash (path[max_len])) - native = concat (match->native, path + max_len, NULL); - else - native = concat (match->native, "\\", path + max_len, NULL); - free (path); - - unconvert_slashes (native); - for (char *s = strstr (native + 1, "\\.\\"); s && *s; s = strstr (s, "\\.\\")) - memmove (s + 1, s + 3, strlen (s + 3) + 1); - return native; -} - -char * -cygpath_rel (const char *cwd, const char *s, ...) -{ - va_list v; - - va_start (v, s); - - return vcygpath (cwd, s, v); -} - -char * -cygpath (const char *s, ...) -{ - va_list v; - - va_start (v, s); - - return vcygpath (NULL, s, v); -} - -static mnt_t *m = NULL; - -extern "C" FILE * -setmntent (const char *, const char *) -{ - m = mount_table; - if (!max_mount_entry) - read_mounts (); - return NULL; -} - -extern "C" struct mntent * -getmntent (FILE *) -{ - static mntent mnt; - if (!m->posix) - return NULL; - - mnt.mnt_fsname = (char *) m->native; - mnt.mnt_dir = (char *) m->posix; - if (!mnt.mnt_type) - mnt.mnt_type = (char *) malloc (16); - if (!mnt.mnt_opts) - mnt.mnt_opts = (char *) malloc (64); - - strcpy (mnt.mnt_type, - (char *) ((m->flags & MOUNT_SYSTEM) ? "system" : "user")); - - if (!(m->flags & MOUNT_BINARY)) - strcpy (mnt.mnt_opts, (char *) "text"); - else - strcpy (mnt.mnt_opts, (char *) "binary"); - - if (m->flags & MOUNT_CYGWIN_EXEC) - strcat (mnt.mnt_opts, (char *) ",cygexec"); - else if (m->flags & MOUNT_EXEC) - strcat (mnt.mnt_opts, (char *) ",exec"); - else if (m->flags & MOUNT_NOTEXEC) - strcat (mnt.mnt_opts, (char *) ",notexec"); - - if (m->flags & MOUNT_NOACL) - strcat (mnt.mnt_opts, (char *) ",noacl"); - - if (m->flags & MOUNT_NOPOSIX) - strcat (mnt.mnt_opts, (char *) ",posix=0"); - - if (m->flags & (MOUNT_AUTOMATIC | MOUNT_CYGDRIVE)) - strcat (mnt.mnt_opts, (char *) ",auto"); - - mnt.mnt_freq = 1; - mnt.mnt_passno = 1; - m++; - return &mnt; -} - -#endif /* !FSTAB_ONLY */ diff --git a/winsup/utils/path.h b/winsup/utils/path.h deleted file mode 100644 index a5c77ef58..000000000 --- a/winsup/utils/path.h +++ /dev/null @@ -1,32 +0,0 @@ -/* path.h - - Copyright 2001, 2002, 2003, 2006, 2008, 2009 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -struct mnt_t -{ - char *native; - char *posix; - unsigned flags; -}; - -char *cygpath (const char *s, ...); -char *cygpath_rel (const char *cwd, const char *s, ...); -bool is_exe (HANDLE); -bool is_symlink (HANDLE); -bool readlink (HANDLE, char *, int); -int get_word (HANDLE, int); -int get_dword (HANDLE, int); -bool from_fstab_line (mnt_t *m, char *line, bool user); - -extern mnt_t mount_table[255]; -extern int max_mount_entry; - -#ifndef SYMLINK_MAX -#define SYMLINK_MAX 4095 /* PATH_MAX - 1 */ -#endif diff --git a/winsup/utils/pldd.c b/winsup/utils/pldd.c deleted file mode 100644 index ea99a8bac..000000000 --- a/winsup/utils/pldd.c +++ /dev/null @@ -1,145 +0,0 @@ -/* pldd.c - - Copyright 2012 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#define WIN32_LEAN_AND_MEAN -#define UNICODE -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct option longopts[] = -{ - {"help", no_argument, NULL, '?'}, - {"version", no_argument, NULL, 'V'}, - {"usage", no_argument, NULL, 0}, - {0, no_argument, NULL, 0} -}; -const char *opts = "?V"; - -__attribute__((noreturn)) -static void -print_help (void) -{ - printf ("Usage: pldd [OPTION...] PID\n\n" - "List dynamic shared objects loaded into a process.\n\n" - " -?, --help Give this help list\n" - " --usage Give a short usage message\n" - " -V, --version Print program version\n"); - exit (EXIT_SUCCESS); -} - -__attribute__((noreturn)) -static void -print_usage (void) -{ - printf ("Usage: pldd [-?V] [--help] [--usage] [--version] PID\n"); - exit (EXIT_SUCCESS); -} - -__attribute__((noreturn)) -static void -print_version () -{ - printf ("pldd (cygwin) %d.%d.%d\n" - "List dynamic shared objects loaded into process.\n" - "Copyright (C) 2012 Red Hat, Inc.\n\n" - "This program comes with NO WARRANTY, to the extent permitted by law.\n" - "You may redistribute copies of this program under the terms of\n" - "the Cygwin license. Please consult the CYGWIN_LICENSE file for details.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR); - exit (EXIT_SUCCESS); -} - -__attribute__((noreturn)) -static void -print_nargs (void) -{ - fprintf (stderr, "Exactly one parameter with process ID required.\n" - "Try `pldd --help' or `pldd --usage' for more information.\n"); - exit (EXIT_FAILURE); -} - -int -main (int argc, char *argv[]) -{ - int optch, pid, winpid, i; - char *pidfile, *exefile, *exename; - FILE *fd; - HANDLE hProcess; - HMODULE hModules[1024]; - DWORD cbModules; - - while ((optch = getopt_long (argc, argv, opts, longopts, &optind)) != -1) - switch (optch) - { - case '?': - print_help (); - break; - case 'V': - print_version (); - break; - case 0: - if (strcmp ("usage", longopts[optind].name) == 0) - print_usage (); - break; - default: - break; - } - - argc -= optind; - argv += optind; - if (argc != 1) - print_nargs (); - - pid = atoi (argv[0]); - - if ((pid == 0)) - error (1, 0, "invalid process ID '%s'", argv[0]); - - pidfile = (char *) malloc (32); - sprintf (pidfile, "/proc/%d/winpid", pid); - fd = fopen (pidfile, "rb"); - if (!fd) - error (1, ENOENT, "cannot open /proc/%d", pid); - fscanf (fd, "%d", &winpid); - - exefile = (char *) malloc (32); - exename = (char *) malloc (MAX_PATH); - sprintf (exefile, "/proc/%d/exename", pid); - fd = fopen (exefile, "rb"); - fscanf (fd, "%s", exename); - - hProcess = OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, winpid); - if (!hProcess) - error (1, EPERM, "cannot attach to process %d", pid); - - printf ("%d:\t%s\n", pid, exename); - - EnumProcessModules (hProcess, hModules, sizeof (hModules), &cbModules); - /* start at 1 to skip the executable itself */ - for (i = 1; i < (cbModules / sizeof (HMODULE)); i++) - { - TCHAR winname[MAX_PATH]; - char posixname[MAX_PATH]; - GetModuleFileNameEx (hProcess, hModules[i], winname, MAX_PATH); - cygwin_conv_path (CCP_WIN_W_TO_POSIX, winname, posixname, MAX_PATH); - printf ("%s\n", posixname); - } - - return 0; -} diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc deleted file mode 100644 index 952b63ee3..000000000 --- a/winsup/utils/ps.cc +++ /dev/null @@ -1,409 +0,0 @@ -/* ps.cc - - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "loadlib.h" - -/* Maximum possible path length under NT. There's no official define - for that value. Note that PATH_MAX is only 4K. */ -#define NT_MAX_PATH 32768 - -static char *prog_name; - -static struct option longopts[] = -{ - {"all", no_argument, NULL, 'a' }, - {"everyone", no_argument, NULL, 'e' }, - {"full", no_argument, NULL, 'f' }, - {"help", no_argument, NULL, 'h' }, - {"long", no_argument, NULL, 'l' }, - {"process", required_argument, NULL, 'p'}, - {"summary", no_argument, NULL, 's' }, - {"user", required_argument, NULL, 'u'}, - {"version", no_argument, NULL, 'V'}, - {"windows", no_argument, NULL, 'W'}, - {NULL, 0, NULL, 0} -}; - -static char opts[] = "aefhlp:su:VW"; - -static char * -start_time (external_pinfo *child) -{ - time_t st = child->start_time; - time_t t = time (NULL); - static char stime[40] = {'\0'}; - char now[40]; - - strncpy (stime, ctime (&st) + 4, 15); - strcpy (now, ctime (&t) + 4); - - if ((t - st) < (24 * 3600)) - return (stime + 7); - - stime[6] = '\0'; - - return stime; -} - -#define FACTOR (0x19db1ded53ea710LL) -#define NSPERSEC 10000000LL - -/* Convert a Win32 time to "UNIX" format. */ -long __stdcall -to_time_t (FILETIME *ptr) -{ - /* A file time is the number of 100ns since jan 1 1601 - stuffed into two long words. - A time_t is the number of seconds since jan 1 1970. */ - - long rem; - long long x = ((long long) ptr->dwHighDateTime << 32) + ((unsigned)ptr->dwLowDateTime); - x -= FACTOR; /* number of 100ns between 1601 and 1970 */ - rem = x % ((long long)NSPERSEC); - rem += (NSPERSEC / 2); - x /= (long long) NSPERSEC; /* number of 100ns in a second */ - x += (long long) (rem / NSPERSEC); - return x; -} - -static const char * -ttynam (int ntty) -{ - static char buf[9]; - char buf0[9]; - if (ntty < 0) - strcpy (buf0, "?"); - else if (ntty & 0xffff0000) - sprintf (buf0, "cons%d", ntty & 0xff); - else - sprintf (buf0, "pty%d", ntty); - sprintf (buf, " %-7s", buf0); - return buf; -} - -static void -usage (FILE * stream, int status) -{ - fprintf (stream, "\ -Usage: %1$s [-aefls] [-u UID] [-p PID]\n\ -\n\ -Report process status\n\ -\n\ - -a, --all show processes of all users\n\ - -e, --everyone show processes of all users\n\ - -f, --full show process uids, ppids\n\ - -h, --help output usage information and exit\n\ - -l, --long show process uids, ppids, pgids, winpids\n\ - -p, --process show information for specified PID\n\ - -s, --summary show process summary\n\ - -u, --user list processes owned by UID\n\ - -V, --version output version information and exit\n\ - -W, --windows show windows as well as cygwin processes\n\ -\n\ -With no options, %1$s outputs the long format by default\n\n", - prog_name); - exit (status); -} - -static void -print_version () -{ - printf ("ps (cygwin) %d.%d.%d\n" - "Show process statistics\n" - "Copyright (C) 1996 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -char unicode_buf[sizeof (UNICODE_STRING) + NT_MAX_PATH]; - -int -main (int argc, char *argv[]) -{ - external_pinfo *p; - int aflag, lflag, fflag, sflag, proc_id; - uid_t uid; - bool found_proc_id = true; - DWORD proc_access = PROCESS_QUERY_LIMITED_INFORMATION; - cygwin_getinfo_types query = CW_GETPINFO; - const char *dtitle = " PID TTY STIME COMMAND\n"; - const char *dfmt = "%7d%4s%10s %s\n"; - const char *ftitle = " UID PID PPID TTY STIME COMMAND\n"; - const char *ffmt = "%8.8s%8d%8d%4s%10s %s\n"; - const char *ltitle = " PID PPID PGID WINPID TTY UID STIME COMMAND\n"; - const char *lfmt = "%c %7d %7d %7d %10u %4s %4u %8s %s\n"; - char ch; - PUNICODE_STRING uni = (PUNICODE_STRING) unicode_buf; - void *drive_map = NULL; - - aflag = lflag = fflag = sflag = 0; - uid = getuid (); - proc_id = -1; - lflag = 1; - - setlocale (LC_ALL, ""); - - prog_name = program_invocation_short_name; - - while ((ch = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (ch) - { - case 'a': - case 'e': - aflag = 1; - break; - case 'f': - fflag = 1; - break; - case 'h': - usage (stdout, 0); - case 'l': - lflag = 1; - break; - case 'p': - proc_id = atoi (optarg); - aflag = 1; - found_proc_id = false; - break; - case 's': - sflag = 1; - break; - case 'u': - uid = atoi (optarg); - if (uid == 0) - { - struct passwd *pw; - - if ((pw = getpwnam (optarg))) - uid = pw->pw_uid; - else - { - fprintf (stderr, "%s: user %s unknown\n", prog_name, optarg); - exit (1); - } - } - break; - case 'V': - print_version (); - exit (0); - break; - case 'W': - query = CW_GETPINFO_FULL; - aflag = 1; - break; - - default: - fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); - exit (1); - } - - if (sflag) - printf (dtitle); - else if (fflag) - printf (ftitle); - else if (lflag) - printf (ltitle); - - (void) cygwin_internal (CW_LOCK_PINFO, 1000); - - if (query == CW_GETPINFO_FULL) - { - /* Enable debug privilege to allow to enumerate all processes, - not only processes in current session. */ - HANDLE tok; - if (OpenProcessToken (GetCurrentProcess (), - TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, - &tok)) - { - TOKEN_PRIVILEGES priv; - - priv.PrivilegeCount = 1; - if (LookupPrivilegeValue (NULL, SE_DEBUG_NAME, - &priv.Privileges[0].Luid)) - { - priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - AdjustTokenPrivileges (tok, FALSE, &priv, 0, NULL, NULL); - } - } - - /* Check process query capabilities. */ - OSVERSIONINFO version; - version.dwOSVersionInfoSize = sizeof version; - GetVersionEx (&version); - if (version.dwMajorVersion <= 5) /* pre-Vista */ - { - proc_access = PROCESS_QUERY_INFORMATION; - if (version.dwMinorVersion < 1) /* Windows 2000 */ - proc_access |= PROCESS_VM_READ; - else - { - } - } - - /* Except on Windows 2000, fetch an opaque drive mapping object from the - Cygwin DLL. This is used to map NT device paths to Win32 paths. */ - if (!(proc_access & PROCESS_VM_READ)) - { - drive_map = (void *) cygwin_internal (CW_ALLOC_DRIVE_MAP); - /* Check old Cygwin version. */ - if (drive_map == (void *) -1) - drive_map = NULL; - /* Allow fallback to GetModuleFileNameEx for post-W2K. */ - if (!drive_map) - proc_access = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ; - } - } - - for (int pid = 0; - (p = (external_pinfo *) cygwin_internal (query, pid | CW_NEXTPID)); - pid = p->pid) - { - if ((proc_id > 0) && (p->pid != proc_id)) - continue; - else - found_proc_id = true; - - if (aflag) - /* nothing to do */; - else if (p->version >= EXTERNAL_PINFO_VERSION_32_BIT) - { - if (p->uid32 != uid) - continue; - } - else if (p->uid != uid) - continue; - char status = ' '; - if (p->process_state & PID_STOPPED) - status = 'S'; - else if (p->process_state & PID_TTYIN) - status = 'I'; - else if (p->process_state & PID_TTYOU) - status = 'O'; - - /* Maximum possible path length under NT. There's no official define - for that value. */ - char pname[NT_MAX_PATH + sizeof (" ")]; - if (p->ppid) - { - char *s; - pname[0] = '\0'; - strncat (pname, p->progname_long, NT_MAX_PATH); - s = strchr (pname, '\0') - 4; - if (s > pname && strcasecmp (s, ".exe") == 0) - *s = '\0'; - if (p->process_state & PID_EXITED || (p->exitcode & ~0xffff)) - strcat (pname, " "); - } - else if (query == CW_GETPINFO_FULL) - { - HANDLE h; - NTSTATUS status; - wchar_t *win32path = NULL; - - h = OpenProcess (proc_access, FALSE, p->dwProcessId); - if (!h) - continue; - /* We use NtQueryInformationProcess in the first place, because - GetModuleFileNameEx does not work on 64 bit systems when trying - to fetch module names of 64 bit processes. */ - if (!(proc_access & PROCESS_VM_READ)) /* Windows 2000 */ - { - status = NtQueryInformationProcess (h, ProcessImageFileName, uni, - sizeof unicode_buf, NULL); - if (NT_SUCCESS (status)) - { - /* NtQueryInformationProcess returns a native NT device path. - Call CW_MAP_DRIVE_MAP to convert the path to an ordinary - Win32 path. The returned pointer is a pointer into the - incoming buffer given as third argument. It's expected - to be big enough, which we made sure by defining - unicode_buf to have enough space for a maximum sized - UNICODE_STRING. */ - if (uni->Length == 0) /* System process */ - win32path = (wchar_t *) L"System"; - else - { - uni->Buffer[uni->Length / sizeof (WCHAR)] = L'\0'; - win32path = (wchar_t *) cygwin_internal (CW_MAP_DRIVE_MAP, - drive_map, - uni->Buffer); - } - } - } - else - { - if (GetModuleFileNameExW (h, NULL, (PWCHAR) unicode_buf, - NT_MAX_PATH)) - win32path = (wchar_t *) unicode_buf; - } - if (win32path) - wcstombs (pname, win32path, sizeof pname); - else - strcpy (pname, "*** unknown ***"); - FILETIME ct, et, kt, ut; - if (GetProcessTimes (h, &ct, &et, &kt, &ut)) - p->start_time = to_time_t (&ct); - CloseHandle (h); - } - - char uname[128]; - - if (fflag) - { - struct passwd *pw; - - if ((pw = getpwuid (p->version >= EXTERNAL_PINFO_VERSION_32_BIT ? - p->uid32 : p->uid))) - strcpy (uname, pw->pw_name); - else - sprintf (uname, "%u", (unsigned) - (p->version >= EXTERNAL_PINFO_VERSION_32_BIT ? - p->uid32 : p->uid)); - } - - if (sflag) - printf (dfmt, p->pid, ttynam (p->ctty), start_time (p), pname); - else if (fflag) - printf (ffmt, uname, p->pid, p->ppid, ttynam (p->ctty), start_time (p), - pname); - else if (lflag) - printf (lfmt, status, p->pid, p->ppid, p->pgid, - p->dwProcessId, ttynam (p->ctty), - p->version >= EXTERNAL_PINFO_VERSION_32_BIT ? p->uid32 : p->uid, - start_time (p), pname); - - } - if (drive_map) - cygwin_internal (CW_FREE_DRIVE_MAP, drive_map); - (void) cygwin_internal (CW_UNLOCK_PINFO); - - return found_proc_id ? 0 : 1; -} diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc deleted file mode 100644 index 86f2bb61f..000000000 --- a/winsup/utils/regtool.cc +++ /dev/null @@ -1,993 +0,0 @@ -/* regtool.cc - - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011 Red Hat Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include -#define WINVER 0x0502 -#include -#include -#include -#include "loadlib.h" - -#define DEFAULT_KEY_SEPARATOR '\\' - -#define REG_AUTO -1 - -int value_type = REG_AUTO; - -char key_sep = DEFAULT_KEY_SEPARATOR; - -#define LIST_KEYS 0x01 -#define LIST_VALS 0x02 -#define LIST_ALL (LIST_KEYS | LIST_VALS) - -static char *prog_name; - -static struct option longopts[] = -{ - {"binary", no_argument, NULL, 'b' }, - {"dword", no_argument, NULL, 'd' }, - {"dword-be", no_argument, NULL, 'D' }, - {"expand-string", no_argument, NULL, 'e' }, - {"help", no_argument, NULL, 'h' }, - {"integer", no_argument, NULL, 'i' }, - {"keys", no_argument, NULL, 'k'}, - {"list", no_argument, NULL, 'l'}, - {"multi-string", no_argument, NULL, 'm'}, - {"none", no_argument, NULL, 'n' }, - {"postfix", no_argument, NULL, 'p'}, - {"quiet", no_argument, NULL, 'q'}, - {"qword", no_argument, NULL, 'Q' }, - {"string", no_argument, NULL, 's'}, - {"verbose", no_argument, NULL, 'v'}, - {"version", no_argument, NULL, 'V'}, - {"wow64", no_argument, NULL, 'w'}, - {"wow32", no_argument, NULL, 'W'}, - {"hex", no_argument, NULL, 'x'}, - {"key-separator", required_argument, NULL, 'K'}, - {NULL, 0, NULL, 0} -}; - -static char opts[] = "bdDehiklmnpqQsvVwWxK:"; - -const char *types[] = -{ - "REG_NONE", - "REG_SZ", - "REG_EXPAND_SZ", - "REG_BINARY", - "REG_DWORD", - "REG_DWORD_BIG_ENDIAN", - "REG_LINK", - "REG_MULTI_SZ", - "REG_RESOURCE_LIST", - "REG_FULL_RESOURCE_DESCRIPTOR", - "REG_RESOURCE_REQUIREMENTS_LIST", - "REG_QWORD", -}; - -int listwhat = 0; -int postfix = 0; -int verbose = 0; -int quiet = 0; -int hex = 0; -DWORD wow64 = 0; -char **argv; - -HKEY key; -wchar_t *value; - -static void -usage (FILE *where = stderr) -{ - fprintf (where, "" - "Usage: %s [OPTION] ACTION KEY [data...]\n" - "\n" - "View or edit the Win32 registry\n" - "\n", prog_name); - if (where == stdout) - { - fprintf (where, "" - "Actions:\n" - "\n" - " add KEY\\SUBKEY add new SUBKEY\n" - " check KEY exit 0 if KEY exists, 1 if not\n" - " get KEY\\VALUE prints VALUE to stdout\n" - " list KEY list SUBKEYs and VALUEs\n" - " remove KEY remove KEY\n" - " set KEY\\VALUE [data ...] set VALUE\n" - " unset KEY\\VALUE removes VALUE from KEY\n" - " load KEY\\SUBKEY PATH load hive from PATH into new SUBKEY\n" - " unload KEY\\SUBKEY unload hive and remove SUBKEY\n" - " save KEY\\SUBKEY PATH save SUBKEY into new hive PATH\n" - "\n"); - fprintf (where, "" - "Options for 'list' Action:\n" - "\n" - " -k, --keys print only KEYs\n" - " -l, --list print only VALUEs\n" - " -p, --postfix like ls -p, appends '\\' postfix to KEY names\n" - "\n" - "Options for 'get' Action:\n" - "\n" - " -b, --binary print data as printable hex bytes\n" - " -n, --none print data as stream of bytes as stored in registry\n" - " -x, --hex print numerical data as hex numbers\n" - "\n" - "Options for 'set' Action:\n" - "\n" - " -b, --binary set type to REG_BINARY (hex args or '-')\n" - " -d, --dword set type to REG_DWORD\n" - " -D, --dword-be set type to REG_DWORD_BIG_ENDIAN\n" - " -e, --expand-string set type to REG_EXPAND_SZ\n" - " -i, --integer set type to REG_DWORD\n" - " -m, --multi-string set type to REG_MULTI_SZ\n" - " -n, --none set type to REG_NONE\n" - " -Q, --qword set type to REG_QWORD\n" - " -s, --string set type to REG_SZ\n" - "\n" - "Options for 'set' and 'unset' Actions:\n" - "\n" - " -K, --key-separator[=] set key-value separator to instead of '\\'\n" - "\n" - "Other Options:\n" - "\n" - " -h, --help output usage information and exit\n" - " -q, --quiet no error output, just nonzero return if KEY/VALUE missing\n" - " -v, --verbose verbose output, including VALUE contents when applicable\n" - " -w, --wow64 access 64 bit registry view (ignored on 32 bit Windows)\n" - " -W, --wow32 access 32 bit registry view (ignored on 32 bit Windows)\n" - " -V, --version output version information and exit\n" - "\n"); - fprintf (where, "" - "KEY is in the format [host]\\prefix\\KEY\\KEY\\VALUE, where host is optional\n" - "remote host in either \\\\hostname or hostname: format and prefix is any of:\n" - " root HKCR HKEY_CLASSES_ROOT (local only)\n" - " config HKCC HKEY_CURRENT_CONFIG (local only)\n" - " user HKCU HKEY_CURRENT_USER (local only)\n" - " machine HKLM HKEY_LOCAL_MACHINE\n" - " users HKU HKEY_USERS\n" - "\n" - "If the keyname starts with a forward slash ('/'), the forward slash is used\n" - "as separator and the backslash can be used as escape character.\n"); - fprintf (where, "" - "Example:\n" - "%s list '/machine/SOFTWARE/Classes/MIME/Database/Content Type/audio\\/wav'\n\n", prog_name); - } - if (where == stderr) - fprintf (where, - "ACTION is one of add, check, get, list, remove, set, unset, load, unload, save\n" - "\n" - "Try `%s --help' for more information.\n", prog_name); - exit (where == stderr ? 1 : 0); -} - -static void -print_version () -{ - printf ("regtool (cygwin) %d.%d.%d\n" - "Registry tool\n" - "Copyright (C) 2000 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -void -Fail (unsigned int rv) -{ - char *buf; - if (!quiet) - { - FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_SYSTEM, - 0, rv, 0, (CHAR *) & buf, 0, 0); - fprintf (stderr, "Error (%d): %s\n", rv, buf); - LocalFree (buf); - } - exit (1); -} - -static struct -{ - const char *string; - HKEY key; -} wkprefixes[] = -{ - {"root", HKEY_CLASSES_ROOT}, - {"HKCR", HKEY_CLASSES_ROOT}, - {"HKEY_CLASSES_ROOT", HKEY_CLASSES_ROOT}, - {"config", HKEY_CURRENT_CONFIG}, - {"HKCC", HKEY_CURRENT_CONFIG}, - {"HKEY_CURRENT_CONFIG", HKEY_CURRENT_CONFIG}, - {"user", HKEY_CURRENT_USER}, - {"HKCU", HKEY_CURRENT_USER}, - {"HKEY_CURRENT_USER", HKEY_CURRENT_USER}, - {"machine", HKEY_LOCAL_MACHINE}, - {"HKLM", HKEY_LOCAL_MACHINE}, - {"HKEY_LOCAL_MACHINE", HKEY_LOCAL_MACHINE}, - {"users", HKEY_USERS}, - {"HKU", HKEY_USERS}, - {"HKEY_USERS", HKEY_USERS}, - {0, 0} -}; - -void -translate (char *key) -{ -#define isodigit(c) (strchr("01234567", c)) -#define tooct(c) ((c)-'0') -#define tohex(c) (strchr(_hs,tolower(c))-_hs) - static char _hs[] = "0123456789abcdef"; - - char *d = key; - char *s = key; - char c; - - while (*s) - { - if (*s == '\\') - switch (*++s) - { - case 'a': - *d++ = '\007'; - break; - case 'b': - *d++ = '\b'; - break; - case 'e': - *d++ = '\033'; - break; - case 'f': - *d++ = '\f'; - break; - case 'n': - *d++ = '\n'; - break; - case 'r': - *d++ = '\r'; - break; - case 't': - *d++ = '\t'; - break; - case 'v': - *d++ = '\v'; - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - c = tooct (*s); - if (isodigit (s[1])) - { - c = (c << 3) | tooct (*++s); - if (isodigit (s[1])) - c = (c << 3) | tooct (*++s); - } - *d++ = c; - break; - case 'x': - if (!isxdigit (s[1])) - c = '0'; - else - { - c = tohex (*++s); - if (isxdigit (s[1])) - c = (c << 4) | tohex (*++s); - } - *d++ = c; - break; - default: /* before non-special char: just add the char */ - *d++ = *s; - break; - } - else if (*s == '/') - *d++ = '\\'; - else - *d++ = *s; - ++s; - } - *d = '\0'; -} - -void -find_key (int howmanyparts, REGSAM access, int option = 0) -{ - HKEY base; - int rv; - char *n = argv[0], *e, *h, c; - char* host = NULL; - int i; - size_t len; - - if (*n == '/') - translate (n); - if (*n != '\\') - { - /* expect host:/key/value format */ - host = (char*) malloc (strlen (n) + 1); - host[0] = host [1] = '\\'; - for (e = n, h = host + 2; *e && *e != ':'; e++, h++) - *h = *e; - *h = 0; - n = e + 1; - if (*n == '/') - translate (n); - } - else if (n[0] == '\\' && n[1] == '\\') - { - /* expect //host/key/value format */ - host = (char*) malloc (strlen (n) + 1); - host[0] = host[1] = '\\'; - for (e = n + 2, h = host + 2; *e && *e != '\\'; e++, h++) - *h = *e; - *h = 0; - n = e; - } - while (*n != '\\') - n++; - *n++ = 0; - for (e = n; *e && *e != '\\'; e++); - c = *e; - *e = 0; - for (i = 0; wkprefixes[i].string; i++) - if (strcmp (wkprefixes[i].string, n) == 0) - break; - if (!wkprefixes[i].string) - { - fprintf (stderr, "Unknown key prefix. Valid prefixes are:\n"); - for (i = 0; wkprefixes[i].string; i++) - fprintf (stderr, "\t%s\n", wkprefixes[i].string); - exit (1); - } - - n = e; - *e = c; - while (*n && *n == '\\') - n++; - e = n + strlen (n); - if (howmanyparts > 1) - { - while (n < e && *e != key_sep) - e--; - if (*e != key_sep) - { - key = wkprefixes[i].key; - if (value) - free (value); - len = mbstowcs (NULL, n, 0) + 1; - value = (wchar_t *) malloc (len * sizeof (wchar_t)); - mbstowcs (value, n, len); - return; - } - else - { - *e = 0; - if (value) - free (value); - len = mbstowcs (NULL, e + 1, 0) + 1; - value = (wchar_t *) malloc (len * sizeof (wchar_t)); - mbstowcs (value, e + 1, len); - } - } - if (host) - { - rv = RegConnectRegistry (host, wkprefixes[i].key, &base); - if (rv != ERROR_SUCCESS) - Fail (rv); - free (host); - } - else - base = wkprefixes[i].key; - - if (n[0] == 0) - key = base; - else - { - len = mbstowcs (NULL, n, 0) + 1; - wchar_t name[len]; - mbstowcs (name, n, len); - if (access) - { - rv = RegOpenKeyExW (base, name, 0, access | wow64, &key); - if (option && (rv == ERROR_SUCCESS || rv == ERROR_ACCESS_DENIED)) - { - /* reopen with desired option due to missing option support in - RegOpenKeyE */ - /* FIXME: may create the key in rare cases (e.g. access denied - in parent) */ - HKEY key2; - if (RegCreateKeyExW (base, name, 0, NULL, option, access | wow64, - NULL, &key2, NULL) - == ERROR_SUCCESS) - { - if (rv == ERROR_SUCCESS) - RegCloseKey (key); - key = key2; - rv = ERROR_SUCCESS; - } - } - if (rv != ERROR_SUCCESS) - Fail (rv); - } - else if (argv[1]) - { - ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], NULL, 0); - wchar_t win32_path[len]; - cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], win32_path, len); - rv = RegLoadKeyW (base, name, win32_path); - if (rv != ERROR_SUCCESS) - Fail (rv); - if (verbose) - printf ("key %ls loaded from file %ls\n", name, win32_path); - } - else - { - rv = RegUnLoadKeyW (base, name); - if (rv != ERROR_SUCCESS) - Fail (rv); - if (verbose) - printf ("key %ls unloaded\n", name); - } - } -} - - -int -cmd_list () -{ - DWORD num_subkeys, maxsubkeylen, num_values, maxvalnamelen, maxvaluelen; - DWORD maxclasslen; - wchar_t *subkey_name, *value_name, *class_name, *vd; - unsigned char *value_data; - DWORD i, j, m, n, t; - int v; - - find_key (1, KEY_READ); - RegQueryInfoKeyW (key, 0, 0, 0, &num_subkeys, &maxsubkeylen, &maxclasslen, - &num_values, &maxvalnamelen, &maxvaluelen, 0, 0); - - subkey_name = (wchar_t *) malloc ((maxsubkeylen + 1) * sizeof (wchar_t)); - class_name = (wchar_t *) malloc ((maxclasslen + 1) * sizeof (wchar_t)); - value_name = (wchar_t *) malloc ((maxvalnamelen + 1) * sizeof (wchar_t)); - value_data = (unsigned char *) malloc (maxvaluelen + 1); - - if (!listwhat) - listwhat = LIST_ALL; - - if (listwhat & LIST_KEYS) - for (i = 0; i < num_subkeys; i++) - { - m = (maxsubkeylen + 1) * sizeof (wchar_t); - n = (maxclasslen + 1) * sizeof (wchar_t); - RegEnumKeyExW (key, i, subkey_name, &m, 0, class_name, &n, 0); - printf ("%ls", subkey_name); - if (postfix || verbose) - fputc (key_sep, stdout); - - if (verbose) - printf (" (%ls)", class_name); - - puts (""); - } - - if (listwhat & LIST_VALS) - for (i = 0; i < num_values; i++) - { - m = (maxvalnamelen + 1) * sizeof (wchar_t); - n = maxvaluelen + 1; - RegEnumValueW (key, i, value_name, &m, 0, &t, (BYTE *) value_data, &n); - value_data[n] = 0; - if (!verbose) - printf ("%ls\n", value_name); - else - { - printf ("%ls (%s) = ", value_name, types[t]); - switch (t) - { - case REG_NONE: - case REG_BINARY: - for (j = 0; j < 8 && j < n; j++) - printf ("%02x ", value_data[j]); - printf ("\n"); - break; - case REG_DWORD: - printf ("0x%08x (%u)\n", *(unsigned int *) value_data, - *(unsigned int *) value_data); - break; - case REG_DWORD_BIG_ENDIAN: - v = ((value_data[0] << 24) - | (value_data[1] << 16) - | (value_data[2] << 8) - | (value_data[3])); - printf ("0x%08x (%d)\n", v, v); - break; - case REG_QWORD: - printf ("0x%016llx (%llu)\n", - *(unsigned long long *) value_data, - *(unsigned long long *) value_data); - break; - case REG_EXPAND_SZ: - case REG_SZ: - case REG_LINK: - printf ("\"%ls\"\n", (wchar_t *) value_data); - break; - case REG_MULTI_SZ: - vd = (wchar_t *) value_data; - while (vd && *vd) - { - printf ("\"%ls\"", vd); - vd = vd + wcslen (vd) + 1; - if (*vd) - printf (", "); - } - printf ("\n"); - break; - default: - printf ("?\n"); - break; - } - } - } - return 0; -} - -int -cmd_add () -{ - find_key (2, KEY_ALL_ACCESS); - HKEY newkey; - DWORD newtype; - int rv = RegCreateKeyExW (key, value, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS | wow64, 0, &newkey, &newtype); - if (rv != ERROR_SUCCESS) - Fail (rv); - - if (verbose) - { - if (newtype == REG_OPENED_EXISTING_KEY) - printf ("Key %ls already exists\n", value); - else - printf ("Key %ls created\n", value); - } - return 0; -} - -extern "C" { - LONG WINAPI (*regDeleteKeyEx)(HKEY, LPCWSTR, REGSAM, DWORD); -} - -int -cmd_remove () -{ - DWORD rv; - - find_key (2, KEY_ALL_ACCESS); - if (wow64) - { - HMODULE mod = LoadLibrary ("advapi32.dll"); - if (mod) - regDeleteKeyEx = (LONG WINAPI (*)(HKEY, LPCWSTR, REGSAM, DWORD)) GetProcAddress (mod, "RegDeleteKeyExW"); - } - if (regDeleteKeyEx) - rv = (*regDeleteKeyEx) (key, value, wow64, 0); - else - rv = RegDeleteKeyW (key, value); - if (rv != ERROR_SUCCESS) - Fail (rv); - if (verbose) - printf ("subkey %ls deleted\n", value); - return 0; -} - -int -cmd_check () -{ - find_key (1, KEY_READ); - if (verbose) - printf ("key %s exists\n", argv[0]); - return 0; -} - -int -cmd_set () -{ - int i, n, max_n; - DWORD v, rv; - unsigned long long llval; - char *a = argv[1], *data = 0; - find_key (2, KEY_ALL_ACCESS); - - if (!a) - usage (); - if (value_type == REG_AUTO) - { - char *e; - llval = strtoull (a, &e, 0); - if (a[0] == '%') - value_type = REG_EXPAND_SZ; - else if (a[0] && !*e) - value_type = llval > 0xffffffffULL ? REG_QWORD : REG_DWORD; - else if (argv[2]) - value_type = REG_MULTI_SZ; - else - value_type = REG_SZ; - } - - switch (value_type) - { - case REG_NONE: - case REG_BINARY: - for (n = 0; argv[n+1]; n++) - ; - if (n == 1 && strcmp (argv[1], "-") == 0) - { /* read from stdin */ - i = n = 0; - for (;;) - { - if (i <= n) - { - i = n + BUFSIZ; - data = (char *) realloc (data, i); - } - int r = fread (data+n, 1, i-n, stdin); - if (r <= 0) - break; - n += r; - } - } - else if (n > 0) - { /* parse hex from argv */ - data = (char *) malloc (n); - for (i = 0; i < n; i++) - { - char *e; - errno = 0; - v = strtoul (argv[i+1], &e, 16); - if (errno || v > 0xff || *e) - { - fprintf (stderr, "Invalid hex constant `%s'\n", argv[i+1]); - exit (1); - } - data[i] = (char) v; - } - } - rv = RegSetValueExW (key, value, 0, value_type, (const BYTE *) data, n); - break; - case REG_DWORD: - v = strtoul (a, 0, 0); - rv = RegSetValueExW (key, value, 0, REG_DWORD, (const BYTE *) &v, - sizeof (v)); - break; - case REG_DWORD_BIG_ENDIAN: - v = strtoul (a, 0, 0); - v = (((v & 0xff) << 24) - | ((v & 0xff00) << 8) - | ((v & 0xff0000) >> 8) - | ((v & 0xff000000) >> 24)); - rv = RegSetValueExW (key, value, 0, REG_DWORD_BIG_ENDIAN, - (const BYTE *) &v, sizeof (v)); - break; - case REG_QWORD: - llval = strtoul (a, 0, 0); - rv = RegSetValueExW (key, value, 0, REG_QWORD, (const BYTE *) &llval, - sizeof (llval)); - break; - case REG_SZ: - case REG_EXPAND_SZ: - { - n = mbstowcs (NULL, a, 0); - wchar_t w[n + 1]; - mbstowcs (w, a, n + 1); - rv = RegSetValueExW (key, value, 0, value_type, - (const BYTE *) w, (n + 1) * sizeof (wchar_t)); - } - break; - case REG_MULTI_SZ: - for (i = 1, max_n = 1; argv[i]; i++) - max_n += mbstowcs (NULL, argv[i], 0) + 1; - data = (char *) malloc (max_n * sizeof (wchar_t)); - for (i = 1, n = 0; argv[i]; i++) - n += mbstowcs ((wchar_t *) data + n, argv[i], max_n - n) + 1; - ((wchar_t *)data)[n] = L'\0'; - rv = RegSetValueExW (key, value, 0, REG_MULTI_SZ, (const BYTE *) data, - (n + 1) * sizeof (wchar_t)); - break; - case REG_AUTO: - rv = ERROR_SUCCESS; - break; - default: - rv = ERROR_INVALID_CATEGORY; - break; - } - - if (data) - free(data); - - if (rv != ERROR_SUCCESS) - Fail (rv); - - return 0; -} - -int -cmd_unset () -{ - find_key (2, KEY_ALL_ACCESS); - DWORD rv = RegDeleteValueW (key, value); - if (rv != ERROR_SUCCESS) - Fail (rv); - if (verbose) - printf ("value %ls deleted\n", value); - return 0; -} - -int -cmd_get () -{ - find_key (2, KEY_READ); - DWORD vtype, dsize, rv; - PBYTE data; - wchar_t *vd; - - rv = RegQueryValueExW (key, value, 0, &vtype, 0, &dsize); - if (rv != ERROR_SUCCESS) - Fail (rv); - data = (PBYTE) malloc (dsize + 1); - rv = RegQueryValueExW (key, value, 0, &vtype, data, &dsize); - if (rv != ERROR_SUCCESS) - Fail (rv); - if (value_type == REG_BINARY) - { - for (unsigned i = 0; i < dsize; i++) - printf ("%02x%c", (unsigned char)data[i], - (i < dsize-1 ? ' ' : '\n')); - } - else if (value_type == REG_NONE) - fwrite (data, dsize, 1, stdout); - else - switch (vtype) - { - case REG_NONE: - case REG_BINARY: - fwrite (data, dsize, 1, stdout); - break; - case REG_DWORD: - printf (hex ? "0x%08x\n" : "%u\n", *(unsigned int *) data); - break; - case REG_DWORD_BIG_ENDIAN: - rv = ((data[0] << 24) - | (data[1] << 16) - | (data[2] << 8) - | (data[3])); - printf (hex ? "0x%08x\n" : "%u\n", (unsigned int) rv); - break; - case REG_QWORD: - printf (hex ? "0x%016llx\n" : "%llu\n", *(unsigned long long *) data); - break; - case REG_SZ: - case REG_LINK: - printf ("%ls\n", (wchar_t *) data); - break; - case REG_EXPAND_SZ: - if (value_type == REG_EXPAND_SZ) // hack - { - wchar_t *buf; - DWORD bufsize; - bufsize = ExpandEnvironmentStringsW ((wchar_t *) data, 0, 0); - buf = (wchar_t *) malloc (bufsize + 1); - ExpandEnvironmentStringsW ((wchar_t *) data, buf, bufsize + 1); - free (data); - data = (PBYTE) buf; - } - printf ("%ls\n", (wchar_t *) data); - break; - case REG_MULTI_SZ: - vd = (wchar_t *) data; - while (vd && *vd) - { - printf ("%ls\n", vd); - vd = vd + wcslen (vd) + 1; - } - break; - } - return 0; -} - -int -cmd_load () -{ - if (!argv[1]) - { - usage (); - return 1; - } - find_key (1, 0); - return 0; -} - -int -cmd_unload () -{ - if (argv[1]) - { - usage (); - return 1; - } - find_key (1, 0); - return 0; -} - -DWORD -set_privilege (const char *name) -{ - TOKEN_PRIVILEGES tp; - if (!LookupPrivilegeValue (NULL, name, &tp.Privileges[0].Luid)) - return GetLastError (); - tp.PrivilegeCount = 1; - tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - HANDLE t; - /* OpenProcessToken does not work here, because main thread has its own - impersonation token */ - if (!OpenThreadToken (GetCurrentThread (), TOKEN_ADJUST_PRIVILEGES, FALSE, &t)) - return GetLastError (); - AdjustTokenPrivileges (t, FALSE, &tp, 0, NULL, NULL); - DWORD rv = GetLastError (); - CloseHandle (t); - return rv; -} - -int -cmd_save () -{ - if (!argv[1]) - { - usage (); - return 1; - } - /* try to set SeBackupPrivilege, let RegSaveKey report the error */ - set_privilege (SE_BACKUP_NAME); - /* REG_OPTION_BACKUP_RESTORE is necessary to save /HKLM/SECURITY */ - find_key (1, KEY_QUERY_VALUE, REG_OPTION_BACKUP_RESTORE); - ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], NULL, 0); - wchar_t win32_path[len]; - cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], win32_path, len); - DWORD rv = RegSaveKeyW (key, win32_path, NULL); - if (rv != ERROR_SUCCESS) - Fail (rv); - if (verbose) - printf ("key saved to %ls\n", win32_path); - return 0; -} - -static struct -{ - const char *name; - int (*func) (); -} commands[] = -{ - {"list", cmd_list}, - {"add", cmd_add}, - {"remove", cmd_remove}, - {"check", cmd_check}, - {"set", cmd_set}, - {"unset", cmd_unset}, - {"get", cmd_get}, - {"load", cmd_load}, - {"unload", cmd_unload}, - {"save", cmd_save}, - {0, 0} -}; - -int -main (int argc, char **_argv) -{ - int g; - - setlocale (LC_ALL, ""); - - prog_name = program_invocation_short_name; - - while ((g = getopt_long (argc, _argv, opts, longopts, NULL)) != EOF) - switch (g) - { - case 'b': - value_type = REG_BINARY; - break; - case 'd': - value_type = REG_DWORD; - break; - case 'D': - value_type = REG_DWORD_BIG_ENDIAN; - break; - case 'e': - value_type = REG_EXPAND_SZ; - break; - case 'k': - listwhat |= LIST_KEYS; - break; - case 'h': - usage (stdout); - case 'i': - value_type = REG_DWORD; - break; - case 'l': - listwhat |= LIST_VALS; - break; - case 'm': - value_type = REG_MULTI_SZ; - break; - case 'n': - value_type = REG_NONE; - break; - case 'p': - postfix++; - break; - case 'q': - quiet++; - break; - case 'Q': - value_type = REG_QWORD; - break; - case 's': - value_type = REG_SZ; - break; - case 'v': - verbose++; - break; - case 'V': - print_version (); - exit (0); - case 'w': - wow64 = KEY_WOW64_64KEY; - break; - case 'W': - wow64 = KEY_WOW64_32KEY; - break; - case 'x': - hex++; - break; - case 'K': - key_sep = *optarg; - break; - default : - fprintf (stderr, "Try `%s --help' for more information.\n", - prog_name); - return 1; - } - - if ((_argv[optind] == NULL) || (_argv[optind+1] == NULL)) - usage (); - - argv = _argv + optind; - int i; - for (i = 0; commands[i].name; i++) - if (strcmp (commands[i].name, argv[0]) == 0) - { - argv++; - return commands[i].func (); - } - usage (); - - return 0; -} diff --git a/winsup/utils/setfacl.c b/winsup/utils/setfacl.c deleted file mode 100644 index 66739c043..000000000 --- a/winsup/utils/setfacl.c +++ /dev/null @@ -1,561 +0,0 @@ -/* setfacl.c - - Copyright 2000, 2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011 Red Hat Inc. - - Written by Corinna Vinschen - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef BOOL -#define BOOL int -#endif - -#ifndef TRUE -#define TRUE (1) -#endif - -#ifndef FALSE -#define FALSE (0) -#endif - -#ifndef ILLEGAL_MODE -#define ILLEGAL_MODE ((mode_t)0xffffffff) -#endif - -static char *prog_name; - -typedef enum { - NoAction, - Set, - Modify, - Delete, - ModNDel, - SetFromFile -} action_t; - -mode_t getperm (char *in) -{ - if (isdigit ((unsigned char) *in) && !in[1]) - { - int i = atoi (in); - if (i < 0 || i > 7) - return ILLEGAL_MODE; - return i << 6 | i << 3 | i; - } - if (strlen (in) > 3 && strchr (" \t\n\r#", in[3])) - in[3] = '\0'; - if (strlen (in) != 3) - return ILLEGAL_MODE; - if (!strchr ("r-", in[0]) - || !strchr ("w-", in[1]) - || !strchr ("x-", in[2])) - return ILLEGAL_MODE; - return (in[0] == 'r' ? S_IROTH : 0) - | (in[1] == 'w' ? S_IWOTH : 0) - | (in[2] == 'x' ? S_IXOTH : 0); -} - -BOOL -getaclentry (action_t action, char *c, aclent_t *ace) -{ - char *c2; - - ace->a_type = 0; - ace->a_id = (uid_t) -1; - ace->a_perm = 0; - - /* First, check if we're handling a default entry. */ - if (!strncmp (c, "default:", 8) || !strncmp (c, "d:", 2)) - { - ace->a_type = ACL_DEFAULT; - c = strchr (c, ':') + 1; - } - /* c now points to the type. Check for next colon. If we find a colon, - NUL it. Otherwise the string is invalid, except when deleting. */ - c2 = strchrnul (c, ':'); - if (*c2 == ':') - *c2++ = '\0'; - else if (action != Delete) - return FALSE; - /* Fetch the type. */ - if (!strcmp (c, "u") || !strcmp (c, "user")) - ace->a_type |= USER_OBJ; - else if (!strcmp (c, "g") || !strcmp (c, "group")) - ace->a_type |= GROUP_OBJ; - else if (!strcmp (c, "m") || !strcmp (c, "mask")) - ace->a_type |= CLASS_OBJ; - else if (!strcmp (c, "o") || !strcmp (c, "other")) - ace->a_type |= OTHER_OBJ; - else - return FALSE; - /* Skip to next field. */ - c = c2; - if (!*c && action != Delete) - return FALSE; - /* If this is a user or group entry, check if next char is a colon char. - If so, skip it, otherwise it's the name of a user or group. */ - if (!(ace->a_type & (USER_OBJ | GROUP_OBJ))) - { - /* Mask and other entries may contain an extra colon. */ - if (*c == ':') - ++c; - } - else if (*c == ':') - ++c; - else if (*c) - { - /* c now points to the id. Check for next colon. If we find a colon, - NUL it. Otherwise the string is invalid, except when deleting. - If we delete, it must be a default entry since standard ugo entries - can't be deleted. */ - c2 = strchrnul (c + 1, ':'); - if (*c2 == ':') - *c2++ = '\0'; - else if (action != Delete) - return FALSE; - else if (!(ace->a_type & ACL_DEFAULT)) - return FALSE; - /* Fetch user/group id. */ - if (isdigit ((unsigned char) *c)) - { - char *c3; - - ace->a_id = strtol (c, &c3, 10); - if (*c3) - return FALSE; - } - else if (ace->a_type & USER_OBJ) - { - struct passwd *pw = getpwnam (c); - if (!pw) - return FALSE; - ace->a_id = pw->pw_uid; - } - else - { - struct group *gr = getgrnam (c); - if (!gr) - return FALSE; - ace->a_id = gr->gr_gid; - } - if (ace->a_type & USER_OBJ) - { - ace->a_type &= ~USER_OBJ; - ace->a_type |= USER; - } - else - { - ace->a_type &= ~GROUP_OBJ; - ace->a_type |= GROUP; - } - /* Skip to next field. */ - c = c2; - } - if (action == Delete) - { - /* Trailing garbage? */ - if (*c) - return FALSE; - /* No, we're good. */ - ace->a_perm = ILLEGAL_MODE; - return TRUE; - } - /* Check perms. */ - if ((ace->a_perm = getperm (c)) == ILLEGAL_MODE) - return FALSE; - return TRUE; -} - -BOOL -getaclentries (action_t action, char *buf, aclent_t *acls, int *idx) -{ - char *c; - - if (action == SetFromFile) - { - FILE *fp; - char fbuf[256], *fb; - - if (!strcmp (buf, "-")) - fp = stdin; - else if (! (fp = fopen (buf, "r"))) - return FALSE; - while ((fb = fgets (fbuf, 256, fp))) - { - while (strchr (" \t", *fb)) - ++fb; - if (strchr ("\n\r#", *fb)) - continue; - if (!getaclentry (action, fb, acls + (*idx)++)) - { - fclose (fp); - return FALSE; - } - } - if (fp != stdin) - fclose (fp); - } - else - for (c = strtok (buf, ","); c; c = strtok (NULL, ",")) - if (!getaclentry (action, c, acls + (*idx)++)) - return FALSE; - return TRUE; -} - -int -searchace (aclent_t *aclp, int nentries, int type, int id) -{ - int i; - - for (i = 0; i < nentries; ++i) - if ((aclp[i].a_type == type && (id < 0 || aclp[i].a_id == id)) - || !aclp[i].a_type) - return i; - return -1; -} - -int -modacl (aclent_t *tgt, int tcnt, aclent_t *src, int scnt) -{ - int t, s, i; - - for (s = 0; s < scnt; ++s) - { - t = searchace (tgt, MAX_ACL_ENTRIES, src[s].a_type, - (src[s].a_type & (USER | GROUP)) ? src[s].a_id : -1); - if (t < 0) - return -1; - if (src[s].a_perm == ILLEGAL_MODE) - { - if (t < tcnt) - { - for (i = t + 1; i < tcnt; ++i) - tgt[i - 1] = tgt[i]; - --tcnt; - } - } - else - { - tgt[t] = src[s]; - if (t >= tcnt) - ++tcnt; - } - } - return tcnt; -} - -int -setfacl (action_t action, char *path, aclent_t *acls, int cnt) -{ - aclent_t lacl[MAX_ACL_ENTRIES]; - int lcnt; - - memset (lacl, 0, sizeof lacl); - if (action == Set) - { - if (acl (path, SETACL, cnt, acls)) - { - perror (prog_name); - return 2; - } - } - else if ((lcnt = acl (path, GETACL, MAX_ACL_ENTRIES, lacl)) < 0 - || (lcnt = modacl (lacl, lcnt, acls, cnt)) < 0 - || (lcnt = acl (path, SETACL, lcnt, lacl)) < 0) - { - perror (prog_name); - return 2; - } - return 0; -} - -static void -usage (FILE * stream) -{ - fprintf (stream, "" - "Usage: %s [-r] (-f ACL_FILE | -s acl_entries) FILE...\n" - " %s [-r] ([-d acl_entries] [-m acl_entries]) FILE...\n" - "\n" - "Modify file and directory access control lists (ACLs)\n" - "\n" - " -d, --delete delete one or more specified ACL entries\n" - " -f, --file set ACL entries for FILE to ACL entries read\n" - " from a ACL_FILE\n" - " -m, --modify modify one or more specified ACL entries\n" - " -r, --replace replace mask entry with maximum permissions\n" - " needed for the file group class\n" - " -s, --substitute substitute specified ACL entries for the\n" - " ACL of FILE\n" - " -h, --help output usage information and exit\n" - " -V, --version output version information and exit\n" - "\n" - "At least one of (-d, -f, -m, -s) must be specified\n" - "\n", prog_name, prog_name); - if (stream == stdout) - { - printf("" - " Acl_entries are one or more comma-separated ACL entries \n" - " from the following list:\n" - "\n" - " u[ser]::perm\n" - " u[ser]:uid:perm\n" - " g[roup]::perm\n" - " g[roup]:gid:perm\n" - " m[ask]:perm\n" - " o[ther]:perm\n" - "\n" - " Default entries are like the above with the additional\n" - " default identifier. For example: \n" - "\n" - " d[efault]:u[ser]:uid:perm\n" - "\n" - " 'perm' is either a 3-char permissions string in the form\n" - " \"rwx\" with the character - for no permission\n" - " or it is the octal representation of the permissions, a\n" - " value from 0 (equivalent to \"---\") to 7 (\"rwx\").\n" - " 'uid' is a user name or a numerical uid.\n" - " 'gid' is a group name or a numerical gid.\n" - "\n" - "\n" - "For each file given as parameter, %s will either replace its\n" - "complete ACL (-s, -f), or it will add, modify, or delete ACL\n" - "entries.\n" - "\n" - "The following options are supported:\n" - "\n" - "-d Delete one or more specified entries from the file's ACL.\n" - " The owner, group and others entries must not be deleted.\n" - " Acl_entries to be deleted should be specified without\n" - " permissions, as in the following list:\n" - "\n" - " u[ser]:uid\n" - " g[roup]:gid\n" - " d[efault]:u[ser]:uid\n" - " d[efault]:g[roup]:gid\n" - " d[efault]:m[ask]:\n" - " d[efault]:o[ther]:\n" - "\n" - "-f Take the Acl_entries from ACL_FILE one per line. Whitespace\n" - " characters are ignored, and the character \"#\" may be used\n" - " to start a comment. The special filename \"-\" indicates\n" - " reading from stdin.\n" - " Required entries are\n" - " - One user entry for the owner of the file.\n" - " - One group entry for the group of the file.\n" - " - One other entry.\n" - " If additional user and group entries are given:\n" - " - A mask entry for the file group class of the file.\n" - " - No duplicate user or group entries with the same uid/gid.\n" - " If it is a directory:\n" - " - One default user entry for the owner of the file.\n" - " - One default group entry for the group of the file.\n" - " - One default mask entry for the file group class.\n" - " - One default other entry.\n" - "\n" - "-m Add or modify one or more specified ACL entries.\n" - " Acl_entries is a comma-separated list of entries from the \n" - " same list as above.\n" - "\n" - "-r Causes the permissions specified in the mask entry to be\n" - " ignored and replaced by the maximum permissions needed for\n" - " the file group class.\n" - "\n" - "-s Like -f, but substitute the file's ACL with Acl_entries\n" - " specified in a comma-separated list on the command line.\n" - "\n" - "While the -d and -m options may be used in the same command, the\n" - "-f and -s options may be used only exclusively.\n" - "\n" - "Directories may contain default ACL entries. Files created\n" - "in a directory that contains default ACL entries will have\n" - "permissions according to the combination of the current umask,\n" - "the explicit permissions requested and the default ACL entries\n" - "Note: Under Cygwin, the default ACL entries are not taken into\n" - "account currently.\n\n", prog_name); - } - else - fprintf(stream, "Try '%s --help' for more information.\n", prog_name); -} - -struct option longopts[] = { - {"delete", required_argument, NULL, 'd'}, - {"file", required_argument, NULL, 'f'}, - {"modify", required_argument, NULL, 'm'}, - {"replace", no_argument, NULL, 'r'}, - {"substitute", required_argument, NULL, 's'}, - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'V'}, - {0, no_argument, NULL, 0} -}; -const char *opts = "d:f:hm:rs:V"; - -static void -print_version () -{ - printf ("setfacl (cygwin) %d.%d.%d\n" - "POSIX ACL modification utility\n" - "Copyright (C) 2000 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -int -main (int argc, char **argv) -{ - int c; - action_t action = NoAction; - int ropt = 0; - aclent_t acls[MAX_ACL_ENTRIES]; - int aclidx = 0; - int ret = 0; - - prog_name = program_invocation_short_name; - - memset (acls, 0, sizeof acls); - while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (c) - { - case 'd': - if (action == NoAction) - action = Delete; - else if (action == Modify) - action = ModNDel; - else - { - usage (stderr); - return 1; - } - if (! getaclentries (Delete, optarg, acls, &aclidx)) - { - fprintf (stderr, "%s: illegal acl entries\n", prog_name); - return 2; - } - break; - case 'f': - if (action == NoAction) - action = Set; - else - { - usage (stderr); - return 1; - } - if (! getaclentries (SetFromFile, optarg, acls, &aclidx)) - { - fprintf (stderr, "%s: illegal acl entries\n", prog_name); - return 2; - } - break; - case 'h': - usage (stdout); - return 0; - case 'm': - if (action == NoAction) - action = Modify; - else if (action == Delete) - action = ModNDel; - else - { - usage (stderr); - return 1; - } - if (! getaclentries (Modify, optarg, acls, &aclidx)) - { - fprintf (stderr, "%s: illegal acl entries\n", prog_name); - return 2; - } - break; - case 'r': - if (!ropt) - ropt = 1; - else - { - usage (stderr); - return 1; - } - break; - case 's': - if (action == NoAction) - action = Set; - else - { - usage (stderr); - return 1; - } - if (! getaclentries (Set, optarg, acls, &aclidx)) - { - fprintf (stderr, "%s: illegal acl entries\n", prog_name); - return 2; - } - break; - case 'V': - print_version (); - return 0; - default: - fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); - return 1; - } - if (action == NoAction) - { - usage (stderr); - return 1; - } - if (optind > argc - 1) - { - usage (stderr); - return 1; - } - if (action == Set) - switch (aclcheck (acls, aclidx, NULL)) - { - case GRP_ERROR: - fprintf (stderr, "%s: more than one group entry.\n", prog_name); - return 2; - case USER_ERROR: - fprintf (stderr, "%s: more than one user entry.\n", prog_name); - return 2; - case CLASS_ERROR: - fprintf (stderr, "%s: more than one mask entry.\n", prog_name); - return 2; - case OTHER_ERROR: - fprintf (stderr, "%s: more than one other entry.\n", prog_name); - return 2; - case DUPLICATE_ERROR: - fprintf (stderr, "%s: duplicate additional user or group.\n", prog_name); - return 2; - case ENTRY_ERROR: - fprintf (stderr, "%s: invalid entry type.\n", prog_name); - return 2; - case MISS_ERROR: - fprintf (stderr, "%s: missing entries.\n", prog_name); - return 2; - case MEM_ERROR: - fprintf (stderr, "%s: out of memory.\n", prog_name); - return 2; - default: - break; - } - for (c = optind; c < argc; ++c) - ret |= setfacl (action, argv[c], acls, aclidx); - return ret; -} diff --git a/winsup/utils/setmetamode.c b/winsup/utils/setmetamode.c deleted file mode 100644 index fc1059f7c..000000000 --- a/winsup/utils/setmetamode.c +++ /dev/null @@ -1,120 +0,0 @@ -/* setmetamode.c - - Copyright 2006, 2011 Red Hat Inc. - - Written by Kazuhiro Fujieda - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include - -static void -usage (void) -{ - fprintf (stderr, "Usage: %s [metabit|escprefix]\n" - "\n" - "Get or set keyboard meta mode\n" - "\n" - " Without argument, it shows the current meta key mode.\n" - " metabit|meta|bit The meta key sets the top bit of the character.\n" - " escprefix|esc|prefix The meta key sends an escape prefix.\n" - "\n" - "Other options:\n" - "\n" - " -h, --help This text\n" - " -V, --version Print program version and exit\n\n", - program_invocation_short_name); -} - -static void -error (void) -{ - fprintf (stderr, - "%s: The standard input isn't a console device.\n", - program_invocation_short_name); -} - -void -print_version () -{ - printf ("setmetamode (cygwin) %d.%d.%d\n" - "Get or set keyboard meta mode\n" - "Copyright (C) 2006 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -struct option longopts[] = { - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'V'}, - {0, no_argument, NULL, 0} -}; -const char *opts = "hV"; - -int -main (int ac, char *av[]) -{ - int param; - int opt; - - if (ac < 2) - { - if (ioctl (0, KDGKBMETA, ¶m) < 0) - { - error (); - return 1; - } - if (param == 0x03) - puts ("metabit"); - else - puts ("escprefix"); - return 0; - } - - while ((opt = getopt_long (ac, av, opts, longopts, NULL)) != -1) - switch (opt) - { - case 'h': - usage (); - return 0; - case 'V': - print_version (); - return 0; - default: - fprintf (stderr, "Try `%s --help' for more information.\n", - program_invocation_short_name); - return 1; - } - - if (!strcmp ("meta", av[1]) || !strcmp ("bit", av[1]) - || !strcmp ("metabit", av[1])) - param = 0x03; - else if (!strcmp ("esc", av[1]) || !strcmp ("prefix", av[1]) - || !strcmp ("escprefix", av[1])) - param = 0x04; - else - { - usage (); - return 1; - } - if (ioctl (0, KDSKBMETA, param) < 0) - { - error (); - return 1; - } - return 0; -} diff --git a/winsup/utils/ssp.c b/winsup/utils/ssp.c deleted file mode 100644 index 3136a9f66..000000000 --- a/winsup/utils/ssp.c +++ /dev/null @@ -1,956 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 2002, 2009, 2011, 2013 Red Hat, 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 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by DJ Delorie - * - */ - -#ifdef __x86_64__ - -#include - -int -main (int argc, char **argv) -{ - fprintf (stderr, "%s: This application is unsuported on x86_64 so far.\n", - argv[0]); - return 1; -} - -#else - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static char *prog_name; - -static struct option longopts[] = -{ - {"console-trace", no_argument, NULL, 'c' }, - {"disable", no_argument, NULL, 'd' }, - {"enable", no_argument, NULL, 'e' }, - {"help", no_argument, NULL, 'h' }, - {"dll", no_argument, NULL, 'l' }, - {"sub-threads", no_argument, NULL, 's' }, - {"trace-eip", no_argument, NULL, 't' }, - {"verbose", no_argument, NULL, 'v' }, - {"version", no_argument, NULL, 'V' }, - {NULL, 0, NULL, 0} -}; - -static char opts[] = "+cdehlstvV"; - -#define KERNEL_ADDR 0x77000000 - -#define TRACE_SSP 0 - -#define VERBOSE 1 -#define TIMES 1000 - -/* from winsup/gmon.h */ -struct gmonhdr { - unsigned long lpc; /* base pc address of sample buffer */ - unsigned long hpc; /* max pc address of sampled buffer */ - int ncnt; /* size of sample buffer (plus this header) */ - int version; /* version number */ - int profrate; /* profiling clock rate */ - int spare[3]; /* reserved */ -}; -#define GMONVERSION 0x00051879 -#define HISTCOUNTER unsigned short - -typedef struct { - unsigned int base_address; - int pcount; - int scount; - char *name; -} DllInfo; - -typedef struct { - unsigned int address; - unsigned char real_byte; -} PendingBreakpoints; - -unsigned low_pc=0, high_pc=0; -unsigned last_pc=0, pc, last_sp=0, sp; -int total_cycles, count; -HANDLE hProcess; -PROCESS_INFORMATION procinfo; -STARTUPINFO startup; -CONTEXT context; -HISTCOUNTER *hits=0; -struct gmonhdr hdr; -int running = 1, profiling = 1; -char dll_name[1024], *dll_ptr, *cp; -int eip; -unsigned opcode_count = 0; - -int stepping_enabled = 1; -int tracing_enabled = 0; -int trace_console = 0; -int trace_all_threads = 0; -int dll_counts = 0; -int verbose = 0; - -#define MAXTHREADS 100 -DWORD active_thread_ids[MAXTHREADS]; -HANDLE active_threads[MAXTHREADS]; -DWORD thread_step_flags[MAXTHREADS]; -DWORD thread_return_address[MAXTHREADS]; -int num_active_threads = 0; -int suspended_count=0; - -#define MAXDLLS 100 -DllInfo dll_info[MAXDLLS]; -int num_dlls=0; - -#define MAXPENDS 100 -PendingBreakpoints pending_breakpoints[MAXPENDS]; -int num_breakpoints=0; - -static void -add_breakpoint (unsigned int address) -{ - int i; - DWORD rv; - static char int3[] = { 0xcc }; - for (i=0; i= num_breakpoints) - num_breakpoints = i+1; -} - -static int -remove_breakpoint (unsigned int address) -{ - int i; - DWORD rv; - for (i=0; ibase_address < b->base_address) - return -1; - return 1; -} - -static char * -addr2dllname (unsigned int addr) -{ - int i; - for (i=num_dlls-1; i>=0; i--) - { - if (dll_info[i].base_address < addr) - { - return dll_info[i].name; - } - } - return (char *)""; -} - -static void -dump_registers (HANDLE thread) -{ - context.ContextFlags = CONTEXT_FULL; - GetThreadContext (thread, &context); - printf ("eax %08lx ebx %08lx ecx %08lx edx %08lx eip\n", - context.Eax, context.Ebx, context.Ecx, context.Edx); - printf ("esi %08lx edi %08lx ebp %08lx esp %08lx %08lx\n", - context.Esi, context.Esi, context.Ebp, context.Esp, context.Eip); -} - -typedef struct Edge { - struct Edge *next; - unsigned int from_pc; - unsigned int to_pc; - unsigned int count; -} Edge; - -Edge *edges[4096]; - -void -store_call_edge (unsigned int from_pc, unsigned int to_pc) -{ - Edge *e; - unsigned int h = ((from_pc + to_pc)>>4) & 4095; - for (e=edges[h]; e; e=e->next) - if (e->from_pc == from_pc && e->to_pc == to_pc) - break; - if (!e) - { - e = (Edge *)malloc (sizeof (Edge)); - e->next = edges[h]; - edges[h] = e; - e->from_pc = from_pc; - e->to_pc = to_pc; - e->count = 0; - } - e->count++; -} - -void -write_call_edges (FILE *f) -{ - int h; - Edge *e; - for (h=0; h<4096; h++) - for (e=edges[h]; e; e=e->next) - fwrite (&(e->from_pc), 1, 3*sizeof (unsigned int), f); -} - -char * -wide_strdup (char *cp) -{ - unsigned short *s = (unsigned short *)cp; - int len; - char *rv; - for (len=0; s[len]; len++); - rv = (char *)malloc (len+1); - for (len=0; s[len]; len++) - rv[len] = s[len]; - rv[len] = 0; - return rv; -} - -void -run_program (char *cmdline) -{ - FILE *tracefile = 0; - int tix, i; - HANDLE hThread; - char *string; - - memset (&startup, 0, sizeof (startup)); - startup.cb = sizeof (startup); - - if (!CreateProcess (0, cmdline, 0, 0, 0, - CREATE_NEW_PROCESS_GROUP - | CREATE_SUSPENDED - | DEBUG_PROCESS - | DEBUG_ONLY_THIS_PROCESS, - 0, 0, &startup, &procinfo)) - { - fprintf (stderr, "Can't create process: error %ld\n", GetLastError ()); - exit (1); - } - - hProcess = procinfo.hProcess; -#if 0 - printf ("procinfo: %08x %08x %08x %08x\n", - hProcess, procinfo.hThread, procinfo.dwProcessId, procinfo.dwThreadId); -#endif - - active_threads[0] = procinfo.hThread; - active_thread_ids[0] = procinfo.dwThreadId; - thread_step_flags[0] = stepping_enabled; - num_active_threads = 1; - - dll_info[0].base_address = 0; - dll_info[0].pcount = 0; - dll_info[0].scount = 0; - dll_info[0].name = cmdline; - num_dlls = 1; - - SetThreadPriority (procinfo.hThread, THREAD_PRIORITY_IDLE); - - context.ContextFlags = CONTEXT_FULL; - - ResumeThread (procinfo.hThread); - - total_cycles = 0; - - if (tracing_enabled) - { - tracefile = fopen ("trace.ssp", "w"); - if (!tracefile) - { - tracing_enabled = 0; - perror ("trace.ssp"); - } - } - - running = 1; - while (running) - { - int src, dest; - DWORD rv; - DEBUG_EVENT event; - int contv = DBG_CONTINUE; - - event.dwDebugEventCode = -1; - if (!WaitForDebugEvent (&event, INFINITE)) - { - printf ("idle...\n"); - } - - hThread = lookup_thread_id (event.dwThreadId, &tix); - -#if 0 - printf ("DE: %x/%d %d %d ", - hThread, tix, - event.dwDebugEventCode, num_active_threads); - for (src=0; src=0; i--) - { - if (dll_info[i].base_address < context.Eip) - { - if (hThread == procinfo.hThread) - dll_info[i].pcount++; - else - dll_info[i].scount++; - break; - } - } - } - - if (pc < last_pc || pc > last_pc+10) - { - static int ncalls=0; - static int qq=0; - if (++qq % 100 == 0) - fprintf (stderr, " %08x %d %d \r", - pc, ncalls, opcode_count); - - if (sp == last_sp-4) - { - ncalls++; - store_call_edge (last_pc, pc); - if (last_pc < KERNEL_ADDR && pc > KERNEL_ADDR) - { - int retaddr; - DWORD rv; - ReadProcessMemory (hProcess, - (void *)sp, - (LPVOID)&(retaddr), - 4, &rv); -#if 0 - printf ("call last_pc = %08x pc = %08x rv = %08x\n", - last_pc, pc, retaddr); - /* experimental - try to skip kernel calls for speed */ - add_breakpoint (retaddr); - set_step_threads (event.dwThreadId, 0); -#endif - } - } - } - - total_cycles++; - last_sp = sp; - last_pc = pc; - if (pc >= low_pc && pc < high_pc) - hits[(pc - low_pc)/2] ++; - break; - default: - if (verbose) - { - printf ("exception %ld, ", event.u.Exception.dwFirstChance); - printf ("code: %lx flags: %lx\n", - event.u.Exception.ExceptionRecord.ExceptionCode, - event.u.Exception.ExceptionRecord.ExceptionFlags); - if (event.u.Exception.dwFirstChance == 1) - dump_registers (hThread); - } - contv = DBG_EXCEPTION_NOT_HANDLED; - running = 0; - break; - } - - if (!rv) - { - if (pc == thread_return_address[tix]) - { - if (context.EFlags & 0x100) - { - context.EFlags &= ~0x100; /* TRAP (single step) flag */ - SetThreadContext (hThread, &context); - } - } - else if (stepping_enabled) - { - if (!(context.EFlags & 0x100)) - { - context.EFlags |= 0x100; /* TRAP (single step) flag */ - SetThreadContext (hThread, &context); - } - } - } - break; - - case OUTPUT_DEBUG_STRING_EVENT: - string = (char *)malloc (event.u.DebugString.nDebugStringLength+1); - i = ReadProcessMemory (hProcess, - event.u.DebugString.lpDebugStringData, - (LPVOID)string, - event.u.DebugString.nDebugStringLength, - &rv); - if (!i) - { - printf ("error reading memory: %ld %ld\n", rv, GetLastError ()); - } - if (verbose) - printf ("ODS: %x/%d \"%s\"\n", - (int)hThread, tix, string); - - if (strcmp (string, "ssp on") == 0) - { - stepping_enabled = 1; - set_step_threads (event.dwThreadId, 1); - } - - if (strcmp (string, "ssp off") == 0) - { - stepping_enabled = 0; - set_step_threads (event.dwThreadId, 0); - } - - break; - - - case LOAD_DLL_DEBUG_EVENT: - if (verbose) - printf ("load dll %08x:", - (int)event.u.LoadDll.lpBaseOfDll); - - dll_ptr = (char *)"( u n k n o w n ) \0\0"; - if (event.u.LoadDll.lpImageName) - { - ReadProcessMemory (hProcess, - event.u.LoadDll.lpImageName, - (LPVOID)&src, - sizeof (src), - &rv); - if (src) - { - ReadProcessMemory (hProcess, - (void *)src, - (LPVOID)dll_name, - sizeof (dll_name), - &rv); - dll_name[rv] = 0; - dll_ptr = dll_name; - for (cp=dll_name; *cp; cp++) - { - if (*cp == '\\' || *cp == '/') - { - dll_ptr = cp+1; - } - *cp = tolower ((unsigned char) *cp); - } - } - } - - - dll_info[num_dlls].base_address - = (unsigned int)event.u.LoadDll.lpBaseOfDll; - dll_info[num_dlls].pcount = 0; - dll_info[num_dlls].scount = 0; - dll_info[num_dlls].name = wide_strdup (dll_ptr); - if (verbose) - printf (" %s\n", dll_info[num_dlls].name); - num_dlls++; - qsort (dll_info, num_dlls, sizeof (DllInfo), dll_sort); - - break; - - case UNLOAD_DLL_DEBUG_EVENT: - if (verbose) - printf ("unload dll\n"); - break; - - case EXIT_PROCESS_DEBUG_EVENT: - if (verbose) - printf ("process %08lx %08lx exit %ld\n", - event.dwProcessId, event.dwThreadId, - event.u.ExitProcess.dwExitCode); - - running = 0; - break; - } - - set_steps (); - ContinueDebugEvent (event.dwProcessId, event.dwThreadId, contv); - } - - count = 0; - for (pc=low_pc; pc\n" - "\n" - "The SSP is a program that uses the Win32 debug API to run a program\n" - "one ASM instruction at a time. It records the location of each\n" - "instruction used, how many times that instruction is used, and all\n" - "function calls. The results are saved in a format that is usable by\n" - "the profiling program \"gprof\", although gprof will claim the values\n" - "are seconds, they really are instruction counts. More on that later.\n" - "\n" - "Because the SSP was originally designed to profile the cygwin DLL, it\n" - "does not automatically select a block of code to report statistics on.\n" - "You must specify the range of memory addresses to keep track of\n" - "manually, but it's not hard to figure out what to specify. Use the\n" - "\"objdump\" program to determine the bounds of the target's \".text\"\n" - "section. Let's say we're profiling cygwin1.dll. Make sure you've\n" - "built it with debug symbols (else gprof won't run) and run objdump\n" - "like this:\n" - "\n" - " objdump -h cygwin1.dll\n" - "\n" - "It will print a report like this:\n" - "\n" - "cygwin1.dll: file format pei-i386\n" - "\n" - "Sections:\n" - "Idx Name Size VMA LMA File off Algn\n" - " 0 .text 0007ea00 61001000 61001000 00000400 2**2\n" - " CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA\n" - " 1 .data 00008000 61080000 61080000 0007ee00 2**2\n" - " CONTENTS, ALLOC, LOAD, DATA\n" - " . . .\n" - "\n" - "The only information we're concerned with are the VMA of the .text\n" - "section and the VMA of the section after it (sections are usually\n" - "contiguous; you can also add the Size to the VMA to get the end\n" - "address). In this case, the VMA is 0x61001000 and the ending address\n" - "is either 0x61080000 (start of .data method) or 0x0x6107fa00 (VMA+Size\n" - "method).\n" - "\n" - "There are two basic ways to use SSP - either profiling a whole\n" - "program, or selectively profiling parts of the program.\n" - "\n" - "To profile a whole program, just run ssp without options. By default,\n" - "it will step the whole program. Here's a simple example, using the\n" - "numbers above:\n" - "\n" - " ssp 0x61001000 0x61080000 hello.exe\n" - "\n" - "This will step the whole program. It will take at least 8 minutes on\n" - "a PII/300 (yes, really). When it's done, it will create a file called\n" - "\"gmon.out\". You can turn this data file into a readable report with\n" - "gprof:\n" - "\n" - " gprof -b cygwin1.dll\n" - "\n" - "The \"-b\" means 'skip the help pages'. You can omit this until you're\n" - "familiar with the report layout. The gprof documentation explains\n" - "a lot about this report, but ssp changes a few things. For example,\n" - "the first part of the report reports the amount of time spent in each\n" - "function, like this:\n" - "\n" - "Each sample counts as 0.01 seconds.\n" - " %% cumulative self self total\n" - " time seconds seconds calls ms/call ms/call name\n" - " 10.02 231.22 72.43 46 1574.57 1574.57 strcspn\n" - " 7.95 288.70 57.48 130 442.15 442.15 strncasematch\n" - "\n" - "The \"seconds\" columns are really CPU opcodes, 1/100 second per opcode.\n" - "So, \"231.22\" above means 23,122 opcodes. The ms/call values are 10x\n" - "too big; 1574.57 means 157.457 opcodes per call. Similar adjustments\n" - "need to be made for the \"self\" and \"children\" columns in the second\n" - "part of the report.\n" - "\n" - "OK, so now we've got a huge report that took a long time to generate,\n" - "and we've identified a spot we want to work on optimizing. Let's say\n" - "it's the time() function. We can use SSP to selectively profile this\n" - "function by using OutputDebugString() to control SSP from within the\n" - "program. Here's a sample program:\n" - "\n" - " #include \n" - " main()\n" - " {\n" - " time_t t;\n" - " OutputDebugString(\"ssp on\");\n" - " time(&t);\n" - " OutputDebugString(\"ssp off\");\n" - " }\n" - "\n" - "Then, add the \"-d\" option to ssp to default to *disabling* profiling.\n" - "The program will run at full speed until the first OutputDebugString,\n" - "then step until the second.\n" - "\n" - " ssp -d 0x61001000 0x61080000 hello.exe\n" - "\n" - "You can then use gprof (as usual) to see the performance profile for\n" - "just that portion of the program's execution.\n" - "\n" - "There are many options to ssp. Since step-profiling makes your\n" - "program run about 1,000 times slower than normal, it's best to\n" - "understand all the options so that you can narrow down the parts\n" - "of your program you need to single-step.\n" - "\n" - "\"-v\" - verbose. This prints messages about threads starting and\n" - "stopping, OutputDebugString calls, DLLs loading, etc.\n" - "\n" - "\"-t\" and \"-c\" - tracing. With -t, *every* step's address is written\n" - "to the file \"trace.ssp\". This can be used to help debug functions,\n" - "since it can trace multiple threads. Clever use of scripts can match\n" - "addresses with disassembled opcodes if needed. Warning: creates\n" - "*huge* files, very quickly. \"-c\" prints each address to the console,\n" - "useful for debugging key chunks of assembler.\n" - "Use \"addr2line -C -f -s -e foo.exe < trace.ssp > lines.ssp\" and then\n" - "\"perl cvttrace\" to convert to symbolic traces.\n" - "\n" - "\"-s\" - subthreads. Usually, you only need to trace the main thread,\n" - "but sometimes you need to trace all threads, so this enables that.\n" - "It's also needed when you want to profile a function that only a\n" - "subthread calls. However, using OutputDebugString automatically\n" - "enables profiling on the thread that called it, not the main thread.\n" - "\n" - "\"-l\" - dll profiling. Generates a pretty table of how much time was\n" - "spent in each dll the program used. No sense optimizing a function in\n" - "your program if most of the time is spent in the DLL.\n" - "\n" - "Typically use the -v, -s, and -l options:\n" - "\n" - " ssp -v -s -l -d 0x61001000 0x61080000 hello.exe\n" - "\n"); - if (stream == stderr) - fprintf (stream, "Try '%s --help' for more information.\n", prog_name); - exit (stream == stderr ? 1 : 0); -} - -static void -print_version () -{ - printf ("ssp (cygwin) %d.%d.%d\n" - "Single-Step Profiler\n" - "Copyright (C) 2000 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -int -main (int argc, char **argv) -{ - int c, i; - int total_pcount = 0, total_scount = 0; - FILE *gmon; - - setbuf (stdout, 0); - - prog_name = program_invocation_short_name; - - while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (c) - { - case 'c': - printf ("tracing *all* $eip to the console\n"); - trace_console = 1; - break; - case 'd': - printf ("stepping disabled; enable via OutputDebugString (\"ssp on\")\n"); - stepping_enabled = 0; - break; - case 'e': - printf ("stepping enabled; disable via OutputDebugString (\"ssp off\")\n"); - stepping_enabled = 1; - break; - case 'h': - usage (stdout); - break; - case 'l': - printf ("profiling dll usage\n"); - dll_counts = 1; - break; - case 's': - printf ("tracing all sub-threads too, not just the main one\n"); - trace_all_threads = 1; - break; - case 't': - printf ("tracing all $eip to trace.ssp\n"); - tracing_enabled = 1; - break; - case 'v': - printf ("verbose messages enabled\n"); - verbose = 1; - break; - case 'V': - print_version (); - exit (0); - default: - fprintf (stderr, "Try `%s --help' for more information.\n", prog_name); - exit (1); - } - - if ( (argc - optind) < 3 ) - usage (stderr); - sscanf (argv[optind++], "%i", &low_pc); - sscanf (argv[optind++], "%i", &high_pc); - - if (low_pc > high_pc-8) - { - fprintf (stderr, "Hey, low_pc must be lower than high_pc\n"); - exit (1); - } - - hits = (HISTCOUNTER *)malloc (high_pc-low_pc+4); - memset (hits, 0, high_pc-low_pc+4); - - fprintf (stderr, "prun: [%08x,%08x] Running '%s'\n", - low_pc, high_pc, argv[optind]); - - run_program (argv[optind]); - - hdr.lpc = low_pc; - hdr.hpc = high_pc; - hdr.ncnt = high_pc-low_pc + sizeof (hdr); - hdr.version = GMONVERSION; - hdr.profrate = 100; - - gmon = fopen ("gmon.out", "wb"); - fwrite (&hdr, 1, sizeof (hdr), gmon); - fwrite (hits, 1, high_pc-low_pc, gmon); - write_call_edges (gmon); - fclose (gmon); - - if (dll_counts) - { - /* 1234567 123% 1234567 123% 12345678 xxxxxxxxxxx */ - printf (" Main-Thread Other-Thread BaseAddr DLL Name\n"); - - total_pcount = 0; - total_scount = 0; - for (i=0; i - -The SSP is a program that uses the Win32 debug API to run a program -one ASM instruction at a time. It records the location of each -instruction used, how many times that instruction is used, and all -function calls. The results are saved in a format that is usable by -the profiling program "gprof", although gprof will claim the values -are seconds, they really are instruction counts. More on that later. - -Because the SSP was originally designed to profile the cygwin DLL, it -does not automatically select a block of code to report statistics on. -You must specify the range of memory addresses to keep track of -manually, but it's not hard to figure out what to specify. Use the -"objdump" program to determine the bounds of the target's ".text" -section. Let's say we're profiling cygwin1.dll. Make sure you've -built it with debug symbols (else gprof won't run) and run objdump -like this: - - objdump -h cygwin1.dll - -It will print a report like this: - -cygwin1.dll: file format pei-i386 - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 0007ea00 61001000 61001000 00000400 2**2 - CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA - 1 .data 00008000 61080000 61080000 0007ee00 2**2 - CONTENTS, ALLOC, LOAD, DATA - . . . - -The only information we're concerned with are the VMA of the .text -section and the VMA of the section after it (sections are usually -contiguous; you can also add the Size to the VMA to get the end -address). In this case, the VMA is 0x61001000 and the ending address -is either 0x61080000 (start of .data method) or 0x0x6107fa00 (VMA+Size -method). - -There are two basic ways to use SSP - either profiling a whole -program, or selectively profiling parts of the program. - -To profile a whole program, just run ssp without options. By default, -it will step the whole program. Here's a simple example, using the -numbers above: - - ssp 0x61001000 0x61080000 hello.exe - -This will step the whole program. It will take at least 8 minutes on -a PII/300 (yes, really). When it's done, it will create a file called -"gmon.out". You can turn this data file into a readable report with -gprof: - - gprof -b cygwin1.dll - -The "-b" means "skip the help pages". You can omit this until you're -familiar with the report layout. The gprof documentation explains -a lot about this report, but ssp changes a few things. For example, -the first part of the report reports the amount of time spent in each -function, like this: - -Each sample counts as 0.01 seconds. - % cumulative self self total - time seconds seconds calls ms/call ms/call name - 10.02 231.22 72.43 46 1574.57 1574.57 strcspn - 7.95 288.70 57.48 130 442.15 442.15 strncasematch - -The "seconds" columns are really CPU opcodes, 1/100 second per opcode. -So, "231.22" above means 23,122 opcodes. The ms/call values are 10x -too big; 1574.57 means 157.457 opcodes per call. Similar adjustments -need to be made for the "self" and "children" columns in the second -part of the report. - -OK, so now we've got a huge report that took a long time to generate, -and we've identified a spot we want to work on optimizing. Let's say -it's the time() function. We can use SSP to selectively profile this -function by using OutputDebugString() to control SSP from within the -program. Here's a sample program: - - #include - main() - { - time_t t; - OutputDebugString("ssp on"); - time(&t); - OutputDebugString("ssp off"); - } - -Then, add the "-d" option to ssp to default to *disabling* profiling. -The program will run at full speed until the first OutputDebugString, -then step until the second. - - ssp -d 0x61001000 0x61080000 hello.exe - -You can then use gprof (as usual) to see the performance profile for -just that portion of the program's execution. - -OK, now for the other ssp options, and when to use them: - -"-v" - verbose. This prints messages about threads starting and -stopping, OutputDebugString calls, DLLs loading, etc. - -"-t" and "-tc" - tracing. With -t, *every* step's address is written -to the file "trace.ssp". This can be used to help debug functions, -since it can trace multiple threads. Clever use of scripts can match -addresses with disassembled opcodes if needed. Warning: creates -*huge* files, very quickly. "-tc" prints each address to the console, -useful for debugging key chunks of assembler. - -"-s" - subthreads. Usually, you only need to trace the main thread, -but sometimes you need to trace all threads, so this enables that. -It's also needed when you want to profile a function that only a -subthread calls. However, using OutputDebugString automatically -enables profiling on the thread that called it, not the main thread. - -"-dll" - dll profiling. Generates a pretty table of how much time was -spent in each dll the program used. No sense optimizing a function in -your program if most of the time is spent in the DLL. - -I usually use the -v, -s, and -dll options: - - ssp -v -s -dll -d 0x61001000 0x61080000 hello.exe diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc deleted file mode 100644 index 73096ab3b..000000000 --- a/winsup/utils/strace.cc +++ /dev/null @@ -1,1107 +0,0 @@ -/* strace.cc - - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011, 2012, 2013 Red Hat Inc. - - Written by Chris Faylor - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#define cygwin_internal cygwin_internal_dontuse -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../cygwin/include/sys/strace.h" -#include "../cygwin/include/sys/cygwin.h" -#include "../cygwin/include/cygwin/version.h" -#include "path.h" -#undef cygwin_internal -#include "loadlib.h" - -/* we *know* we're being built with GCC */ -#ifndef alloca -#define alloca __builtin_alloca -#endif - -static const char *pgm; -static int forkdebug = 1; -static int numerror = 1; -static int show_usecs = 1; -static int delta = 1; -static int hhmmss; -static int bufsize; -static int new_window; -static long flush_period; -static int include_hex; -static int quiet = -1; - -static unsigned char strace_active = 1; -static int processes; - -static BOOL close_handle (HANDLE h, DWORD ok); - -#define CloseHandle(h) close_handle(h, 0) - -struct child_list -{ - DWORD id; - HANDLE hproc; - int saw_stars; - char nfields; - long long start_time; - DWORD last_usecs; - struct child_list *next; - child_list ():id (0), hproc (NULL), saw_stars (0), nfields (0), - start_time (0), last_usecs (0), next (NULL) - { - } -}; - -child_list children; - -static void -warn (int geterrno, const char *fmt, ...) -{ - va_list args; - char buf[4096]; - - va_start (args, fmt); - sprintf (buf, "%s: ", pgm); - vsprintf (strchr (buf, '\0'), fmt, args); - if (geterrno) - perror (buf); - else - { - fputs (buf, stderr); - fputs ("\n", stderr); - } -} - -static void __attribute__ ((noreturn)) -error (int geterrno, const char *fmt, ...) -{ - va_list args; - char buf[4096]; - - va_start (args, fmt); - sprintf (buf, "%s: ", pgm); - vsprintf (strchr (buf, '\0'), fmt, args); - if (geterrno) - perror (buf); - else - { - fputs (buf, stderr); - fputs ("\n", stderr); - } - exit (1); -} - -DWORD lastid = 0; -HANDLE lasth; - -static child_list * -get_child (DWORD id) -{ - child_list *c; - for (c = &children; (c = c->next) != NULL;) - if (c->id == id) - return c; - - return NULL; -} - -static void -add_child (DWORD id, HANDLE hproc) -{ - if (!get_child (id)) - { - child_list *c = children.next; - children.next = (child_list *) calloc (1, sizeof (child_list)); - children.next->next = c; - lastid = children.next->id = id; - lasth = children.next->hproc = hproc; - processes++; - if (!quiet) - fprintf (stderr, "Windows process %lu attached\n", id); - } -} - -static void -remove_child (DWORD id) -{ - child_list *c; - if (id == lastid) - lastid = 0; - for (c = &children; c->next != NULL; c = c->next) - if (c->next->id == id) - { - child_list *c1 = c->next; - c->next = c1->next; - free (c1); - if (!quiet) - fprintf (stderr, "Windows process %lu detached\n", id); - processes--; - return; - } - - error (0, "no process id %d found", id); -} - -#define LINE_BUF_CHUNK 128 - -class linebuf -{ - size_t alloc; -public: - size_t ix; - char *buf; - linebuf () - { - ix = 0; - alloc = 0; - buf = NULL; - } - ~linebuf () - { - if (buf) - free (buf); - } - void add (const char *what, int len); - void add (const char *what) - { - add (what, strlen (what)); - } - void prepend (const char *what, int len); -}; - -void -linebuf::add (const char *what, int len) -{ - size_t newix; - if ((newix = ix + len) >= alloc) - { - alloc += LINE_BUF_CHUNK + len; - buf = (char *) realloc (buf, alloc + 1); - } - memcpy (buf + ix, what, len); - ix = newix; - buf[ix] = '\0'; -} - -void -linebuf::prepend (const char *what, int len) -{ - int buflen; - size_t newix; - if ((newix = ix + len) >= alloc) - { - alloc += LINE_BUF_CHUNK + len; - buf = (char *) realloc (buf, alloc + 1); - buf[ix] = '\0'; - } - if ((buflen = strlen (buf))) - memmove (buf + len, buf, buflen + 1); - else - buf[newix] = '\0'; - memcpy (buf, what, len); - ix = newix; -} - -static void -make_command_line (linebuf & one_line, char **argv) -{ - for (; *argv; argv++) - { - char *p = NULL; - const char *a = *argv; - - int len = strlen (a); - if (len != 0 && !(p = strpbrk (a, " \t\n\r\""))) - one_line.add (a, len); - else - { - one_line.add ("\"", 1); - for (; p; a = p, p = strchr (p, '"')) - { - one_line.add (a, ++p - a); - if (p[-1] == '"') - one_line.add ("\"", 1); - } - if (*a) - one_line.add (a); - one_line.add ("\"", 1); - } - one_line.add (" ", 1); - } - - if (one_line.ix) - one_line.buf[one_line.ix - 1] = '\0'; - else - one_line.add ("", 1); -} - -static DWORD child_pid; - -static BOOL WINAPI -ctrl_c (DWORD) -{ - static int tic = 1; - if ((tic ^= 1) && !GenerateConsoleCtrlEvent (CTRL_C_EVENT, 0)) - error (0, "couldn't send CTRL-C to child, win32 error %d\n", - GetLastError ()); - return TRUE; -} - -extern "C" { -uintptr_t (*cygwin_internal) (int, ...); -WCHAR cygwin_dll_path[32768]; -}; - -static int -load_cygwin () -{ - static HMODULE h; - - if (cygwin_internal) - return 1; - - if (h) - return 0; - - if (!(h = LoadLibrary ("cygwin1.dll"))) - { - errno = ENOENT; - return 0; - } - GetModuleFileNameW (h, cygwin_dll_path, 32768); - if (!(cygwin_internal = (uintptr_t (*) (int, ...)) GetProcAddress (h, "cygwin_internal"))) - { - errno = ENOSYS; - return 0; - } - return 1; -} - -#define DEBUG_PROCESS_DETACH_ON_EXIT 0x00000001 -#define DEBUG_PROCESS_ONLY_THIS_PROCESS 0x00000002 - -static void -attach_process (pid_t pid) -{ - child_pid = (DWORD) cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid); - if (!child_pid) - child_pid = pid; - - if (!DebugActiveProcess (child_pid)) - error (0, "couldn't attach to pid %d for debugging", child_pid); - - if (forkdebug) - { - HANDLE h = OpenProcess(PROCESS_ALL_ACCESS, FALSE, child_pid); - - if (h) - { - /* Try to turn off DEBUG_ONLY_THIS_PROCESS so we can follow forks */ - /* This is only supported on XP and later */ - ULONG DebugFlags = DEBUG_PROCESS_DETACH_ON_EXIT; - NTSTATUS status = NtSetInformationProcess (h, ProcessDebugFlags, &DebugFlags, sizeof (DebugFlags)); - if (!NT_SUCCESS (status)) - warn (0, "Could not clear DEBUG_ONLY_THIS_PROCESS (%x), will not trace child processes", status); - - CloseHandle(h); - } - } - - return; -} - - -static void -create_child (char **argv) -{ - linebuf one_line; - - STARTUPINFO si; - PROCESS_INFORMATION pi; - BOOL ret; - DWORD flags; - - if (strchr (*argv, '/')) - *argv = cygpath (*argv, NULL); - memset (&si, 0, sizeof (si)); - si.cb = sizeof (si); - - flags = CREATE_DEFAULT_ERROR_MODE - | (forkdebug ? DEBUG_PROCESS : DEBUG_ONLY_THIS_PROCESS); - if (new_window) - flags |= CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP; - - make_command_line (one_line, argv); - - SetConsoleCtrlHandler (NULL, 0); - const char *cygwin_env = getenv ("CYGWIN"); - const char *space; - if (cygwin_env) - space = " "; - else - space = cygwin_env = ""; - char *newenv = (char *) malloc (sizeof ("CYGWIN=noglob") + strlen (space) + strlen (cygwin_env)); - sprintf (newenv, "CYGWIN=noglob%s%s", space, cygwin_env); - _putenv (newenv); - ret = CreateProcess (0, one_line.buf, /* command line */ - NULL, /* Security */ - NULL, /* thread */ - TRUE, /* inherit handles */ - flags, /* start flags */ - NULL, /* default environment */ - NULL, /* current directory */ - &si, &pi); - if (!ret) - error (0, "error creating process %s, (error %d)", *argv, - GetLastError ()); - - CloseHandle (pi.hThread); - CloseHandle (pi.hProcess); - child_pid = pi.dwProcessId; - SetConsoleCtrlHandler (ctrl_c, 1); -} - -static int -output_winerror (FILE *ofile, char *s) -{ - char *winerr = strstr (s, "Win32 error "); - if (!winerr) - return 0; - - DWORD errnum = atoi (winerr + sizeof ("Win32 error ") - 1); - if (!errnum) - return 0; - - /* - * NOTE: Currently there is no policy for how long the - * the buffers are, and looks like 256 is a smallest one - * (dlfcn.cc). Other than error 1395 (length 213) and - * error 1015 (length 249), the rest are all under 188 - * characters, and so I'll use 189 as the buffer length. - * For those longer error messages, FormatMessage will - * return FALSE, and we'll get the old behaviour such as - * ``Win32 error 1395'' etc. - */ - char buf[4096]; - if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - errnum, - MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) buf, sizeof (buf), NULL)) - return 0; - - /* Get rid the trailing CR/NL pair. */ - char *p = strchr (buf, '\0'); - p[-2] = '\n'; - p[-1] = '\0'; - - *winerr = '\0'; - fputs (s, ofile); - fputs (buf, ofile); - return 1; -} - -static SYSTEMTIME * -syst (long long t) -{ - FILETIME n; - static SYSTEMTIME st; - long long now = t /*+ ((long long) usecs * 10)*/; - n.dwHighDateTime = now >> 32; - n.dwLowDateTime = now & 0xffffffff; - FileTimeToSystemTime (&n, &st); - return &st; -} - -static void __stdcall -handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile) -{ - int len; - int special; - char alen[3 + 8 + 1]; - SIZE_T nbytes; - child_list *child = get_child (id); - if (!child) - error (0, "no process id %d found", id); - HANDLE hchild = child->hproc; -#define INTROLEN (sizeof (alen) - 1) - - if (id == lastid && hchild != lasth) - warn (0, "%p != %p", hchild, lasth); - - alen[INTROLEN] = '\0'; - if (!ReadProcessMemory (hchild, p, alen, INTROLEN, &nbytes)) -#ifndef DEBUGGING - return; -#else - error (0, - "couldn't get message length from subprocess %d<%p>, windows error %d", - id, hchild, GetLastError ()); -#endif - - if (strncmp (alen, "cYg", 3)) - return; - len = (int) strtoul (alen + 3, NULL, 16); - if (!len) - return; - - if (len > 0) - special = 0; - else - { - special = len; - if (special == _STRACE_INTERFACE_ACTIVATE_ADDR || special == _STRACE_CHILD_PID) - len = 17; - } - - char *buf; - buf = (char *) alloca (len + 85) + 20; - - if (!ReadProcessMemory (hchild, ((char *) p) + INTROLEN, buf, len, &nbytes)) - error (0, "couldn't get message from subprocess, windows error %d", - GetLastError ()); - - buf[len] = '\0'; - char *s = strtok (buf, " "); - -#ifdef __x86_64__ - unsigned long long n = strtoull (s, NULL, 16); -#else - unsigned long n = strtoul (s, NULL, 16); -#endif - - s = strchr (s, '\0') + 1; - - if (special == _STRACE_CHILD_PID) - { - DebugActiveProcess (n); - return; - } - - if (special == _STRACE_INTERFACE_ACTIVATE_ADDR) - { - s = strtok (NULL, " "); - if (*s && *s == '1' && !forkdebug) - /* don't activate since we are not following forks */; - else if (!WriteProcessMemory (hchild, (LPVOID) n, &strace_active, - sizeof (strace_active), &nbytes)) - error (0, "couldn't write strace flag to subprocess at %p, " - "windows error %d", n, GetLastError ()); - return; - } - - char *origs = s; - - if (mask & n) - /* got it */ ; - else if (!(mask & _STRACE_ALL) || (n & _STRACE_NOTALL)) - return; /* This should not be included in "all" output */ - - DWORD dusecs, usecs; - char *ptusec, *ptrest; - - dusecs = strtoul (s, &ptusec, 10); - char *q = ptusec; - while (*q == ' ') - q++; - if (*q != '[') - { - usecs = strtoul (q, &ptrest, 10); - while (*ptrest == ' ') - ptrest++; - } - else - { - ptrest = q; - ptusec = show_usecs ? s : ptrest; - usecs = dusecs; - } - -#if 1 - child->saw_stars = 2; -#else - if (child->saw_stars == 0) - { - FILETIME st; - char *news; - - GetSystemTimeAsFileTime (&st); - FileTimeToLocalFileTime (&st, &st); - child->start_time = st.dwHighDateTime; - child->start_time <<= 32; - child->start_time |= st.dwLowDateTime; - if (*(news = ptrest) != '[') - child->saw_stars = 2; - else - { - child->saw_stars++; - while ((news = strchr (news, ' ')) != NULL && *++news != '*') - child->nfields++; - if (news == NULL) - child->saw_stars++; - else - { - s = news; - child->nfields++; - } - } - } - else if (child->saw_stars < 2) - { - int i; - char *news; - if (*(news = ptrest) != '[') - child->saw_stars = 2; - else - { - for (i = 0; i < child->nfields; i++) - if ((news = strchr (news, ' ')) == NULL) - break; // Should never happen - else - news++; - - if (news == NULL) - child->saw_stars = 2; - else - { - s = news; - if (*s == '*') - { - SYSTEMTIME *st = syst (child->start_time); - fprintf (ofile, - "Date/Time: %d-%02d-%02d %02d:%02d:%02d\n", - st->wYear, st->wMonth, st->wDay, st->wHour, - st->wMinute, st->wSecond); - child->saw_stars++; - } - } - } - } -#endif - - long long d = usecs - child->last_usecs; - char intbuf[40]; - - if (child->saw_stars < 2 || s != origs) - /* Nothing */ ; - else if (hhmmss) - { - s = ptrest - 9; - SYSTEMTIME *st = syst (child->start_time + (long long) usecs * 10); - sprintf (s, "%02d:%02d:%02d", st->wHour, st->wMinute, st->wSecond); - *strchr (s, '\0') = ' '; - } - else if (!delta) - s = ptusec; - else - { - s = ptusec; - sprintf (intbuf, "%5d ", (int) d); - int len = strlen (intbuf); - - memcpy ((s -= len), intbuf, len); - } - - if (include_hex) - { - s -= 8; -#ifdef __x86_64__ - sprintf (s, "%012I64x", n); -#else - sprintf (s, "%08lx", n); -#endif - strchr (s, '\0')[0] = ' '; - } - child->last_usecs = usecs; - if (numerror || !output_winerror (ofile, s)) - fputs (s, ofile); - if (!bufsize) - fflush (ofile); -} - -static DWORD -proc_child (unsigned mask, FILE *ofile, pid_t pid) -{ - DWORD res = 0; - DEBUG_EVENT ev; - time_t cur_time, last_time; - - SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_HIGHEST); - last_time = time (NULL); - while (1) - { - BOOL debug_event = WaitForDebugEvent (&ev, 1000); - DWORD status = DBG_CONTINUE; - - if (bufsize && flush_period > 0 && - (cur_time = time (NULL)) >= last_time + flush_period) - { - last_time = cur_time; - fflush (ofile); - } - - if (!debug_event) - continue; - - if (pid) - { - (void) cygwin_internal (CW_STRACE_TOGGLE, pid); - pid = 0; - } - - switch (ev.dwDebugEventCode) - { - case CREATE_PROCESS_DEBUG_EVENT: - if (ev.u.CreateProcessInfo.hFile) - CloseHandle (ev.u.CreateProcessInfo.hFile); - add_child (ev.dwProcessId, ev.u.CreateProcessInfo.hProcess); - break; - - case CREATE_THREAD_DEBUG_EVENT: - break; - - case LOAD_DLL_DEBUG_EVENT: - if (ev.u.LoadDll.hFile) - CloseHandle (ev.u.LoadDll.hFile); - break; - - case OUTPUT_DEBUG_STRING_EVENT: - handle_output_debug_string (ev.dwProcessId, - ev.u.DebugString.lpDebugStringData, - mask, ofile); - break; - - case EXIT_PROCESS_DEBUG_EVENT: - res = ev.u.ExitProcess.dwExitCode; - remove_child (ev.dwProcessId); - break; - case EXCEPTION_DEBUG_EVENT: - if (ev.u.Exception.ExceptionRecord.ExceptionCode - != (DWORD) STATUS_BREAKPOINT) - { - status = DBG_EXCEPTION_NOT_HANDLED; - if (ev.u.Exception.dwFirstChance) - fprintf (ofile, "--- Process %lu, exception %08lx at %p\n", - ev.dwProcessId, - ev.u.Exception.ExceptionRecord.ExceptionCode, - ev.u.Exception.ExceptionRecord.ExceptionAddress); - } - break; - } - if (!ContinueDebugEvent (ev.dwProcessId, ev.dwThreadId, status)) - error (0, "couldn't continue debug event, windows error %d", - GetLastError ()); - if (!processes) - break; - } - - return res; -} - -static void -dotoggle (pid_t pid) -{ - child_pid = (DWORD) cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid); - if (!child_pid) - { - warn (0, "no such cygwin pid - %d", pid); - child_pid = pid; - } - if (cygwin_internal (CW_STRACE_TOGGLE, child_pid)) - error (0, "failed to toggle tracing for process %d<%d>", pid, child_pid); - - return; -} - -static DWORD -dostrace (unsigned mask, FILE *ofile, pid_t pid, char **argv) -{ - if (!pid) - create_child (argv); - else - attach_process (pid); - - return proc_child (mask, ofile, pid); -} - -typedef struct tag_mask_mnemonic -{ - unsigned long val; - const char *text; -} -mask_mnemonic; - -static const mask_mnemonic mnemonic_table[] = { - {_STRACE_ALL, "all"}, - {_STRACE_FLUSH, "flush"}, - {_STRACE_INHERIT, "inherit"}, - {_STRACE_UHOH, "uhoh"}, - {_STRACE_SYSCALL, "syscall"}, - {_STRACE_STARTUP, "startup"}, - {_STRACE_DEBUG, "debug"}, - {_STRACE_PARANOID, "paranoid"}, - {_STRACE_TERMIOS, "termios"}, - {_STRACE_SELECT, "select"}, - {_STRACE_WM, "wm"}, - {_STRACE_SIGP, "sigp"}, - {_STRACE_MINIMAL, "minimal"}, - {_STRACE_EXITDUMP, "exitdump"}, - {_STRACE_SYSTEM, "system"}, - {_STRACE_NOMUTEX, "nomutex"}, - {_STRACE_MALLOC, "malloc"}, - {_STRACE_THREAD, "thread"}, - {_STRACE_PTHREAD, "pthread"}, - {_STRACE_SPECIAL, "special"}, - {0, NULL} -}; - -static unsigned long -mnemonic2ul (const char *nptr, char **endptr) -{ - // Look up mnemonic in table, return value. - // *endptr = ptr to char that breaks match. - const mask_mnemonic *mnp = mnemonic_table; - - while (mnp->text != NULL) - { - if (strcmp (mnp->text, nptr) == 0) - { - // Found a match. - if (endptr != NULL) - { - *endptr = ((char *) nptr) + strlen (mnp->text); - } - return mnp->val; - } - mnp++; - } - - // Didn't find it. - if (endptr != NULL) - { - *endptr = (char *) nptr; - } - return 0; -} - -static unsigned long -parse_mask (const char *ms, char **endptr) -{ - const char *p = ms; - char *newp; - unsigned long retval = 0, thisval; - const size_t bufsize = 16; - char buffer[bufsize]; - size_t len; - - while (*p != '\0') - { - // First extract the term, terminate it, and lowercase it. - strncpy (buffer, p, bufsize); - buffer[bufsize - 1] = '\0'; - len = strcspn (buffer, "+,\0"); - buffer[len] = '\0'; - strlwr (buffer); - - // Check if this is a mnemonic. We have to do this first or strtoul() - // will false-trigger on anything starting with "a" through "f". - thisval = mnemonic2ul (buffer, &newp); - if (buffer == newp) - { - // This term isn't mnemonic, check if it's hex. - thisval = strtoul (buffer, &newp, 16); - if (newp != buffer + len) - { - // Not hex either, syntax error. - *endptr = (char *) p; - return 0; - } - } - - p += len; - retval += thisval; - - // Handle operators - if (*p == '\0') - break; - if ((*p == '+') || (*p == ',')) - { - // For now these both equate to addition/ORing. Until we get - // fancy and add things like "all-", all we need do is - // continue the looping. - p++; - continue; - } - else - { - // Syntax error - *endptr = (char *) p; - return 0; - } - } - - *endptr = (char *) p; - return retval; -} - -static void -usage (FILE *where = stderr) -{ - fprintf (where, "\ -Usage: %s [OPTIONS] \n\ -Usage: %s [OPTIONS] -p \n\ -\n\ -Trace system calls and signals\n\ -\n\ - -b, --buffer-size=SIZE set size of output file buffer\n\ - -d, --no-delta don't display the delta-t microsecond timestamp\n\ - -f, --trace-children trace child processes (toggle - default true)\n\ - -h, --help output usage information and exit\n\ - -m, --mask=MASK set message filter mask\n\ - -n, --crack-error-numbers output descriptive text instead of error\n\ - numbers for Windows errors\n\ - -o, --output=FILENAME set output file to FILENAME\n\ - -p, --pid=n attach to executing program with cygwin pid n\n\ - -q, --quiet suppress messages about attaching, detaching, etc.\n\ - -S, --flush-period=PERIOD flush buffered strace output every PERIOD secs\n\ - -t, --timestamp use an absolute hh:mm:ss timestamp insted of \n\ - the default microsecond timestamp. Implies -d\n\ - -T, --toggle toggle tracing in a process already being\n\ - traced. Requires -p \n\ - -u, --usecs toggle printing of microseconds timestamp\n\ - -V, --version output version information and exit\n\ - -w, --new-window spawn program under test in a new window\n\ -\n", pgm, pgm); - if ( where == stdout) - fprintf (stdout, "\ - MASK can be any combination of the following mnemonics and/or hex values\n\ - (0x is optional). Combine masks with '+' or ',' like so:\n\ -\n\ - --mask=wm+system,malloc+0x00800\n\ -\n\ - Mnemonic Hex Corresponding Def Description\n\ - =========================================================================\n\ - all 0x000001 (_STRACE_ALL) All strace messages.\n\ - flush 0x000002 (_STRACE_FLUSH) Flush output buffer after each message.\n\ - inherit 0x000004 (_STRACE_INHERIT) Children inherit mask from parent.\n\ - uhoh 0x000008 (_STRACE_UHOH) Unusual or weird phenomenon.\n\ - syscall 0x000010 (_STRACE_SYSCALL) System calls.\n\ - startup 0x000020 (_STRACE_STARTUP) argc/envp printout at startup.\n\ - debug 0x000040 (_STRACE_DEBUG) Info to help debugging. \n\ - paranoid 0x000080 (_STRACE_PARANOID) Paranoid info.\n\ - termios 0x000100 (_STRACE_TERMIOS) Info for debugging termios stuff.\n\ - select 0x000200 (_STRACE_SELECT) Info on ugly select internals.\n\ - wm 0x000400 (_STRACE_WM) Trace Windows msgs (enable _strace_wm).\n\ - sigp 0x000800 (_STRACE_SIGP) Trace signal and process handling.\n\ - minimal 0x001000 (_STRACE_MINIMAL) Very minimal strace output.\n\ - pthread 0x002000 (_STRACE_PTHREAD) Pthread calls.\n\ - exitdump 0x004000 (_STRACE_EXITDUMP) Dump strace cache on exit.\n\ - system 0x008000 (_STRACE_SYSTEM) Serious error; goes to console and log.\n\ - nomutex 0x010000 (_STRACE_NOMUTEX) Don't use mutex for synchronization.\n\ - malloc 0x020000 (_STRACE_MALLOC) Trace malloc calls.\n\ - thread 0x040000 (_STRACE_THREAD) Thread-locking calls.\n\ - special 0x100000 (_STRACE_SPECIAL) Special debugging printfs for\n\ - non-checked-in code\n\ -"); - if (where == stderr) - fprintf (stderr, "Try `%s --help' for more information.\n", pgm); - exit (where == stderr ? 1 : 0 ); -} - -struct option longopts[] = { - {"buffer-size", required_argument, NULL, 'b'}, - {"help", no_argument, NULL, 'h'}, - {"flush-period", required_argument, NULL, 'S'}, - {"hex", no_argument, NULL, 'H'}, - {"mask", required_argument, NULL, 'm'}, - {"new-window", no_argument, NULL, 'w'}, - {"output", required_argument, NULL, 'o'}, - {"no-delta", no_argument, NULL, 'd'}, - {"pid", required_argument, NULL, 'p'}, - {"quiet", no_argument, NULL, 'q'}, - {"timestamp", no_argument, NULL, 't'}, - {"toggle", no_argument, NULL, 'T'}, - {"trace-children", no_argument, NULL, 'f'}, - {"translate-error-numbers", no_argument, NULL, 'n'}, - {"usecs", no_argument, NULL, 'u'}, - {"version", no_argument, NULL, 'V'}, - {NULL, 0, NULL, 0} -}; - -static const char *const opts = "+b:dhHfm:no:p:qS:tTuVw"; - -static void -print_version () -{ - printf ("strace (cygwin) %d.%d.%d\n" - "System Trace\n" - "Copyright (C) 2000 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -int -main (int argc, char **argv) -{ - unsigned mask = 0; - FILE *ofile = NULL; - pid_t pid = 0; - int opt; - int toggle = 0; - int sawquiet = -1; - - if (load_cygwin ()) - { - char **av = (char **) cygwin_internal (CW_ARGV); - if (av && (uintptr_t) av != (uintptr_t) -1) - for (argc = 0, argv = av; *av; av++) - argc++; - } - - if (!(pgm = strrchr (*argv, '\\')) && !(pgm = strrchr (*argv, '/'))) - pgm = *argv; - else - pgm++; - - while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (opt) - { - case 'b': - bufsize = atoi (optarg); - break; - case 'd': - delta ^= 1; - break; - case 'f': - forkdebug ^= 1; - break; - case 'h': - // Print help and exit - usage (stdout); - break; - case 'H': - include_hex ^= 1; - break; - case 'm': - { - char *endptr; - mask = parse_mask (optarg, &endptr); - if (*endptr != '\0') - { - // Bad mask expression. - error (0, "syntax error in mask expression \"%s\" near \ -character #%d.\n", optarg, (int) (endptr - optarg), endptr); - } - break; - } - case 'n': - numerror ^= 1; - break; - case 'o': - if ((ofile = fopen (cygpath (optarg, NULL), "wb")) == NULL) - error (1, "can't open %s", optarg); -#ifdef F_SETFD - (void) fcntl (fileno (ofile), F_SETFD, 0); -#endif - break; - case 'p': - pid = strtoul (optarg, NULL, 10); - strace_active |= 2; - break; - case 'q': - if (sawquiet < 0) - sawquiet = 1; - else - sawquiet ^= 1; - break; - case 'S': - flush_period = strtoul (optarg, NULL, 10); - break; - case 't': - hhmmss ^= 1; - break; - case 'T': - toggle ^= 1; - break; - case 'u': - // FIXME: currently unimplemented - show_usecs ^= 1; - delta ^= 1; - break; - case 'V': - // Print version info and exit - print_version (); - return 0; - case 'w': - new_window ^= 1; - break; - default: - fprintf (stderr, "Try `%s --help' for more information.\n", pgm); - exit (1); - } - - if (pid && argv[optind]) - error (0, "cannot provide both a command line and a process id"); - - if (!pid && !argv[optind]) - error (0, "must provide either a command line or a process id"); - - if (toggle && !pid) - error (0, "must provide a process id to toggle tracing"); - - if (!pid) - quiet = sawquiet < 0 || !sawquiet; - else if (sawquiet < 0) - quiet = 0; - else - quiet = sawquiet; - - if (!mask) - mask = _STRACE_ALL; - - if (bufsize) - setvbuf (ofile, (char *) alloca (bufsize), _IOFBF, bufsize); - - if (!ofile) - ofile = stdout; - - if (toggle) - dotoggle (pid); - else - ExitProcess (dostrace (mask, ofile, pid, argv + optind)); - return 0; -} - -#undef CloseHandle - -static BOOL -close_handle (HANDLE h, DWORD ok) -{ - child_list *c; - for (c = &children; (c = c->next) != NULL;) - if (c->hproc == h && c->id != ok) - error (0, "Closing child handle %p", h); - return CloseHandle (h); -} diff --git a/winsup/utils/testsuite.cc b/winsup/utils/testsuite.cc deleted file mode 100644 index bab6f309e..000000000 --- a/winsup/utils/testsuite.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* testsuite.cc - - Copyright 2008, 2011 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -/* This file implements a driver for performing tests on the file/path - translation code in path.cc. This file is meant to be generic, all - test harness data is in testsuite.h. */ - -#include -#include -#include -#define WIN32_LEAN_AND_MEAN -#include -#define TESTSUITE -#include "testsuite.h" - -typedef struct - { - const char *cwd; /* in win32 form, as if by GetCurrentDirectory */ - const char *posix; /* input */ - const char *win32; /* expected output */ - } test_t; - -#define TESTSUITE_TESTS -#include "testsuite.h" -#undef TESTSUITE_TESTS - -static int curtest; - -/* A replacement for the w32api GetCurrentDirectory() that returns - the cwd that the current test specifies. */ -DWORD -testsuite_getcwd (DWORD nBufferLength, LPSTR lpBuffer) -{ - unsigned len = strlen (testsuite_tests[curtest].cwd) + 1; - - /* If the test specified NO_CWD, then it means we should not have - needed the CWD for that test as the test was for an absolute path, - and so if we see that here return 0, simulating a - GetCurrentDirectory() error. */ - if (strcmp (testsuite_tests[curtest].cwd, NO_CWD) == 0) - return 0; - - if (nBufferLength >= len) - { - strcpy (lpBuffer, testsuite_tests[curtest].cwd); - return len - 1; - } - return len; -} - -extern char *cygpath (const char *s, ...); - -int -main (int argc, char **argv) -{ - int numpass = 0; - - for (test_t &t = testsuite_tests[curtest]; t.posix; t = testsuite_tests[++curtest]) - { - char *result = cygpath (t.posix, NULL); - bool pass = (strcmp (result, t.win32) == 0); - - if (pass) - { - numpass++; - printf ("test %03d: PASS cwd=%-18s input=%-22s expected+actual=%s\n", - curtest, t.cwd, t.posix, result); - } - else - { - printf ("test %03d: FAIL cwd=%-18s input=%-29s expected=%-25s actual=%s\n", - curtest, t.cwd, t.posix, t.win32, result); - } - } - printf ("\n" - "total tests: %d\n" - "pass : %d (%.1f%%)\n" - "fail : %d (%.1f%%)\n", - curtest, numpass, ((float)numpass)/curtest * 100.0F, curtest - numpass, - ((float)curtest - numpass)/curtest * 100.0F); - return (numpass < curtest ? 1 : 0); -} diff --git a/winsup/utils/testsuite.h b/winsup/utils/testsuite.h deleted file mode 100644 index 2632f719b..000000000 --- a/winsup/utils/testsuite.h +++ /dev/null @@ -1,131 +0,0 @@ -/* testsuite.h - - Copyright 2008, 2011 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -/* This file implements a test harness for the MinGW implementation of - POSIX path translation in utils/path.cc. This code is used by strace - and cygcheck which cannot depend on the Cygwin DLL. The tests below - are a basic set of sanity checks for translating relative and - absolute paths from POSIX form to Win32 form based on the contents of - a mount table. */ - -/* Including this file should be a no-op if TESTSUITE is not defined. */ -#ifdef TESTSUITE - -/* These definitions are common to both the testsuite mount table - as well as the testsuite definitions themselves, so define them - here so that they are only defined in one location. */ -#define TESTSUITE_ROOT "X:\\xyzroot" -#define TESTSUITE_CYGDRIVE "/testcygdrive" - -/* Define a mount table in the form that read_mounts() would populate. - This is used in place of actually reading the host mount - table from the registry for the duration of the testsuite. This - table should match the battery of tests below. */ - -#if defined(TESTSUITE_MOUNT_TABLE) -static mnt_t mount_table[] = { -/* native posix flags issys */ - { TESTSUITE_ROOT, (char*)"/", MOUNT_BINARY | MOUNT_SYSTEM, 1 }, - { "O:\\other", (char*)"/otherdir", MOUNT_BINARY | MOUNT_SYSTEM, 1 }, - { "S:\\some\\dir", (char*)"/somedir", MOUNT_BINARY | MOUNT_SYSTEM, 1 }, - { TESTSUITE_ROOT"\\bin", (char*)"/usr/bin", MOUNT_BINARY | MOUNT_SYSTEM, 1 }, - { TESTSUITE_ROOT"\\lib", (char*)"/usr/lib", MOUNT_BINARY | MOUNT_SYSTEM, 1 }, - { ".", (char*)TESTSUITE_CYGDRIVE, MOUNT_BINARY | MOUNT_SYSTEM | MOUNT_CYGDRIVE, 1 }, - { NULL, (char*)NULL, 0, 0 } -}; - - -/* Define the main set of tests. This is defined here instead of in - testsuite.cc so that all test harness data is in one place and not - spread over several files. */ - -#elif defined(TESTSUITE_TESTS) -#define NO_CWD "N/A" -static test_t testsuite_tests[] = { - { NO_CWD, "/file.ext", TESTSUITE_ROOT"\\file.ext" }, - { NO_CWD, "/dir/file.ext", TESTSUITE_ROOT"\\dir\\file.ext" }, - { NO_CWD, "/foo/dir/file.ext", TESTSUITE_ROOT"\\foo\\dir\\file.ext" }, - { NO_CWD, "/bin/file.ext", TESTSUITE_ROOT"\\bin\\file.ext" }, - { NO_CWD, "/bin/dir/file.ext", TESTSUITE_ROOT"\\bin\\dir\\file.ext" }, - { NO_CWD, "/lib/file.ext", TESTSUITE_ROOT"\\lib\\file.ext" }, - { NO_CWD, "/lib/dir/file.ext", TESTSUITE_ROOT"\\lib\\dir\\file.ext" }, - { NO_CWD, "/usr/bin/file.ext", TESTSUITE_ROOT"\\bin\\file.ext" }, - { NO_CWD, "/usr/bin/dir/file.ext", TESTSUITE_ROOT"\\bin\\dir\\file.ext" }, - { NO_CWD, "/usr/lib/file.ext", TESTSUITE_ROOT"\\lib\\file.ext" }, - { NO_CWD, "/usr/lib/dir/file.ext", TESTSUITE_ROOT"\\lib\\dir\\file.ext" }, - { NO_CWD, "/home/file.ext", TESTSUITE_ROOT"\\home\\file.ext" }, - { NO_CWD, "/home/foo/file.ext", TESTSUITE_ROOT"\\home\\foo\\file.ext" }, - { NO_CWD, "/home/foo/dir/file.ext", TESTSUITE_ROOT"\\home\\foo\\dir\\file.ext" }, - { NO_CWD, "/usr/file.ext", TESTSUITE_ROOT"\\usr\\file.ext" }, - { NO_CWD, "/usr/share/file.ext", TESTSUITE_ROOT"\\usr\\share\\file.ext" }, - { TESTSUITE_ROOT, "foo", TESTSUITE_ROOT"\\foo" }, - { TESTSUITE_ROOT, "./foo", TESTSUITE_ROOT"\\foo" }, - { TESTSUITE_ROOT, "foo/bar", TESTSUITE_ROOT"\\foo\\bar" }, - { TESTSUITE_ROOT, "./foo/bar", TESTSUITE_ROOT"\\foo\\bar" }, - { TESTSUITE_ROOT, "foo/./bar", TESTSUITE_ROOT"\\foo\\bar" }, - { TESTSUITE_ROOT, "./foo/./bar", TESTSUITE_ROOT"\\foo\\bar" }, - { TESTSUITE_ROOT, "bin/file.ext", TESTSUITE_ROOT"\\bin\\file.ext" }, - { TESTSUITE_ROOT, "lib/file.ext", TESTSUITE_ROOT"\\lib\\file.ext" }, - { TESTSUITE_ROOT, "usr/bin/file.ext", TESTSUITE_ROOT"\\bin\\file.ext" }, - { TESTSUITE_ROOT, "usr/lib/file.ext", TESTSUITE_ROOT"\\lib\\file.ext" }, - { TESTSUITE_ROOT, "etc/file.ext", TESTSUITE_ROOT"\\etc\\file.ext" }, - { TESTSUITE_ROOT, "etc/foo/file.ext", TESTSUITE_ROOT"\\etc\\foo\\file.ext" }, - { TESTSUITE_ROOT"\\bin", "foo", TESTSUITE_ROOT"\\bin\\foo" }, - { TESTSUITE_ROOT"\\bin", "./foo", TESTSUITE_ROOT"\\bin\\foo" }, - { TESTSUITE_ROOT"\\bin", "foo/bar", TESTSUITE_ROOT"\\bin\\foo\\bar" }, - { TESTSUITE_ROOT"\\bin", "./foo/bar", TESTSUITE_ROOT"\\bin\\foo\\bar" }, - { TESTSUITE_ROOT"\\bin", "foo/./bar", TESTSUITE_ROOT"\\bin\\foo\\bar" }, - { TESTSUITE_ROOT"\\bin", "./foo/./bar", TESTSUITE_ROOT"\\bin\\foo\\bar" }, - { TESTSUITE_ROOT"\\bin\\foo", "bar", TESTSUITE_ROOT"\\bin\\foo\\bar" }, - { TESTSUITE_ROOT"\\bin\\foo", "./bar", TESTSUITE_ROOT"\\bin\\foo\\bar" }, - { TESTSUITE_ROOT"\\bin\\foo", "bar/baz", TESTSUITE_ROOT"\\bin\\foo\\bar\\baz" }, - { TESTSUITE_ROOT"\\bin\\foo", "./bar/baz", TESTSUITE_ROOT"\\bin\\foo\\bar\\baz" }, - { TESTSUITE_ROOT"\\bin\\foo", "bar/./baz", TESTSUITE_ROOT"\\bin\\foo\\bar\\baz" }, - { TESTSUITE_ROOT"\\bin\\foo", "./bar/./baz", TESTSUITE_ROOT"\\bin\\foo\\bar\\baz" }, - { TESTSUITE_ROOT"\\tmp", "foo", TESTSUITE_ROOT"\\tmp\\foo" }, - { TESTSUITE_ROOT"\\tmp", "./foo", TESTSUITE_ROOT"\\tmp\\foo" }, - { TESTSUITE_ROOT"\\tmp", "foo/bar", TESTSUITE_ROOT"\\tmp\\foo\\bar" }, - { TESTSUITE_ROOT"\\tmp", "./foo/bar", TESTSUITE_ROOT"\\tmp\\foo\\bar" }, - { NO_CWD, "/otherdir/file.ext", "O:\\other\\file.ext" }, - { NO_CWD, "/otherdir/./file.ext", "O:\\other\\file.ext" }, - { NO_CWD, "/otherdir/foo/file.ext", "O:\\other\\foo\\file.ext" }, - { "O:\\other", "file.ext", "O:\\other\\file.ext" }, - { "O:\\other", "./file.ext", "O:\\other\\file.ext" }, - { "O:\\other", "foo/file.ext", "O:\\other\\foo\\file.ext" }, - { "O:\\other\\foo", "file.ext", "O:\\other\\foo\\file.ext" }, - { "O:\\other\\foo", "./file.ext", "O:\\other\\foo\\file.ext" }, - { "O:\\other\\foo", "bar/file.ext", "O:\\other\\foo\\bar\\file.ext" }, - { NO_CWD, "/somedir/file.ext", "S:\\some\\dir\\file.ext" }, - { NO_CWD, "/somedir/./file.ext", "S:\\some\\dir\\file.ext" }, - { NO_CWD, "/somedir/foo/file.ext", "S:\\some\\dir\\foo\\file.ext" }, - { "S:\\some\\dir", "file.ext", "S:\\some\\dir\\file.ext" }, - { "S:\\some\\dir", "./file.ext", "S:\\some\\dir\\file.ext" }, - { "S:\\some\\dir", "foo/file.ext", "S:\\some\\dir\\foo\\file.ext" }, - { "S:\\some\\dir\\foo", "file.ext", "S:\\some\\dir\\foo\\file.ext" }, - { "S:\\some\\dir\\foo", "./file.ext", "S:\\some\\dir\\foo\\file.ext" }, - { "S:\\some\\dir\\foo", "bar/file.ext", "S:\\some\\dir\\foo\\bar\\file.ext" }, - { NO_CWD, "//server/share/foo/bar", "\\\\server\\share\\foo\\bar" }, - { NO_CWD, NULL, NULL } -}; - -#else - -/* Redirect calls to GetCurrentDirectory() to the testsuite instead. */ -#ifdef GetCurrentDirectory -#undef GetCurrentDirectory -#endif -#define GetCurrentDirectory testsuite_getcwd - -DWORD testsuite_getcwd (DWORD, LPSTR); - -#endif - -#endif /* TESTSUITE */ - diff --git a/winsup/utils/tzset.c b/winsup/utils/tzset.c deleted file mode 100644 index 45f3f1655..000000000 --- a/winsup/utils/tzset.c +++ /dev/null @@ -1,721 +0,0 @@ -/* tzset.c: Convert current Windows timezone to POSIX timezone information. - - Copyright 2012, 2013 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef GEOID_NOT_AVAILABLE -#define GEOID_NOT_AVAILABLE -1 -#endif - -/* This table maps Windows timezone keynames and countries per ISO 3166-1 to - POSIX-compatible timezone IDs. The information is taken from - http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html - - The mapping from unicode.org is just a bit incomplete. It doesn't contain - a few timezones available on Windows XP, namely: - - Armenian Standard Time - Mexico Standard Time - Mexico Standard Time 2 - - as well as the still (Windows 7) available - - Mid-Atlantic Standard Time - - It also doesn't contain some of the deprecated country codes used in older - OSes, namely: - - SP (Serbian, proposed) used in XP - CS (Serbian and Montenegro, dissolved, now RS and ME) used in Vista - - While these are apparently old, they are required here to get a complete - mapping on all supported OSes. */ -struct -{ - PCWSTR win_tzkey; - PCWSTR country; - PCWSTR posix_tzid; -} tzmap[] = -{ - { L"AUS Central Standard Time", L"", L"Australia/Darwin" }, - { L"AUS Central Standard Time", L"AU", L"Australia/Darwin" }, - { L"AUS Eastern Standard Time", L"", L"Australia/Sydney" }, - { L"AUS Eastern Standard Time", L"AU", L"Australia/Sydney Australia/Melbourne" }, - { L"Afghanistan Standard Time", L"", L"Asia/Kabul" }, - { L"Afghanistan Standard Time", L"AF", L"Asia/Kabul" }, - { L"Alaskan Standard Time", L"", L"America/Anchorage" }, - { L"Alaskan Standard Time", L"US", L"America/Anchorage America/Juneau America/Nome America/Sitka America/Yakutat" }, - { L"Arab Standard Time", L"", L"Asia/Riyadh" }, - { L"Arab Standard Time", L"BH", L"Asia/Bahrain" }, - { L"Arab Standard Time", L"KW", L"Asia/Kuwait" }, - { L"Arab Standard Time", L"QA", L"Asia/Qatar" }, - { L"Arab Standard Time", L"SA", L"Asia/Riyadh" }, - { L"Arab Standard Time", L"YE", L"Asia/Aden" }, - { L"Arabian Standard Time", L"", L"Asia/Dubai" }, - { L"Arabian Standard Time", L"AE", L"Asia/Dubai" }, - { L"Arabian Standard Time", L"OM", L"Asia/Muscat" }, - { L"Arabian Standard Time", L"ZZ", L"Etc/GMT-4" }, - { L"Arabic Standard Time", L"", L"Asia/Baghdad" }, - { L"Arabic Standard Time", L"IQ", L"Asia/Baghdad" }, - { L"Argentina Standard Time", L"", L"America/Buenos_Aires" }, - { L"Argentina Standard Time", L"AR", L"America/Buenos_Aires America/Argentina/La_Rioja America/Argentina/Rio_Gallegos America/Argentina/Salta America/Argentina/San_Juan America/Argentina/San_Luis America/Argentina/Tucuman America/Argentina/Ushuaia America/Catamarca America/Cordoba America/Jujuy America/Mendoza" }, - { L"Armenian Standard Time", L"AM", L"Asia/Yerevan" }, - { L"Atlantic Standard Time", L"", L"America/Halifax" }, - { L"Atlantic Standard Time", L"BM", L"Atlantic/Bermuda" }, - { L"Atlantic Standard Time", L"CA", L"America/Halifax America/Glace_Bay America/Goose_Bay America/Moncton" }, - { L"Atlantic Standard Time", L"GL", L"America/Thule" }, - { L"Azerbaijan Standard Time", L"", L"Asia/Baku" }, - { L"Azerbaijan Standard Time", L"AZ", L"Asia/Baku" }, - { L"Azores Standard Time", L"", L"Atlantic/Azores" }, - { L"Azores Standard Time", L"GL", L"America/Scoresbysund" }, - { L"Azores Standard Time", L"PT", L"Atlantic/Azores" }, - { L"Bahia Standard Time", L"", L"America/Bahia" }, - { L"Bahia Standard Time", L"BR", L"America/Bahia" }, - { L"Bangladesh Standard Time", L"", L"Asia/Dhaka" }, - { L"Bangladesh Standard Time", L"BD", L"Asia/Dhaka" }, - { L"Bangladesh Standard Time", L"BT", L"Asia/Thimphu" }, - { L"Canada Central Standard Time", L"", L"America/Regina" }, - { L"Canada Central Standard Time", L"CA", L"America/Regina America/Swift_Current" }, - { L"Cape Verde Standard Time", L"", L"Atlantic/Cape_Verde" }, - { L"Cape Verde Standard Time", L"CV", L"Atlantic/Cape_Verde" }, - { L"Cape Verde Standard Time", L"ZZ", L"Etc/GMT+1" }, - { L"Caucasus Standard Time", L"", L"Asia/Yerevan" }, - { L"Caucasus Standard Time", L"AM", L"Asia/Yerevan" }, - { L"Cen. Australia Standard Time", L"", L"Australia/Adelaide" }, - { L"Cen. Australia Standard Time", L"AU", L"Australia/Adelaide Australia/Broken_Hill" }, - { L"Central America Standard Time", L"", L"America/Guatemala" }, - { L"Central America Standard Time", L"BZ", L"America/Belize" }, - { L"Central America Standard Time", L"CR", L"America/Costa_Rica" }, - { L"Central America Standard Time", L"EC", L"Pacific/Galapagos" }, - { L"Central America Standard Time", L"GT", L"America/Guatemala" }, - { L"Central America Standard Time", L"HN", L"America/Tegucigalpa" }, - { L"Central America Standard Time", L"NI", L"America/Managua" }, - { L"Central America Standard Time", L"SV", L"America/El_Salvador" }, - { L"Central America Standard Time", L"ZZ", L"Etc/GMT+6" }, - { L"Central Asia Standard Time", L"", L"Asia/Almaty" }, - { L"Central Asia Standard Time", L"AQ", L"Antarctica/Vostok" }, - { L"Central Asia Standard Time", L"IO", L"Indian/Chagos" }, - { L"Central Asia Standard Time", L"KG", L"Asia/Bishkek" }, - { L"Central Asia Standard Time", L"KZ", L"Asia/Almaty Asia/Qyzylorda" }, - { L"Central Asia Standard Time", L"ZZ", L"Etc/GMT-6" }, - { L"Central Brazilian Standard Time", L"", L"America/Cuiaba" }, - { L"Central Brazilian Standard Time", L"BR", L"America/Cuiaba America/Campo_Grande" }, - { L"Central Europe Standard Time", L"", L"Europe/Budapest" }, - { L"Central Europe Standard Time", L"AL", L"Europe/Tirane" }, - { L"Central Europe Standard Time", L"CS", L"Europe/Belgrade" }, - { L"Central Europe Standard Time", L"CZ", L"Europe/Prague" }, - { L"Central Europe Standard Time", L"HU", L"Europe/Budapest" }, - { L"Central Europe Standard Time", L"ME", L"Europe/Podgorica" }, - { L"Central Europe Standard Time", L"RS", L"Europe/Belgrade" }, - { L"Central Europe Standard Time", L"SI", L"Europe/Ljubljana" }, - { L"Central Europe Standard Time", L"SK", L"Europe/Bratislava" }, - { L"Central Europe Standard Time", L"SP", L"Europe/Belgrade" }, - { L"Central European Standard Time", L"", L"Europe/Warsaw" }, - { L"Central European Standard Time", L"BA", L"Europe/Sarajevo" }, - { L"Central European Standard Time", L"HR", L"Europe/Zagreb" }, - { L"Central European Standard Time", L"MK", L"Europe/Skopje" }, - { L"Central European Standard Time", L"PL", L"Europe/Warsaw" }, - { L"Central Pacific Standard Time", L"", L"Pacific/Guadalcanal" }, - { L"Central Pacific Standard Time", L"AQ", L"Antarctica/Macquarie" }, - { L"Central Pacific Standard Time", L"FM", L"Pacific/Ponape Pacific/Kosrae" }, - { L"Central Pacific Standard Time", L"NC", L"Pacific/Noumea" }, - { L"Central Pacific Standard Time", L"SB", L"Pacific/Guadalcanal" }, - { L"Central Pacific Standard Time", L"VU", L"Pacific/Efate" }, - { L"Central Pacific Standard Time", L"ZZ", L"Etc/GMT-11" }, - { L"Central Standard Time", L"", L"America/Chicago" }, - { L"Central Standard Time", L"CA", L"America/Winnipeg America/Rainy_River America/Rankin_Inlet America/Resolute" }, - { L"Central Standard Time", L"MX", L"America/Matamoros" }, - { L"Central Standard Time", L"US", L"America/Chicago America/Indiana/Knox America/Indiana/Tell_City America/Menominee America/North_Dakota/Beulah America/North_Dakota/Center America/North_Dakota/New_Salem" }, - { L"Central Standard Time", L"ZZ", L"CST6CDT" }, - { L"Central Standard Time (Mexico)", L"", L"America/Mexico_City" }, - { L"Central Standard Time (Mexico)", L"MX", L"America/Mexico_City America/Bahia_Banderas America/Cancun America/Merida America/Monterrey" }, - { L"China Standard Time", L"", L"Asia/Shanghai" }, - { L"China Standard Time", L"CN", L"Asia/Shanghai Asia/Chongqing Asia/Harbin Asia/Kashgar Asia/Urumqi" }, - { L"China Standard Time", L"HK", L"Asia/Hong_Kong" }, - { L"China Standard Time", L"MO", L"Asia/Macau" }, - { L"Dateline Standard Time", L"", L"Etc/GMT+12" }, - { L"Dateline Standard Time", L"ZZ", L"Etc/GMT+12" }, - { L"E. Africa Standard Time", L"", L"Africa/Nairobi" }, - { L"E. Africa Standard Time", L"AQ", L"Antarctica/Syowa" }, - { L"E. Africa Standard Time", L"DJ", L"Africa/Djibouti" }, - { L"E. Africa Standard Time", L"ER", L"Africa/Asmera" }, - { L"E. Africa Standard Time", L"ET", L"Africa/Addis_Ababa" }, - { L"E. Africa Standard Time", L"KE", L"Africa/Nairobi" }, - { L"E. Africa Standard Time", L"KM", L"Indian/Comoro" }, - { L"E. Africa Standard Time", L"MG", L"Indian/Antananarivo" }, - { L"E. Africa Standard Time", L"SD", L"Africa/Khartoum" }, - { L"E. Africa Standard Time", L"SO", L"Africa/Mogadishu" }, - { L"E. Africa Standard Time", L"SS", L"Africa/Juba" }, - { L"E. Africa Standard Time", L"TZ", L"Africa/Dar_es_Salaam" }, - { L"E. Africa Standard Time", L"UG", L"Africa/Kampala" }, - { L"E. Africa Standard Time", L"YT", L"Indian/Mayotte" }, - { L"E. Africa Standard Time", L"ZZ", L"Etc/GMT-3" }, - { L"E. Australia Standard Time", L"", L"Australia/Brisbane" }, - { L"E. Australia Standard Time", L"AU", L"Australia/Brisbane Australia/Lindeman" }, - { L"E. Europe Standard Time", L"", L"Asia/Nicosia" }, - { L"E. Europe Standard Time", L"CY", L"Asia/Nicosia" }, - { L"E. South America Standard Time", L"", L"America/Sao_Paulo" }, - { L"E. South America Standard Time", L"BR", L"America/Sao_Paulo" }, - { L"Eastern Standard Time", L"", L"America/New_York" }, - { L"Eastern Standard Time", L"BS", L"America/Nassau" }, - { L"Eastern Standard Time", L"CA", L"America/Toronto America/Iqaluit America/Montreal America/Nipigon America/Pangnirtung America/Thunder_Bay" }, - { L"Eastern Standard Time", L"TC", L"America/Grand_Turk" }, - { L"Eastern Standard Time", L"US", L"America/New_York America/Detroit America/Indiana/Petersburg America/Indiana/Vincennes America/Indiana/Winamac America/Kentucky/Monticello America/Louisville" }, - { L"Eastern Standard Time", L"ZZ", L"EST5EDT" }, - { L"Egypt Standard Time", L"", L"Africa/Cairo" }, - { L"Egypt Standard Time", L"EG", L"Africa/Cairo" }, - { L"Egypt Standard Time", L"PS", L"Asia/Gaza Asia/Hebron" }, - { L"Ekaterinburg Standard Time", L"", L"Asia/Yekaterinburg" }, - { L"Ekaterinburg Standard Time", L"RU", L"Asia/Yekaterinburg" }, - { L"FLE Standard Time", L"", L"Europe/Kiev" }, - { L"FLE Standard Time", L"AX", L"Europe/Mariehamn" }, - { L"FLE Standard Time", L"BG", L"Europe/Sofia" }, - { L"FLE Standard Time", L"EE", L"Europe/Tallinn" }, - { L"FLE Standard Time", L"FI", L"Europe/Helsinki" }, - { L"FLE Standard Time", L"LT", L"Europe/Vilnius" }, - { L"FLE Standard Time", L"LV", L"Europe/Riga" }, - { L"FLE Standard Time", L"UA", L"Europe/Kiev Europe/Simferopol Europe/Uzhgorod Europe/Zaporozhye" }, - { L"Fiji Standard Time", L"", L"Pacific/Fiji" }, - { L"Fiji Standard Time", L"FJ", L"Pacific/Fiji" }, - { L"GMT Standard Time", L"", L"Europe/London" }, - { L"GMT Standard Time", L"ES", L"Atlantic/Canary" }, - { L"GMT Standard Time", L"FO", L"Atlantic/Faeroe" }, - { L"GMT Standard Time", L"GB", L"Europe/London" }, - { L"GMT Standard Time", L"GG", L"Europe/Guernsey" }, - { L"GMT Standard Time", L"IE", L"Europe/Dublin" }, - { L"GMT Standard Time", L"IM", L"Europe/Isle_of_Man" }, - { L"GMT Standard Time", L"JE", L"Europe/Jersey" }, - { L"GMT Standard Time", L"PT", L"Europe/Lisbon Atlantic/Madeira" }, - { L"GTB Standard Time", L"", L"Europe/Bucharest" }, - { L"GTB Standard Time", L"GR", L"Europe/Athens" }, - { L"GTB Standard Time", L"MD", L"Europe/Chisinau" }, - { L"GTB Standard Time", L"RO", L"Europe/Bucharest" }, - { L"Georgian Standard Time", L"", L"Asia/Tbilisi" }, - { L"Georgian Standard Time", L"GE", L"Asia/Tbilisi" }, - { L"Greenland Standard Time", L"", L"America/Godthab" }, - { L"Greenland Standard Time", L"GL", L"America/Godthab" }, - { L"Greenwich Standard Time", L"", L"Atlantic/Reykjavik" }, - { L"Greenwich Standard Time", L"BF", L"Africa/Ouagadougou" }, - { L"Greenwich Standard Time", L"CI", L"Africa/Abidjan" }, - { L"Greenwich Standard Time", L"EH", L"Africa/El_Aaiun" }, - { L"Greenwich Standard Time", L"GH", L"Africa/Accra" }, - { L"Greenwich Standard Time", L"GM", L"Africa/Banjul" }, - { L"Greenwich Standard Time", L"GN", L"Africa/Conakry" }, - { L"Greenwich Standard Time", L"GW", L"Africa/Bissau" }, - { L"Greenwich Standard Time", L"IS", L"Atlantic/Reykjavik" }, - { L"Greenwich Standard Time", L"LR", L"Africa/Monrovia" }, - { L"Greenwich Standard Time", L"ML", L"Africa/Bamako" }, - { L"Greenwich Standard Time", L"MR", L"Africa/Nouakchott" }, - { L"Greenwich Standard Time", L"SH", L"Atlantic/St_Helena" }, - { L"Greenwich Standard Time", L"SL", L"Africa/Freetown" }, - { L"Greenwich Standard Time", L"SN", L"Africa/Dakar" }, - { L"Greenwich Standard Time", L"ST", L"Africa/Sao_Tome" }, - { L"Greenwich Standard Time", L"TG", L"Africa/Lome" }, - { L"Hawaiian Standard Time", L"", L"Pacific/Honolulu" }, - { L"Hawaiian Standard Time", L"CK", L"Pacific/Rarotonga" }, - { L"Hawaiian Standard Time", L"PF", L"Pacific/Tahiti" }, - { L"Hawaiian Standard Time", L"TK", L"Pacific/Fakaofo" }, - { L"Hawaiian Standard Time", L"UM", L"Pacific/Johnston" }, - { L"Hawaiian Standard Time", L"US", L"Pacific/Honolulu" }, - { L"Hawaiian Standard Time", L"ZZ", L"Etc/GMT+10" }, - { L"India Standard Time", L"", L"Asia/Calcutta" }, - { L"India Standard Time", L"IN", L"Asia/Calcutta" }, - { L"Iran Standard Time", L"", L"Asia/Tehran" }, - { L"Iran Standard Time", L"IR", L"Asia/Tehran" }, - { L"Israel Standard Time", L"", L"Asia/Jerusalem" }, - { L"Israel Standard Time", L"IL", L"Asia/Jerusalem" }, - { L"Jordan Standard Time", L"", L"Asia/Amman" }, - { L"Jordan Standard Time", L"JO", L"Asia/Amman" }, - { L"Kaliningrad Standard Time", L"", L"Europe/Kaliningrad" }, - { L"Kaliningrad Standard Time", L"BY", L"Europe/Minsk" }, - { L"Kaliningrad Standard Time", L"RU", L"Europe/Kaliningrad" }, - { L"Kamchatka Standard Time", L"", L"Asia/Kamchatka" }, - { L"Korea Standard Time", L"", L"Asia/Seoul" }, - { L"Korea Standard Time", L"KP", L"Asia/Pyongyang" }, - { L"Korea Standard Time", L"KR", L"Asia/Seoul" }, - { L"Magadan Standard Time", L"", L"Asia/Magadan" }, - { L"Magadan Standard Time", L"RU", L"Asia/Magadan Asia/Anadyr Asia/Kamchatka" }, - { L"Mauritius Standard Time", L"", L"Indian/Mauritius" }, - { L"Mauritius Standard Time", L"MU", L"Indian/Mauritius" }, - { L"Mauritius Standard Time", L"RE", L"Indian/Reunion" }, - { L"Mauritius Standard Time", L"SC", L"Indian/Mahe" }, - { L"Mexico Standard Time", L"", L"America/Mexico_City" }, - { L"Mexico Standard Time 2", L"", L"America/Mazatlan" }, - { L"Mid-Atlantic Standard Time", L"", L"Atlantic/South_Georgia" }, - { L"Middle East Standard Time", L"", L"Asia/Beirut" }, - { L"Middle East Standard Time", L"LB", L"Asia/Beirut" }, - { L"Montevideo Standard Time", L"", L"America/Montevideo" }, - { L"Montevideo Standard Time", L"UY", L"America/Montevideo" }, - { L"Morocco Standard Time", L"", L"Africa/Casablanca" }, - { L"Morocco Standard Time", L"MA", L"Africa/Casablanca" }, - { L"Mountain Standard Time", L"", L"America/Denver" }, - { L"Mountain Standard Time", L"CA", L"America/Edmonton America/Cambridge_Bay America/Inuvik America/Yellowknife" }, - { L"Mountain Standard Time", L"MX", L"America/Ojinaga" }, - { L"Mountain Standard Time", L"US", L"America/Denver America/Boise America/Shiprock" }, - { L"Mountain Standard Time", L"ZZ", L"MST7MDT" }, - { L"Mountain Standard Time (Mexico)", L"", L"America/Chihuahua" }, - { L"Mountain Standard Time (Mexico)", L"MX", L"America/Chihuahua America/Mazatlan" }, - { L"Myanmar Standard Time", L"", L"Asia/Rangoon" }, - { L"Myanmar Standard Time", L"CC", L"Indian/Cocos" }, - { L"Myanmar Standard Time", L"MM", L"Asia/Rangoon" }, - { L"N. Central Asia Standard Time", L"", L"Asia/Novosibirsk" }, - { L"N. Central Asia Standard Time", L"RU", L"Asia/Novosibirsk Asia/Novokuznetsk Asia/Omsk" }, - { L"Namibia Standard Time", L"", L"Africa/Windhoek" }, - { L"Namibia Standard Time", L"NA", L"Africa/Windhoek" }, - { L"Nepal Standard Time", L"", L"Asia/Kathmandu" }, - { L"Nepal Standard Time", L"NP", L"Asia/Kathmandu" }, - { L"New Zealand Standard Time", L"", L"Pacific/Auckland" }, - { L"New Zealand Standard Time", L"AQ", L"Antarctica/South_Pole Antarctica/McMurdo" }, - { L"New Zealand Standard Time", L"NZ", L"Pacific/Auckland" }, - { L"Newfoundland Standard Time", L"", L"America/St_Johns" }, - { L"Newfoundland Standard Time", L"CA", L"America/St_Johns" }, - { L"North Asia East Standard Time", L"", L"Asia/Irkutsk" }, - { L"North Asia East Standard Time", L"RU", L"Asia/Irkutsk" }, - { L"North Asia Standard Time", L"", L"Asia/Krasnoyarsk" }, - { L"North Asia Standard Time", L"RU", L"Asia/Krasnoyarsk" }, - { L"Pacific SA Standard Time", L"", L"America/Santiago" }, - { L"Pacific SA Standard Time", L"AQ", L"Antarctica/Palmer" }, - { L"Pacific SA Standard Time", L"CL", L"America/Santiago" }, - { L"Pacific Standard Time", L"", L"America/Los_Angeles" }, - { L"Pacific Standard Time", L"CA", L"America/Vancouver America/Dawson America/Whitehorse" }, - { L"Pacific Standard Time", L"MX", L"America/Tijuana" }, - { L"Pacific Standard Time", L"US", L"America/Los_Angeles" }, - { L"Pacific Standard Time", L"ZZ", L"PST8PDT" }, - { L"Pacific Standard Time (Mexico)", L"", L"America/Santa_Isabel" }, - { L"Pacific Standard Time (Mexico)", L"MX", L"America/Santa_Isabel" }, - { L"Pakistan Standard Time", L"", L"Asia/Karachi" }, - { L"Pakistan Standard Time", L"PK", L"Asia/Karachi" }, - { L"Paraguay Standard Time", L"", L"America/Asuncion" }, - { L"Paraguay Standard Time", L"PY", L"America/Asuncion" }, - { L"Romance Standard Time", L"", L"Europe/Paris" }, - { L"Romance Standard Time", L"BE", L"Europe/Brussels" }, - { L"Romance Standard Time", L"DK", L"Europe/Copenhagen" }, - { L"Romance Standard Time", L"ES", L"Europe/Madrid Africa/Ceuta" }, - { L"Romance Standard Time", L"FR", L"Europe/Paris" }, - { L"Russian Standard Time", L"", L"Europe/Moscow" }, - { L"Russian Standard Time", L"RU", L"Europe/Moscow Europe/Samara Europe/Volgograd" }, - { L"SA Eastern Standard Time", L"", L"America/Cayenne" }, - { L"SA Eastern Standard Time", L"AQ", L"Antarctica/Rothera" }, - { L"SA Eastern Standard Time", L"BR", L"America/Fortaleza America/Araguaina America/Belem America/Maceio America/Recife America/Santarem" }, - { L"SA Eastern Standard Time", L"GF", L"America/Cayenne" }, - { L"SA Eastern Standard Time", L"SR", L"America/Paramaribo" }, - { L"SA Eastern Standard Time", L"ZZ", L"Etc/GMT+3" }, - { L"SA Pacific Standard Time", L"", L"America/Bogota" }, - { L"SA Pacific Standard Time", L"CA", L"America/Coral_Harbour" }, - { L"SA Pacific Standard Time", L"CO", L"America/Bogota" }, - { L"SA Pacific Standard Time", L"EC", L"America/Guayaquil" }, - { L"SA Pacific Standard Time", L"HT", L"America/Port-au-Prince" }, - { L"SA Pacific Standard Time", L"JM", L"America/Jamaica" }, - { L"SA Pacific Standard Time", L"KY", L"America/Cayman" }, - { L"SA Pacific Standard Time", L"PA", L"America/Panama" }, - { L"SA Pacific Standard Time", L"PE", L"America/Lima" }, - { L"SA Pacific Standard Time", L"ZZ", L"Etc/GMT+5" }, - { L"SA Western Standard Time", L"", L"America/La_Paz" }, - { L"SA Western Standard Time", L"AG", L"America/Antigua" }, - { L"SA Western Standard Time", L"AI", L"America/Anguilla" }, - { L"SA Western Standard Time", L"AW", L"America/Aruba" }, - { L"SA Western Standard Time", L"BB", L"America/Barbados" }, - { L"SA Western Standard Time", L"BL", L"America/St_Barthelemy" }, - { L"SA Western Standard Time", L"BO", L"America/La_Paz" }, - { L"SA Western Standard Time", L"BR", L"America/Manaus America/Boa_Vista America/Eirunepe America/Porto_Velho America/Rio_Branco" }, - { L"SA Western Standard Time", L"CA", L"America/Blanc-Sablon" }, - { L"SA Western Standard Time", L"CW", L"America/Curacao" }, - { L"SA Western Standard Time", L"DM", L"America/Dominica" }, - { L"SA Western Standard Time", L"DO", L"America/Santo_Domingo" }, - { L"SA Western Standard Time", L"GD", L"America/Grenada" }, - { L"SA Western Standard Time", L"GP", L"America/Guadeloupe" }, - { L"SA Western Standard Time", L"GY", L"America/Guyana" }, - { L"SA Western Standard Time", L"KN", L"America/St_Kitts" }, - { L"SA Western Standard Time", L"LC", L"America/St_Lucia" }, - { L"SA Western Standard Time", L"MF", L"America/Marigot" }, - { L"SA Western Standard Time", L"MQ", L"America/Martinique" }, - { L"SA Western Standard Time", L"MS", L"America/Montserrat" }, - { L"SA Western Standard Time", L"PR", L"America/Puerto_Rico" }, - { L"SA Western Standard Time", L"TT", L"America/Port_of_Spain" }, - { L"SA Western Standard Time", L"VC", L"America/St_Vincent" }, - { L"SA Western Standard Time", L"VG", L"America/Tortola" }, - { L"SA Western Standard Time", L"VI", L"America/St_Thomas" }, - { L"SA Western Standard Time", L"ZZ", L"Etc/GMT+4" }, - { L"SE Asia Standard Time", L"", L"Asia/Bangkok" }, - { L"SE Asia Standard Time", L"AQ", L"Antarctica/Davis" }, - { L"SE Asia Standard Time", L"CX", L"Indian/Christmas" }, - { L"SE Asia Standard Time", L"ID", L"Asia/Jakarta Asia/Pontianak" }, - { L"SE Asia Standard Time", L"KH", L"Asia/Phnom_Penh" }, - { L"SE Asia Standard Time", L"LA", L"Asia/Vientiane" }, - { L"SE Asia Standard Time", L"MN", L"Asia/Hovd" }, - { L"SE Asia Standard Time", L"TH", L"Asia/Bangkok" }, - { L"SE Asia Standard Time", L"VN", L"Asia/Saigon" }, - { L"SE Asia Standard Time", L"ZZ", L"Etc/GMT-7" }, - { L"Samoa Standard Time", L"", L"Pacific/Apia" }, - { L"Samoa Standard Time", L"WS", L"Pacific/Apia" }, - { L"Singapore Standard Time", L"", L"Asia/Singapore" }, - { L"Singapore Standard Time", L"BN", L"Asia/Brunei" }, - { L"Singapore Standard Time", L"ID", L"Asia/Makassar" }, - { L"Singapore Standard Time", L"MY", L"Asia/Kuala_Lumpur Asia/Kuching" }, - { L"Singapore Standard Time", L"PH", L"Asia/Manila" }, - { L"Singapore Standard Time", L"SG", L"Asia/Singapore" }, - { L"Singapore Standard Time", L"ZZ", L"Etc/GMT-8" }, - { L"South Africa Standard Time", L"", L"Africa/Johannesburg" }, - { L"South Africa Standard Time", L"BI", L"Africa/Bujumbura" }, - { L"South Africa Standard Time", L"BW", L"Africa/Gaborone" }, - { L"South Africa Standard Time", L"CD", L"Africa/Lubumbashi" }, - { L"South Africa Standard Time", L"LS", L"Africa/Maseru" }, - { L"South Africa Standard Time", L"LY", L"Africa/Tripoli" }, - { L"South Africa Standard Time", L"MW", L"Africa/Blantyre" }, - { L"South Africa Standard Time", L"MZ", L"Africa/Maputo" }, - { L"South Africa Standard Time", L"RW", L"Africa/Kigali" }, - { L"South Africa Standard Time", L"SZ", L"Africa/Mbabane" }, - { L"South Africa Standard Time", L"ZA", L"Africa/Johannesburg" }, - { L"South Africa Standard Time", L"ZM", L"Africa/Lusaka" }, - { L"South Africa Standard Time", L"ZW", L"Africa/Harare" }, - { L"South Africa Standard Time", L"ZZ", L"Etc/GMT-2" }, - { L"Sri Lanka Standard Time", L"", L"Asia/Colombo" }, - { L"Sri Lanka Standard Time", L"LK", L"Asia/Colombo" }, - { L"Syria Standard Time", L"", L"Asia/Damascus" }, - { L"Syria Standard Time", L"SY", L"Asia/Damascus" }, - { L"Taipei Standard Time", L"", L"Asia/Taipei" }, - { L"Taipei Standard Time", L"TW", L"Asia/Taipei" }, - { L"Tasmania Standard Time", L"", L"Australia/Hobart" }, - { L"Tasmania Standard Time", L"AU", L"Australia/Hobart Australia/Currie" }, - { L"Tokyo Standard Time", L"", L"Asia/Tokyo" }, - { L"Tokyo Standard Time", L"ID", L"Asia/Jayapura" }, - { L"Tokyo Standard Time", L"JP", L"Asia/Tokyo" }, - { L"Tokyo Standard Time", L"PW", L"Pacific/Palau" }, - { L"Tokyo Standard Time", L"TL", L"Asia/Dili" }, - { L"Tokyo Standard Time", L"ZZ", L"Etc/GMT-9" }, - { L"Tonga Standard Time", L"", L"Pacific/Tongatapu" }, - { L"Tonga Standard Time", L"KI", L"Pacific/Enderbury" }, - { L"Tonga Standard Time", L"TO", L"Pacific/Tongatapu" }, - { L"Tonga Standard Time", L"ZZ", L"Etc/GMT-13" }, - { L"Turkey Standard Time", L"", L"Europe/Istanbul" }, - { L"Turkey Standard Time", L"TR", L"Europe/Istanbul" }, - { L"US Eastern Standard Time", L"", L"America/Indianapolis" }, - { L"US Eastern Standard Time", L"US", L"America/Indianapolis America/Indiana/Marengo America/Indiana/Vevay" }, - { L"US Mountain Standard Time", L"", L"America/Phoenix" }, - { L"US Mountain Standard Time", L"CA", L"America/Dawson_Creek" }, - { L"US Mountain Standard Time", L"MX", L"America/Hermosillo" }, - { L"US Mountain Standard Time", L"US", L"America/Phoenix" }, - { L"US Mountain Standard Time", L"ZZ", L"Etc/GMT+7" }, - { L"UTC", L"", L"Etc/GMT" }, - { L"UTC", L"GL", L"America/Danmarkshavn" }, - { L"UTC", L"ZZ", L"Etc/GMT" }, - { L"UTC+12", L"", L"Etc/GMT-12" }, - { L"UTC+12", L"KI", L"Pacific/Tarawa" }, - { L"UTC+12", L"MH", L"Pacific/Majuro Pacific/Kwajalein" }, - { L"UTC+12", L"NR", L"Pacific/Nauru" }, - { L"UTC+12", L"TV", L"Pacific/Funafuti" }, - { L"UTC+12", L"UM", L"Pacific/Wake" }, - { L"UTC+12", L"WF", L"Pacific/Wallis" }, - { L"UTC+12", L"ZZ", L"Etc/GMT-12" }, - { L"UTC-02", L"", L"Etc/GMT+2" }, - { L"UTC-02", L"BR", L"America/Noronha" }, - { L"UTC-02", L"GS", L"Atlantic/South_Georgia" }, - { L"UTC-02", L"ZZ", L"Etc/GMT+2" }, - { L"UTC-11", L"", L"Etc/GMT+11" }, - { L"UTC-11", L"AS", L"Pacific/Pago_Pago" }, - { L"UTC-11", L"NU", L"Pacific/Niue" }, - { L"UTC-11", L"UM", L"Pacific/Midway" }, - { L"UTC-11", L"ZZ", L"Etc/GMT+11" }, - { L"Ulaanbaatar Standard Time", L"", L"Asia/Ulaanbaatar" }, - { L"Ulaanbaatar Standard Time", L"MN", L"Asia/Ulaanbaatar Asia/Choibalsan" }, - { L"Venezuela Standard Time", L"", L"America/Caracas" }, - { L"Venezuela Standard Time", L"VE", L"America/Caracas" }, - { L"Vladivostok Standard Time", L"", L"Asia/Vladivostok" }, - { L"Vladivostok Standard Time", L"RU", L"Asia/Vladivostok Asia/Sakhalin" }, - { L"W. Australia Standard Time", L"", L"Australia/Perth" }, - { L"W. Australia Standard Time", L"AQ", L"Antarctica/Casey" }, - { L"W. Australia Standard Time", L"AU", L"Australia/Perth" }, - { L"W. Central Africa Standard Time", L"", L"Africa/Lagos" }, - { L"W. Central Africa Standard Time", L"AO", L"Africa/Luanda" }, - { L"W. Central Africa Standard Time", L"BJ", L"Africa/Porto-Novo" }, - { L"W. Central Africa Standard Time", L"CD", L"Africa/Kinshasa" }, - { L"W. Central Africa Standard Time", L"CF", L"Africa/Bangui" }, - { L"W. Central Africa Standard Time", L"CG", L"Africa/Brazzaville" }, - { L"W. Central Africa Standard Time", L"CM", L"Africa/Douala" }, - { L"W. Central Africa Standard Time", L"DZ", L"Africa/Algiers" }, - { L"W. Central Africa Standard Time", L"GA", L"Africa/Libreville" }, - { L"W. Central Africa Standard Time", L"GQ", L"Africa/Malabo" }, - { L"W. Central Africa Standard Time", L"NE", L"Africa/Niamey" }, - { L"W. Central Africa Standard Time", L"NG", L"Africa/Lagos" }, - { L"W. Central Africa Standard Time", L"TD", L"Africa/Ndjamena" }, - { L"W. Central Africa Standard Time", L"TN", L"Africa/Tunis" }, - { L"W. Central Africa Standard Time", L"ZZ", L"Etc/GMT-1" }, - { L"W. Europe Standard Time", L"", L"Europe/Berlin" }, - { L"W. Europe Standard Time", L"AD", L"Europe/Andorra" }, - { L"W. Europe Standard Time", L"AT", L"Europe/Vienna" }, - { L"W. Europe Standard Time", L"CH", L"Europe/Zurich" }, - { L"W. Europe Standard Time", L"DE", L"Europe/Berlin" }, - { L"W. Europe Standard Time", L"GI", L"Europe/Gibraltar" }, - { L"W. Europe Standard Time", L"IT", L"Europe/Rome" }, - { L"W. Europe Standard Time", L"LI", L"Europe/Vaduz" }, - { L"W. Europe Standard Time", L"LU", L"Europe/Luxembourg" }, - { L"W. Europe Standard Time", L"MC", L"Europe/Monaco" }, - { L"W. Europe Standard Time", L"MT", L"Europe/Malta" }, - { L"W. Europe Standard Time", L"NL", L"Europe/Amsterdam" }, - { L"W. Europe Standard Time", L"NO", L"Europe/Oslo" }, - { L"W. Europe Standard Time", L"SE", L"Europe/Stockholm" }, - { L"W. Europe Standard Time", L"SJ", L"Arctic/Longyearbyen" }, - { L"W. Europe Standard Time", L"SM", L"Europe/San_Marino" }, - { L"W. Europe Standard Time", L"VA", L"Europe/Vatican" }, - { L"West Asia Standard Time", L"", L"Asia/Tashkent" }, - { L"West Asia Standard Time", L"AQ", L"Antarctica/Mawson" }, - { L"West Asia Standard Time", L"KZ", L"Asia/Oral Asia/Aqtau Asia/Aqtobe" }, - { L"West Asia Standard Time", L"MV", L"Indian/Maldives" }, - { L"West Asia Standard Time", L"TF", L"Indian/Kerguelen" }, - { L"West Asia Standard Time", L"TJ", L"Asia/Dushanbe" }, - { L"West Asia Standard Time", L"TM", L"Asia/Ashgabat" }, - { L"West Asia Standard Time", L"UZ", L"Asia/Tashkent Asia/Samarkand" }, - { L"West Asia Standard Time", L"ZZ", L"Etc/GMT-5" }, - { L"West Pacific Standard Time", L"", L"Pacific/Port_Moresby" }, - { L"West Pacific Standard Time", L"AQ", L"Antarctica/DumontDUrville" }, - { L"West Pacific Standard Time", L"FM", L"Pacific/Truk" }, - { L"West Pacific Standard Time", L"GU", L"Pacific/Guam" }, - { L"West Pacific Standard Time", L"MP", L"Pacific/Saipan" }, - { L"West Pacific Standard Time", L"PG", L"Pacific/Port_Moresby" }, - { L"West Pacific Standard Time", L"ZZ", L"Etc/GMT-10" }, - { L"Yakutsk Standard Time", L"", L"Asia/Yakutsk" }, - { L"Yakutsk Standard Time", L"RU", L"Asia/Yakutsk" } -}; - -#define TZMAP_SIZE (sizeof tzmap / sizeof tzmap[0]) - -static struct option longopts[] = -{ - {"help", no_argument, NULL, 'h' }, - {"version", no_argument, NULL, 'V'}, - {NULL, 0, NULL, 0} -}; - -static char opts[] = "hV"; - -#define REG_TZINFO L"SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation" -#define REG_TZDB L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones" - -/* Not available on pre-XP */ -GEOID WINAPI (*getusergeoid)(GEOCLASS); -int WINAPI (*getgeoinfo)(GEOID, GEOTYPE, LPWSTR, int, LANGID); - -static inline HKEY -reg_open (HKEY pkey, PCWSTR path, const char *msg) -{ - LONG ret; - HKEY hkey; - - ret = RegOpenKeyExW (pkey, path, 0, KEY_READ, &hkey); - if (ret == ERROR_SUCCESS) - return hkey; - if (msg) - fprintf (stderr, "%s: cannot open registry %s, error code %" PRIu32 "\n", - program_invocation_short_name, msg, (unsigned int) ret); - return NULL; -} - -/* For symmetry */ -#define reg_close(hkey) RegCloseKey(hkey) - -static inline BOOL -reg_query (HKEY hkey, PCWSTR value, PWCHAR buf, DWORD size, const char *msg) -{ - LONG ret; - DWORD type; - - ret = RegQueryValueExW (hkey, value, 0, &type, (LPBYTE) buf, &size); - if (ret == ERROR_SUCCESS) - return TRUE; - if (msg) - fprintf (stderr, "%s: cannot query registry %s, error code %" PRIu32 "\n", - program_invocation_short_name, msg, (unsigned int) ret); - return FALSE; -} - -static inline BOOL -reg_enum (HKEY hkey, int idx, PWCHAR name, DWORD size) -{ - return RegEnumKeyExW (hkey, idx, name, &size, NULL, NULL, NULL, NULL) - == ERROR_SUCCESS; -} - -static void -usage (FILE *stream) -{ - fprintf (stream, "" - "Usage: %1$s [OPTION]\n" - "\n" - "Print POSIX-compatible timezone ID from current Windows timezone setting\n" - "\n" - "Options:\n" - " -h, --help output usage information and exit.\n" - " -V, --version output version information and exit.\n" - "\n" - "Use %1$s to set your TZ variable. In POSIX-compatible shells like bash,\n" - "dash, mksh, or zsh:\n" - "\n" - " export TZ=$(%1$s)\n" - "\n" - "In csh-compatible shells like tcsh:\n" - "\n" - " setenv TZ `%1$s`\n" - "\n", program_invocation_short_name); -}; - -static void -print_version () -{ - printf ("tzset (cygwin) %d.%d.%d\n" - "POSIX-timezone generator\n" - "Copyright (C) 2012 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -int -main (int argc, char **argv) -{ - BOOL ret; - HKEY hkey, skey; - WCHAR keyname[256], stdname[256], std2name[256], country[10], *spc; - GEOID geo; - int opt, idx, gotit = -1; - - setlocale (LC_ALL, ""); - while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (opt) - { - case 'h': - usage (stdout); - return 0; - case 'V': - print_version (); - return 0; - default: - fprintf (stderr, "Try `%s --help' for more information.\n", - program_invocation_short_name); - return 1; - } - if (optind < argc) - { - usage (stderr); - return 1; - } - - /* First fetch current timezone information from registry. */ - hkey = reg_open (HKEY_LOCAL_MACHINE, REG_TZINFO, "timezone information"); - if (!hkey) - return 1; - /* Vista introduced the TimeZoneKeyName value, which simplifies the - job a lot. */ - if (!reg_query (hkey, L"TimeZoneKeyName", keyname, sizeof keyname, NULL)) - { - /* Pre-Vista we have a lot more to do. First fetch the name of the - Standard (non-DST) timezone. If we can't get that, give up. */ - if (!reg_query (hkey, L"StandardName", stdname, sizeof stdname, - "timezone information")) - { - reg_close (hkey); - return 1; - } - reg_close (hkey); - /* Now open the timezone database registry key. Every subkey is a - timezone. The key name is what we're after, but to find the right - one, we have to compare the name of the previously fetched - "StandardName" with the "Std" value in the timezone info... */ - hkey = reg_open (HKEY_LOCAL_MACHINE, REG_TZDB, "timezone database"); - if (!hkey) - return 1; - for (idx = 0; reg_enum (hkey, idx, keyname, sizeof keyname); ++idx) - { - skey = reg_open (hkey, keyname, NULL); - if (skey) - { - /* ...however, on MUI-enabled machines, the names are not stored - directly in the above StandardName, rather it is a resource - pointer into tzres.dll. This is stored in MUI_Std. - Fortunately it's easy to recognize this situation: If - StandardName starts with @, it's a resource pointer, otherwise - it's the cleartext value. */ - ret = reg_query (skey, stdname[0] == L'@' ? L"MUI_Std" : L"Std", - std2name, sizeof std2name, NULL); - reg_close (skey); - if (ret && !wcscmp (stdname, std2name)) - break; - } - } - } - reg_close (hkey); - - /* Fetch addresses of Geo functions. As long as we support Windows 2000 - this is required, unfortunately. */ - getusergeoid = (GEOID (WINAPI *)()) - GetProcAddress (GetModuleHandle ("kernel32.dll"), "GetUserGeoID"); - getgeoinfo = (int (WINAPI *)(GEOID, GEOTYPE, LPWSTR, int, LANGID)) - GetProcAddress (GetModuleHandle ("kernel32.dll"), "GetGeoInfoW"); - *country = L'\0'; - /* Post-W2K we fetch the current Geo-location of the user and convert it - to a ISO 3166-1 compatible nation code. */ - if (getusergeoid && getgeoinfo) - { - geo = getusergeoid (GEOCLASS_NATION); - if (geo != GEOID_NOT_AVAILABLE) - getgeoinfo (geo, GEO_ISO2, country, sizeof country, 0); - } - /* On W2K, or if the Geo-location isn't available, we use the locale - setting instead. */ - if (!*country) - GetLocaleInfoW (LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, - country, sizeof country); - - /* Now iterate over the mapping table and find the right entry. */ - for (idx = 0; idx < TZMAP_SIZE; ++idx) - { - if (!wcscmp (keyname, tzmap[idx].win_tzkey)) - { - if (gotit < 0) - gotit = idx; - if (!wcscmp (country, tzmap[idx].country)) - break; - } - else if (gotit >= 0) - { - idx = gotit; - break; - } - } - if (idx >= TZMAP_SIZE) - { - if (gotit < 0) - { - fprintf (stderr, - "%s: can't find matching POSIX timezone for " - "Windows timezone \"%ls\"\n", - program_invocation_short_name, keyname); - return 1; - } - idx = gotit; - } - /* Got one. Print it. - Note: The tzmap array is in the R/O data section on x86_64. Don't - try to overwrite the space, as the code did originally. */ - spc = wcschr (tzmap[idx].posix_tzid, L' '); - if (!spc) - spc = wcschr (tzmap[idx].posix_tzid, L'\0'); - printf ("%.*ls\n", (int) (spc - tzmap[idx].posix_tzid), tzmap[idx].posix_tzid); - return 0; -} diff --git a/winsup/utils/umount.cc b/winsup/utils/umount.cc deleted file mode 100644 index e9b1cee5f..000000000 --- a/winsup/utils/umount.cc +++ /dev/null @@ -1,145 +0,0 @@ -/* umount.cc - - Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2008, 2011 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#include -#include -#include -#include -#include -#include -#include -#include - -static void remove_all_user_mounts (); - -static const char *progname; - -struct option longopts[] = -{ - {"help", no_argument, NULL, 'h' }, - {"remove-user-mounts", no_argument, NULL, 'U'}, - {"version", no_argument, NULL, 'V'}, - {NULL, 0, NULL, 0} -}; - -char opts[] = "hUV"; - -static void -usage (FILE *where = stderr) -{ - fprintf (where, "\ -Usage: %s [OPTION] []\n\ -\n\ -Unmount filesystems\n\ -\n\ - -h, --help output usage information and exit\n\ - -U, --remove-user-mounts remove all user mounts\n\ - -V, --version output version information and exit\n\ -\n", progname); - exit (where == stderr ? 1 : 0); -} - -static void -error (const char *path) -{ - fprintf (stderr, "%s: %s: %s\n", progname, path, strerror (errno)); - exit (1); -} - -static void -print_version () -{ - printf ("umount (cygwin) %d.%d.%d\n" - "Unmount filesystem utility\n" - "Copyright (C) 1996 - %s Red Hat, Inc.\n" - "This is free software; see the source for copying conditions. There is NO\n" - "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", - CYGWIN_VERSION_DLL_MAJOR / 1000, - CYGWIN_VERSION_DLL_MAJOR % 1000, - CYGWIN_VERSION_DLL_MINOR, - strrchr (__DATE__, ' ') + 1); -} - -int -main (int argc, char **argv) -{ - int i; - int flags = 0; - int default_flag = MOUNT_SYSTEM; - enum do_what - { - nada, - saw_remove_all_user_mounts - } do_what = nada; - - progname = program_invocation_short_name; - - if (argc == 1) - usage (); - - while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) - switch (i) - { - case 'h': - usage (stdout); - case 'U': - if (do_what != nada) - usage (); - do_what = saw_remove_all_user_mounts; - break; - case 'V': - print_version (); - exit (0); - default: - fprintf (stderr, "Try `%s --help' for more information.\n", progname); - exit (1); - } - - switch (do_what) - { - case saw_remove_all_user_mounts: - if (optind != argc) - usage (); - remove_all_user_mounts (); - break; - default: - if (optind != argc - 1) - usage (); - if (cygwin_umount (argv[optind], flags | default_flag) != 0) - error (argv[optind]); - } - - return 0; -} - -/* remove_all_user_mounts: Unmount all user mounts. */ -static void -remove_all_user_mounts () -{ - FILE *m = setmntent ("/-not-used-", "r"); - struct mntent *p; - - while ((p = getmntent (m)) != NULL) - { - /* Remove the mount if it's a user mount. */ - if (strncmp (p->mnt_type, "user", 4) == 0 && - strstr (p->mnt_opts, "noumount") == NULL) - { - if (cygwin_umount (p->mnt_dir, 0)) - error (p->mnt_dir); - - /* We've modified the table so we need to start over. */ - endmntent (m); - m = setmntent ("/-not-used-", "r"); - } - } - - endmntent (m); -} diff --git a/winsup/utils/utils.xml b/winsup/utils/utils.xml deleted file mode 100644 index b7e8ff81d..000000000 --- a/winsup/utils/utils.xml +++ /dev/null @@ -1,2127 +0,0 @@ - - - - - Cygwin Utilities - - Cygwin comes with a number of command-line utilities that are used to - manage the UNIX emulation portion of the Cygwin environment. While many of - these reflect their UNIX counterparts, each was written specifically for - Cygwin. You may use the long or short option names interchangeably; for - example, --help and -h function - identically. All of the Cygwin command-line utilities support the - --help and --version options. - - - cygcheck - - -Usage: cygcheck [-v] [-h] PROGRAM - cygcheck -c [-d] [PACKAGE] - cygcheck -s [-r] [-v] [-h] - cygcheck -k - cygcheck -f FILE [FILE]... - cygcheck -l [PACKAGE]... - cygcheck -p REGEXP - cygcheck --delete-orphaned-installation-keys - cygcheck --enable-unique-object-names Cygwin-DLL - cygcheck --disable-unique-object-names Cygwin-DLL - cygcheck --show-unique-object-names Cygwin-DLL - cygcheck -h - -List system information, check installed packages, or query package database. - -At least one command option or a PROGRAM is required, as shown above. - - PROGRAM list library (DLL) dependencies of PROGRAM - -c, --check-setup show installed version of PACKAGE and verify integrity - (or for all installed packages if none specified) - -d, --dump-only just list packages, do not verify (with -c) - -s, --sysinfo produce diagnostic system information (implies -c -d) - -r, --registry also scan registry for Cygwin settings (with -s) - -k, --keycheck perform a keyboard check session (must be run from a - plain console only, not from a pty/rxvt/xterm) - -f, --find-package find the package to which FILE belongs - -l, --list-package list contents of PACKAGE (or all packages if none given) - -p, --package-query search for REGEXP in the entire cygwin.com package - repository (requires internet connectivity) - --delete-orphaned-installation-keys - Delete installation keys of old, now unused - installations from the registry. Requires the right - to change the registry. - --enable-unique-object-names Cygwin-DLL - --disable-unique-object-names Cygwin-DLL - --show-unique-object-names Cygwin-DLL - Enable, disable, or show the setting of the - \"unique object names\" setting in the Cygwin DLL - given as argument to this option. The DLL path must - be given as valid Windows(!) path. - See the users guide for more information. - If you don't know what this means, don't change it. - -v, --verbose produce more verbose output - -h, --help annotate output with explanatory comments when given - with another command, otherwise print this help - -V, --version print the version of cygcheck and exit - -Note: -c, -f, and -l only report on packages that are currently installed. To - search all official Cygwin packages use -p instead. The -p REGEXP matches - package names, descriptions, and names of files/paths within all packages. - - - The cygcheck program is a diagnostic utility for - dealing with Cygwin programs. If you are familiar with - dpkg or rpm, - cygcheck is similar in many ways. (The major - difference is that setup.exe handles installing and - uninstalling packages; see for more - information.) - The -c option checks the version and status of - installed Cygwin packages. If you specify one or more package names, - cygcheck will limit its output to those packages, or - with no arguments it lists all packages. A package will be marked - Incomplete if files originally installed are no longer - present. The best thing to do in that situation is reinstall the package - with setup.exe. To see which files are missing, use - the -v option. If you do not need to know the status - of each package and want cygcheck to run faster, add - the -d option and cygcheck will - only output the name and version for each package. - If you list one or more programs on the command line, - cygcheck will diagnose the runtime environment of that - program or programs, providing the names of DLL files on which the - program depends. If you specify the -s option, - cygcheck will give general system information. If you - list one or more programs on the command line and specify - -s, cygcheck will report on - both. - The -f option helps you to track down which - package a file came from, and -l lists all files in a - package. For example, to find out about - /usr/bin/less and its package: Example <command>cygcheck</command> - usage - -$ cygcheck -f /usr/bin/less -less-381-1 - -$ cygcheck -l less -/usr/bin/less.exe -/usr/bin/lessecho.exe -/usr/bin/lesskey.exe -/usr/man/man1/less.1 -/usr/man/man1/lesskey.1 - - - - The -h option prints additional helpful messages - in the report, at the beginning of each section. It also adds table - column headings. While this is useful information, it also adds some to - the size of the report, so if you want a compact report or if you know - what everything is already, just leave this out. - - The -v option causes the output to be more - verbose. What this means is that additional information will be reported - which is usually not interesting, such as the internal version numbers of - DLLs, additional information about recursive DLL usage, and if a file in - one directory in the PATH also occurs in other directories on the PATH. - - The -r option causes cygcheck - to search your registry for information that is relevant to Cygwin - programs. These registry entries are the ones that have "Cygwin" in the - name. If you are paranoid about privacy, you may remove information from - this report, but please keep in mind that doing so makes it harder to - diagnose your problems. - - In contrast to the other options that search the packages that are - installed on your local system, the -p option can be - used to search the entire official Cygwin package repository. It takes as - argument a Perl-compatible regular expression which is used to match - package names, package descriptions, and path/filenames of the contents - of packages. This feature requires an active internet connection, since - it must query the cygwin.com web site. In fact, it is - equivalent to the search that is available on the Cygwin package listing - page. - - For example, perhaps you are getting an error because you are missing - a certain DLL and you want to know which package includes that file: - Searching all packages for a - file - -$ cygcheck -p 'cygintl-2\.dll' -Found 1 matches for 'cygintl-2\.dll'. - -libintl2-0.12.1-3 GNU Internationalization runtime library - -$ cygcheck -p 'libexpat.*\.a' -Found 2 matches for 'libexpat.*\.a'. - -expat-1.95.7-1 XML parser library written in C -expat-1.95.8-1 XML parser library written in C - -$ cygcheck -p '/ls\.exe' -Found 2 matches for '/ls\.exe'. - -coreutils-5.2.1-5 GNU core utilities (includes fileutils, sh-utils and textutils) -coreutils-5.3.0-6 GNU core utilities (includes fileutils, sh-utils and textutils) - - - - Note that this option takes a regular expression, not a glob or - wildcard. This means that you need to use .* if you - want something similar to the wildcard * commonly used - in filename globbing. Similarly, to match the period character you should - use \. since the . character in a - regexp is a metacharacter that will match any character. Also be aware - that the characters such as \ and * - are shell metacharacters, so they must be either escaped or quoted, as in - the example above. - - The third example above illustrates that if you want to match a whole - filename, you should include the / path seperator. In - the given example this ensures that filenames that happen to end in - ls.exe such as ncftpls.exe are not - shown. Note that this use does not mean "look for packages with - ls in the root directory," since the - / can match anywhere in the path. It's just there to - anchor the match so that it matches a full filename. - - By default the matching is case-sensitive. To get a case insensitive - match, begin your regexp with (?i) which is a - PCRE-specific feature. For complete documentation on Perl-compatible - regular expression syntax and options, read the perlre - manpage, or one of many websites such as perldoc.com - that document the Perl language. - - The cygcheck program should be used to send - information about your system for troubleshooting when requested. When - asked to run this command save the output so that you can email it, for - example: - - -$ cygcheck -s -v -r -h > cygcheck_output.txt - - - Each Cygwin DLL stores its path and installation key in the - registry. This allows troubleshooting of problems which could be a result - of having multiple concurrent Cygwin installations. However, if you're - experimenting a lot with different Cygwin installation paths, your - registry could accumulate a lot of old Cygwin installation entries for - which the installation doesn't exist anymore. To get rid of these - orphaned registry entries, use the cygcheck - --delete-orphaned-installation-keys command. - - Each Cygwin DLL generates a key value from its installation path. - This value is not only stored in the registry, it's also used to generate - global object names used for interprocess communication. This keeps - different Cygwin installations separate. Processes running under a Cygwin - DLL installed in C:\cygwin don't see processes running under a Cygwin DLL - installed in C:\Program Files\cygwin. This allows running multiple - versions of Cygwin DLLs without these versions to interfere with each - other, or to run small third-party installations for a specific purpose - independently from a Cygwin net distribution. - - For debugging purposes it could be desired that the various Cygwin - DLLs use the same key, independently from their installation paths. If - the DLLs have different versions, trying to run processes under these - DLLs concurrently will result in error messages like this one: - - -*** shared version mismatch detected - 0x8A88009C/0x75BE0074. -This problem is probably due to using incompatible versions of the Cygwin DLL. -Search for cygwin1.dll using the Windows Start->Find/Search facility -and delete all but the most recent version. The most recent version *should* -reside in x:\\cygwin\\bin, where 'x' is the drive on which you have -installed the cygwin distribution. Rebooting is also suggested if you -are unable to find another Cygwin DLL. - - - To disable the usage of a unique key value of a certain Cygwin DLL, - use the cygcheck --disable-unique-object-names - Cygwin-DLL command. Cygwin-DLL is the - Windows path (*not* a Cygwin POSIX path) to the DLL for which you want to - disable this feature. Note that you have to stop all Cygwin processes - running under this DLL, before you're allowed to change this setting. For - instance, run cygcheck from a DOS command line for - this purpose. - - To re-enable the usage of a unique key, use the cygcheck - --enable-unique-object-names Cygwin-DLL command. This option - has the same characteristics as the - --disable-unique-object-names option - - Finally, you can use cygcheck --show-unique-object-names - Cygwin-DLL to find out if the given Cygwin DLL use unique - object names or not. In contrast to the --disable-... - and --enable-... options, the - --show-unique-object-names option also works for - Cygwin DLLs which are currently in use. - - - - - cygpath - - -Usage: cygpath (-d|-m|-u|-w|-t TYPE) [-f FILE] [OPTION]... NAME... - cygpath [-c HANDLE] - cygpath [-ADHOPSW] - cygpath [-F ID] - -Convert Unix and Windows format paths, or output system path information - -Output type options: - - -d, --dos print DOS (short) form of NAMEs (C:\PROGRA~1\) - -m, --mixed like --windows, but with regular slashes (C:/WINNT) - -M, --mode report on mode of file (currently binmode or textmode) - -u, --unix (default) print Unix form of NAMEs (/cygdrive/c/winnt) - -w, --windows print Windows form of NAMEs (C:\WINNT) - -t, --type TYPE print TYPE form: 'dos', 'mixed', 'unix', or 'windows' - -Path conversion options: - - -a, --absolute output absolute path - -l, --long-name print Windows long form of NAMEs (with -w, -m only) - -p, --path NAME is a PATH list (i.e., '/bin:/usr/bin') - -s, --short-name print DOS (short) form of NAMEs (with -w, -m only) - -C, --codepage CP print DOS, Windows, or mixed pathname in Windows - codepage CP. CP can be a numeric codepage identifier, - or one of the reserved words ANSI, OEM, or UTF8. - If this option is missing, cygpath defaults to the - character set defined by the current locale. - -System information: - - -A, --allusers use `All Users' instead of current user for -D, -P - -D, --desktop output `Desktop' directory and exit - -H, --homeroot output `Profiles' directory (home root) and exit - -O, --mydocs output `My Documents' directory and exit - -P, --smprograms output Start Menu `Programs' directory and exit - -S, --sysdir output system directory and exit - -W, --windir output `Windows' directory and exit - -F, --folder ID output special folder with numeric ID and exit - -Other options: - - -f, --file FILE read FILE for input; use - to read from STDIN - -o, --option read options from FILE as well (for use with --file) - -c, --close HANDLE close HANDLE (for use in captured process) - -i, --ignore ignore missing argument - -h, --help output usage information and exit - -V, --version output version information and exit - - - The cygpath program is a utility that converts - Windows native filenames to Cygwin POSIX-style pathnames and vice versa. - It can be used when a Cygwin program needs to pass a file name to a - native Windows program, or expects to get a file name from a native - Windows program. Alternatively, cygpath can output - information about the location of important system directories in either - format. - - The -u and -w options indicate - whether you want a conversion to UNIX (POSIX) format - (-u) or to Windows format (-w). Use - the -d to get DOS-style (8.3) file and path names. The - -m option will output Windows-style format but with - forward slashes instead of backslashes. This option is especially useful - in shell scripts, which use backslashes as an escape character. - - In combination with the -w option, you can use - the -l and -s options to use normal - (long) or DOS-style (short) form. The -d option is - identical to -w and -s together. - - The -C option allows to specify a Windows codepage - to print DOS and Windows paths created with one of the - -d, -m, or -w - options. The default is to use the character set of the current locale - defined by one of the internationalization environment variables - LC_ALL, LC_CTYPE, or LANG, - see . This is sometimes not sufficient for - interaction with native Windows tools, which might expect native, - non-ASCII characters in a specific Windows codepage. Console tools, for - instance, might expect pathnames in the current OEM codepage, while - graphical tools like Windows Explorer might expect pathnames in the - current ANSI codepage. - - The -C option takes a single parameter: - - - ANSI, to specify the current ANSI - codepage - - - OEM, to specify the current OEM (console) - codepage - - - UTF8, to specify UTF-8. - - - A numerical, decimal codepage number, for instance 936 for GBK, - 28593 for ISO-8859-3, etc. A full list of supported codepages is - listed on the Microsoft MSDN page Code Page Identifiers. A codepage of 0 is the same as if the - -C hasn't been specified at all. - - - - The -p option means that you want to convert a - path-style string rather than a single filename. For example, the PATH - environment variable is semicolon-delimited in Windows, but - colon-delimited in UNIX. By giving -p you are - instructing cygpath to convert between these - formats. - - The -i option supresses the print out of the usage - message if no filename argument was given. It can be used in make file - rules converting variables that may be omitted to a proper format. Note - that cygpath output may contain spaces (C:\Program - Files) so should be enclosed in quotes. - - - - Example <command>cygpath</command> usage - - - - - - The capital options -D, -H, - -P, -S, and -W - output directories used by Windows that are not the same on all systems, - for example -S might output C:\WINNT\system32 or - C:\Windows\System32. The -H shows the Windows profiles - directory that can be used as root of home. The -A - option forces use of the "All Users" directories instead of the current - user for the -D, -O and - -P options. The -F outputs other - special folders specified by their internal numeric code (decimal or - 0x-prefixed hex). For valid codes and symbolic names, see the CSIDL_* - definitions in the include file /usr/include/w32api/shlobj.h from package - w32api. The current valid range of codes for folders is 0 (Desktop) to 59 - (CDBurn area). By default the output is in UNIX (POSIX) format; use the - -w or -d options to get other - formats. - - - - - dumper - - -Usage: dumper [OPTION] FILENAME WIN32PID - -Dump core from WIN32PID to FILENAME.core - --d, --verbose be verbose while dumping --h, --help output help information and exit --q, --quiet be quiet while dumping (default) --V, --version output version information and exit - - - The dumper utility can be used to create a core - dump of running Windows process. This core dump can be later loaded to - gdb and analyzed. One common way to use - dumper is to plug it into cygwin's Just-In-Time - debugging facility by adding - -error_start=x:\path\to\dumper.exe - to the - CYGWIN environment variable. Please note that - x:\path\to\dumper.exe is Windows-style and not cygwin - path. If error_start is set this way, then dumper will - be started whenever some program encounters a fatal error. - - dumper can be also be started from the command - line to create a core dump of any running process. Unfortunately, because - of a Windows API limitation, when a core dump is created and - dumper exits, the target process is terminated too. - - To save space in the core dump, dumper doesn't - write those portions of target process' memory space that are loaded from - executable and dll files and are unchangeable, such as program code and - debug info. Instead, dumper saves paths to files which - contain that data. When a core dump is loaded into gdb, it uses these - paths to load appropriate files. That means that if you create a core - dump on one machine and try to debug it on another, you'll need to place - identical copies of the executable and dlls in the same directories as on - the machine where the core dump was created. - - - - - getconf - - -Usage: getconf [-v specification] variable_name [pathname] - getconf -a [pathname] - -Get configuration values - - -v specification Indicate specific version for which configuration - values shall be fetched. - -a, --all Print all known configuration values - -Other options: - - -h, --help This text - -V, --version Print program version and exit - - - The getconf utility prints the value of the - configuration variable specified by variable_name. If - no pathname is given, getconf - serves as a wrapper for the confstr and - sysconf functions, supporting the symbolic constants - defined in the limits.h and - unistd.h headers, without their respective - _CS_ or _SC_ prefixes. - - If pathname is given, getconf - prints the value of the configuration variable for the specified - pathname. In this form, getconf serves as a wrapper - for the pathconf function, supporting the symbolic - constants defined in the unistd.h header, without the - _PC_ prefix. - - If you specify the -v option, the parameter - denotes a specification for which the value of the configuration variable - should be printed. Note that the only specifications supported by Cygwin - are POSIX_V7_ILP32_OFFBIG and the legacy - POSIX_V6_ILP32_OFFBIG and - XBS5_ILP32_OFFBIG equivalents. - - Use the -a option to print a list of all available - configuration variables for the system, or given - pathname, and their values. - - - - - getfacl - - -Usage: getfacl [-adn] FILE [FILE2...] - -Display file and directory access control lists (ACLs). - - -a, --all display the filename, the owner, the group, and - the ACL of the file - -d, --dir display the filename, the owner, the group, and - the default ACL of the directory, if it exists - -h, --help output usage information and exit - -n, --noname display user and group IDs instead of names - -V, --version output version information and exit - -When multiple files are specified on the command line, a blank -line separates the ACLs for each file. - - - For each argument that is a regular file, special file or directory, - getfacl displays the owner, the group, and the ACL. - For directories getfacl displays additionally the - default ACL. With no options specified, getfacl - displays the filename, the owner, the group, and both the ACL and the - default ACL, if it exists. For more information on Cygwin and Windows - ACLs, see in the Cygwin User's Guide. The format - for ACL output is as follows: - - # file: filename - # owner: name or uid - # group: name or uid - user::perm - user:name or uid:perm - group::perm - group:name or gid:perm - mask:perm - other:perm - default:user::perm - default:user:name or uid:perm - default:group::perm - default:group:name or gid:perm - default:mask:perm - default:other:perm - - - - - - kill - - -Usage: kill [-f] [-signal] [-s signal] pid1 [pid2 ...] - kill -l [signal] - -Send signals to processes - - -f, --force force, using win32 interface if necessary - -l, --list print a list of signal names - -s, --signal send signal (use kill --list for a list) - -h, --help output usage information and exit - -V, --version output version information and exit - - - The kill program allows you to send arbitrary - signals to other Cygwin programs. The usual purpose is to end a running - program from some other window when ^C won't work, but you can also send - program-specified signals such as SIGUSR1 to trigger actions within the - program, like enabling debugging or re-opening log files. Each program - defines the signals they understand. - - You may need to specify the full path to use kill - from within some shells, including bash, the default - Cygwin shell. This is because bash defines a - kill builtin function; see the bash - man page under BUILTIN COMMANDS for more - information. To make sure you are using the Cygwin version, try - -$ /bin/kill --version - which should give the Cygwin - kill version number and copyright information. - - Unless you specific the -f option, the "pid" - values used by kill are the Cygwin pids, not the - Windows pids. To get a list of running programs and their Cygwin pids, - use the Cygwin ps program. ps -W - will display all windows pids. - - The kill -l option prints the name of the given - signal, or a list of all signal names if no signal is given. - - To send a specific signal, use the -signN option, - either with a signal number or a signal name (minus the "SIG" part), as - shown in these examples: - - - Using the kill command - -$ kill 123 -$ kill -1 123 -$ kill -HUP 123 -$ kill -f 123 - - - - Here is a list of available signals, their numbers, and some - commentary on them, from the file - <sys/signal.h>, which should be considered the - official source of this information. - - -SIGHUP 1 hangup -SIGINT 2 interrupt -SIGQUIT 3 quit -SIGILL 4 illegal instruction (not reset when caught) -SIGTRAP 5 trace trap (not reset when caught) -SIGABRT 6 used by abort -SIGEMT 7 EMT instruction -SIGFPE 8 floating point exception -SIGKILL 9 kill (cannot be caught or ignored) -SIGBUS 10 bus error -SIGSEGV 11 segmentation violation -SIGSYS 12 bad argument to system call -SIGPIPE 13 write on a pipe with no one to read it -SIGALRM 14 alarm clock -SIGTERM 15 software termination signal from kill -SIGURG 16 urgent condition on IO channel -SIGSTOP 17 sendable stop signal not from tty -SIGTSTP 18 stop signal from tty -SIGCONT 19 continue a stopped process -SIGCHLD 20 to parent on child stop or exit -SIGCLD 20 System V name for SIGCHLD -SIGTTIN 21 to readers pgrp upon background tty read -SIGTTOU 22 like TTIN for output if (tp->t_local&LTOSTOP) -SIGIO 23 input/output possible -SIGPOLL 23 System V name for SIGIO -SIGXCPU 24 exceeded CPU time limit -SIGXFSZ 25 exceeded file size limit -SIGVTALRM 26 virtual time alarm -SIGPROF 27 profiling time alarm -SIGWINCH 28 window changed -SIGLOST 29 resource lost (eg, record-lock lost) -SIGPWR 29 power failure -SIGUSR1 30 user defined signal 1 -SIGUSR2 31 user defined signal 2 - - - - - - ldd - - -Usage: ldd [OPTION]... FILE... - -Print shared library dependencies - - -h, --help print this help and exit - -V, --version print version information and exit - -r, --function-relocs process data and function relocations - (currently unimplemented) - -u, --unused print unused direct dependencies - (currently unimplemented) - -v, --verbose print all information - (currently unimplemented) - - - ldd prints the shared libraries (DLLs) an - executable or DLL is linked against. No modifying option is implemented - yet. - - - - - locale - - -Usage: locale [-amvhV] - or: locale [-ck] NAME - or: locale [-usfnU] - -Get locale-specific information. - -System information: - - -a, --all-locales List all available supported locales - -m, --charmaps List all available character maps - -v, --verbose More verbose output - -Modify output format: - - -c, --category-name List information about given category NAME - -k, --keyword-name Print information about given keyword NAME - -Default locale information: - - -u, --user Print locale of user's default UI language - -s, --system Print locale of system default UI language - -f, --format Print locale of user's regional format settings - (time, numeric & monetary) - -n, --no-unicode Print system default locale for non-Unicode programs - -U, --utf Attach \".UTF-8\" to the result - -Other options: - - -h, --help This text - -V, --version Print program version and exit - - - locale without parameters prints information about - the current locale environment settings. - - The -u, -s, - -f, and -n options can be used to - request the various Windows locale settings. The purpose is to use this - command in scripts to set the POSIX locale variables. - - The -u option prints the current user's Windows UI - locale to stdout. In Windows Vista and Windows 7 this setting is called - the "Display Language"; there was no corresponding user setting in - Windows XP. The -s option prints the systems default - instead. The -f option prints the user's setting for - time, date, number and currency. That's equivalent to the setting in the - "Formats" or "Regional Options" tab in the "Region and Language" or - "Regional and Language Options" dialog. With the -U - option locale appends a ".UTF-8". - - Usage example: - - -bash$ export LANG=$(locale -uU) -bash$ echo $LANG -en_US.UTF-8 -bash$ export LC_TIME=$(locale -fU) -bash$ echo $LC_TIME -de_DE.UTF-8 - - - The -a option is helpful to learn which locales - are supported by your Windows machine. It prints all available locales - and the allowed modifiers. Example: - - -bash$ locale -a -C -C.utf8 -POSIX -af_ZA -af_ZA.utf8 -am_ET -am_ET.utf8 -... -be_BY -be_BY.utf8 -be_BY@latin -... -ca_ES -ca_ES.utf8 -ca_ES@euro -catalan -... - - - The -v option prints more detailed information - about each available locale. Example: - - -bash$ locale -av -locale: af_ZA archive: /cygdrive/c/Windows/system32/kernel32.dll -------------------------------------------------------------------------------- - language | Afrikaans -territory | South Africa - codeset | ISO-8859-1 - -locale: af_ZA.utf8 archive: /cygdrive/c/Windows/system32/kernel32.dll -------------------------------------------------------------------------------- - language | Afrikaans -territory | South Africa - codeset | UTF-8 - -... - -locale: ca_ES@euro archive: /cygdrive/c/Windows/system32/kernel32.dll -------------------------------------------------------------------------------- - language | Catalan -territory | Spain - codeset | ISO-8859-15 - -locale: catalan archive: /usr/share/locale/locale.alias -------------------------------------------------------------------------------- - language | Catalan -territory | Spain - codeset | ISO-8859-1 - -... - - - The -m option prints the names of the available - charmaps supported by Cygwin to stdout. - - Otherwise, if arguments are given, locale prints - the values assigned to these arguments. Arguments can be names of locale - categories (for instance: LC_CTYPE, LC_MONETARY), or names of keywords - supported in the locale categories (for instance: thousands_sep, - charmap). The -c option prints additionally the name - of the category. The -k option prints additionally the - name of the keyword. Example: - - -bash$ locale -ck LC_MESSAGES -LC_MESSAGES -yesexpr="^[yY]" -noexpr="^[nN]" -yesstr="yes" -nostr="no" -messages-codeset="UTF-8" -bash$ locale noexpr -^[nN] - - - - - minidumper - - -Usage: minidumper [OPTION] FILENAME WIN32PID - -Write minidump from WIN32PID to FILENAME.dmp - --t, --type minidump type flags --n, --nokill don't terminate the dumped process --d, --verbose be verbose while dumping --h, --help output help information and exit --q, --quiet be quiet while dumping (default) --V, --version output version information and exit - - - - The minidumper utility can be used to create a - minidump of a running Windows process. This minidump can be later - analysed using breakpad or Windows debugging tools. - - - - minidumper can be used with cygwin's Just-In-Time - debugging facility in exactly the same way as dumper - (See ). - - - - minidumper can also be started from the command line to - create a minidump of any running process. For compatibility with - dumper the target process is terminated after dumping - unless the -n option is given. - - - - - - mkgroup - - -Usage: mkgroup [OPTION]... - -Print /etc/group file to stdout - -Options: - - -l,--local [machine[,offset]] - print local groups with gid offset offset - (from local machine if no machine specified) - -L,--Local [machine[,offset]] - ditto, but generate groupname with machine prefix - -d,--domain [domain[,offset]] - print domain groups with gid offset offset - (from current domain if no domain specified) - -D,--Domain [domain[,offset]] - ditto, but generate groupname with machine prefix - -c,--current print current group - -C,--Current ditto, but generate groupname with machine or - domain prefix - -S,--separator char for -L, -D, -C use character char as domain\group - separator in groupname instead of the default '\' - -o,--id-offset offset change the default offset (10000) added to gids - in domain or foreign server accounts. - -g,--group groupname only return information for the specified group - one of -l, -L, -d, -D must be specified, too - -b,--no-builtin don't print BUILTIN groups - -U,--unix grouplist additionally print UNIX groups when using -l or -L - on a UNIX Samba server - grouplist is a comma-separated list of groupnames - or gid ranges (root,-25,50-100). - (enumerating large ranges can take a long time!) - -s,--no-sids (ignored) - -u,--users (ignored) - -h,--help print this message - -V,--version print version information and exit - -Default is to print local groups on stand-alone machines, plus domain -groups on domain controllers and domain member machines. - - - The mkgroup program can be used to help configure - Cygwin by creating a /etc/group file. Its use is - essential to include Windows security information. - - The command is initially called by setup.exe to - create a default /etc/group. This should be - sufficient in most circumstances. However, especially when working in a - multi-domain environment, you can use mkgroup manually - to create a more complete /etc/group file for all - domains. Especially when you have the same group name used on multiple - machines or in multiple domains, you can use the -D, - -L and -C options to create unique - domain\group style groupnames. - - Note that this information is static. If you change the group - information in your system, you'll need to regenerate the group file for - it to have the new information. - - The -d/-D and -l/-L options - allow you to specify where the information comes from, the local SAM of a - machine or from the domain, or both. With the -d/-D - options the program contacts a Domain Controller, which my be unreachable - or have restricted access. Comma-separated from the machine or domain, - you can specify an offset which is used as base added to the group's RID - to compute the gid (offset + RID = gid). This allows you to create the - same gids every time you re-run mkgroup. For very - simple needs, an entry for the current user's group can be created by - using the option -c or -C. If you - want to use one of the -D, -L or - -C options, but you don't like the backslash as - domain/group separator, you can specify another separator using the - -S option, for instance: - - - Setting up group entry for current user with different - domain/group separator - -$ mkgroup -C -S+ > /etc/group -$ cat /etc/group -DOMAIN+my_group:S-1-5-21-2913048732-1697188782-3448811101-1144:11144: - - - - The -o option allows for special cases (such as - multiple domains) where the GIDs might match otherwise. The - -g option only prints the information for one group. - The -U option allows you to enumerate the standard - UNIX groups on a Samba machine. It's used together with -l - samba-server or -L samba-server. The normal - UNIX groups are usually not enumerated, but they can show up as a group - in ls -l output. - - - - - mkpasswd - - -Usage: mkpasswd [OPTIONS]... - -Print /etc/passwd file to stdout - -Options: - - -l,--local [machine[,offset]] - print local user accounts with uid offset offset - (from local machine if no machine specified) - -L,--Local [machine[,offset]] - ditto, but generate username with machine prefix - -d,--domain [domain[,offset]] - print domain accounts with uid offset offset - (from current domain if no domain specified) - -D,--Domain [domain[,offset]] - ditto, but generate username with domain prefix - -c,--current print current user - -C,--Current ditto, but generate username with machine or - domain prefix - -S,--separator char for -L, -D, -C use character char as domain\user - separator in username instead of the default '\' - -o,--id-offset offset change the default offset (10000) added to uids - in domain or foreign server accounts. - -u,--username username only return information for the specified user - one of -l, -L, -d, -D must be specified, too - -p,--path-to-home path use specified path instead of user account home dir - or /home prefix - -U,--unix userlist additionally print UNIX users when using -l or -L\ - on a UNIX Samba server - userlist is a comma-separated list of usernames - or uid ranges (root,-25,50-100). - (enumerating large ranges can take a long time!) - -s,--no-sids (ignored) - -m,--no-mount (ignored) - -g,--local-groups (ignored) - -h,--help displays this message - -V,--version version information and exit - -Default is to print local accounts on stand-alone machines, domain accounts -on domain controllers and domain member machines. - - - The mkpasswd program can be used to help configure - Cygwin by creating a /etc/passwd from your system - information. Its use is essential to include Windows security - information. However, the actual passwords are determined by Windows, not - by the content of /etc/passwd. - - The command is initially called by setup.exe to - create a default /etc/passwd. This should be - sufficient in most circumstances. However, especially when working in a - multi-domain environment, you can use mkpasswd - manually to create a more complete /etc/passwd file - for all domains. Especially when you have the same user name used on - multiple machines or in multiple domains, you can use the - -D, -L and -C - options to create unique domain\user style usernames. - - Note that this information is static. If you change the user - information in your system, you'll need to regenerate the passwd file for - it to have the new information. - - The -d/-D and -l/-L options - allow you to specify where the information comes from, the local machine - or the domain (default or given), or both. With the - -d/-D options the program contacts the Domain - Controller, which may be unreachable or have restricted access. - Comma-separated from the machine or domain, you can specify an offset - which is used as base added to the user's RID to compute the uid (offset - + RID = uid). This allows to create the same uids every time you re-run - mkpasswd. An entry for the current user can be created - by using the option -c or -C. If - you want to use one of the -D, -L - or -C options, but you don't like the backslash as - domain/group separator, you can specify another separator using the - -S option, similar to the mkgroup. - The -o option allows for special cases (such as - multiple domains) where the UIDs might match otherwise. The - -p option causes mkpasswd to use - the specified prefix instead of the account home dir or /home/ - . For example, this command: Using an alternate home root - -$ mkpasswd -l -p "$(cygpath -H)" > /etc/passwd - - would put local users' home directories in the Windows - 'Profiles' directory. The -u option creates just an - entry for the specified user. The -U option allows you - to enumerate the standard UNIX users on a Samba machine. It's used - together with -l samba-server or -L - samba-server. The normal UNIX users are usually not enumerated, - but they can show up as file owners in ls -l output. - - - - - mount - - -Usage: mount [OPTION] [<win32path> <posixpath>] - mount -a - mount <posixpath> - -Display information about mounted filesystems, or mount a filesystem - - -a, --all mount all filesystems mentioned in fstab - -c, --change-cygdrive-prefix change the cygdrive path prefix to <posixpath> - -f, --force force mount, don't warn about missing mount - point directories - -h, --help output usage information and exit - -m, --mount-entries write fstab entries to replicate mount points - and cygdrive prefixes - -o, --options X[,X...] specify mount options - -p, --show-cygdrive-prefix show user and/or system cygdrive path prefix - -V, --version output version information and exit - - - The mount program is used to map your drives and - shares onto Cygwin's simulated POSIX directory tree, much like as is done - by mount commands on typical UNIX systems. However, in contrast to mount - points given in /etc/fstab, mount points created or - changed with mount are not persistent. They disappear - immediately after the last process of the current user exited. Please see - for more information on the concepts behind - the Cygwin POSIX file system and strategies for using mounts. To remove - mounts temporarily, use umount - - - Using mount - - If you just type mount with no parameters, it - will display the current mount table for you. - - - Displaying the current set of mount points - -$ mount -C:/cygwin/bin on /usr/bin type ntfs (binary) -C:/cygwin/lib on /usr/lib type ntfs (binary) -C:/cygwin on / type ntfs (binary) -C: on /mnt/c type ntfs (binary,user,noumount) -D: on /mnt/d type fat (binary,user,noumount) - - - - In this example, c:/cygwin is the POSIX root and the D drive is - mapped to /mnt/d. Note that in this case, the root - mount is a system-wide mount point that is visible to all users running - Cygwin programs, whereas the /mnt/d mount is only - visible to the current user. - - The mount utility is also the mechanism for - adding new mounts to the mount table in memory. The following example - demonstrates how to mount the directory - //pollux/home/joe/data to - /data for the duration of the current session. - - - Adding mount points - -$ ls /data -ls: /data: No such file or directory -$ mount //pollux/home/joe/data /data -mount: warning - /data does not exist! -$ mount -//pollux/home/joe/data on /data type smbfs (binary) -C:/cygwin/bin on /usr/bin type ntfs (binary) -C:/cygwin/lib on /usr/lib type ntfs (binary) -C:/cygwin on / type ntfs (binary) -C: on /c type ntfs (binary,user,noumount) -D: on /d type fat (binary,user,noumount) - - - - A given POSIX path may only exist once in the mount table. Attempts - to replace the mount will fail with a busy error. The - -f (force) option causes the old mount to be - silently replaced with the new one, provided the old mount point was a - user mount point. It's not valid to replace system-wide mount points. - Additionally, the -f option will silence warnings - about the non-existence of directories at the Win32 path - location. - - The -o option is the method via which various - options about the mount point may be recorded. The following options - are available (note that most of the options are duplicates of other - mount flags): - - - acl - Use the filesystem's access control lists (ACLs) to - implement real POSIX permissions (default). - binary - Files default to binary mode (default). - bind - Allows to remount part of the file hierarchy somewhere else. - Different from other mount calls, the first argument - specifies an absolute POSIX path, rather than a Win32 path. - This POSIX path is remounted to the POSIX path specified as - the second parameter. The conversion to a Win32 path is done - within Cygwin immediately at the time of the call. Note that - symlinks are ignored while performing this path conversion. - cygexec - Treat all files below mount point as cygwin executables. - dos - Always convert leading spaces and trailing dots and spaces to - characters in the UNICODE private use area. This allows to use - broken filesystems which only allow DOS filenames, even if they - are not recognized as such by Cygwin. - exec - Treat all files below mount point as executable. - ihash - Always fake inode numbers rather than using the ones returned - by the filesystem. This allows to use broken filesystems which - don't return unambiguous inode numbers, even if they are not - recognized as such by Cygwin. - noacl - Ignore ACLs and fake POSIX permissions. - nosuid - No suid files are allowed (currently unimplemented) - notexec - Treat all files below mount point as not executable. - override - Override immutable mount points. - posix=0 - Switch off case sensitivity for paths under this mount point. - posix=1 - Switch on case sensitivity for paths under this mount point - (default). - sparse - Switch on support for sparse files. This option only makes - sense on NTFS and then only if you really need sparse files. - text - Files default to CRLF text mode line endings. - - - For a more complete description of the mount options and the - /etc/fstab file, see . - - Note that all mount points added with mount are - user mount points. System mount points can only be specified in the - /etc/fstab file. - - If you added mount points to /etc/fstab or - your /etc/fstab.d/<username> file, you can - add these mount points to your current user session using the - -a/--all option, or by specifing the posix path - alone on the command line. As an example, consider you added a mount - point with the POSIX path /my/mount. You can add - this mount point with either one of the following two commands to your - current user session. - - -$ mount /my/mount -$ mount -a - - - The first command just adds the /my/mount - mount point to your current session, the mount -a - adds all new mount points to your user session. - - If you change a mount point to point to another native path, or if - you changed the flags of a mount point, you have to - umount the mount point first, before you can add it - again. Please note that all such added mount points are added as user - mount points, and that the rule that system mount points can't be - removed or replaced in a running session still applies. - - To bind a POSIX path to another POSIX path, use the - bind mount flag. - - -$ mount -o bind /var /usr/var - - - This command makes the file hirarchy under - /var additionally available under - /usr/var. - - The -m option causes the - mount utility to output the current mount table in a - series of fstab entries. You can save this output as a backup when - experimenting with the mount table. Copy the output to - /etc/fstab to restore the old state. It also makes - moving your settings to a different machine much easier. - - - - - Cygdrive mount points - - Whenever Cygwin cannot use any of the existing mounts to convert - from a particular Win32 path to a POSIX one, Cygwin will, instead, - convert to a POSIX path using a default mount point: - /cygdrive. For example, if Cygwin accesses - z:\foo and the z drive is not currently in the - mount table, then z:\ will be accessible as - /cygdrive/z. The mount utility - can be used to change this default automount prefix through the use of - the "--change-cygdrive-prefix" option. In the following example, we - will set the automount prefix to /mnt: - - - Changing the default prefix - -$ mount --change-cygdrive-prefix /mnt - - - - Note that the cygdrive prefix can be set both per-user and - system-wide, and that as with all mounts, a user-specific mount takes - precedence over the system-wide setting. The mount - utility creates system-wide mounts by default if you do not specify a - type. You can always see the user and system cygdrive prefixes with the - -p option. Using the --options - flag with --change-cygdrive-prefix makes all new - automounted filesystems default to this set of options. For instance - (using the short form of the command line flags) - - - Changing the default prefix with specific mount options - -$ mount -c /mnt -o binary,noacl - - - - - - - - Limitations - - Limitations: there is a hard-coded limit of 64 mount points (up to - Cygwin 1.7.9: 30 mount points). Also, although you can mount to - pathnames that do not start with "/", there is no way to make use of - such mount points. - - Normally the POSIX mount point in Cygwin is an existing empty - directory, as in standard UNIX. If this is the case, or if there is a - place-holder for the mount point (such as a file, a symbolic link - pointing anywhere, or a non-empty directory), you will get the expected - behavior. Files present in a mount point directory before the mount - become invisible to Cygwin programs. - - It is sometimes desirable to mount to a non-existent directory, for - example to avoid cluttering the root directory with names such as - a, b, c - pointing to disks. Although mount will give you a - warning, most everything will work properly when you refer to the mount - point explicitly. Some strange effects can occur however. For example - if your current working directory is /dir, say, - and /dir/mtpt is a mount point, then - mtpt will not show up in an ls - or echo * command and find . will - not find mtpt. - - - - - - - passwd - - -Usage: passwd [OPTION] [USER] - -Change USER's password or password attributes. - -User operations: - -l, --lock lock USER's account. - -u, --unlock unlock USER's account. - -c, --cannot-change USER can't change password. - -C, --can-change USER can change password. - -e, --never-expires USER's password never expires. - -E, --expires USER's password expires according to system's - password aging rule. - -p, --pwd-not-required no password required for USER. - -P, --pwd-required password is required for USER. - -R, --reg-store-pwd enter password to store it in the registry for - later usage by services to be able to switch - to this user context with network credentials. - -System operations: - -i, --inactive NUM set NUM of days before inactive accounts are disabled - (inactive accounts are those with expired passwords). - -n, --minage DAYS set system minimum password age to DAYS days. - -x, --maxage DAYS set system maximum password age to DAYS days. - -L, --length LEN set system minimum password length to LEN. - -Other options: - -d, --logonserver SERVER connect to SERVER (e.g. domain controller). - Default server is the local system, unless - changing the current user, in which case the - default is the content of $LOGONSERVER. - -S, --status display password status for USER (locked, expired, - etc.) plus global system password settings. - -h, --help output usage information and exit. - -V, --version output version information and exit. - -If no option is given, change USER's password. If no user name is given, -operate on current user. System operations must not be mixed with user -operations. Don't specify a USER when triggering a system operation. - -Don't specify a user or any other option together with the -R option. -Non-Admin users can only store their password if cygserver is running. -Note that storing even obfuscated passwords in the registry is not overly -secure. Use this feature only if the machine is adequately locked down. -Don't use this feature if you don't need network access within a remote -session. You can delete your stored password by using `passwd -R' and -specifying an empty password. - - - passwd changes passwords for user accounts. A - normal user may only change the password for their own account, but - administrators may change passwords on any account. - passwd also changes account information, such as - password expiry dates and intervals. - - For password changes, the user is first prompted for their old - password, if one is present. This password is then encrypted and compared - against the stored password. The user has only one chance to enter the - correct password. The administrators are permitted to bypass this step so - that forgotten passwords may be changed. - - The user is then prompted for a replacement password. - passwd will prompt twice for this replacement and - compare the second entry against the first. Both entries are required to - match in order for the password to be changed. - - After the password has been entered, password aging information is - checked to see if the user is permitted to change their password at this - time. If not, passwd refuses to change the password - and exits. - - To get current password status information, use the - -S option. Administrators can use - passwd to perform several account maintenance - functions (users may perform some of these functions on their own - accounts). Accounts may be locked with the -l flag and - unlocked with the -u flag. Similarly, - -c disables a user's ability to change passwords, and - -C allows a user to change passwords. For password - expiry, the -e option disables expiration, while the - -E option causes the password to expire according to - the system's normal aging rules. Use -p to disable the - password requirement for a user, or -P to require a - password. - - Administrators can also use passwd to change - system-wide password expiry and length requirements with the - -i, -n, -x, and - -L options. The -i option is used - to disable an account after the password has been expired for a number of - days. After a user account has had an expired password for - NUM days, the user may no longer sign on to the - account. The -n option is used to set the minimum - number of days before a password may be changed. The user will not be - permitted to change the password until MINDAYS days - have elapsed. The -x option is used to set the maximum - number of days a password remains valid. After - MAXDAYS days, the password is required to be - changed. Allowed values for the above options are 0 to 999. The - -L option sets the minimum length of allowed passwords - for users who don't belong to the administrators group to - LEN characters. Allowed values for the minimum - password length are 0 to 14. In any of the above cases, a value of 0 - means `no restrictions'. - - All operations affecting the current user are by default run against - the logon server of the current user (taken from the environment variable - LOGONSERVER. When password or account information of other - users should be changed, the default server is the local system. To - change a user account on a remote machine, use the -d - option to specify the machine to run the command against. Note that the - current user must be a valid member of the administrators group on the - remote machine to perform such actions. - - Users can use the passwd -R to enter a password - which then gets stored in a special area of the registry on the local - system, which is also used by Windows to store passwords of accounts - running Windows services. When a privileged Cygwin application calls the - set{e}uid(user_id) system call, Cygwin checks if a - password for that user has been stored in this registry area. If so, it - uses this password to switch to this user account using that password. - This allows you to logon through, for instance, ssh - with public key authentication and get a full qualified user token with - all credentials for network access. However, the method has some - drawbacks security-wise. This is explained in more detail in . - - Please note that storing passwords in that registry area is a - privileged operation which only administrative accounts are allowed to - do. Administrators can enter the password for other user accounts into - the registry by specifying the username on the commandline. If normal, - non-admin users should be allowed to enter their passwords using - passwd -R, it's required to run - cygserver as a service under the LocalSystem account - before running passwd -R. This only affects storing - passwords. Using passwords in privileged processes does not require - cygserver to run. - - Limitations: Users may not be able to change their password on some - systems. - - - - - pldd - - -Usage: pldd [OPTION...] PID - -List dynamic shared objects loaded into a process. - - -?, --help Give this help list - --usage Give a short usage message - -V, --version Print program version - - - pldd prints the shared libraries (DLLs) loaded by - the process with the given PID. - - - - - ps - - -Usage: ps [-aefls] [-u UID] - -Report process status - - -a, --all show processes of all users - -e, --everyone show processes of all users - -f, --full show process uids, ppids - -h, --help output usage information and exit - -l, --long show process uids, ppids, pgids, winpids - -p, --process show information for specified PID - -s, --summary show process summary - -u, --user list processes owned by UID - -V, --version output version information and exit - -W, --windows show windows as well as cygwin processes -With no options, ps outputs the long format by default - - - The ps program gives the status of all the Cygwin - processes running on the system (ps = "process status"). Due to the - limitations of simulating a POSIX environment under Windows, there is - little information to give. - - The PID column is the process ID you need to give to the - kill command. The PPID is the parent process ID, and - PGID is the process group ID. The WINPID column is the process ID - displayed by NT's Task Manager program. The TTY column gives which - pseudo-terminal a process is running on, or a '?' for - services. The UID column shows which user owns each process. STIME is the - time the process was started, and COMMAND gives the name of the program - running. Listings may also have a status flag in column zero; - S means stopped or suspended (in other words, in the - background), I means waiting for input or interactive - (foreground), and O means waiting to output. - - By default, ps will only show processes owned by - the current user. With either the -a or - -e option, all user's processes (and system processes) - are listed. There are historical UNIX reasons for the synonomous options, - which are functionally identical. The -f option - outputs a "full" listing with usernames for UIDs. The - -l option is the default display mode, showing a - "long" listing with all the above columns. The other display option is - -s, which outputs a shorter listing of just PID, TTY, - STIME, and COMMAND. The -u option allows you to show - only processes owned by a specific user. The -p option - allows you to show information for only the process with the specified - PID. The -W option causes ps show - non-Cygwin Windows processes as well as Cygwin processes. The WINPID is - also the PID, and they can be killed with the Cygwin - kill command's -f option. - - - - - regtool - - -Usage: regtool [OPTION] (add|check|get|list|remove|unset|load|unload|save) KEY - -View or edit the Win32 registry - -Actions: - - add KEY\SUBKEY add new SUBKEY - check KEY exit 0 if KEY exists, 1 if not - get KEY\VALUE prints VALUE to stdout - list KEY list SUBKEYs and VALUEs - remove KEY remove KEY - set KEY\VALUE [data ...] set VALUE - unset KEY\VALUE removes VALUE from KEY - load KEY\SUBKEY PATH load hive from PATH into new SUBKEY - unload KEY\SUBKEY unload hive and remove SUBKEY - save KEY\SUBKEY PATH save SUBKEY into new hive PATH - -Options for 'list' Action: - - -k, --keys print only KEYs - -l, --list print only VALUEs - -p, --postfix like ls -p, appends '\' postfix to KEY names - -Options for 'get' Action: - - -b, --binary print REG_BINARY data as hex bytes - -n, --none print data as stream of bytes as stored in registry - -x, --hex print numerical data as hex numbers - -Options for 'set' Action: - - -b, --binary set type to REG_BINARY (hex args or '-') - -D, --dword-be set type to REG_DWORD_BIG_ENDIAN - -e, --expand-string set type to REG_EXPAND_SZ - -i, --integer set type to REG_DWORD - -m, --multi-string set type to REG_MULTI_SZ - -n, --none set type to REG_NONE - -Q, --qword set type to REG_QWORD - -s, --string set type to REG_SZ - -Options for 'set' and 'unset' Actions: - - -K<c>, --key-separator[=]<c> set key separator to <c> instead of '\' - -Other Options: - - -h, --help output usage information and exit - -q, --quiet no error output, just nonzero return if KEY/VALUE missing - -v, --verbose verbose output, including VALUE contents when applicable - -w, --wow64 access 64 bit registry view (ignored on 32 bit Windows) - -W, --wow32 access 32 bit registry view (ignored on 32 bit Windows) - -V, --version output version information and exit - -KEY is in the format [host]\prefix\KEY\KEY\VALUE, where host is optional -remote host in either \\hostname or hostname: format and prefix is any of: - root HKCR HKEY_CLASSES_ROOT (local only) - config HKCC HKEY_CURRENT_CONFIG (local only) - user HKCU HKEY_CURRENT_USER (local only) - machine HKLM HKEY_LOCAL_MACHINE - users HKU HKEY_USERS - -You can use forward slash ('/') as a separator instead of backslash, in -that case backslash is treated as escape character -Example: regtool.exe get '\user\software\Microsoft\Clock\iFormat' - - - The regtool program allows shell scripts to access - and modify the Windows registry. Note that modifying the Windows registry - is dangerous, and carelessness here can result in an unusable system. Be - careful. - - The -v option means "verbose". For most commands, - this causes additional or lengthier messages to be printed. Conversely, - the -q option supresses error messages, so you can use - the exit status of the program to detect if a key exists or not (for - example). - - The -w option allows you to access the 64 bit view - of the registry. Several subkeys exist in a 32 bit and a 64 bit version - when running on Windows 64. Since Cygwin is running in 32 bit mode, it - only has access to the 32 bit view of these registry keys. When using the - -w switch, the 64 bit view is used and - regtool can access the entire registry. This option is - simply ignored when running on 32 bit Windows versions. - - The -W option allows you to access the 32 bit view - on the registry. The purpose of this option is mainly for symmetry. It - permits creation of OS agnostic scripts which would also work in a - hypothetical 64 bit version of Cygwin. - - You must provide regtool with an - action following options (if any). Currently, the - action must be add, set, - check, get, - list, remove, - set, or unset. - - The add action adds a new key. The - check action checks to see if a key exists (the exit - code of the program is zero if it does, nonzero if it does not). The - get action gets the value of a key, and prints it (and - nothing else) to stdout. Note: if the value doesn't exist, an error - message is printed and the program returns a non-zero exit code. If you - give -q, it doesn't print the message but does return - the non-zero exit code. - - The list action lists the subkeys and values - belonging to the given key. With list, the - -k option instructs regtool to - print only KEYs, and the -l option to print only - VALUEs. The -p option postfixes a - '/' to each KEY, but leave VALUEs with no postfix. The - remove action removes a key. Note that you may need to - remove everything in the key before you may remove it, but don't rely on - this stopping you from accidentally removing too much. - - The get action prints a value within a key. With - the -b option, data is printed as hex bytes. - -n allows to print the data as a typeless stream of - bytes. Integer values (REG_DWORD, REG_QWORD) are usually printed as - decimal values. The -x option allows to print the - numbers as hexadecimal values. - - The set action sets a value within a key. - -b means it's binary data (REG_BINARY). The binary - values are specified as hex bytes in the argument list. If the argument - is '-', binary data is read from stdin instead. - -d or -i means the value is a 32 - bit integer value (REG_DWORD). -D means the value is a - 32 bit integer value in Big Endian representation (REG_DWORD_BIG_ENDIAN). - -Q means the value is a 64 bit integer value - (REG_QWORD). -s means the value is a string (REG_SZ). - -e means it's an expanding string (REG_EXPAND_SZ) that - contains embedded environment variables. -m means it's - a multi-string (REG_MULTI_SZ). If you don't specify one of these, - regtool tries to guess the type based on the value you - give. If it looks like a number, it's a DWORD, unless it's value doesn't - fit into 32 bit, in which case it's a QWORD. If it starts with a percent, - it's an expanding string. If you give multiple values, it's a - multi-string. Else, it's a regular string. - - The unset action removes a value from a - key. - - The load action adds a new subkey and loads the - contents of a registry hive into it. The parent key must be - HKEY_LOCAL_MACHINE or HKEY_USERS. The unload action - unloads the file and removes the subkey. - - The save action saves a subkey into a registry - hive. - - By default, the last "\" or "/" is assumed to be the separator - between the key and the value. You can use the -K - option to provide an alternate key/value separator character. - - - - - setfacl - - -Usage: setfacl [-r] (-f ACL_FILE | -s acl_entries) FILE... - setfacl [-r] ([-d acl_entries] [-m acl_entries]) FILE... - -Modify file and directory access control lists (ACLs) - - -d, --delete delete one or more specified ACL entries - -f, --file set ACL entries for FILE to ACL entries read - from a ACL_FILE - -m, --modify modify one or more specified ACL entries - -r, --replace replace mask entry with maximum permissions - needed for the file group class - -s, --substitute substitute specified ACL entries for the - ACL of FILE - -h, --help output usage information and exit - -V, --version output version information and exit - -At least one of (-d, -f, -m, -s) must be specified - - - For each file given as parameter, setfacl will - either replace its complete ACL (-s, - -f), or it will add, modify, or delete ACL entries. - For more information on Cygwin and Windows ACLs, see see in the Cygwin User's Guide. - - Acl_entries are one or more comma-separated ACL entries from the - following list: - - u[ser]::perm - u[ser]:uid:perm - g[roup]::perm - g[roup]:gid:perm - m[ask]::perm - o[ther]::perm - - Default entries are like the above with the additional default - identifier. For example: - - d[efault]:u[ser]:uid:perm - - - perm is either a 3-char permissions string in - the form "rwx" with the character '-' for no - permission or it is the octal representation of the permissions, a value - from 0 (equivalent to "---") to 7 ("rwx"). uid is a - user name or a numerical uid. gid is a group name or - a numerical gid. - - The following options are supported: - - -d Delete one or more specified entries from the - file's ACL. The owner, group and others entries must not be deleted. - Acl_entries to be deleted should be specified without permissions, as in - the following list: - - u[ser]:uid - g[roup]:gid - d[efault]:u[ser]:uid - d[efault]:g[roup]:gid - d[efault]:m[ask]: - d[efault]:o[ther]: - - - -f Take the Acl_entries from ACL_FILE one per - line. Whitespace characters are ignored, and the character "#" may be - used to start a comment. The special filename "-" indicates reading from - stdin. Note that you can use this with getfacl and - setfacl to copy ACLs from one file to another: - -$ getfacl source_file | setfacl -f - target_file - - - Required entries are: one user entry for the owner of the file, one - group entry for the group of the file, and one other entry. - - If additional user and group entries are given: a mask entry for the - file group class of the file, and no duplicate user or group entries with - the same uid/gid. - - If it is a directory: one default user entry for the owner of the - file, one default group entry for the group of the file, one default mask - entry for the file group class, and one default other entry. - - -m Add or modify one or more specified ACL - entries. Acl_entries is a comma-separated list of entries from the same - list as above. - - -r Causes the permissions specified in the mask - entry to be ignored and replaced by the maximum permissions needed for - the file group class. - - -s Like -f, but substitute the - file's ACL with Acl_entries specified in a comma-separated list on the - command line. - - While the -d and -m options - may be used in the same command, the -f and - -s options may be used only exclusively. - - Directories may contain default ACL entries. Files created in a - directory that contains default ACL entries will have permissions - according to the combination of the current umask, the explicit - permissions requested and the default ACL entries - - Limitations: Under Cygwin, the default ACL entries are not taken - into account currently. - - - - - setmetamode - - -Usage: setmetamode [metabit|escprefix] - -Get or set keyboard meta mode - - Without argument, it shows the current meta key mode. - metabit|meta|bit The meta key sets the top bit of the character. - escprefix|esc|prefix The meta key sends an escape prefix. - -Other options: - - -h, --help This text - -V, --version Print program version and exit - - - setmetamode can be used to determine and set the - key code sent by the meta (aka Alt) key. - - - - - ssp - - -Usage: ssp [options] low_pc high_pc command... - -Single-step profile COMMAND - - -c, --console-trace trace every EIP value to the console. *Lots* slower. - -d, --disable disable single-stepping by default; use - OutputDebugString ("ssp on") to enable stepping - -e, --enable enable single-stepping by default; use - OutputDebugString ("ssp off") to disable stepping - -h, --help output usage information and exit - -l, --dll enable dll profiling. A chart of relative DLL usage - is produced after the run. - -s, --sub-threads trace sub-threads too. Dangerous if you have - race conditions. - -t, --trace-eip trace every EIP value to a file TRACE.SSP. This - gets big *fast*. - -v, --verbose output verbose messages about debug events. - -V, --version output version information and exit - -Example: ssp 0x401000 0x403000 hello.exe - - - SSP - The Single Step Profiler - - Original Author: DJ Delorie - - The SSP is a program that uses the Win32 debug API to run a program - one ASM instruction at a time. It records the location of each - instruction used, how many times that instruction is used, and all - function calls. The results are saved in a format that is usable by the - profiling program gprof, although - gprof will claim the values are seconds, they really - are instruction counts. More on that later. - - Because the SSP was originally designed to profile the Cygwin DLL, - it does not automatically select a block of code to report statistics on. - You must specify the range of memory addresses to keep track of manually, - but it's not hard to figure out what to specify. Use the "objdump" - program to determine the bounds of the target's ".text" section. Let's - say we're profiling cygwin1.dll. Make sure you've built it with debug - symbols (else gprof won't run) and run objdump like - this: -$ objdump -h cygwin1.dll - It will print a report - like this: - -cygwin1.dll: file format pei-i386 - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 0007ea00 61001000 61001000 00000400 2**2 - CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA - 1 .data 00008000 61080000 61080000 0007ee00 2**2 - CONTENTS, ALLOC, LOAD, DATA - . . . - - - The only information we're concerned with are the VMA of the .text - section and the VMA of the section after it (sections are usually - contiguous; you can also add the Size to the VMA to get the end address). - In this case, the VMA is 0x61001000 and the ending address is either - 0x61080000 (start of .data method) or 0x0x6107fa00 (VMA+Size method). - - There are two basic ways to use SSP - either profiling a whole - program, or selectively profiling parts of the program. - - To profile a whole program, just run ssp without - options. By default, it will step the whole program. Here's a simple - example, using the numbers above: - -$ ssp 0x61001000 0x61080000 hello.exe - This will step - the whole program. It will take at least 8 minutes on a PII/300 (yes, - really). When it's done, it will create a file called "gmon.out". You can - turn this data file into a readable report with gprof: - -$ gprof -b cygwin1.dll - The "-b" means 'skip the help - pages'. You can omit this until you're familiar with the report layout. - The gprof documentation explains a lot about this - report, but ssp changes a few things. For example, the - first part of the report reports the amount of time spent in each - function, like this: - -Each sample counts as 0.01 seconds. - % cumulative self self total - time seconds seconds calls ms/call ms/call name - 10.02 231.22 72.43 46 1574.57 1574.57 strcspn - 7.95 288.70 57.48 130 442.15 442.15 strncasematch - - The "seconds" columns are really CPU opcodes, 1/100 second per opcode. - So, "231.22" above means 23,122 opcodes. The ms/call values are 10x too - big; 1574.57 means 157.457 opcodes per call. Similar adjustments need to - be made for the "self" and "children" columns in the second part of the - report. - - OK, so now we've got a huge report that took a long time to - generate, and we've identified a spot we want to work on optimizing. - Let's say it's the time() function. We can use SSP to selectively profile - this function by using OutputDebugString() to control SSP from within the - program. Here's a sample program: - - #include <windows.h> - main() - { - time_t t; - OutputDebugString("ssp on"); - time(&t); - OutputDebugString("ssp off"); - } - - - Then, add the -d option to ssp to default to - *disabling* profiling. The program will run at full speed until the first - OutputDebugString, then step until the second. You can then use - gprof (as usual) to see the performance profile for - just that portion of the program's execution. - - There are many options to ssp. Since step-profiling makes your - program run about 1,000 times slower than normal, it's best to understand - all the options so that you can narrow down the parts of your program you - need to single-step. - - -v - verbose. This prints messages about threads - starting and stopping, OutputDebugString calls, DLLs loading, etc. - - -t and -c - tracing. With - -t, *every* step's address is written to the file - "trace.ssp". This can be used to help debug functions, since it can trace - multiple threads. Clever use of scripts can match addresses with - disassembled opcodes if needed. Warning: creates *huge* files, very - quickly. -c prints each address to the console, useful - for debugging key chunks of assembler. Use addr2line -C -f -s -e - foo.exe < trace.ssp > lines.ssp and then perl - cvttrace to convert to symbolic traces. - - -s - subthreads. Usually, you only need to trace - the main thread, but sometimes you need to trace all threads, so this - enables that. It's also needed when you want to profile a function that - only a subthread calls. However, using OutputDebugString automatically - enables profiling on the thread that called it, not the main thread. - - -l - dll profiling. Generates a pretty table of - how much time was spent in each dll the program used. No sense optimizing - a function in your program if most of the time is spent in the DLL. I - usually use the -v, -s, and - -l options: - -$ ssp -v -s -l -d 0x61001000 0x61080000 hello.exe - - - - - - strace - - -Usage: strace.exe [OPTIONS] <command-line> -Usage: strace.exe [OPTIONS] -p <pid> - -Trace system calls and signals - - -b, --buffer-size=SIZE set size of output file buffer - -d, --no-delta don't display the delta-t microsecond timestamp - -f, --trace-children trace child processes (toggle - default true) - -h, --help output usage information and exit - -m, --mask=MASK set message filter mask - -n, --crack-error-numbers output descriptive text instead of error - numbers for Windows errors - -o, --output=FILENAME set output file to FILENAME - -p, --pid=n attach to executing program with cygwin pid n - -q, --quiet toggle "quiet" flag. Defaults to on if "-p", - off otherwise. - -S, --flush-period=PERIOD flush buffered strace output every PERIOD secs - -t, --timestamp use an absolute hh:mm:ss timestamp insted of - the default microsecond timestamp. Implies -d - -T, --toggle toggle tracing in a process already being - traced. Requires -p <pid> - -u, --usecs toggle printing of microseconds timestamp - -V, --version output version information and exit - -w, --new-window spawn program under test in a new window - - MASK can be any combination of the following mnemonics and/or hex values - (0x is optional). Combine masks with '+' or ',' like so: - - --mask=wm+system,malloc+0x00800 - - Mnemonic Hex Corresponding Def Description - ========================================================================= - all 0x000001 (_STRACE_ALL) All strace messages. - flush 0x000002 (_STRACE_FLUSH) Flush output buffer after each message. - inherit 0x000004 (_STRACE_INHERIT) Children inherit mask from parent. - uhoh 0x000008 (_STRACE_UHOH) Unusual or weird phenomenon. - syscall 0x000010 (_STRACE_SYSCALL) System calls. - startup 0x000020 (_STRACE_STARTUP) argc/envp printout at startup. - debug 0x000040 (_STRACE_DEBUG) Info to help debugging. - paranoid 0x000080 (_STRACE_PARANOID) Paranoid info. - termios 0x000100 (_STRACE_TERMIOS) Info for debugging termios stuff. - select 0x000200 (_STRACE_SELECT) Info on ugly select internals. - wm 0x000400 (_STRACE_WM) Trace Windows msgs (enable _strace_wm). - sigp 0x000800 (_STRACE_SIGP) Trace signal and process handling. - minimal 0x001000 (_STRACE_MINIMAL) Very minimal strace output. - pthread 0x002000 (_STRACE_PTHREAD) Pthread calls. - exitdump 0x004000 (_STRACE_EXITDUMP) Dump strace cache on exit. - system 0x008000 (_STRACE_SYSTEM) Serious error; goes to console and log. - nomutex 0x010000 (_STRACE_NOMUTEX) Don't use mutex for synchronization. - malloc 0x020000 (_STRACE_MALLOC) Trace malloc calls. - thread 0x040000 (_STRACE_THREAD) Thread-locking calls. - special 0x100000 (_STRACE_SPECIAL) Special debugging printfs for - non-checked-in code - - - The strace program executes a program, and - optionally the children of the program, reporting any Cygwin DLL output - from the program(s) to stdout, or to a file with the - -o option. With the -w option, you - can start an strace session in a new window, for example: - -$ strace -o tracing_output -w sh -c 'while true; do echo "tracing..."; done' & - - This is particularly useful for strace sessions that - take a long time to complete. - - Note that strace is a standalone Windows program - and so does not rely on the Cygwin DLL itself (you can verify this with - cygcheck). As a result it does not understand - symlinks. This program is mainly useful for debugging the Cygwin DLL - itself. - - - - - tzset - - -Usage: tzset [OPTION] - -Print POSIX-compatible timezone ID from current Windows timezone setting - -Options: - -h, --help output usage information and exit. - -V, --version output version information and exit. - -Use tzset to set your TZ variable. In POSIX-compatible shells like bash, -dash, mksh, or zsh: - - export TZ=$(tzset) - -In csh-compatible shells like tcsh: - - setenv TZ `tzset` - - - The tzset tool reads the current timezone from - Windows and generates a POSIX-compatible timezone information for the TZ - environment variable from that information. That's all there is to it. - For the way how to use it, see the above usage information. - - - - - umount - - -Usage: umount.exe [OPTION] [<posixpath>] - -Unmount filesystems - - -h, --help output usage information and exit - -U, --remove-user-mounts remove all user mounts - -V, --version output version information and exit - - - The umount program removes mounts from the mount - table in the current session. If you specify a POSIX path that - corresponds to a current mount point, umount will - remove it from the current mount table. Note that you can only remove - user mount points. The -U flag may be used to specify - removing all user mount points from the current user session. - - See for more information on the mount - table. - - - diff --git a/winsup/utils/wide_path.h b/winsup/utils/wide_path.h deleted file mode 100644 index 7a507c809..000000000 --- a/winsup/utils/wide_path.h +++ /dev/null @@ -1,43 +0,0 @@ -/* wide_path.h -- Define class wide_path to convert multibyte win32 path - to wchar_t Win32 path including long path prefix if - necessary. - - Copyright 2009, 2011, 2013 Red Hat, Inc. - - This file is part of Cygwin. - - This software is a copyrighted work licensed under the terms of the - Cygwin license. Please consult the file "CYGWIN_LICENSE" for - details. */ - -#include -#include - -class wide_path -{ - wchar_t *wp; - -public: - wide_path () : wp (NULL) {} - wide_path (const char *mb_path, bool do_prefix = true) - { - int len = mbstowcs (NULL, mb_path, 0) + 1; - wp = (wchar_t *) malloc ((len + 6) * sizeof (wchar_t)); - wchar_t *wp_p = wp; - if (do_prefix && len >= MAX_PATH && strncmp (mb_path, "\\\\?\\", 4) != 0) - { - wcscpy (wp_p, L"\\\\?\\"); - wp_p += 4; - if (strncmp (mb_path, "\\\\", 2) == 0) - { - wcscpy (wp_p, L"UNC"); - wp_p += 3; - ++mb_path; - --len; - } - } - mbstowcs (wp_p, mb_path, len); - } - ~wide_path () { if (wp) free (wp); } - operator const wchar_t *() const { return wp; } -}; -- cgit v1.2.3